lean4-htt/tests/elab/issue5767.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

63 lines
1.7 KiB
Text

axiom Std.HashMap : Type
axiom Std.HashMap.insert : Std.HashMap → Std.HashMap
axiom Std.HashMap.get? : Std.HashMap → Int → Option Unit
structure St where
m : Unit
map : Std.HashMap
opaque P : St → Prop
noncomputable
def go1 (ss : Int) (st0 : St) : Bool :=
let st1 := { st0 with map := st0.map.insert }
match st1.map.get? ss with
| some _ =>
have : P st1 := sorry
have : P st1 := sorry
go1 ss st1
| none => true
termination_by st0
decreasing_by sorry
/--
info: go1.induct (ss : Int) (motive : St → Prop)
(case1 :
∀ (x : St),
have st1 := { m := x.m, map := x.map.insert };
∀ (val : Unit), st1.map.get? ss = some val → P st1 → P st1 → motive st1 → motive x)
(case2 :
∀ (x : St),
have st1 := { m := x.m, map := x.map.insert };
st1.map.get? ss = none → motive x)
(st0 : St) : motive st0
-/
#guard_msgs in
#check go1.induct
-- the above was the original bugreport, and a (spurious) mdata around the match
-- triggered a bug and looking through it solved it. But that would just hide it, and it
-- can be triggered like this:
noncomputable
def go2 (ss : Int) (st0 : St) : Bool :=
let st1 := { st0 with map := st0.map.insert }
id <| match st1.map.get? ss with -- the ss argument is needed
| some _ =>
have : P st1 := sorry -- both needed
have : P st1 := sorry -- both needed
go2 ss st1
| none => true
termination_by st0
decreasing_by sorry
/--
info: go2.induct : ∀ (motive : St → Prop),
(∀ (x : St),
have st1 := { m := x.m, map := x.map.insert };
motive st1 → motive x) →
∀ (st0 : St), motive st0
-/
#guard_msgs in
#check @go2.induct