8
8
9
9
module Relation.Binary.PropositionalEquality where
10
10
11
- open import Algebra
12
- open import Algebra.Structures
13
- open import Algebra.Definitions
14
11
import Axiom.Extensionality.Propositional as Ext
15
12
open import Axiom.UniquenessOfIdentityProofs
16
- open import Function.Base
13
+ open import Function.Base using (id; _∘_)
17
14
open import Function.Equality using (Π; _⟶_; ≡-setoid)
18
15
open import Level using (Level; _⊔_)
19
16
open import Data.Product using (∃)
20
17
21
18
open import Relation.Nullary using (yes ; no)
22
19
open import Relation.Nullary.Decidable.Core
23
- open import Relation.Unary using (Pred)
24
20
open import Relation.Binary
25
21
open import Relation.Binary.Indexed.Heterogeneous
26
22
using (IndexedSetoid)
@@ -35,69 +31,11 @@ private
35
31
C : Set c
36
32
37
33
------------------------------------------------------------------------
38
- -- Re-export contents of core module
34
+ -- Re-export contents modules that make up the parts
39
35
40
36
open import Relation.Binary.PropositionalEquality.Core public
41
-
42
- ------------------------------------------------------------------------
43
- -- Some properties
44
-
45
- subst₂ : ∀ (_∼_ : REL A B ℓ) {x y u v} → x ≡ y → u ≡ v → x ∼ u → y ∼ v
46
- subst₂ _ refl refl p = p
47
-
48
- cong-app : ∀ {A : Set a} {B : A → Set b} {f g : (x : A) → B x} →
49
- f ≡ g → (x : A) → f x ≡ g x
50
- cong-app refl x = refl
51
-
52
- cong₂ : ∀ (f : A → B → C) {x y u v} → x ≡ y → u ≡ v → f x u ≡ f y v
53
- cong₂ f refl refl = refl
54
-
55
- ------------------------------------------------------------------------
56
- -- Structure of equality as a binary relation
57
-
58
- isEquivalence : IsEquivalence {A = A} _≡_
59
- isEquivalence = record
60
- { refl = refl
61
- ; sym = sym
62
- ; trans = trans
63
- }
64
-
65
- isDecEquivalence : Decidable _≡_ → IsDecEquivalence {A = A} _≡_
66
- isDecEquivalence _≟_ = record
67
- { isEquivalence = isEquivalence
68
- ; _≟_ = _≟_
69
- }
70
-
71
- isPreorder : IsPreorder {A = A} _≡_ _≡_
72
- isPreorder = record
73
- { isEquivalence = isEquivalence
74
- ; reflexive = id
75
- ; trans = trans
76
- }
77
-
78
- ------------------------------------------------------------------------
79
- -- Bundles for equality as a binary relation
80
-
81
- setoid : Set a → Setoid _ _
82
- setoid A = record
83
- { Carrier = A
84
- ; _≈_ = _≡_
85
- ; isEquivalence = isEquivalence
86
- }
87
-
88
- decSetoid : Decidable {A = A} _≡_ → DecSetoid _ _
89
- decSetoid _≟_ = record
90
- { _≈_ = _≡_
91
- ; isDecEquivalence = isDecEquivalence _≟_
92
- }
93
-
94
- preorder : Set a → Preorder _ _ _
95
- preorder A = record
96
- { Carrier = A
97
- ; _≈_ = _≡_
98
- ; _∼_ = _≡_
99
- ; isPreorder = isPreorder
100
- }
37
+ open import Relation.Binary.PropositionalEquality.Properties public
38
+ open import Relation.Binary.PropositionalEquality.Algebra public
101
39
102
40
------------------------------------------------------------------------
103
41
-- Pointwise equality
@@ -147,64 +85,7 @@ isPropositional : Set a → Set a
147
85
isPropositional A = (a b : A) → a ≡ b
148
86
149
87
------------------------------------------------------------------------
150
- -- Various equality rearrangement lemmas
151
-
152
- trans-injectiveˡ : ∀ {x y z : A} {p₁ p₂ : x ≡ y} (q : y ≡ z) →
153
- trans p₁ q ≡ trans p₂ q → p₁ ≡ p₂
154
- trans-injectiveˡ refl = subst₂ _≡_ (trans-reflʳ _) (trans-reflʳ _)
155
-
156
- trans-injectiveʳ : ∀ {x y z : A} (p : x ≡ y) {q₁ q₂ : y ≡ z} →
157
- trans p q₁ ≡ trans p q₂ → q₁ ≡ q₂
158
- trans-injectiveʳ refl eq = eq
159
-
160
- cong-id : ∀ {x y : A} (p : x ≡ y) → cong id p ≡ p
161
- cong-id refl = refl
162
-
163
- cong-∘ : ∀ {x y : A} {f : B → C} {g : A → B} (p : x ≡ y) →
164
- cong (f ∘ g) p ≡ cong f (cong g p)
165
- cong-∘ refl = refl
166
-
167
- trans-cong : ∀ {x y z : A} {f : A → B} (p : x ≡ y) {q : y ≡ z} →
168
- trans (cong f p) (cong f q) ≡ cong f (trans p q)
169
- trans-cong refl = refl
170
-
171
- cong₂-reflˡ : ∀ {_∙_ : A → B → C} {x u v} → (p : u ≡ v) →
172
- cong₂ _∙_ refl p ≡ cong (x ∙_) p
173
- cong₂-reflˡ refl = refl
174
-
175
- cong₂-reflʳ : ∀ {_∙_ : A → B → C} {x y u} → (p : x ≡ y) →
176
- cong₂ _∙_ p refl ≡ cong (_∙ u) p
177
- cong₂-reflʳ refl = refl
178
-
179
- module _ {P : Pred A p} {x y : A} where
180
-
181
- subst-injective : ∀ (x≡y : x ≡ y) {p q : P x} →
182
- subst P x≡y p ≡ subst P x≡y q → p ≡ q
183
- subst-injective refl p≡q = p≡q
184
-
185
- subst-subst : ∀ {z} (x≡y : x ≡ y) {y≡z : y ≡ z} {p : P x} →
186
- subst P y≡z (subst P x≡y p) ≡ subst P (trans x≡y y≡z) p
187
- subst-subst refl = refl
188
-
189
- subst-subst-sym : (x≡y : x ≡ y) {p : P y} →
190
- subst P x≡y (subst P (sym x≡y) p) ≡ p
191
- subst-subst-sym refl = refl
192
-
193
- subst-sym-subst : (x≡y : x ≡ y) {p : P x} →
194
- subst P (sym x≡y) (subst P x≡y p) ≡ p
195
- subst-sym-subst refl = refl
196
-
197
- subst-∘ : ∀ {x y : A} {P : Pred B p} {f : A → B}
198
- (x≡y : x ≡ y) {p : P (f x)} →
199
- subst (P ∘ f) x≡y p ≡ subst P (cong f x≡y) p
200
- subst-∘ refl = refl
201
-
202
- subst-application : ∀ {a₁ a₂ b₁ b₂} {A₁ : Set a₁} {A₂ : Set a₂}
203
- (B₁ : A₁ → Set b₁) {B₂ : A₂ → Set b₂}
204
- {f : A₂ → A₁} {x₁ x₂ : A₂} {y : B₁ (f x₁)}
205
- (g : ∀ x → B₁ (f x) → B₂ x) (eq : x₁ ≡ x₂) →
206
- subst B₂ eq (g x₁ y) ≡ g x₂ (subst B₁ (cong f eq) y)
207
- subst-application _ _ refl = refl
88
+ -- More complex rearrangement lemmas
208
89
209
90
-- A lemma that is very similar to Lemma 2.4.3 from the HoTT book.
210
91
@@ -240,20 +121,6 @@ module _ (_≟_ : Decidable {A = A} _≡_) {x y : A} where
240
121
≢-≟-identity : x ≢ y → ∃ λ ¬eq → x ≟ y ≡ no ¬eq
241
122
≢-≟-identity ¬eq = dec-no (x ≟ y) ¬eq
242
123
243
- ------------------------------------------------------------------------
244
- -- Any operation forms a magma over _≡_
245
-
246
- isMagma : (_∙_ : Op₂ A) → IsMagma _≡_ _∙_
247
- isMagma _∙_ = record
248
- { isEquivalence = isEquivalence
249
- ; ∙-cong = cong₂ _∙_
250
- }
251
-
252
- magma : (_∙_ : Op₂ A) → Magma _ _
253
- magma _∙_ = record
254
- { isMagma = isMagma _∙_
255
- }
256
-
257
124
------------------------------------------------------------------------
258
125
-- DEPRECATED NAMES
259
126
------------------------------------------------------------------------
0 commit comments