Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAW core type-checker does not normalize the types of constants #1420

Closed
eddywestbrook opened this issue Aug 18, 2021 · 1 comment
Closed

Comments

@eddywestbrook
Copy link
Contributor

The following well-typed SAWCore code will cause a type error:

`FunType : (a b:sort 0) -> sort 0;
FunType a b = a -> b;

myId : FunType Nat Nat;
myId x = x;

applyId : Nat -> Nat;
applyId x = myId x;`

The issue is that the type-checker needs to normalize the type of myId when the application happens in order to see that FunType Nat Nat normalizes to the arrow type Nat -> Nat. A similar problem happens with constants whose types normalize to (but are not) record or pair types.

One suggestion for how to fix this is to replace calls to the recognizer functions asPi, asPairType, and asRecordType in the SCTypeCheck module with calls to new functions asPiWHNF, asPairTypeWHNF, and asRecordTypeWHNF that call the normalizer in the case that the associated recognizer function fails to match.

@eddywestbrook
Copy link
Contributor Author

Fixed by #1426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant