import BidirTT.Syntax

namespace BidirTT.Examples

open BidirTT

def idTy : Raw :=
  .pi "A" (.univ 0) (.pi "_" (.var "A") (.var "A"))

def idTm : Raw :=
  .lam "A" (.lam "x" (.var "x"))

def idAnn : Raw := .ann idTm idTy

def constTy : Raw :=
  .pi "A" (.univ 0) (.pi "B" (.univ 0)
    (.pi "_" (.var "A") (.pi "_" (.var "B") (.var "A"))))

def constTm : Raw :=
  .lam "A" (.lam "B" (.lam "x" (.lam "_" (.var "x"))))

def constAnn : Raw := .ann constTm constTy

def swapTy : Raw :=
  .pi "A" (.univ 0) (.pi "B" (.univ 0)
    (.pi "_" (.sig "_" (.var "A") (.var "B"))
             (.sig "_" (.var "B") (.var "A"))))

def swapTm : Raw :=
  .lam "A" (.lam "B" (.lam "p"
    (.pair (.snd (.var "p")) (.fst (.var "p")))))

def swapAnn : Raw := .ann swapTm swapTy

def depPairTy : Raw :=
  .sig "A" (.univ 2) (.var "A")

def depPairTm : Raw :=
  .pair
    (.univ 1)
    (.pi "_" (.univ 0) (.univ 0))

def depPairAnn : Raw := .ann depPairTm depPairTy

def fstDepPair : Raw := .fst depPairAnn

def sndDepPair : Raw := .snd depPairAnn

def omegaTy : Raw :=
  .pi "A" (.univ 0) (.var "A")

def omegaTm : Raw :=
  .lam "x" (.app (.var "x") (.var "x"))

def omegaAnn : Raw := .ann omegaTm omegaTy

def unknownVar : Raw := .var "nope"

def pairMismatch : Raw :=
  .ann (.pair (.univ 1) (.univ 1))
       (.sig "A" (.univ 2) (.var "A"))

def badFst : Raw := .fst (.univ 0)

def letUniverse : Raw :=
  .ann
    (.letE "A" (.univ 1) (.pi "_" (.univ 0) (.univ 0)) (.var "A"))
    (.univ 1)

def univ0 : Raw := .univ 0

end BidirTT.Examples
