Q.agda 534 B

12345678910111213141516171819202122232425262728293031323334
  1. module Q where
  2. import AlonzoPrelude
  3. open AlonzoPrelude -- , using(Bool,False,True,String,showBool)
  4. import PreludeNat
  5. open PreludeNat
  6. import PreludeBool
  7. open PreludeBool
  8. import PreludeShow
  9. open PreludeShow
  10. pred : Nat -> Nat
  11. pred (zero) = zero
  12. pred (suc n) = n
  13. mplus : Nat -> Nat -> Nat
  14. mplus zero y = y
  15. mplus (suc n) y = suc (mplus n y )
  16. Q : Bool -> Set
  17. Q true = Nat
  18. Q false = Bool
  19. f : (b : Bool) -> Q b
  20. f true = pred 3
  21. f false = true
  22. mid : {A : Set} -> A -> A
  23. mid x = x
  24. mainS : String
  25. mainS = showBool (f (const false true))