证明Conat余代数(同伦)终端性的唯一性问题
You've already nailed the existence of the unique homomorphism from any F-coalgebra to ConatCoalgebra using coit. To finish proving homotopy terminality, we need to show any other homomorphism from a coalgebra (C, sc) to ConatCoalgebra is path-equal to the coit-constructed one.
Key Context
- A coalgebra is homotopy terminal if the space of homomorphisms from any other coalgebra to it is contractible (
isContr): meaning there's exactly one homomorphism (up to path equality). - For coinductive types like
Conat, equality is determined by theirforcefields (via guarded recursion). - Since
Conatis an hSet, function spaces intoConatare also hSets, which simplifies equality proofs for homomorphisms.
Step-by-Step Solution
Here's how to fill the hole in ConatCoalgebraTerminal:
ConatCoalgebraTerminal : isTerminalCoalgebra ConatCoalgebra ConatCoalgebraTerminal (C , sc) = (coit.coit sc , λ i s → coit.coitSpec sc s i) , λ y → let -- Unpack the arbitrary homomorphism we need to equate to our coit-based one (f , f-hom) = y -- Helper: Build a Conat equality from an equality of their force fields -- Guarded by the `i` index in the force field, so it's valid for coinductive types conat-path : ∀ {x y : Conat} → force x ≡ force y → x ≡ y conat-path p i .force = p i -- Prove coit sc s ≡ f s for every s ∈ C (coinductive equality) eq : ∀ s → coit sc s ≡ f s eq s = conat-path (eq-force s) where eq-force : ∀ s → force (coit sc s) ≡ force (f s) eq-force s with sc s -- Case 1: sc s is zero (inl tt) ... | inl tt = yesy sc (inl tt) ∙ sym (f-hom s) -- Case 2: sc s is successor (inr s'): use coinductive hypothesis (eq s') ... | inr s' = yesy sc (inr s') ∙ cong inr (eq s') ∙ sym (f-hom s) -- Lift pointwise equality to a function-level path (coit sc ≡ f) eq-fun : coit.coit sc ≡ f eq-fun = funExt eq -- Use hSet properties to show homomorphism proofs are unique (propositional) -- First, confirm F Conat is an hSet (since Unit and Conat are hSets) isSetFConat : isSet (F Conat) isSetFConat = isSetSum isSetUnit isSetConat -- The space of functions F C → F Conat is an hSet (codomain is hSet) isSetFC→FConat : isSet (F C → F Conat) isSetFC→FConat = isSet→isSetFun isSetFConat -- Homomorphism proofs are propositional (only one valid path per function) hom-prop : isProp (F-map f ∘ sc ≡ force ∘ f) hom-prop = isSet→isProp isSetFC→FConat -- Transport our coit homomorphism proof along eq-fun to match f-hom transport-coitSpec : transport (λ i → F-map (eq-fun i) ∘ sc ≡ force ∘ eq-fun i) (coit.coitSpec sc) ≡ f-hom transport-coitSpec = isProp→pathP (λ i → hom-prop) (coit.coitSpec sc) f-hom -- Build the final Σ-type path (equates both the function and its homomorphism proof) Σ-path : (coit.coit sc , coit.coitSpec sc) ≡ (f , f-hom) Σ-path = ΣPathP (eq-fun , transport-coitSpec) in Σ-path
Breakdown of Critical Parts
conat-path: SinceConatis coinductive, two values are equal if theirforcefields are equal. This helper constructs such a path directly, and theiindex in theforcefield satisfies Agda's guardedness condition.eq(Pointwise Equality):- For each
s ∈ C, we proveforce (coit sc s) ≡ force (f s):- When
sc siszero, both sides reduce tozero; we chainyesy(your existing lemma) with the homomorphism propertyf-hom. - When
sc sissucc s', we use the coinductive hypothesiseq s'to show the successor parts are equal, then chain withyesyandf-hom.
- When
- For each
Function Equality:
funExt eqturns pointwise equality into a path between the functionscoit scandf.Propositional Homomorphism Proofs: Since
F Conatis an hSet, the space of homomorphism proofs (paths betweenF-map f ∘ scandforce ∘ f) is a proposition. This means any two valid proofs are equal, so we useisProp→pathPto connect ourcoitSpectof-hom.Σ-Type Path:
ΣPathPcombines the function path and the homomorphism proof path to get the equality of the two Σ-type homomorphisms.
Dependencies
Make sure you have access to these utilities from Cubical libraries:
isSetUnit(fromCubical.Data.Unit),isSetSum(fromCubical.Data.Sum)- Your existing
isSetConatproof funExt(fromCubical.Foundations.Function)ΣPathPandisProp→pathP(fromCubical.Foundations.Path)
内容的提问来源于stack exchange,提问作者Potato44

