playground/lean4/two.lean

13 lines
369 B
Plaintext
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 types -/
inductive Tree (β:Type v) where
| leaf
| node (left:Tree β) (key:Nat) (value:β) (right:Tree β)
deriving Repr -- Repr is a type class
#eval Tree.node Tree.leaf 10 true Tree.leaf
--#eval Tree.node ⬝leaf 10 true ⬝leaf
inductive Vector (α:Type u):Nat -> Type u
| nil : Vector α 0
| cons : α -> Vector α n -> Vector α (n+1)