Skip to content

Commit 86f43fe

Browse files
MatthewDaggittandreasabel
authored andcommitted
Add biased versions of Function structures (#2210)
1 parent b58f923 commit 86f43fe

File tree

8 files changed

+136
-7
lines changed

8 files changed

+136
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,10 @@ Non-backwards compatible changes
755755
- The records in `Function.Structures` and `Function.Bundles` export proofs
756756
of these under the names `strictlySurjective`, `strictlyInverseˡ` and
757757
`strictlyInverseʳ`,
758-
- Conversion functions have been added in both directions to
759-
`Function.Consequences(.Propositional/Setoid)`.
758+
- Conversion functions for the definitions have been added in both directions
759+
to `Function.Consequences(.Propositional/Setoid)`.
760+
- Conversion functions for structures have been added in
761+
`Function.Structures.Biased`.
760762
761763
### New `Function.Strict`
762764

src/Algebra/Structures/Biased.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- The Agda standard library
33
--
44
-- Ways to give instances of certain structures where some fields can
5-
-- be given in terms of others
5+
-- be given in terms of others. Re-exported via `Algebra`.
66
------------------------------------------------------------------------
77

88
{-# OPTIONS --cubical-compatible --safe #-}

src/Data/Product/Function/Dependent/Propositional.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ module _ where
185185
( {x} A x ↠ B (to I↠J x))
186186
Σ I A ↠ Σ J B
187187
Σ-↠ {I = I} {J = J} {A = A} {B = B} I↠J A↠B =
188-
mk↠ (strictlySurjective⇒surjective strictlySurjective′)
188+
mk↠strictlySurjective
189189
where
190190
to′ : Σ I A Σ J B
191191
to′ = map (to I↠J) (to A↠B)

src/Function.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ open import Function.Base public
1313
open import Function.Strict public
1414
open import Function.Definitions public
1515
open import Function.Structures public
16+
open import Function.Structures.Biased public
1617
open import Function.Bundles public

src/Function/Construct/Symmetry.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module _ {≈₁ : Rel A ℓ₁} {≈₂ : Rel B ℓ₂} {f : A → B} {f⁻¹ :
108108
isLeftInverse : IsRightInverse ≈₁ ≈₂ f f⁻¹ IsLeftInverse ≈₂ ≈₁ f⁻¹ f
109109
isLeftInverse inv = record
110110
{ isCongruent = isCongruent F.isCongruent F.from-cong
111-
; from-cong = F.cong
111+
; from-cong = F.to-cong
112112
; inverseˡ = inverseˡ ≈₁ ≈₂ F.inverseʳ
113113
} where module F = IsRightInverse inv
114114

src/Function/Structures.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ record IsRightInverse (to : A → B) (from : B → A) : Set (a ⊔ b ⊔ ℓ₁
120120
inverseʳ : Inverseʳ _≈₁_ _≈₂_ to from
121121

122122
open IsCongruent isCongruent public
123-
renaming (cong to cong)
123+
renaming (cong to to-cong)
124124

125125
strictlyInverseʳ : StrictlyInverseʳ _≈₁_ to from
126126
strictlyInverseʳ x = inverseʳ Eq₂.refl

src/Function/Structures/Biased.agda

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
------------------------------------------------------------------------
2+
-- The Agda standard library
3+
--
4+
-- Ways to give instances of certain structures where some fields can
5+
-- be given in terms of others.
6+
-- The contents of this file should usually be accessed from `Function`.
7+
------------------------------------------------------------------------
8+
9+
10+
{-# OPTIONS --cubical-compatible --safe #-}
11+
12+
open import Relation.Binary.Core using (Rel)
13+
open import Relation.Binary.Bundles using (Setoid)
14+
open import Relation.Binary.Structures using (IsEquivalence)
15+
16+
module Function.Structures.Biased {a b ℓ₁ ℓ₂}
17+
{A : Set a} (_≈₁_ : Rel A ℓ₁) -- Equality over the domain
18+
{B : Set b} (_≈₂_ : Rel B ℓ₂) -- Equality over the codomain
19+
where
20+
21+
open import Data.Product.Base as Product using (∃; _×_; _,_)
22+
open import Function.Base
23+
open import Function.Definitions
24+
open import Function.Structures _≈₁_ _≈₂_
25+
open import Function.Consequences.Setoid
26+
open import Level using (_⊔_)
27+
28+
------------------------------------------------------------------------
29+
-- Surjection
30+
------------------------------------------------------------------------
31+
32+
record IsStrictSurjection (f : A B) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
33+
field
34+
isCongruent : IsCongruent f
35+
strictlySurjective : StrictlySurjective _≈₂_ f
36+
37+
open IsCongruent isCongruent public
38+
39+
isSurjection : IsSurjection f
40+
isSurjection = record
41+
{ isCongruent = isCongruent
42+
; surjective = strictlySurjective⇒surjective
43+
Eq₁.setoid Eq₂.setoid cong strictlySurjective
44+
}
45+
46+
open IsStrictSurjection public
47+
using () renaming (isSurjection to isStrictSurjection)
48+
49+
------------------------------------------------------------------------
50+
-- Bijection
51+
------------------------------------------------------------------------
52+
53+
record IsStrictBijection (f : A B) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
54+
field
55+
isInjection : IsInjection f
56+
strictlySurjective : StrictlySurjective _≈₂_ f
57+
58+
isBijection : IsBijection f
59+
isBijection = record
60+
{ isInjection = isInjection
61+
; surjective = strictlySurjective⇒surjective
62+
Eq₁.setoid Eq₂.setoid cong strictlySurjective
63+
} where open IsInjection isInjection
64+
65+
open IsStrictBijection public
66+
using () renaming (isBijection to isStrictBijection)
67+
68+
------------------------------------------------------------------------
69+
-- Left inverse
70+
------------------------------------------------------------------------
71+
72+
record IsStrictLeftInverse (to : A B) (from : B A) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
73+
field
74+
isCongruent : IsCongruent to
75+
from-cong : Congruent _≈₂_ _≈₁_ from
76+
strictlyInverseˡ : StrictlyInverseˡ _≈₂_ to from
77+
78+
isLeftInverse : IsLeftInverse to from
79+
isLeftInverse = record
80+
{ isCongruent = isCongruent
81+
; from-cong = from-cong
82+
; inverseˡ = strictlyInverseˡ⇒inverseˡ
83+
Eq₁.setoid Eq₂.setoid cong strictlyInverseˡ
84+
} where open IsCongruent isCongruent
85+
86+
open IsStrictLeftInverse public
87+
using () renaming (isLeftInverse to isStrictLeftInverse)
88+
89+
------------------------------------------------------------------------
90+
-- Right inverse
91+
------------------------------------------------------------------------
92+
93+
record IsStrictRightInverse (to : A B) (from : B A) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
94+
field
95+
isCongruent : IsCongruent to
96+
from-cong : Congruent _≈₂_ _≈₁_ from
97+
strictlyInverseʳ : StrictlyInverseʳ _≈₁_ to from
98+
99+
isRightInverse : IsRightInverse to from
100+
isRightInverse = record
101+
{ isCongruent = isCongruent
102+
; from-cong = from-cong
103+
; inverseʳ = strictlyInverseʳ⇒inverseʳ
104+
Eq₁.setoid Eq₂.setoid from-cong strictlyInverseʳ
105+
} where open IsCongruent isCongruent
106+
107+
open IsStrictRightInverse public
108+
using () renaming (isRightInverse to isStrictRightInverse)
109+
110+
------------------------------------------------------------------------
111+
-- Inverse
112+
------------------------------------------------------------------------
113+
114+
record IsStrictInverse (to : A B) (from : B A) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
115+
field
116+
isLeftInverse : IsLeftInverse to from
117+
strictlyInverseʳ : StrictlyInverseʳ _≈₁_ to from
118+
119+
isInverse : IsInverse to from
120+
isInverse = record
121+
{ isLeftInverse = isLeftInverse
122+
; inverseʳ = strictlyInverseʳ⇒inverseʳ
123+
Eq₁.setoid Eq₂.setoid from-cong strictlyInverseʳ
124+
} where open IsLeftInverse isLeftInverse
125+
126+
open IsStrictInverse public
127+
using () renaming (isInverse to isStrictInverse)

src/Relation/Binary/PropositionalEquality.agda

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,3 @@ isPropositional = Irrelevant
135135
Please use Relation.Nullary.Irrelevant instead. "
136136
#-}
137137

138-

0 commit comments

Comments
 (0)