lean4-htt/tests/elab/issue5661.lean
Joachim Breitner 2398d2cc66
feat: no [defeq] attribute on sizeOf_spec lemmas (#13320)
This PR changes the auto-generated `sizeOf` definitions to be not
exposed and the `sizeOf_spec` theorem to be not marked `[defeq]`.
2026-04-08 11:10:50 +00:00

75 lines
1.6 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean.Meta.Basic
set_option warn.sorry false
inductive StructLike α where
| mk : α → StructLike α
inductive Nested where
| nest : StructLike Nested → Nested
| other
/--
info: theorem Nested.nest.sizeOf_spec : ∀ (a : StructLike Nested), sizeOf (Nested.nest a) = 1 + sizeOf a :=
fun a => Eq.refl (1 + sizeOf a)
-/
#guard_msgs in
#print Nested.nest.sizeOf_spec
/-- info: StructLike -/
#guard_msgs in
open Lean Meta in
run_meta do
let i ← getConstInfoRec ``Nested.rec_1
logInfo m!"{i.getMajorInduct}"
theorem works (x : StructLike Nested) : StructLike.rec
(motive := fun _ => Bool)
(mk := fun _ => true)
x = true
:= rfl
theorem failed_before (x : StructLike Nested) : Nested.rec_1
(motive_1 := fun _ => Bool) (motive_2 := fun _ => Bool)
(nest := fun _ _ => true)
(other := true)
(mk := fun _ _ => true)
x = true
:= rfl
-- The original surface bug
inductive Set (α : Type u) where
| mk (l : List α)
inductive Value where
| prim
| set (s : Set Value)
instance : DecidableEq Value := sorry
mutual
def Value.lt : Value → Value → Bool
| .prim, .prim => false
| .set (.mk vs₁), .set (.mk vs₂) => Values.lt vs₁ vs₂
| .prim, .set _ => true
| .set _, .prim => false
def Values.lt : List Value → List Value → Bool
| [], [] => false
| [], _ => true
| _, [] => false
| v₁ :: vs₁, v₂ :: vs₂ => Value.lt v₁ v₂ || (v₁ = v₂ && Values.lt vs₁ vs₂)
end
theorem Value.lt_irrefl (v : Value) :
¬ Value.lt v v
:= by
cases v
case set a =>
show ¬Values.lt a.1 a.1 = true
sorry
all_goals sorry