@@ -26,7 +26,6 @@ open import Relation.Binary.Core using (REL)
26
26
open import Relation.Binary.PropositionalEquality as P
27
27
using (_≡_; _≗_; refl)
28
28
29
- open Related.EquationalReasoning hiding (_≡⟨_⟩_)
30
29
private
31
30
module ×⊎ {k ℓ} = CommutativeSemiring (×-⊎-commutativeSemiring k ℓ)
32
31
@@ -71,6 +70,7 @@ module _ {s p} {C : Container s p} {x} {X : Set x}
71
70
(∃ λ x → x ∈ xs₁ × P₁ x) ∼⟨ Σ.cong ↔-refl (xs₁≈xs₂ ×-cong P₁↔P₂ _) ⟩
72
71
(∃ λ x → x ∈ xs₂ × P₂ x) ↔⟨ SK-sym (↔∈ C) ⟩
73
72
◇ C P₂ xs₂ ∎
73
+ where open Related.EquationalReasoning
74
74
75
75
-- Nested occurrences of ◇ can sometimes be swapped.
76
76
@@ -95,6 +95,7 @@ module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s
95
95
(∃ λ y → y ∈ ys × ∃ λ x → x ∈ xs × P x y) ↔⟨ Σ.cong ↔-refl (Σ.cong ↔-refl (SK-sym (↔∈ C₁))) ⟩
96
96
(∃ λ y → y ∈ ys × ◇ _ (flip P y) xs) ↔⟨ SK-sym (↔∈ C₂) ⟩
97
97
◇ _ (λ y → ◇ _ (flip P y) xs) ys ∎
98
+ where open Related.EquationalReasoning
98
99
99
100
-- Nested occurrences of ◇ can sometimes be flattened.
100
101
@@ -162,9 +163,10 @@ module _ {s p} (C : Container s p) {x y} {X : Set x} {Y : Set y}
162
163
map↔∘ : ∀ {xs : ⟦ C ⟧ X} (f : X → Y) → ◇ C P (map f xs) ↔ ◇ C (P ∘′ f) xs
163
164
map↔∘ {xs} f =
164
165
◇ C P (map f xs) ↔⟨ ↔Σ C ⟩
165
- ∃ (P ∘′ proj₂ (map f xs)) ↔ ⟨⟩
166
+ ∃ (P ∘′ proj₂ (map f xs)) ≡ ⟨⟩
166
167
∃ (P ∘′ f ∘′ proj₂ xs) ↔⟨ SK-sym (↔Σ C) ⟩
167
168
◇ C (P ∘′ f) xs ∎
169
+ where open Related.EquationalReasoning
168
170
169
171
-- Membership in a mapped container can be expressed without reference
170
172
-- to map.
@@ -178,6 +180,7 @@ module _ {s p} (C : Container s p) {x y} {X : Set x} {Y : Set y}
178
180
y ∈ map f xs ↔⟨ map↔∘ C (y ≡_) f ⟩
179
181
◇ C (λ x → y ≡ f x) xs ↔⟨ ↔∈ C ⟩
180
182
∃ (λ x → x ∈ xs × y ≡ f x) ∎
183
+ where open Related.EquationalReasoning
181
184
182
185
-- map is a congruence for bag and set equality and related preorders.
183
186
@@ -193,6 +196,7 @@ module _ {s p} (C : Container s p) {x y} {X : Set x} {Y : Set y}
193
196
◇ C (λ y → x ≡ f₂ y) xs₂ ↔⟨ SK-sym (map↔∘ C (_≡_ x) f₂) ⟩
194
197
x ∈ map f₂ xs₂ ∎
195
198
where
199
+ open Related.EquationalReasoning
196
200
helper : ∀ y → (x ≡ f₁ y) ↔ (x ≡ f₂ y)
197
201
helper y rewrite f₁≗f₂ y = ↔-refl
198
202
@@ -205,7 +209,7 @@ module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s
205
209
remove-linear {xs} m = mk↔ₛ′ t f t∘f f∘t
206
210
where
207
211
open _≃_
208
- open P.≡-Reasoning renaming (_∎ to _∎′)
212
+ open P.≡-Reasoning
209
213
210
214
position⊸m : ∀ {s} → Position C₂ (shape⊸ m s) ≃ Position C₁ s
211
215
position⊸m = ↔⇒≃ (position⊸ m)
@@ -259,7 +263,7 @@ module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s
259
263
260
264
P.subst (P ∘ proj₂ xs) P.refl p ≡⟨⟩
261
265
262
- p ∎′ )
266
+ p ∎)
263
267
)
264
268
265
269
t∘f : t ∘ f ≗ id
@@ -279,7 +283,7 @@ module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s
279
283
(P.trans-symˡ (right-inverse-of position⊸m _)) ⟩
280
284
P.subst (P ∘ proj₂ xs) P.refl p ≡⟨⟩
281
285
282
- p ∎′ )
286
+ p ∎)
283
287
)
284
288
285
289
-- Linear endomorphisms are identity functions if bag equality is used.
@@ -290,6 +294,7 @@ module _ {s p} {C : Container s p} {x} {X : Set x} where
290
294
linear-identity {xs} m {x} =
291
295
x ∈ ⟪ m ⟫⊸ xs ↔⟨ remove-linear (_≡_ x) m ⟩
292
296
x ∈ xs ∎
297
+ where open Related.EquationalReasoning
293
298
294
299
-- If join can be expressed using a linear morphism (in a certain
295
300
-- way), then it can be absorbed by the predicate.
@@ -307,4 +312,6 @@ module _ {s₁ s₂ s₃ p₁ p₂ p₃}
307
312
◇ C₃ P (⟪ join ⟫⊸ xss′) ↔⟨ remove-linear P join ⟩
308
313
◇ (C₁ C.∘ C₂) P xss′ ↔⟨ SK-sym $ flatten P xss ⟩
309
314
◇ C₁ (◇ C₂ P) xss ∎
310
- where xss′ = Inverse.from (Composition.correct C₁ C₂) xss
315
+ where
316
+ open Related.EquationalReasoning
317
+ xss′ = Inverse.from (Composition.correct C₁ C₂) xss
0 commit comments