Repository navigation
Kernel: is_proof_type requires a sort (fixes proof of False) - #26
Merged
Merged
Conversation
`is_proof_type` answered "not a proposition" when the inferred type of `t` did not reduce to a sort. For a structure whose sort is a stuck term this let `infer_proj` skip the "no data out of a proof" guard, and together with proof irrelevance that proves `False` (Arena bugs/proj-of-subst-prop). As in leanprover/lean4#14807, the type of `t` must now reduce to a sort, and otherwise checking fails with "type expected". Adds the Arena reproducer as a fixture and a regression test that requires its rejection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sound.txt Co-Authored-By: Claude Opus 5.5 <[email protected]>
gimbalzero
force-pushed
the
fix-17-proj-prop
branch
from
November 21, 2026 21:13
1945246 to
1ab1202
Compare
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.
Closes #17
Certus accepted a proof of
Falsewith no axioms (Arenabugs/proj-of-subst-prop).is_proof_typereturnedfalse("not a proposition") when the inferred type oftdid not reduce to a sort. ForOwner witness, whose sortgate witnessis a stuckEq.rec,infer_projtherefore treated a proof as data and allowedp.1 : Bool. Proof irrelevance then equatesOwner.mk witness falsewithOwner.mk witness true.Fix
As in leanprover/lean4#14807,
is_proof_typenow callsensure_sorton the inferred type: the type must reduce to a sort, and otherwise checking fails withtype expected. It can no longer answer "not a proposition" for something whose sort it cannot determine.Audit of every caller of
is_proof_typeAll callers are in
tc.rs.inductive.rsdoes not call it: its Prop decisions (result_level, field universes,elim_only_at_zero, K-target) go throughensure_sort/sort_of, which already fail withtype expectedon a non-sort.infer_proj:is_prop_struct = is_proof_type(xt)falseon a stuck sort skipped the data-projection guard. This is the bug.infer_proj: field check!is_proof_type(d)(twice)falsewas the safe direction (it rejected the projection).type expected.ctor_when_structure(structure eta for iota): skips expansion if the type is a Propfalseon a stuck sort would eta-expand a proof intoProjs, including data projections out of it.is_def_eq_coreproof irrelevance oninfer(a)falseskipped proof irrelevance. That only loses equalities (incomplete, not unsound).Test
crates/certus-kernel/tests/arena.rschecks the Arena reproducer.fixtures/proj-of-subst-prop.ndjsonis the unchanged round-2026-09 file (256 KB, sha2561c9d8a26…5b9d, verified). The test requires rejection atPR14806Subst.observewithtype expected. It fails onmainwith "proof of False was ACCEPTED (110 declarations)".Rebased onto
mainwith #24 merged. This PR deletes thebugs/proj-of-subst-propline fromtests/arena/known-unsound.txt. Localpython3 tests/arena/run.py(round-2026-09,-j 2 --timeout 60 --memory-limit 1) gives 0 FALSE-ACCEPT and 0 known-false-accept: 110 correct-accept, 70 correct-reject, 3 false-reject (#19 ×2, #20) and 10 errors from the 1 GB local memory cap (#21, #22 and other perf tests). None of these depend on this change.Timing:
certus check sum_explicit.cert.ndjsontakes 0.006 s, the same as before.🤖 Generated with Claude Code