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

85 lines
1.6 KiB
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.
inductive L1.{u} (α : Type u)
| nil
| cons : α L1 α L1 α
#check L1
#check @L1.cons
inductive L2.{u} (α : Type u)
| nil
| cons (head : α) (tail : L2 α)
#check @L2.cons
universe u v
variable (α : Type u)
inductive A (β : Type v)
| nil
| protected cons : α β A β A β
#check @A.cons
#check A.nil (α := Nat) (β := Bool)
mutual
inductive isEven : Nat Prop
| z : isEven 0
| s (n : Nat) : isOdd n isEven (n+1)
inductive isOdd : Nat Prop
| s (n : Nat) : isEven n isOdd (n+1)
end
#check isEven
#check isOdd.s
#check @isEven.rec
inductive V (α : Type _) : Nat Type _
| nil : V α 0
| cons {n : Nat} : α V α n V α (n+1)
#check @V.nil
#check @V.cons
#check @V.rec
#check @V.noConfusion
#check @V.brecOn
#check @V.casesOn
#check @V.recOn
#check @V.below
class inductive Dec (p : Prop) : Type
| isTrue (h : p)
| isFalse (h : Not p)
instance tst : Dec True :=
Dec.isTrue True.intro
#check tst
variable (β : Type _)
inductive T1
| mk : β β T1
#check @T1.mk
inductive MyEq {α : Type} (a : α) : α Prop
| refl : MyEq a a
#check @MyEq.refl
inductive ListLast {α : Type u} : List α Type u
| empty : ListLast []
| nonEmpty : (as : List α) (a : α) ListLast (as ++ [a])
-- make sure to instantiate mvars in constructors
inductive Test : Nat Type
| mk : Test ((fun n => n.succ) Nat.zero)
inductive SortedMap {α : Type u} {β : Type v} [LT α] : List (α × β) Prop
| nil : SortedMap []
| cons : (k : α) (v : β) (l : List (α × β)),
SortedMap l
SortedMap ((k,v)::l)