Files
lean4/tests/elab/grind_eta_struct_internalize.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

39 lines
962 B
Lean4
Raw Permalink 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.
namespace List
/-
This example exposed a bug in the `grind` internalizer when `grind -revert`
is used.
-/
variable {α : Type} {β : α Type}
def keys : List (Sigma β) List α :=
map Sigma.fst
@[grind =]
theorem keys_cons {s} {l : List (Sigma β)} : (s :: l).keys = s.1 :: l.keys :=
rfl
variable [DecidableEq α]
def dlookup (a : α) : List (Sigma β) Option (β a)
| [] => none
| a', b :: l => if h : a' = a then some (Eq.recOn h b) else dlookup a l
@[grind =]
theorem dlookup_cons_eq (l) (a : α) (b : β a) : dlookup a (a, b :: l) = some b :=
dif_pos rfl
@[grind =]
theorem dlookup_cons_ne (l) {a} : s : Sigma β, a s.1 dlookup a (s :: l) = dlookup a l
| _, _, h => dif_neg h.symm
@[grind =]
theorem dlookup_isSome {a : α} {l : List (Sigma β)} : (dlookup a l).isSome a l.keys := by
induction l with
| nil => sorry
| cons s _ _ =>
by_cases a = s.fst
· grind
· sorry