mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
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.
24 lines
840 B
Lean4
24 lines
840 B
Lean4
inductive Many (α : Type u) where
|
||
| none : Many α
|
||
| more : α → (Unit → Many α) → Many α
|
||
|
||
def many_map {α β : Type} (f : α → β) : Many α → Many β
|
||
| .none => .none
|
||
| .more x xs => Many.more (f x) (fun () => many_map f <| xs ())
|
||
|
||
/--
|
||
info: many_map.induct {α : Type} (motive : Many α → Prop) (case1 : motive Many.none)
|
||
(case2 : ∀ (x : α) (xs : Unit → Many α), motive (xs ()) → motive (Many.more x xs)) (a✝ : Many α) : motive a✝
|
||
-/
|
||
#guard_msgs in
|
||
#check many_map.induct
|
||
|
||
-- Unrelated, but for fun, show that we get the identical theorem from well-founded recursion
|
||
|
||
def many_map' {α β : Type} (f : α → β) : Many α → Many β
|
||
| .none => .none
|
||
| .more x xs => Many.more (f x) (fun () => many_map' f <| xs ())
|
||
termination_by m => m
|
||
|
||
example : @many_map.induct = @many_map'.induct := rfl
|