Skip to content

Commit 41aa705

Browse files
committed
Add pairing of type isomorphism
1 parent 106caef commit 41aa705

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Data/Product/Properties.agda

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
module Data.Product.Properties where
1010

1111
open import Axiom.UniquenessOfIdentityProofs using (UIP; module Decidable⇒UIP)
12-
open import Data.Product.Base using (_,_; Σ; _×_; map; swap; ∃; ∃₂)
12+
open import Data.Product.Base using (_,_; Σ; _,′_; _×_; map; swap; ∃; ∃₂)
1313
open import Function.Base using (_∋_; _∘_; id)
14-
open import Function.Bundles using (_↔_; mk↔ₛ′)
14+
open import Function.Bundles using (_↔_; mk↔ₛ′; Inverse)
1515
open import Level using (Level)
1616
open import Relation.Binary.Definitions using (DecidableEquality)
1717
open import Relation.Binary.PropositionalEquality.Core
@@ -114,3 +114,14 @@ module _ {p₁@(a₁ , b₁) p₂@(a₂ , b₂) : A × B} where
114114

115115
from : (∃₂ λ y x R x y) (∃₂ λ x y R x y)
116116
from (y , x , Rxy) = (x , y , Rxy)
117+
118+
------------------------------------------------------------------------
119+
-- Non-dependent product (_×_) preserves type isomorphism (_↔_)
120+
121+
infixr 4 _,′-↔_
122+
123+
_,′-↔_ : A ↔ C B ↔ D (A × B) ↔ (C × D)
124+
i ,′-↔ j = mk↔ₛ′ (map (Inverse.to i) (Inverse.to j))
125+
(map (Inverse.from i) (Inverse.from j))
126+
(λ _ ×-≡,≡→≡ (Inverse.inverseˡ i refl ,′ Inverse.inverseˡ j refl))
127+
(λ _ ×-≡,≡→≡ (Inverse.inverseʳ i refl ,′ Inverse.inverseʳ j refl))

0 commit comments

Comments
 (0)