-
Notifications
You must be signed in to change notification settings - Fork 534
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
doc: mention that inferType
does not ensure type correctness
#5087
Conversation
Mathlib CI status (docs):
|
src/Lean/Meta/Basic.lean
Outdated
/-- | ||
Returns the inferred type of the given expression. | ||
|
||
The type inference algorithm assumes the expression is type-correct for efficiency, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe provide an example for a term that it might succeed on but provide a wrong result? This claim probably sounds quite fancy if you are used to the academic notion of "if type inference succeeds the type it returns is right"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've added some examples of both accidental success and necessary failure.
|
||
The type inference algorithm does not do general type checking, | ||
which is instead handled by the `Lean.Meta.check` algorithm. | ||
Type inference only looks at subterms that are necessary for determining an expression's type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth mentioning that we do not guarantee that Lean.Meta.check
is as efficient and complete as the check implemented in the kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've moved the mention of Lean.Meta.check
to a new paragraph with a comment about the kernel.
0330a2f
to
9380611
Compare
…rover#5087) This also adds links to the implementations of `whnf` and `inferType` to make it easier to navigate this part of the code base.
This also adds links to the implementations of
whnf
andinferType
to make it easier to navigate this part of the code base.