|
| 1 | +{-# OPTIONS --without-K #-} |
| 2 | + |
| 3 | +-- Postulated-truncation consumer for `EchoImageFactorizationProp`. |
| 4 | +-- |
| 5 | +-- ## Purpose |
| 6 | +-- |
| 7 | +-- `EchoImageFactorizationProp` is module-parameterised in a |
| 8 | +-- `TruncInterface`, deliberately scoped to ship the (epi, mono) |
| 9 | +-- factorisation content WITHOUT committing to any particular |
| 10 | +-- implementation of propositional truncation. The base module |
| 11 | +-- itself is `--safe --without-K` with zero postulates; the |
| 12 | +-- propositional-truncation OBLIGATION is bumped to the consumer. |
| 13 | +-- |
| 14 | +-- This module demonstrates the parameter is USABLE by exhibiting a |
| 15 | +-- concrete `TruncInterface ℓ` instance built from four postulates |
| 16 | +-- matching the four interface fields, then opens |
| 17 | +-- `ImageProp T f` to confirm the parametric content goes through |
| 18 | +-- on a concrete consumer. |
| 19 | +-- |
| 20 | +-- ## Honest scope |
| 21 | +-- |
| 22 | +-- This is a POSTULATED-INTERFACE demonstration, NOT a HIT |
| 23 | +-- construction. The postulates assert that propositional |
| 24 | +-- truncation exists and satisfies its standard laws — they do not |
| 25 | +-- prove the existence; they assume it. |
| 26 | +-- |
| 27 | +-- The classification consequence: |
| 28 | +-- |
| 29 | +-- * The flag profile is `--without-K` only (no `--safe`), |
| 30 | +-- because `--safe` forbids `postulate` entirely. This module |
| 31 | +-- therefore lives OUTSIDE the kernel cone and outside |
| 32 | +-- `proofs/agda/All.agda` (per the existing |
| 33 | +-- `EchoDecorationBridge` Exploratory precedent in |
| 34 | +-- `docs/echo-types/echo-kernel-note.adoc`). |
| 35 | +-- * Classification: Exploratory. Listed in the note to satisfy |
| 36 | +-- `scripts/kernel-guard.sh` Check B (classification-drift |
| 37 | +-- lint), not load-bearing. |
| 38 | +-- * The base `EchoImageFactorizationProp` remains kernel-cone |
| 39 | +-- compatible (`--safe --without-K`, zero postulates) and is |
| 40 | +-- the load-bearing artefact. |
| 41 | +-- |
| 42 | +-- ## What this module ships |
| 43 | +-- |
| 44 | +-- * Four `postulate` declarations realising the |
| 45 | +-- `TruncInterface ℓ` record fields. |
| 46 | +-- * `trunc : TruncInterface ℓ` — the packaged interface. |
| 47 | +-- * `module ImagePropPostulated f` re-opening |
| 48 | +-- `EchoImageFactorizationProp.ImageProp trunc f` for any |
| 49 | +-- `f : A → B` at the chosen levels. |
| 50 | +-- * `prop-factor-right-injective-demo` — a pinned re-export of |
| 51 | +-- the mono-side theorem from the parametric content, |
| 52 | +-- specialised to the postulated interface. |
| 53 | +-- * `prop-factor-left-mere-surjective-demo` — same for the |
| 54 | +-- epi-side. |
| 55 | +-- |
| 56 | +-- ## What this module deliberately DOES NOT prove |
| 57 | +-- |
| 58 | +-- * That the postulated `Trunc` IS the standard (-1)-truncation. |
| 59 | +-- It satisfies the interface laws by assumption; that is all |
| 60 | +-- the parametric proofs in `ImageProp` need. |
| 61 | +-- * Anything about the postulates' consistency. The standard |
| 62 | +-- HoTT discipline says the four laws together characterise |
| 63 | +-- `Trunc A` up to equivalence (and Cubical Agda or a hand- |
| 64 | +-- rolled HIT realises them concretely); we cite that |
| 65 | +-- literature rather than mechanise it. |
| 66 | +-- |
| 67 | +-- The mechanical contribution: pin that the parameterised |
| 68 | +-- `EchoImageFactorizationProp.ImageProp` module can be CONSUMED |
| 69 | +-- via interface plug-in. The demonstrative side-effect is a |
| 70 | +-- visible auditable check that the base module's parameter slots |
| 71 | +-- match a real `TruncInterface ℓ` shape. |
| 72 | +-- |
| 73 | +-- ## Headlines (this module's contribution) |
| 74 | +-- |
| 75 | +-- * `trunc` — the packaged interface |
| 76 | +-- * `prop-factor-right-injective-demo` — mono side, plugged |
| 77 | +-- * `prop-factor-left-mere-surjective-demo` — epi side, plugged |
| 78 | + |
| 79 | +module EchoImageFactorizationPropPostulated where |
| 80 | + |
| 81 | +open import EchoImageFactorizationProp using (TruncInterface; module ImageProp) |
| 82 | +open import Echo using (Echo) |
| 83 | + |
| 84 | +open import Level using (Level; suc) |
| 85 | +open import Data.Product.Base using (Σ; _,_) |
| 86 | +open import Relation.Binary.PropositionalEquality |
| 87 | + using (_≡_) |
| 88 | + |
| 89 | +private variable |
| 90 | + ℓ : Level |
| 91 | + |
| 92 | +---------------------------------------------------------------------- |
| 93 | +-- Postulated truncation interface |
| 94 | +---------------------------------------------------------------------- |
| 95 | + |
| 96 | +-- The four standard propositional-truncation obligations. Cubical |
| 97 | +-- Agda or a hand-rolled HIT realises these concretely; here we take |
| 98 | +-- them as assumed. |
| 99 | + |
| 100 | +postulate |
| 101 | + Trunc-pos : Set ℓ → Set ℓ |
| 102 | + ∣_∣-pos : ∀ {A : Set ℓ} → A → Trunc-pos A |
| 103 | + is-prop-pos : ∀ {A : Set ℓ} (x y : Trunc-pos A) → x ≡ y |
| 104 | + rec-pos : ∀ {A B : Set ℓ} |
| 105 | + → ((x y : B) → x ≡ y) |
| 106 | + → (A → B) |
| 107 | + → Trunc-pos A → B |
| 108 | + |
| 109 | +---------------------------------------------------------------------- |
| 110 | +-- Packaged `TruncInterface ℓ` from the postulates |
| 111 | +---------------------------------------------------------------------- |
| 112 | + |
| 113 | +-- Repackage the four postulates as the `TruncInterface ℓ` record |
| 114 | +-- consumed by `EchoImageFactorizationProp.module ImageProp`. |
| 115 | + |
| 116 | +trunc : TruncInterface ℓ |
| 117 | +trunc = record |
| 118 | + { Trunc = Trunc-pos |
| 119 | + ; ∣_∣ = ∣_∣-pos |
| 120 | + ; is-prop = is-prop-pos |
| 121 | + ; rec = rec-pos |
| 122 | + } |
| 123 | + |
| 124 | +---------------------------------------------------------------------- |
| 125 | +-- Consumer demonstration: open `ImageProp trunc f` and re-export |
| 126 | +---------------------------------------------------------------------- |
| 127 | + |
| 128 | +-- Both `A` and `B` need to live at the SAME level `ℓ` per |
| 129 | +-- `ImageProp`'s implicit-equal-level signature. Same-level is the |
| 130 | +-- common Σ-product case in practice; cross-level consumers would |
| 131 | +-- need to lift to a common level (`Level.Lift`). |
| 132 | + |
| 133 | +module ImagePropPostulated {A B : Set ℓ} (f : A → B) where |
| 134 | + -- Open the parametric module with the postulated interface |
| 135 | + -- plugged in. Every name inside `ImageProp` is now available |
| 136 | + -- under this module's namespace. |
| 137 | + open ImageProp trunc f public |
| 138 | + |
| 139 | +---------------------------------------------------------------------- |
| 140 | +-- Demonstrative pinned exports |
| 141 | +---------------------------------------------------------------------- |
| 142 | + |
| 143 | +-- Headline 1 — MONO side, plugged. Pin the mono-side theorem at |
| 144 | +-- the postulated-interface specialisation. This confirms the |
| 145 | +-- parametric content goes through under interface plug-in (the |
| 146 | +-- proof type-checks at the concrete instance). |
| 147 | + |
| 148 | +prop-factor-right-injective-demo : |
| 149 | + ∀ {A B : Set ℓ} (f : A → B) |
| 150 | + {z₁ z₂ : Σ B (λ y → Trunc-pos (Echo f y))} |
| 151 | + → ImagePropPostulated.prop-factor-right f z₁ |
| 152 | + ≡ |
| 153 | + ImagePropPostulated.prop-factor-right f z₂ |
| 154 | + → z₁ ≡ z₂ |
| 155 | +prop-factor-right-injective-demo f = |
| 156 | + ImagePropPostulated.prop-factor-right-injective f |
| 157 | + |
| 158 | +-- Headline 2 — EPI side, plugged. Pin the epi-side theorem at the |
| 159 | +-- postulated-interface specialisation. The truncated existence is |
| 160 | +-- exactly the standard (-1)-truncated surjectivity. |
| 161 | + |
| 162 | +prop-factor-left-mere-surjective-demo : |
| 163 | + ∀ {A B : Set ℓ} (f : A → B) |
| 164 | + (z : Σ B (λ y → Trunc-pos (Echo f y))) |
| 165 | + → Trunc-pos (Σ A λ a → ImagePropPostulated.prop-factor-left f a ≡ z) |
| 166 | +prop-factor-left-mere-surjective-demo f = |
| 167 | + ImagePropPostulated.prop-factor-left-mere-surjective f |
0 commit comments