lean4-htt/tests
Joachim Breitner b5555052bd
feat: T.ctor.elim single-constructor cases function (#9952)
This PR adds “non-branching case statements”: For each inductive
constructor `T.con` this adds a function `T.con.with` that is similar
`T.casesOn`, but has only one arm (the one for `con`), and an additional
`t.toCtorIdx = 12` assumption.

For example:
```lean
inductive Vec (α : Type) : Nat → Type where
  | nil : Vec α 0
  | cons {n} : α → Vec α n → Vec α (n + 1)

/--
info: @[reducible] protected def Vec.cons.elim.{u} : {α : Type} →
  {motive : (a : Nat) → Vec α a → Sort u} →
    {a : Nat} →
      (t : Vec α a) →
        t.ctorIdx = 1 → ({n : Nat} → (a : α) → (a_1 : Vec α n) → motive (n + 1) (Vec.cons a a_1)) → motive a t
-/
#guard_msgs in
#print sig Vec.cons.elim
```

This is a building block for non-quadratic implementations of `BEq` and
`DecidableEq` etc.

Builds on top of #9951.

The compiled code for a these functions could presumably, without
branching on the inductive value, directly access the fields. Achieving
this optimization (and achieving it without a quadratic compilation
cost) is not in scope for this PR.
2025-08-27 09:40:31 +00:00
..
bench chore: set experimental.module=true when running grind benchmarks (#10041) 2025-08-22 03:15:36 +00:00
compiler chore: further split libleanshared on Windows to avoid symbol limit (#10136) 2025-08-26 16:01:57 +00:00
elabissues
ir
lean feat: T.ctor.elim single-constructor cases function (#9952) 2025-08-27 09:40:31 +00:00
pkg chore: error messages consistency (#10143) 2025-08-26 17:55:43 +00:00
playground chore: eliminate uses of intros x y z (#9983) 2025-08-19 06:09:13 +00:00
plugin
simpperf
.gitignore
common.sh
lakefile.toml
lean-toolchain