@@ -17,8 +17,9 @@ open import Relation.Binary.Definitions using (Reflexive; Trans)
17
17
open import Relation.Binary.PropositionalEquality.Properties using (setoid)
18
18
open import Data.Product.Base using (_,_; proj₁; proj₂)
19
19
open import Function.Base using (_∘_)
20
- open import Function.Properties.Surjection using (injective⇒to⁻-cong)
21
- open import Function.Properties.Inverse using (Inverse⇒Equivalence)
20
+ open import Function.Properties.Surjection using (injective⇒section-cong)
21
+ open import Function.Properties.Inverse
22
+ using (Inverse⇒Bijection; Inverse⇒Equivalence)
22
23
23
24
import Function.Construct.Identity as Identity
24
25
import Function.Construct.Symmetry as Symmetry
@@ -30,16 +31,33 @@ private
30
31
A B : Set a
31
32
T S : Setoid a ℓ
32
33
34
+ ------------------------------------------------------------------------
35
+ -- Conversion functions
36
+
37
+ Bijection⇒Inverse : Bijection S T → Inverse S T
38
+ Bijection⇒Inverse bij = record
39
+ { to = to
40
+ ; from = section
41
+ ; to-cong = cong
42
+ ; from-cong = injective⇒section-cong surjection injective
43
+ ; inverse = section-inverseˡ
44
+ , λ y≈to[x] → injective (Eq₂.trans (section-strictInverseˡ _) y≈to[x])
45
+ }
46
+ where open Bijection bij
47
+
48
+ Bijection⇒Equivalence : Bijection T S → Equivalence T S
49
+ Bijection⇒Equivalence = Inverse⇒Equivalence ∘ Bijection⇒Inverse
50
+
33
51
------------------------------------------------------------------------
34
52
-- Setoid properties
35
53
36
54
refl : Reflexive (Bijection {a} {ℓ})
37
55
refl = Identity.bijection _
38
56
39
- -- Can't prove full symmetry as we have no proof that the witness
40
- -- produced by the surjection proof preserves equality
41
- sym-≡ : Bijection S (setoid B) → Bijection (setoid B) S
42
- sym-≡ = Symmetry.bijection-≡
57
+ -- Now we *can* prove full symmetry as we now have a proof that
58
+ -- the witness produced by the surjection proof preserves equality
59
+ sym : Bijection S T → Bijection T S
60
+ sym = Inverse⇒Bijection ∘ Symmetry.inverse ∘ Bijection⇒Inverse
43
61
44
62
trans : Trans (Bijection {a} {ℓ₁} {b} {ℓ₂}) (Bijection {b} {ℓ₂} {c} {ℓ₃}) Bijection
45
63
trans = Composition.bijection
@@ -50,29 +68,28 @@ trans = Composition.bijection
50
68
⤖-isEquivalence : IsEquivalence {ℓ = ℓ} _⤖_
51
69
⤖-isEquivalence = record
52
70
{ refl = refl
53
- ; sym = sym-≡
71
+ ; sym = sym
54
72
; trans = trans
55
73
}
56
74
57
- ------------------------------------------------------------------------
58
- -- Conversion functions
59
-
60
- Bijection⇒Inverse : Bijection S T → Inverse S T
61
- Bijection⇒Inverse bij = record
62
- { to = to
63
- ; from = section
64
- ; to-cong = cong
65
- ; from-cong = injective⇒to⁻-cong surjection injective
66
- ; inverse = (λ y≈to⁻[x] → Eq₂.trans (cong y≈to⁻[x]) (to∘to⁻ _)) ,
67
- (λ y≈to[x] → injective (Eq₂.trans (to∘to⁻ _) y≈to[x]))
68
- }
69
- where open Bijection bij
70
-
71
- Bijection⇒Equivalence : Bijection T S → Equivalence T S
72
- Bijection⇒Equivalence = Inverse⇒Equivalence ∘ Bijection⇒Inverse
73
-
74
75
⤖⇒↔ : A ⤖ B → A ↔ B
75
76
⤖⇒↔ = Bijection⇒Inverse
76
77
77
78
⤖⇒⇔ : A ⤖ B → A ⇔ B
78
79
⤖⇒⇔ = Bijection⇒Equivalence
80
+
81
+
82
+ ------------------------------------------------------------------------
83
+ -- DEPRECATED NAMES
84
+ ------------------------------------------------------------------------
85
+ -- Please use the new names as continuing support for the old names is
86
+ -- not guaranteed.
87
+
88
+ -- Version 2.3
89
+
90
+ sym-≡ : Bijection S (setoid B) → Bijection (setoid B) S
91
+ sym-≡ = Symmetry.bijection-≡
92
+ {-# WARNING_ON_USAGE sym-≡
93
+ "Warning: sym-≡ was deprecated in v2.3.
94
+ Please use sym instead. "
95
+ #-}
0 commit comments