Debian Codegraph @

src/Function/Consequences/Setoid.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Relationships between properties of functions where the equality
5 -- over both the domain and codomain are assumed to be setoids.
6 ------------------------------------------------------------------------
7
8 {-# OPTIONS --cubical-compatible --safe #-}
9
10 open import Relation.Binary.Bundles using (Setoid)
11
12 module Function.Consequences.Setoid
13 {a b ℓ₁ ℓ₂}
14 (S : Setoid a ℓ₁)
15 (T : Setoid b ℓ₂)
16 where
17
18 open import Function.Definitions
19 open import Relation.Nullary.Negation.Core using (¬_)
20
21 import Function.Consequences as C
22
23 private
24 open module S = Setoid S using () renaming (Carrier to A; _≈_ to ≈₁)
25 open module T = Setoid T using () renaming (Carrier to B; _≈_ to ≈₂)
26
27 variable
28 f : A → B
29 f⁻¹ : B → A
30
31 ------------------------------------------------------------------------
32 -- Injective
33
34 contraInjective : Injective ≈₁ ≈₂ f →
35 ∀ {x y} → ¬ (≈₁ x y) → ¬ (≈₂ (f x) (f y))
36 contraInjective = C.contraInjective ≈₂
37
38 ------------------------------------------------------------------------
39 -- Inverseˡ
40
41 inverseˡ⇒surjective : Inverseˡ ≈₁ ≈₂ f f⁻¹ → Surjective ≈₁ ≈₂ f
42 inverseˡ⇒surjective = C.inverseˡ⇒surjective ≈₂
43
44 ------------------------------------------------------------------------
45 -- Inverseʳ
46
47 inverseʳ⇒injective : ∀ f → Inverseʳ ≈₁ ≈₂ f f⁻¹ → Injective ≈₁ ≈₂ f
48 inverseʳ⇒injective f = C.inverseʳ⇒injective ≈₂ f T.refl S.sym S.trans
49
50 ------------------------------------------------------------------------
51 -- Inverseᵇ
52
53 inverseᵇ⇒bijective : Inverseᵇ ≈₁ ≈₂ f f⁻¹ → Bijective ≈₁ ≈₂ f
54 inverseᵇ⇒bijective = C.inverseᵇ⇒bijective ≈₂ T.refl S.sym S.trans
55
56 ------------------------------------------------------------------------
57 -- StrictlySurjective
58
59 surjective⇒strictlySurjective : Surjective ≈₁ ≈₂ f →
60 StrictlySurjective ≈₂ f
61 surjective⇒strictlySurjective =
62 C.surjective⇒strictlySurjective ≈₂ S.refl
63
64 strictlySurjective⇒surjective : Congruent ≈₁ ≈₂ f →
65 StrictlySurjective ≈₂ f →
66 Surjective ≈₁ ≈₂ f
67 strictlySurjective⇒surjective =
68 C.strictlySurjective⇒surjective T.trans
69
70 ------------------------------------------------------------------------
71 -- StrictlyInverseˡ
72
73 inverseˡ⇒strictlyInverseˡ : Inverseˡ ≈₁ ≈₂ f f⁻¹ →
74 StrictlyInverseˡ ≈₂ f f⁻¹
75 inverseˡ⇒strictlyInverseˡ = C.inverseˡ⇒strictlyInverseˡ ≈₁ ≈₂ S.refl
76
77 strictlyInverseˡ⇒inverseˡ : Congruent ≈₁ ≈₂ f →
78 StrictlyInverseˡ ≈₂ f f⁻¹ →
79 Inverseˡ ≈₁ ≈₂ f f⁻¹
80 strictlyInverseˡ⇒inverseˡ = C.strictlyInverseˡ⇒inverseˡ T.trans
81
82 ------------------------------------------------------------------------
83 -- StrictlyInverseʳ
84
85 inverseʳ⇒strictlyInverseʳ : Inverseʳ ≈₁ ≈₂ f f⁻¹ →
86 StrictlyInverseʳ ≈₁ f f⁻¹
87 inverseʳ⇒strictlyInverseʳ = C.inverseʳ⇒strictlyInverseʳ ≈₁ ≈₂ T.refl
88
89 strictlyInverseʳ⇒inverseʳ : Congruent ≈₂ ≈₁ f⁻¹ →
90 StrictlyInverseʳ ≈₁ f f⁻¹ →
91 Inverseʳ ≈₁ ≈₂ f f⁻¹
92 strictlyInverseʳ⇒inverseʳ = C.strictlyInverseʳ⇒inverseʳ S.trans