Add proj-of-prop soundness test#36
Merged
Merged
Conversation
The exported theorem builds a proof of `False` via a projection from a
`Prop`-typed structure whose constructor was applied to an ill-typed
argument:
structure Wrapper : Prop where mk :: p : False
theorem badFalse : False := (Wrapper.mk True.intro).p
A checker that types a projection by inferring (rather than checking)
its structure — trusting the structure to be well-typed rather than
verifying the constructor's arguments against its binders — will accept
this and return `badFalse : False`. A sound checker must reject it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous version used `(Wrapper.mk True.intro).p` with `unchecked` + `debug.skipKernelTC`, but Lean's elaborator desugars `s.field` syntax into a call to the generated projection *function* (here `Wrapper.p`), never a raw `Expr.proj`. The exported declaration was therefore an `App`, which is caught by `infer_app`'s strict argument-type check -- so sound and unsound checkers all rejected it for the wrong reason. Construct the declaration programmatically instead, building the value as a literal `Expr.proj` around the ill-typed `Wrapper.mk True.intro`. Verified with `lka.py run`: the official Lean kernel rejects, nanoda and sonanoda both (incorrectly) accept. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The exported theorem builds a proof of
Falsevia a projection from aProp-typed structure whose constructor was applied to an ill-typedargument:
A checker that types a projection by inferring (rather than checking)
its structure — trusting the structure to be well-typed rather than
verifying the constructor's arguments against its binders — will accept
this and return
badFalse : False. A sound checker must reject it.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com