Skip to content

fix: prove the mkAppRangeAux equation instead of assuming it - #26

Merged
digama0 merged 2 commits into
digama0:masterfrom
kim-em:issue-25
Aug 2, 2026
Merged

fix: prove the mkAppRangeAux equation instead of assuming it#26
digama0 merged 2 commits into
digama0:masterfrom
kim-em:issue-25

Conversation

@kim-em

@kim-em kim-em commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR replaces the Expr.mkAppRangeAux.eq_def axiom in Lean4Lean/Verify/Axioms.lean with a proved theorem. The axiom was a workaround for leanprover/lean4#8464; that has since merged, so mkAppRangeAux is a total definition in the pinned toolchain and its defining equation follows from rw [mkAppRangeAux]. The statement is unchanged, so the consumer in Lean4Lean/Verify/Expr.lean needs no edits, and no replacement assumptions are introduced: #print axioms Lean.Expr.mkAppRangeAux.eq_def reports only propext and Quot.sound.

Closes #25

🤖 Prepared with Claude Code

`Expr.mkAppRangeAux.eq_def` was an axiom as a workaround for
leanprover/lean4#8464. That has merged, so `mkAppRangeAux` is a total
definition in the pinned toolchain and its defining equation is
provable by `rw [mkAppRangeAux]`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LdQizBpspiYVC5HNa8dNg
lean4#8464 having merged does more than make the equation provable: it makes
`mkAppRangeAux` a total definition, so Lean generates `mkAppRangeAux.eq_def` on
demand and there is nothing left for us to state. `Verify/Expr.lean` already
opens the private `mkAppRangeAux`, so the `rw [mkAppRangeAux.eq_def]` at its only
use site resolves to the generated lemma with no edit -- the generated statement
is character-for-character the one removed here.

Keeping our own copy would shadow the generated lemma and leave a restatement to
maintain by hand against a definition we do not own.

`#print axioms Lean.Expr.mkAppRange_eq` reports `[propext, Quot.sound]`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@digama0

digama0 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

🤖 Pushed a commit on top — I think we can drop the declaration entirely rather than prove it.

lean4#8464 having merged does more than make the equation provable: it makes mkAppRangeAux a total definition, so Lean generates mkAppRangeAux.eq_def on demand. Verify/Expr.lean already opens the private mkAppRangeAux at line 628, so the rw [mkAppRangeAux.eq_def] at its only use site picks up the generated lemma with no edit at all. The generated statement is character-for-character the one being removed:

mkAppRangeAux.eq_def : ∀ (n : Nat) (args : Array Expr) (i : Nat) (e : Expr),
  mkAppRangeAux n args i e = if i < n then mkAppRangeAux n args (i + 1) (mkApp e args[i]!) else e

So keeping our own copy shadows the generated lemma and leaves us maintaining a restatement of a definition we don't own — it would silently drift if the upstream definition ever changed shape, and the rw would keep working against our stale copy.

Same axiom result you reported, with nothing left behind:

#print axioms Lean.Expr.mkAppRange_eq   ->   [propext, Quot.sound]

lake build is clean (143 jobs, 23 sorrys, unchanged), and Verify/Axioms.lean goes from 8 axioms to 7 — the remaining ones are the genuinely unprovable PersistentHashMap/PersistentArray ones where the upstream definitions are opaque.

@digama0
digama0 merged commit 66172a2 into digama0:master Aug 2, 2026
1 check passed
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.

Remove the mkAppRangeAux equation axiom

2 participants