MdJustHighlightAgdaAsHtml.agda 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. -- A discussion from -- https://twitter.com/YuumuKonpaku/status/1052959340468953088
  2. -- Andreas, 2019-08-18, test also #1346 (infix declaration in renaming)
  3. -- Andreas, 2019-02-17, test alse #3432 (pattern synonyms in import directive)
  4. module MdJustHighlightAgdaAsHtml where
  5. open import Agda.Builtin.Nat
  6. open import Agda.Builtin.Equality
  7. open import Agda.Primitive public using (lzero)
  8. renaming (Level to ULevel; lsuc to lsucc; _⊔_ to infixl 42 _⊔_)
  9. Type : (i : ULevel) -> Set (lsucc i)
  10. Type i = Set i
  11. data ⊥ : Type lzero where
  12. module PatternSyns where
  13. pattern O' = zero
  14. pattern S n = (suc n)
  15. open PatternSyns using (S) renaming (O' to O)
  16. variable i : ULevel
  17. ¬ : (A : Type i) → Type i
  18. ¬ A = A → ⊥
  19. _≠_ : {A : Type i} → (A → A → Type i)
  20. x ≠ y = ¬ (x ≡ y)
  21. infix 10 _∨_
  22. data _∨_ {a b} (A : Type a) (B : Type b) : Set (a ⊔ b) where
  23. a-intro : A -> A ∨ B
  24. b-intro : B -> A ∨ B
  25. test : (x y : Nat) -> (x ≡ y) ∨ (x ≠ y)
  26. test O O = a-intro refl
  27. test O (S y) = b-intro (λ ())
  28. test (S x) O = b-intro (λ ())
  29. test (S x) (S y) with test x y
  30. ... | a-intro refl = a-intro refl
  31. ... | b-intro k = b-intro (lemma k)
  32. where
  33. lemma : {a b : Nat} -> a ≠ b -> S a ≠ S b
  34. lemma p refl = p refl