{-# OPTIONS --without-K --exact-split --two-level #-}
module Extension.PropRealign where
open import Extension.Prelude
open import Extension.Core
open import Extension.CofibFibration
open import Extension.RelFunext
private
variable
ℓ ℓΦ ℓΨ : Level
module _ {Φ : UUᵉ ℓΦ} {Ψ : UUᵉ ℓΨ} {i : Φ → Ψ}
(c2 : is-cofib-2LTT i ℓ)
(D : Ψ → UU ℓ)
(P : (ψ : Ψ) → D ψ → UU ℓ)
(propP : (ψ : Ψ) (d : D ψ) → is-prop (P ψ d))
where
private
cof : is-cofib i ℓ
cof = pr1ᵉ c2
S : Ψ → UU ℓ
S ψ = Σ (D ψ) (P ψ)
private
CP : (ψ : Ψ) → C (D ψ) → UUᵉ ℓ
CP ψ w = C (P ψ (ic w))
snd-cong : {ψ : Ψ} {u v : C (S ψ)} (E : u =ᵉ v) {w : C (D ψ)}
(q₁ : c (pr1 (ic u)) =ᵉ w) (q₂ : c (pr1 (ic v)) =ᵉ w)
→ exo-tr (CP ψ) q₁ (c (pr2 (ic u))) =ᵉ exo-tr (CP ψ) q₂ (c (pr2 (ic v)))
snd-cong reflᵉ q₁ q₂ = exo-ap-tr (UIPᵉ q₁ q₂)
pair-tr : {ψ : Ψ} {w w' : C (D ψ)} (E : w =ᵉ w') (z : CP ψ w)
→ c {A = S ψ} (ic w , ic z) =ᵉ c (ic w' , ic (exo-tr (CP ψ) E z))
pair-tr reflᵉ z = reflᵉ
tr-×ᵉ : {ℓa ℓf ℓg : Level} {A : UUᵉ ℓa} {F : A → UUᵉ ℓf} {G : A → UUᵉ ℓg}
{x y : A} (e : x =ᵉ y) (u : F x) (v : G x)
→ exo-tr (λ z → F z ×ᵉ G z) e (u ,ᵉ v) =ᵉ (exo-tr F e u ,ᵉ exo-tr G e v)
tr-×ᵉ reflᵉ u v = reflᵉ
module _ (s : (ψ : Ψ) → C (S ψ))
(s₀ : (φ : Φ) → C (S (i φ)))
(agr : (φ : Φ) → c (pr1 (ic (s (i φ)))) =ᵉ c (pr1 (ic (s₀ φ))))
where
Realign : UUᵉ (ℓΦ ⊔ ℓΨ ⊔ ℓ)
Realign = Σᵉ ((ψ : Ψ) → C (S ψ)) (λ s' →
((λ ψ → c (pr1 (ic (s' ψ)))) =ᵉ (λ ψ → c (pr1 (ic (s ψ)))))
×ᵉ ((λ φ → s' (i φ)) =ᵉ s₀))
P' : Ψ → UU ℓ
P' ψ = P ψ (pr1 (ic (s ψ)))
l : (φ : Φ) → C (P' (i φ))
l φ = exo-tr (CP (i φ)) (exo-inv (agr φ)) (c (pr2 (ic (s₀ φ))))
private
Realign-≡ : {r₁ r₂ : Realign} → pr1ᵉ r₁ =ᵉ pr1ᵉ r₂ → r₁ =ᵉ r₂
Realign-≡ {r₁} {r₂} p =
dep-pair-=ᵉ r₁ r₂
(p ,ᵉ exo-concat (tr-×ᵉ p (pr1ᵉ (pr2ᵉ r₁)) (pr2ᵉ (pr2ᵉ r₁)))
(pair-=ᵉ _ _ (UIPᵉ _ _ ,ᵉ UIPᵉ _ _)))
realign-iso : Realign ≅ Ext i (λ ψ → C (P' ψ)) l
realign-iso = to' ,ᵉ (from' ,ᵉ (from-to ,ᵉ to-from))
where
to' : Realign → Ext i (λ ψ → C (P' ψ)) l
to' (s' ,ᵉ (q ,ᵉ r)) =
(λ ψ → exo-tr (CP ψ) (happlyᵉ q ψ) (c (pr2 (ic (s' ψ)))))
,ᵉ funextᵉ (λ φ → snd-cong (happlyᵉ r φ) (happlyᵉ q (i φ)) (exo-inv (agr φ)))
from' : Ext i (λ ψ → C (P' ψ)) l → Realign
from' (F ,ᵉ p) =
(λ ψ → c (pr1 (ic (s ψ)) , ic (F ψ)))
,ᵉ ( reflᵉ
,ᵉ funextᵉ (λ φ →
exo-concat
(exo-ap (λ z → c {A = S (i φ)} (pr1 (ic (s (i φ))) , ic z))
(happlyᵉ p φ))
(exo-concat
(pair-tr (agr φ) (l φ))
(exo-ap (λ z → c {A = S (i φ)} (pr1 (ic (s₀ φ)) , ic z))
(exo-concat
(exo-tr-concat (exo-inv (agr φ)) (agr φ))
(exo-tr-left-law (CP (i φ)) (agr φ)))))) )
from-to : (r : Realign) → from' (to' r) =ᵉ r
from-to (s' ,ᵉ (q ,ᵉ r)) =
Realign-≡ (funextᵉ (λ ψ →
exo-inv (pair-tr (happlyᵉ q ψ) (c (pr2 (ic (s' ψ)))))))
to-from : (w : Ext i (λ ψ → C (P' ψ)) l) → to' (from' w) =ᵉ w
to-from (F ,ᵉ p) = ext-≡ reflᵉ
Realign-isFibrant : isFibrant Realign
Realign-isFibrant =
isfibrant (fibrant-match (Ext-isFibrant cof P' l))
(≅-trans realign-iso (fibrant-witness (Ext-isFibrant cof P' l)))
private
P'-contr : (ψ : Ψ) → is-contr (P' ψ)
P'-contr ψ =
is-proof-irrelevant-all-elements-equal
(all-elements-equal-is-prop (propP ψ (pr1 (ic (s ψ)))))
(pr2 (ic (s ψ)))
realign-contr : is-contr (fibrant-match Realign-isFibrant)
realign-contr = rel-funext-holds-2LTT c2 P' P'-contr l
realignment : Realign
realignment =
pr1ᵉ (pr2ᵉ (fibrant-witness Realign-isFibrant)) (c (center _ realign-contr))
realigned : (ψ : Ψ) → C (S ψ)
realigned = pr1ᵉ realignment
realign-data : (λ ψ → c (pr1 (ic (realigned ψ)))) =ᵉ (λ ψ → c (pr1 (ic (s ψ))))
realign-data = pr1ᵉ (pr2ᵉ realignment)
realign-boundary : (λ φ → realigned (i φ)) =ᵉ s₀
realign-boundary = pr2ᵉ (pr2ᵉ realignment)
realign-unique : (r₁ r₂ : Realign)
→ Id (ic (pr1ᵉ (fibrant-witness Realign-isFibrant) r₁))
(ic (pr1ᵉ (fibrant-witness Realign-isFibrant) r₂))
realign-unique r₁ r₂ =
all-elements-equal-is-prop (is-prop-is-contr _ realign-contr) _ _