Skip to content

Commit 5ec53e6

Browse files
MatthewDaggittandreasabel
authored andcommitted
Fix argument order of composition operators (#2121)
1 parent ba789ee commit 5ec53e6

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Highlights
2929
Bug-fixes
3030
---------
3131

32+
* The combinators `_⟶-∘_`, `_↣-∘_`, `_↠-∘_`, `_⤖-∘_`, `_⇔-∘_`, `_↩-∘_`, `_↪-∘_`, `_↔-∘_`
33+
in `Function.Construct.Composition` had their arguments in the wrong order. They have
34+
been flipped so they can actually be used as a composition operator.
35+
3236
* The following operators were missing a fixity declaration, which has now
3337
been fixed -
3438
```

src/Data/Fin/Permutation.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ reverse = permutation opposite opposite PC.reverse-involutive PC.reverse-involut
104104

105105
infixr 9 _∘ₚ_
106106
_∘ₚ_ : Permutation m n Permutation n o Permutation m o
107-
π₁ ∘ₚ π₂ = π ↔-∘ π
107+
π₁ ∘ₚ π₂ = π ↔-∘ π
108108

109109
-- Flip
110110

src/Function/Construct/Composition.agda

+19-17
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module Function.Construct.Composition where
1010

1111
open import Data.Product.Base as Product using (_,_)
12-
open import Function.Base using (_∘_)
12+
open import Function.Base using (_∘_; flip)
1313
open import Function.Bundles
1414
open import Function.Definitions
1515
open import Function.Structures
@@ -199,31 +199,33 @@ module _ {R : Setoid a ℓ₁} {S : Setoid b ℓ₂} {T : Setoid c ℓ₃} where
199199
------------------------------------------------------------------------
200200
-- Propositional bundles
201201

202+
-- Notice the flipped order of the arguments to mirror composition.
203+
202204
infix 8 _⟶-∘_ _↣-∘_ _↠-∘_ _⤖-∘_ _⇔-∘_ _↩-∘_ _↪-∘_ _↔-∘_
203205

204-
_⟶-∘_ : (AB) (BC) (A ⟶ C)
205-
_⟶-∘_ = function
206+
_⟶-∘_ : (BC) (AB) (A ⟶ C)
207+
_⟶-∘_ = flip function
206208

207-
_↣-∘_ : AB BC A ↣ C
208-
_↣-∘_ = injection
209+
_↣-∘_ : BC AB A ↣ C
210+
_↣-∘_ = flip injection
209211

210-
_↠-∘_ : AB BC A ↠ C
211-
_↠-∘_ = surjection
212+
_↠-∘_ : BC AB A ↠ C
213+
_↠-∘_ = flip surjection
212214

213-
_⤖-∘_ : AB BC A ⤖ C
214-
_⤖-∘_ = bijection
215+
_⤖-∘_ : BC AB A ⤖ C
216+
_⤖-∘_ = flip bijection
215217

216-
_⇔-∘_ : AB BC A ⇔ C
217-
_⇔-∘_ = equivalence
218+
_⇔-∘_ : BC AB A ⇔ C
219+
_⇔-∘_ = flip equivalence
218220

219-
_↩-∘_ : AB BC A ↩ C
220-
_↩-∘_ = leftInverse
221+
_↩-∘_ : BC AB A ↩ C
222+
_↩-∘_ = flip leftInverse
221223

222-
_↪-∘_ : AB BC A ↪ C
223-
_↪-∘_ = rightInverse
224+
_↪-∘_ : BC AB A ↪ C
225+
_↪-∘_ = flip rightInverse
224226

225-
_↔-∘_ : AB BC A ↔ C
226-
_↔-∘_ = inverse
227+
_↔-∘_ : BC AB A ↔ C
228+
_↔-∘_ = flip inverse
227229

228230

229231
------------------------------------------------------------------------

src/Function/Properties/Inverse.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ isEquivalence = record
5555
↔-sym = Symmetry.↔-sym
5656

5757
↔-trans : A ↔ B B ↔ C A ↔ C
58-
↔-trans = Composition._↔-∘_
58+
↔-trans = Composition.inverse
5959

6060
-- need to η-expand for everything to line up properly
6161
↔-isEquivalence : IsEquivalence {ℓ = ℓ} _↔_

src/Function/Related/Propositional.agda

+8-8
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,14 @@ K-reflexive P.refl = K-refl
256256
K-trans : Trans (Related {a} {b} k)
257257
(Related {b} {c} k)
258258
(Related {a} {c} k)
259-
K-trans {k = implication} = Composition._⟶-∘_
260-
K-trans {k = reverseImplication} = flip Composition._⟶-∘_
261-
K-trans {k = equivalence} = Composition._⇔-∘_
262-
K-trans {k = injection} = Composition._↣-∘_
263-
K-trans {k = reverseInjection} = flip Composition._↣-∘_
264-
K-trans {k = leftInverse} = Composition._↪-∘_
265-
K-trans {k = surjection} = Composition._↠-∘_
266-
K-trans {k = bijection} = Composition._↔-∘_
259+
K-trans {k = implication} = flip Composition._⟶-∘_
260+
K-trans {k = reverseImplication} = Composition._⟶-∘_
261+
K-trans {k = equivalence} = flip Composition._⇔-∘_
262+
K-trans {k = injection} = flip Composition._↣-∘_
263+
K-trans {k = reverseInjection} = Composition._↣-∘_
264+
K-trans {k = leftInverse} = flip Composition._↪-∘_
265+
K-trans {k = surjection} = flip Composition._↠-∘_
266+
K-trans {k = bijection} = flip Composition._↔-∘_
267267

268268
SK-sym : {k} Sym (Related {a} {b} ⌊ k ⌋)
269269
(Related {b} {a} ⌊ k ⌋)

0 commit comments

Comments
 (0)