lean4-htt/tests/lean/run/new_inductive.lean
2019-07-02 13:22:11 -07:00

71 lines
1.9 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.

universes u v
inductive myList (α : Type u)
| nil : myList
| cons : α → myList → myList
inductive myPair (α : Type u) (β : Type v)
| mk : α → β → myPair
mutual inductive bla, boo (α : Type u) (m : α → Type v)
with bla : Nat → Type (max u v)
| mk₁ (n : Nat) : α → boo n → bla (n+1)
| mk₂ (a : α) : m a → String → bla 0
with boo : Nat → Type (max u v)
| mk₃ (n : Nat) : bla n → bla (n+1) → boo (n+2)
#print bla
inductive Term (α : Type) (β : Type)
| var : α → bla Term (fun _ => Term) 10 → Term
| foo (p : Nat → myPair Term (myList Term)) (n : β) : myList (myList Term) → Term
#print Term
#print Term.below
#check @Term.casesOn
#print Term.noConfusionType
#print Term.noConfusion
inductive arrow (α β : Type)
| mk (s : Nat → myPair α β) : arrow
mutual inductive tst1, tst2
with tst1 : Type
| mk : (arrow (myPair tst2 Bool) tst2) → tst1
with tst2 : Type
| mk : tst1 → tst2
#check @tst1.casesOn
#check @tst2.casesOn
#check @tst1.recOn
namespace test
inductive Rbnode (α : Type u)
| leaf {} : Rbnode
| redNode (lchild : Rbnode) (val : α) (rchild : Rbnode) : Rbnode
| blackNode (lchild : Rbnode) (val : α) (rchild : Rbnode) : Rbnode
#check @Rbnode.brecOn
namespace Rbnode
variables {α : Type u}
constant insert (lt : αα → Prop) [DecidableRel lt] (t : Rbnode α) (x : α) : Rbnode α := Rbnode.leaf
inductive WellFormed (lt : αα → Prop) : Rbnode α → Prop
| leafWff : WellFormed leaf
| insertWff {n n' : Rbnode α} {x : α} (s : DecidableRel lt) : WellFormed n → n' = insert lt n x → WellFormed n'
end Rbnode
def Rbtree (α : Type u) (lt : αα → Prop) : Type u :=
{t : Rbnode α // t.WellFormed lt }
inductive Trie
| Empty : Trie
| mk : Char → Rbnode (myPair Char Trie) → Trie
#print Trie.rec
#print Trie.noConfusion
end test