Skip to content

Commit 8b8946a

Browse files
authored
Add/fix RightInverse for dependent products (#2706)
* add RightInverse to Data.Product.Function.Dependent.Propositional * correct naming of left-inverse * add leftInverse * update changelog * whitespace * forgot to finish CHANGELOG * james suggestions
1 parent 59306b9 commit 8b8946a

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Bug-fixes
1717
the record constructors `_,_` incorrectly had no declared fixity. They have been given
1818
the fixity `infixr 4 _,_`, consistent with that of `Data.Product.Base`.
1919

20+
* In `Data.Product.Function.Dependent.Setoid`, `left-inverse` defined a
21+
`RightInverse`.
22+
This has been deprecated in favor or `rightInverse`, and a corrected (and
23+
correctly-named) function `leftInverse` has been added.
24+
2025
Non-backwards compatible changes
2126
--------------------------------
2227

@@ -134,6 +139,11 @@ Deprecated names
134139
product-↭ ↦ Data.Nat.ListAction.Properties.product-↭
135140
```
136141

142+
* In `Data.Product.Function.Dependent.Setoid`:
143+
```agda
144+
left-inverse ↦ rightInverse
145+
```
146+
137147
New modules
138148
-----------
139149

@@ -232,6 +242,24 @@ Additions to existing modules
232242
filter-↭ : ∀ (P? : Pred.Decidable P) → xs ↭ ys → filter P? xs ↭ filter P? ys
233243
```
234244

245+
* In `Data.Product.Function.Dependent.Propositional`:
246+
```agda
247+
Σ-↪ : (I↪J : I ↪ J) → (∀ {j} → A (from I↪J j) ↪ B j) → Σ I A ↪ Σ J B
248+
```
249+
250+
* In `Data.Product.Function.Dependent.Setoid`:
251+
```agda
252+
rightInverse :
253+
(I↪J : I ↪ J) →
254+
(∀ {j} → RightInverse (A atₛ (from I↪J j)) (B atₛ j)) →
255+
RightInverse (I ×ₛ A) (J ×ₛ B)
256+
257+
leftInverse :
258+
(I↩J : I ↩ J) →
259+
(∀ {i} → LeftInverse (A atₛ i) (B atₛ (to I↩J i))) →
260+
LeftInverse (I ×ₛ A) (J ×ₛ B)
261+
```
262+
235263
* In `Data.Vec.Relation.Binary.Pointwise.Inductive`:
236264
```agda
237265
zipWith-assoc : Associative _∼_ f → Associative (Pointwise _∼_) (zipWith {n = n} f)

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

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ open import Function.Bundles
2828
open import Relation.Binary.PropositionalEquality.Core as ≡ using (_≡_)
2929
open import Relation.Binary.PropositionalEquality.Properties as ≡
3030
using (module ≡-Reasoning)
31+
open import Function.Construct.Symmetry using (↩-sym; ↪-sym)
3132

3233
private
3334
variable
@@ -238,6 +239,14 @@ module _ where
238239
------------------------------------------------------------------------
239240
-- Right inverses
240241

242+
module _ where
243+
open RightInverse
244+
245+
-- the dual to Σ-↩, taking advantage of the proof above by threading
246+
-- relevant symmetry proofs through it.
247+
Σ-↪ : (I↪J : I ↪ J) ( {j} A (from I↪J j) ↪ B j) Σ I A ↪ Σ J B
248+
Σ-↪ I↪J A↪B = ↩-sym (Σ-↩ (↪-sym I↪J) (↪-sym A↪B))
249+
241250
------------------------------------------------------------------------
242251
-- Inverses
243252

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

+31-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ open import Function.Properties.Injection using (mkInjection)
2020
open import Function.Properties.Surjection using (mkSurjection; ↠⇒⇔)
2121
open import Function.Properties.Equivalence using (mkEquivalence; ⇔⇒⟶; ⇔⇒⟵)
2222
open import Function.Properties.RightInverse using (mkRightInverse)
23+
import Function.Construct.Symmetry as Sym
2324
open import Relation.Binary.Core using (_=[_]⇒_)
2425
open import Relation.Binary.Bundles as B
2526
open import Relation.Binary.Indexed.Heterogeneous
@@ -179,17 +180,17 @@ module _ where
179180
surj = strictlySurjective⇒surjective (I ×ₛ A) (J ×ₛ B) (Func.cong func) strictlySurj
180181

181182
------------------------------------------------------------------------
182-
-- LeftInverse
183+
-- RightInverse
183184

184185
module _ where
185186
open RightInverse
186187
open Setoid
187188

188-
left-inverse :
189+
rightInverse :
189190
(I↪J : I ↪ J)
190191
( {j} RightInverse (A atₛ (from I↪J j)) (B atₛ j))
191192
RightInverse (I ×ₛ A) (J ×ₛ B)
192-
left-inverse {I = I} {J = J} {A = A} {B = B} I↪J A↪B =
193+
rightInverse {I = I} {J = J} {A = A} {B = B} I↪J A↪B =
193194
mkRightInverse equiv invʳ
194195
where
195196
equiv : Equivalence (I ×ₛ A) (J ×ₛ B)
@@ -201,6 +202,19 @@ module _ where
201202
invʳ : Inverseʳ (_≈_ (I ×ₛ A)) (_≈_ (J ×ₛ B)) (Equivalence.to equiv) (Equivalence.from equiv)
202203
invʳ = strictlyInverseʳ⇒inverseʳ (I ×ₛ A) (J ×ₛ B) (Equivalence.from-cong equiv) strictlyInvʳ
203204

205+
------------------------------------------------------------------------
206+
-- LeftInverse
207+
208+
module _ where
209+
open LeftInverse
210+
open Setoid
211+
212+
leftInverse :
213+
(I↩J : I ↩ J)
214+
( {i} LeftInverse (A atₛ i) (B atₛ (to I↩J i)))
215+
LeftInverse (I ×ₛ A) (J ×ₛ B)
216+
leftInverse {I = I} {J = J} {A = A} {B = B} I↩J A↩B =
217+
Sym.leftInverse (rightInverse (Sym.rightInverse I↩J) (Sym.rightInverse A↩B))
204218

205219
------------------------------------------------------------------------
206220
-- Inverses
@@ -252,3 +266,17 @@ module _ where
252266
invʳ : Inverseʳ (_≈_ (I ×ₛ A)) (_≈_ (J ×ₛ B)) to′ from′
253267
invʳ = strictlyInverseʳ⇒inverseʳ (I ×ₛ A) (J ×ₛ B) from′-cong strictlyInvʳ
254268

269+
270+
------------------------------------------------------------------------
271+
-- DEPRECATED NAMES
272+
------------------------------------------------------------------------
273+
-- Please use the new names as continuing support for the old names is
274+
-- not guaranteed.
275+
276+
-- Version 2.3
277+
278+
left-inverse = rightInverse
279+
{-# WARNING_ON_USAGE left-inverse
280+
"Warning: left-inverse was deprecated in v2.3.
281+
Please use rightInverse or leftInverse instead."
282+
#-}

0 commit comments

Comments
 (0)