Repository navigation
psi: keep a disjunction's type when an applied implication proof introduces it - #6314
Merged
Merged
Conversation
…oduces it The kernel infers an unannotated pair as a plain product, so a disjunction introduced inside an implication proof that is applied on the spot lost its tag-indexed family. Ascribe the pair its denoted disjunction type. This lets a theorem proved from an equality, such as n == 1 => n != 0, be cited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HqP8t6ks5c3gBLeNZESrbf
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.
Requested by Jarod · project thread
A theorem whose proof introduces a disjunction can now be cited. Before this change, citing
for
data OneIsNonzero = machine(n: u8) requires n == 1u8 ensures n != 0u8;was refused with "complete theorem implication was refused by the mathematical kernel", although the theorem's own proof is accepted.The cause is in the bounded elaborator, not the citation.
n != 0denotes the disjunctionn < 0 ∨ 0 < n, a pair whose second component's type depends on its tag. The kernel infers an unannotated pair as a plain product. The citation applies the theorem'srequires → ensuresproof on the spot, so the kernel infers that lambda's body instead of checking it against the goal, and the inferred product differs from the denoted disjunction. A disjunction introduction now ascribes its pair the disjunction's type with(λ (x : ty). x) pair, which the kernel checks and then infers asty. No rule is accepted that was refused before: the pair is still checked, now against its exact type.Gate: RC-SOURCE-SEMANTICS | a disjunction introduced inside an applied implication proof keeps its type, so a theorem proved from an equality can be cited
Spec: wiki/spec/proofs/mathematical_bindings.md#logical-hypotheses-and-machine-use
Proof:
mbx test -p proof-admission(new kernel positivea_disjunction_introduced_inside_an_applied_implication_keeps_its_type, which failed with a kernel type mismatch before the fix, and its negative twin with the wrong disjunct),mbx test -p source-compiler --features test-support --test checking_theorem_proof_parameters(32 passed: new positivea_theorem_proved_from_an_equality_supplies_the_aliasand negativea_theorem_proved_from_another_equality_cannot_supply_the_alias),mbx test --no-fail-fast -p proof-admission -p terminal-semantics -p lowered-program-to-checked-program(all passed: 1553, 184, 77 and 332 tests),mbx xtask fmt --check --base origin/main| cleanAgent: Claude Code | Model: unavailable | Effort: medium | Tokens: unavailable | Steps: unavailable | Time: 0h40m | Steers: 0
Generated by Claude Code