-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
inverseᵇ⇒bijective : ∀ (≈₂ : Rel B ℓ₂) → |
I tried to add this implication, but failed because I cannot specify the type of inv-f : B -> A, due to the use of generalized variables.
I showed it in my own code. The following is checked by Agda.
{-# OPTIONS --cubical-compatible --safe #-}
module BijectiveImpliesInverse where
open import Data.Product.Base as Product
open import Function.Definitions
open import Level using (Level)
open import Relation.Binary.Core using (Rel)
open import Relation.Binary.Bundles using (Setoid)
open import Relation.Binary.Definitions using (Reflexive; Symmetric; Transitive)
open import Relation.Nullary.Negation.Core using (¬_; contraposition)
open import Function.Definitions
open import Relation.Binary.Definitions
------------------------------------------------------------------------
-- Bijective
bijective⇒inverseᵇ : ∀ {A B : Set} {f} {ℓ₁ ℓ₂} (≈₁ : Rel A ℓ₁) (≈₂ : Rel B ℓ₂) →
Reflexive ≈₂ →
Symmetric ≈₁ →
Symmetric ≈₂ →
Transitive ≈₁ →
Transitive ≈₂ →
Bijective ≈₁ ≈₂ f →
∃ \f⁻¹ -> Inverseᵇ ≈₁ ≈₂ f f⁻¹
bijective⇒inverseᵇ {A} {B} {f} {ℓ₁} {ℓ₂} ≈₁ ≈₂ ref sym1 sym2 trans1 trans2 (inj , surj) =
inv-f , (l , r)
where
inv-f : B -> A
inv-f x with surj x
... | (y , _) = y
l : Inverseˡ ≈₁ ≈₂ f inv-f
l {y} {x} x=inv-fy with surj y
... | (x , p) = p x=inv-fy
aux : ∀ y -> ≈₂ (f (inv-f y)) y
aux y with surj y
... | (x , p) = p (inj ref)
aux2 : ∀ x -> ≈₁ (inv-f (f x)) x
aux2 x with surj (f x)
... | (z , p) = inj (p (inj ref))
inv-f-cong : ∀ y1 y2 -> ≈₂ y1 y2 -> ≈₁ (inv-f y1) (inv-f y2)
inv-f-cong y1 y2 eq = inj (trans2 (aux y1) (trans2 eq (sym2 (aux y2))))
r : Inverseʳ ≈₁ ≈₂ f inv-f
r {x} {y} y=fx with surj (f x)
... | (z , p) = trans1 (inv-f-cong y (f x) y=fx) (aux2 x)
Metadata
Metadata
Assignees
Labels
No labels