Skip to content

Commit 9bf16e2

Browse files
authored
Add an Inverse for swap in module Data.Sum.Properties (#1720)
1 parent 82c1b9d commit 9bf16e2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,10 @@ Other minor changes
12371237
≤-isDecTotalOrder-≈ : IsDecTotalOrder _≈_ _≤_
12381238
≤-decTotalOrder-≈ : DecTotalOrder _ _ _
12391239
```
1240+
* Added new definitions in `Data.Sum.Properties`:
1241+
```
1242+
swap-↔ : (A ⊎ B) ↔ (B ⊎ A)
1243+
```
12401244

12411245
* Added new proofs in `Data.Sum.Properties`:
12421246
```

src/Data/Sum/Properties.agda

+5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ module Data.Sum.Properties where
1111
open import Level
1212
open import Data.Sum.Base
1313
open import Function
14+
open import Function.Bundles using (mk↔′)
1415
open import Relation.Binary using (Decidable)
1516
open import Relation.Binary.PropositionalEquality
1617
open import Relation.Nullary using (yes; no)
1718
open import Relation.Nullary.Decidable using (map′)
1819

20+
1921
private
2022
variable
2123
a b c d e f : Level
@@ -44,6 +46,9 @@ module _ (dec₁ : Decidable {A = A} {B = A} _≡_)
4446
swap-involutive : swap {A = A} {B = B} ∘ swap ≗ id
4547
swap-involutive = [ (λ _ refl) , (λ _ refl) ]
4648

49+
swap-↔ : (A ⊎ B) ↔ (B ⊎ A)
50+
swap-↔ = mk↔′ swap swap swap-involutive swap-involutive
51+
4752
map-id : map {A = A} {B = B} id id ≗ id
4853
map-id (inj₁ _) = refl
4954
map-id (inj₂ _) = refl

0 commit comments

Comments
 (0)