Debian Codegraph @

doc/README/Relation/Binary/TypeClasses.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Usage examples of typeclasses for binary relations
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module README.Relation.Binary.TypeClasses where
10
11 open import Relation.Nullary
12 open import Relation.Binary.PropositionalEquality
13 open import Relation.Binary.TypeClasses
14
15 open import Data.Bool.Base renaming (_≤_ to _≤Bool)
16 open import Data.Bool.Instances
17 open import Data.List.Base
18 open import Data.List.Instances
19 open import Data.List.Relation.Binary.Lex.NonStrict using (Lex-≤)
20 open import Data.Nat.Base renaming (_≤_ to _≤ℕ_)
21 open import Data.Nat.Instances
22 open import Data.Product.Base using (_×_; _,_; Σ)
23 open import Data.Product.Instances
24 open import Data.Unit.Base renaming (_≤_ to _≤⊤_)
25 open import Data.Unit.Instances
26 open import Data.Vec.Base
27 open import Data.Vec.Instances
28
29 test-Dec≡-Bool : Dec (true ≡ true)
30 test-Dec≡-Bool = true ≟ true
31
32 test-Dec≡-Nat : Dec (0 ≡ 1)
33 test-Dec≡-Nat = 0 ≟ 1
34
35 test-Dec≡-List : Dec (_≡_ {A = List ℕ} (1 ∷ 2 ∷ []) (1 ∷ 2 ∷ []))
36 test-Dec≡-List = (1 ∷ 2 ∷ []) ≟ (1 ∷ 2 ∷ [])
37
38 test-Dec≡-⊤ : Dec (tt ≡ tt)
39 test-Dec≡-⊤ = _ ≟ _
40
41 test-Dec≡-Pair : Dec (_≡_ {A = Bool × Bool} (true , false) (false , true))
42 test-Dec≡-Pair = _ ≟ _
43
44 test-Dec≡-Vec : Dec (_≡_ {A = Vec Bool 2} (true ∷ false ∷ []) (true ∷ false ∷ []))
45 test-Dec≡-Vec = _ ≟ _
46
47 test-Dec≡-Σ : Dec (_≡_ {A = Σ ℕ (Vec Bool)} (0 , []) (1 , true ∷ []))
48 test-Dec≡-Σ = _ ≟ _
49
50 test-Dec≤-Nat : Dec (0 ≤ℕ 1)
51 test-Dec≤-Nat = 0 ≤? 1
52
53 test-Dec≤-List : Dec (Lex-≤ _≡_ _≤ℕ_ (0 ∷ 1 ∷ []) (1 ∷ []))
54 test-Dec≤-List = _ ≤? _