{-# OPTIONS --without-K --exact-split --two-level #-}

--------------------------------------------------------------------------------
-- Theorem 5.15, the (4)β‡’(5)β‡’(1) fragment, for a fibrant interval.
--
-- For a fibrant interval  I = C 𝕀  with points c aβ‚€, c a₁ and segment
-- seg : aβ‚€ = a₁, the boundary inclusion iβˆ‚ : βˆ‚I β†’ I, and any universe 𝓀:
--
--     a homotopy coherent Glue structure for (iβˆ‚, 𝓀)  ⟹  𝓀 is univalent.
--
-- This composes the two pieces:
--   * Lemma 5.13(3)  (`GlueStrengthChain3.strength-chain-3`):
--       a homotopy coherent Glue structure yields a weak Glue structure;
--   * Theorem 5.14 for a fibrant interval
--       (`WeakGlueUAFibrant.fibrant-weak-glue-implies-ua`):
--       a weak Glue structure implies univalence.
-- Together with `UAStrongGlue.ua-implies-strong-glue` (the (1)⇒… direction) and
-- `GlueRules.ua-gives-weak-glue`, this closes the equivalence of univalence with
-- (homotopy-coherent / weak) gluing over a fibrant interval, modulo the encoding
-- Lemma 5.1 that identifies the strong Glue data with the extension
-- type (which links this to the strict-coherent form of the sandwich).
--------------------------------------------------------------------------------

module Extension.GlueSandwichFibrant where

open import Extension.Prelude
open import Extension.GlueStructure using (has-homotopy-coherent-glue)
open import Extension.GlueStrengthChain3 using (strength-chain-3)
open import Extension.WeakGlueUAFibrant using (fibrant-weak-glue-implies-ua)

private
  variable
    β„“I : Level

module _ (𝕀 : UU β„“I) (aβ‚€ a₁ : 𝕀) (𝓀 : Level) (seg : Id aβ‚€ a₁) where

  -- public: part of the statement of `htpy-coherent-glue-implies-ua`
  -- (referenced by the paper index src/index.agda)
  iβˆ‚ : (βŠ€α΅‰ {β„“I} +ᡉ βŠ€α΅‰ {β„“I}) β†’ C 𝕀
  iβˆ‚ (inlᡉ _) = c aβ‚€
  iβˆ‚ (inrᡉ _) = c a₁

  htpy-coherent-glue-implies-ua :
      has-homotopy-coherent-glue iβˆ‚ 𝓀
    β†’ (A B : UU 𝓀) β†’ isEquiv (idtoeqv {A = A} {B = B})
  htpy-coherent-glue-implies-ua hcg =
    fibrant-weak-glue-implies-ua 𝕀 aβ‚€ a₁ 𝓀 seg
      (strength-chain-3 (C 𝕀) iβˆ‚ 𝓀 hcg)