Skip to content

tests: three proofs of False from non-transitive definitional equality - #141

Merged
nomeata merged 1 commit into
masterfrom
joachim/more-bugs
Aug 18, 2026
Merged

nomeata merged 1 commit into
masterfrom
joachim/more-bugs

Conversation

@nomeata

@nomeata nomeata commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Definitional equality is not transitive on three Acc.rec-based values: proof
irrelevance relates a ≡ b and b ≡ c, but not a ≡ c. Three ways to turn
that into False:

  • rec-missing-ih: in the affected kernels the defeq cache is a union-find
    structure, i.e. it closes that relation transitively, but it is only consulted
    for expressions with equal hashes. A crafted collision therefore makes a
    K-like reduction fire in the pass that builds the minor premises of a recursor
    and not in the pass that builds its rules, so the step minor premise takes an
    induction hypothesis that its rule does not supply. Fixed by
    fix: make kernel is_def_eq caching order-independent lean4#14806. Frozen as a static export file, since the malformed
    recursor comes out of the kernel's own inductive-type elaborator; the
    reproducer is kept alongside it.

  • proj-of-stuck-prop: the same reduction decides the result sort of an inductive
    family, which is a Prop when checked under _kernel_fresh.0 and stuck for
    the closed instantiation, so a Bool field can be projected out of a
    proposition that proof irrelevance applies to. Fixed by fix: make the kernel is_prop check require a sort lean4#14807,
    and its use of the cache by #14806.

  • proj-of-subst-prop: the same projection, but reached without any help from the
    defeq cache — P := a = b and Q := a = c are definitionally equal types
    whose proofs behave differently under Eq.rec, so an inductive family declared
    over P is a family of propositions while its instance at a proof of Q has a
    sort that does not reduce to Prop. Needs no axioms. Fixed by
    fix: make the kernel is_prop check require a sort lean4#14807.

All three were accepted by the official kernel at v4.28.0, v4.29.1, v4.33.0 and
nightly-2026-08-01, which also re-derives the broken declarations when replaying
the export data.

Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_013aD597ZqUV1XrMPdveoaKt

Definitional equality is not transitive on three `Acc.rec`-based values: proof
irrelevance relates `a ≡ b` and `b ≡ c`, but not `a ≡ c`.  Three ways to turn
that into `False`:

* rec-missing-ih: in the affected kernels the defeq cache is a union-find
  structure, i.e. it closes that relation transitively, but it is only consulted
  for expressions with equal hashes.  A crafted collision therefore makes a
  K-like reduction fire in the pass that builds the minor premises of a recursor
  and not in the pass that builds its rules, so the `step` minor premise takes an
  induction hypothesis that its rule does not supply.  Fixed by
  leanprover/lean4#14806.  Frozen as a static export file, since the malformed
  recursor comes out of the kernel's own inductive-type elaborator; the
  reproducer is kept alongside it.

* proj-of-stuck-prop: the same reduction decides the result sort of an inductive
  family, which is a `Prop` when checked under `_kernel_fresh.0` and stuck for
  the closed instantiation, so a `Bool` field can be projected out of a
  proposition that proof irrelevance applies to.  Fixed by leanprover/lean4#14807,
  and its use of the cache by #14806.

* proj-of-subst-prop: the same projection, but reached without any help from the
  defeq cache — `P := a = b` and `Q := a = c` are definitionally equal types
  whose proofs behave differently under `Eq.rec`, so an inductive family declared
  over `P` is a family of propositions while its instance at a proof of `Q` has a
  sort that does not reduce to `Prop`.  Needs no axioms.  Fixed by
  leanprover/lean4#14807.

All three were accepted by the official kernel at v4.28.0, v4.29.1, v4.33.0 and
nightly-2026-08-01, which also re-derives the broken declarations when replaying
the export data.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013aD597ZqUV1XrMPdveoaKt
@nomeata
nomeata merged commit 6de926b into master Aug 18, 2026
24 checks passed
@nomeata
nomeata deleted the joachim/more-bugs branch August 18, 2026 08:39
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

Successfully merging this pull request may close these issues.

1 participant