{-# OPTIONS --safe #-}
module Cubical.Experiments.IsoInt.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Int
open import Cubical.Data.Nat
open import Cubical.Data.Empty
open import Cubical.Relation.Nullary
data IsoInt : Type₀ where
zero : IsoInt
suc : IsoInt -> IsoInt
pred : IsoInt -> IsoInt
suc-pred : ∀ z -> suc (pred z) ≡ z
pred-suc : ∀ z -> pred (suc z) ≡ z
suc-iso : Iso IsoInt IsoInt
suc-iso = record { fun = suc ; inv = pred ; rightInv = suc-pred ; leftInv = pred-suc }
module NonTrivial where
p₁ p₂ : Path IsoInt (suc (pred (suc zero))) (suc zero)
p₁ i = suc-pred (suc zero) i
p₂ i = suc (pred-suc zero i)
open import Cubical.HITs.S1
toS¹ : IsoInt → S¹
toS¹ zero = base
toS¹ (suc x) = toS¹ x
toS¹ (pred x) = toS¹ x
toS¹ (suc-pred x i) = refl {x = toS¹ x} i
toS¹ (pred-suc x i) = rotLoop (toS¹ x) i
p₁≡refl : cong toS¹ p₁ ≡ refl
p₁≡refl = refl
p₂≡loop : cong toS¹ p₂ ≡ loop
p₂≡loop = refl
p₁≢p₂ : ¬ (p₁ ≡ p₂)
p₁≢p₂ eq = znots 0≡1
where
0≡1 : 0 ≡ 1
0≡1 = injPos (cong (winding ∘ cong toS¹) eq)
¬isSet-IsoInt : ¬ (isSet IsoInt)
¬isSet-IsoInt pf = NonTrivial.p₁≢p₂ (pf _ _ NonTrivial.p₁ NonTrivial.p₂)
¬Int≡IsoInt : ¬ (ℤ ≡ IsoInt)
¬Int≡IsoInt p = ¬isSet-IsoInt (subst isSet p isSetℤ)
private
open import Cubical.Data.Int.MoreInts.BiInvInt hiding (zero; suc; pred; suc-pred; pred-suc)
import Cubical.Data.Int.MoreInts.BiInvInt as BiI
p₁ p₂ : Path BiInvℤ (BiI.suc (BiI.pred (BiI.suc BiI.zero))) (BiI.suc BiI.zero)
p₁ i = BiI.suc-pred (BiI.suc BiI.zero) i
p₂ i = BiI.suc (BiI.pred-suc BiI.zero i)
open import Cubical.HITs.S1
toS¹ : BiInvℤ → S¹
toS¹ BiI.zero = base
toS¹ (BiI.suc x) = toS¹ x
toS¹ (BiI.predr x) = toS¹ x
toS¹ (BiI.predl x) = toS¹ x
toS¹ (BiI.suc-predr x i) = refl {x = toS¹ x} i
toS¹ (BiI.predl-suc x i) = rotLoop (toS¹ x) i
p₂≡loop : cong toS¹ p₂ ≡ loop
p₂≡loop = refl
open import Cubical.Foundations.GroupoidLaws
p₁≡loop : cong toS¹ p₁ ≡ loop
p₁≡loop = sym (decodeEncode base (cong toS¹ p₁)) ∙ sym (lUnit loop)