Skip to content

Commit 3cd9e7b

Browse files
committed
refactor: use module IsSurjective
1 parent e6899ef commit 3cd9e7b

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/Function/Construct/Symmetry.agda

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module Function.Construct.Symmetry where
1010

1111
open import Data.Product.Base using (_,_; swap; proj₁; proj₂)
1212
open import Function.Base using (_∘_)
13+
open import Function.Consequences
14+
using (module IsSurjective)
1315
open import Function.Definitions
1416
using (Bijective; Injective; Surjective; Inverseˡ; Inverseʳ; Inverseᵇ; Congruent)
1517
open import Function.Structures
@@ -35,21 +37,26 @@ module _ {≈₁ : Rel A ℓ₁} {≈₂ : Rel B ℓ₂} {f : A → B}
3537
((inj , surj) : Bijective ≈₁ ≈₂ f)
3638
where
3739

38-
private
39-
f⁻¹ = proj₁ ∘ surj
40-
f∘f⁻¹≡id = proj₂ ∘ surj
40+
open IsSurjective {≈₂ = ≈₂} surj
41+
using (section; section-strictInverseˡ)
42+
43+
module _ (refl : Reflexive ≈₁) where
44+
45+
private
46+
47+
f∘section≡id = section-strictInverseˡ refl
4148

42-
injective : Reflexive ≈₁ Symmetric ≈₂ Transitive ≈₂
43-
Congruent ≈₁ ≈₂ f Injective ≈₂ ≈₁ f⁻¹
44-
injective refl sym trans cong gx≈gy =
45-
trans (trans (sym (f∘f⁻¹≡id _ refl)) (cong gx≈gy)) (f∘f⁻¹≡id _ refl)
49+
injective : Symmetric ≈₂ Transitive ≈₂
50+
Congruent ≈₁ ≈₂ f Injective ≈₂ ≈₁ section
51+
injective sym trans cong gx≈gy =
52+
trans (trans (sym (f∘section≡id _)) (cong gx≈gy)) (f∘section≡id _)
4653

47-
surjective : Reflexive ≈₁ Transitive ≈₂ Surjective ≈₂ ≈₁ f⁻¹
48-
surjective refl trans x = f x , inj ∘ trans (f∘f⁻¹≡id _ refl)
54+
surjective : Transitive ≈₂ Surjective ≈₂ ≈₁ section
55+
surjective trans x = f x , inj ∘ trans (f∘section≡id _)
4956

50-
bijective : Reflexive ≈₁ Symmetric ≈₂ Transitive ≈₂
51-
Congruent ≈₁ ≈₂ f Bijective ≈₂ ≈₁ f⁻¹
52-
bijective refl sym trans cong = injective refl sym trans cong , surjective refl trans
57+
bijective : Symmetric ≈₂ Transitive ≈₂
58+
Congruent ≈₁ ≈₂ f Bijective ≈₂ ≈₁ section
59+
bijective sym trans cong = injective sym trans cong , surjective trans
5360

5461
module _ (≈₁ : Rel A ℓ₁) (≈₂ : Rel B ℓ₂) {f : A B} {f⁻¹ : B A} where
5562

0 commit comments

Comments
 (0)