-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInstances.agda
More file actions
86 lines (55 loc) · 2.02 KB
/
Copy pathInstances.agda
File metadata and controls
86 lines (55 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{-# OPTIONS --cubical-compatible #-}
module Class.Decidable.Instances where
open import Class.Prelude
open import Class.Decidable.Core
open import Class.DecEq.Core
instance
-- ** deriving from DecEq
DecEq⇒Dec : ⦃ DecEq A ⦄ → _≡_ {A = A} ⁇²
DecEq⇒Dec = ⁇² _≟_
-- ** basic type formers
Dec-⊥ : ⊥ ⁇
Dec-⊥ .dec = no λ()
Dec-⊤ : ⊤ ⁇
Dec-⊤ .dec = yes tt
open import Relation.Nullary.Decidable as D
Dec-→ : ⦃ A ⁇ ⦄ → ⦃ B ⁇ ⦄ → (A → B) ⁇
Dec-→ .dec = dec D.→-dec dec
-- ** products
Dec-× : ⦃ A ⁇ ⦄ → ⦃ B ⁇ ⦄ → (A × B) ⁇
Dec-× .dec = dec D.×-dec dec
-- ** sums
Dec-⊎ : ⦃ A ⁇ ⦄ → ⦃ B ⁇ ⦄ → (A ⊎ B) ⁇
Dec-⊎ .dec = dec D.⊎-dec dec
Dec-T : T ⁇¹
Dec-T = ⁇¹ 𝔹.T?
import Data.List.Relation.Unary.All as L
import Data.List.Relation.Unary.Any as L
Dec-All : ⦃ P ⁇¹ ⦄ → L.All P ⁇¹
Dec-All = ⁇¹ L.all? dec¹
Dec-Any : ⦃ P ⁇¹ ⦄ → L.Any P ⁇¹
Dec-Any = ⁇¹ L.any? dec¹
import Data.List.Relation.Unary.AllPairs as AP
Dec-AllPairs : ⦃ R ⁇² ⦄ → AP.AllPairs R ⁇¹
Dec-AllPairs = ⁇¹ AP.allPairs? dec²
open import Data.Vec.Relation.Unary.All as V
open import Data.Vec.Relation.Unary.Any as V
Dec-VAll : ⦃ P ⁇¹ ⦄ → V.All P {n} ⁇¹
Dec-VAll = ⁇¹ V.all? dec¹
Dec-VAny : ⦃ P ⁇¹ ⦄ → V.Any P {n} ⁇¹
Dec-VAny = ⁇¹ V.any? dec¹
import Data.Maybe.Relation.Unary.All as Mb renaming (dec to all?)
import Data.Maybe.Relation.Unary.Any as Mb renaming (dec to any?)
Dec-MAll : ⦃ P ⁇¹ ⦄ → Mb.All P ⁇¹
Dec-MAll = ⁇¹ Mb.all? dec¹
Dec-MAny : ⦃ P ⁇¹ ⦄ → Mb.Any P ⁇¹
Dec-MAny = ⁇¹ Mb.any? dec¹
-- ** inequalities
ℕ-Dec-≤ = ⁇² Nat._≤?_
ℕ-Dec-< = ⁇² Nat._<?_
import Data.Integer.Properties as ℤ
ℤ-Dec-≤ = ⁇² ℤ._≤?_
ℤ-Dec-< = ⁇² ℤ._<?_
import Data.Rational.Properties as Rat
ℚ-Dec-≤ = ⁇² Rat._≤?_
ℚ-Dec-< = ⁇² Rat._<?_