// Adapted from https://www.aya-prover.org/guide/haskeller-tutorial.html
inductive Nat | zero | suc Nat

open Nat

example def infixl <+> Nat Nat : Nat
| 0, nn
| suc m, nsuc (m <+> n)

overlap def infixl <+> Nat Nat : Nat
| 0, nn
| n, 0 ⇒ n
| suc m, nsuc (m <+> n)

def oh (x : Nat) : Natx

example def infixl [+] (a n : Nat) : Nat elim a
| 0 ⇒ n
| suc msuc (m [+] n)

def id {A : Type} (x : A) ⇒ x

open inductive Maybe (A : Type)
| nothing
| just A

variable A : Type

// example def id (x : A) ⇒ x

// def BinOp (A : Type) ⇒ A → A → A

// example def infixl <+> : BinOp Nat
// | 0, n ⇒ n
// | suc m, n ⇒ suc (m <+> n)

// Unit type
open inductive Unit | unit

// A type family
def FromJust (x : Maybe A) : Type
| just aA
| nothingUnit

// A function that uses the type family
def fromJust (x : Maybe A) : FromJust x
| just aa
| nothingunit

inductive Example (A : Type)
| cons (x : Maybe A) (FromJust x)

open inductive Vec (Nat) (Type)
| 0, Tnil
| suc n, Tinfixr :< T (Vec n T)

variable m n : Nat

overlap def infixr ++ (Vec n A) (Vec m A) : Vec (n <+> m) A
| nil, ysys
| x :< xs, ysx :< xs ++ ys
| xs, nilxs
tighter :<