lean4-htt/tests/lean/run/inductive1.lean
Leonardo de Moura 90a79a0b06 chore: remove command universes
Now, `universe` may declare many universes. The goal is to make it
consistent with the `variable` command
2021-06-29 17:01:07 -07:00

85 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.

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.binductionOn
#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)