Skip to content

Commit 9e8cfa9

Browse files
hyperpolymathclaude
andcommitted
EchoResidueTaxonomy: Search + Epistemic as ResidueForm instances
Closes the last two "structurally compatible" gaps in the Tier-2 residue grid companion remark. All eight decoration modules now have packaged ResidueForm instances (six worked + two endpoints). * `search-residue` — bounded-`n` search witness as the residue carrier, parametric in a search-completeness witness `∀ {y} (e : Echo f y) → Σ ℕ λ k → (k < n) × (enum k ≡ proj₁ e)`. Mirrors `module CostInstance.cost-residue`'s parametric-witness shape: an external proof that the relevant point exists in the decoration's quantitative axis is passed at the boundary. The lowering's EchoS triple is `(k, k<n, trans (cong f eq) p)`. * `epistemic-residue` — `identity-residue` specialised to `obs r` (Role → Bool from EchoChoreo). The indistinguishability class at observation value `y` IS the fibre `Echo (obs r) y`, so the "quotient by indist" interpretation collapses definitionally to identity. Pinned under a distinct name so the epistemic reading is discoverable at the taxonomy boundary; no new carrier (a setoid carrier with explicit equivalence relation or a propositional truncation of the class would both be separate earn-back lifts — the latter handled by EchoImageFactorizationProp in a related PR). Companion remark updated to mark items 6 and 8 as LANDED (matching items 5 and 7 which landed 2026-05-27); closing paragraph revised to reflect all eight decorations now packaged. Smoke.agda pin extended to include `search-residue` and `epistemic-residue`. ## Build invariant * `EchoResidueTaxonomy.agda` compiles standalone under `--safe --without-K`, zero postulates, no funext. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 00f94bd commit 9e8cfa9

2 files changed

Lines changed: 96 additions & 14 deletions

File tree

proofs/agda/EchoResidueTaxonomy.agda

Lines changed: 94 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,71 @@ module CostInstance {ℓ} (K : CostAlgebra ℓ) where
232232
cost-residue f cost c cost-meets =
233233
record { lower = λ {y} (x , p) x , p , cost-meets x }
234234

235+
----------------------------------------------------------------------
236+
-- Search instance (2026-05-28, Tier-2 grid completion).
237+
--
238+
-- `EchoSearch.EchoS enum f y n` is the bounded-`n` witness-search
239+
-- echo: a step index `k < n` at which the enumerator returns a
240+
-- preimage of `y` under `f`. Lowering from `Echo f y` requires
241+
-- a search-completeness witness — for every echo at `y`, an
242+
-- enumerator step `k < n` produces its source element.
243+
--
244+
-- The search-completeness assumption is exactly the per-fibre
245+
-- "enum exhausts A within n steps" property. Compared to
246+
-- `cost-residue` (where the budget-meets witness is a numeric
247+
-- bound on cost), `search-residue` requires structural location
248+
-- information (a specific step). Both fit the same parametric
249+
-- shape: an external witness supplied at the ResidueForm boundary.
250+
--
251+
-- Closes the "EchoSearch structurally compatible but not packaged"
252+
-- gap noted in the companion remark. Fourth non-endpoint,
253+
-- non-generic decoration instance.
254+
----------------------------------------------------------------------
255+
256+
open import EchoSearch using (EchoS; SearchStrategy)
257+
open import Data.Nat.Base using (ℕ; _<_)
258+
open import Data.Product.Base using (_×_; proj₁)
259+
open import Relation.Binary.PropositionalEquality using (cong; trans)
260+
261+
search-residue :
262+
{a b} {A : Set a} {B : Set b}
263+
(enum : SearchStrategy A) (f : A B) (n : ℕ)
264+
(search-complete : {y : B} (e : Echo f y)
265+
Σ ℕ (λ k (k < n) × (enum k ≡ proj₁ e)))
266+
ResidueForm f (λ y EchoS enum f y n)
267+
search-residue enum f n search-complete =
268+
record { lower = λ {y} e@(x , p)
269+
let (k , k<n , eq) = search-complete e
270+
in k , k<n , trans (cong f eq) p }
271+
272+
----------------------------------------------------------------------
273+
-- Epistemic instance (2026-05-28, Tier-2 grid completion).
274+
--
275+
-- For a role `r : Role` from `EchoChoreo`, the indistinguishability
276+
-- class at observation value `y` is exactly the fibre
277+
-- `Echo (obs r) y` — every global indistinguishable-at-r from a
278+
-- representative IS a fibre element. The "knowledge-equivalence-
279+
-- class residue" interpretation thus DEFINITIONALLY collapses to
280+
-- `identity-residue` specialised to `obs r`.
281+
--
282+
-- Pinning under a separate name makes the epistemic reading
283+
-- discoverable at the taxonomy boundary without introducing a
284+
-- distinct carrier (which would require either propositional
285+
-- truncation of the class — same earn-back as `(epi, mono)` image
286+
-- factorisation, handled by `EchoImageFactorizationProp` — or a
287+
-- setoid carrier with an explicit equivalence relation).
288+
--
289+
-- Closes the "EchoEpistemic structurally compatible but
290+
-- relational" gap noted in the companion remark. Fifth instance
291+
-- (degenerate-but-named: definitionally equal to `identity-residue
292+
-- (obs r)`, but the name pins the epistemic reading).
293+
----------------------------------------------------------------------
294+
295+
open import EchoChoreo using (Role; obs)
296+
297+
epistemic-residue : (r : Role) ResidueForm (obs r) (Echo (obs r))
298+
epistemic-residue r = identity-residue (obs r)
299+
235300
----------------------------------------------------------------------
236301
-- Companion remark.
237302
--
@@ -265,25 +330,40 @@ module CostInstance {ℓ} (K : CostAlgebra ℓ) where
265330
-- parametric record sits inside the `K`-parameterised
266331
-- sub-module to keep the carrier signature tidy.
267332
--
268-
-- 6. *EchoSearch*. Search-bound-indexed refinement (enumerator-
269-
-- bounded). Search bound 0 = trivial-residue; unbounded search
270-
-- = identity-residue.
333+
-- 6. *EchoSearch*. LANDED 2026-05-28 as `search-residue` above.
334+
-- Per-output carrier `EchoS enum f y n` (bounded-`n` search
335+
-- witness); lowering requires a search-completeness witness
336+
-- `∀ {y} (e : Echo f y) → Σ ℕ λ k → (k < n) × (enum k ≡ proj₁ e)`
337+
-- passed at the boundary (mirrors `cost-residue`'s
338+
-- `cost-meets` parameter). Degenerate endpoints: search bound
339+
-- 0 trivialises (no echo lowers — the `EchoS f y 0` is empty
340+
-- via `echo-search-bound-zero`); unbounded search via a
341+
-- surjective enumerator recovers identity-residue.
271342
--
272343
-- 7. *EchoIndexed*. LANDED 2026-05-27 as `indexed-residue`
273344
-- above. Per-output carrier `Σ I (λ idx → Echoᵢ I ι f idx y)`;
274345
-- lowering `(x, p) ↦ (ι x, x, refl, p)`.
275346
--
276-
-- 8. *EchoEpistemic*. Knowledge-equivalence-class residue
277-
-- (`Indist`, `Knows`). Lowering quotients the echo by
278-
-- indistinguishability; structurally compatible but uses a
279-
-- relational rather than Σ-shape residue.
280-
--
281-
-- All eight are structurally compatible with `ResidueForm`. The
282-
-- four instances pinned above demonstrate the pattern at the two
283-
-- endpoints + the generic Σ-cert + one worked non-trivial
284-
-- instance; adding the remaining seven as packaged `ResidueForm`
285-
-- instances is mechanical wiring (each module already has the
286-
-- `lower` map; the wiring just exposes it through the record).
347+
-- 8. *EchoEpistemic*. LANDED 2026-05-28 as `epistemic-residue`
348+
-- above. Definitionally `identity-residue (obs r)`: the
349+
-- indistinguishability class at observation `y` IS the fibre
350+
-- `Echo (obs r) y`. Pinned under a distinct name so the
351+
-- epistemic reading is discoverable at the taxonomy boundary;
352+
-- no new carrier (a setoid carrier with explicit equivalence
353+
-- relation or a propositional-truncation of the class would
354+
-- both be separate earn-back lifts).
355+
--
356+
-- All eight are now packaged. Endpoint instances (1-3:
357+
-- trivial-residue + identity-residue + echoR-residue) cover the
358+
-- generic shapes; six non-endpoint instances ship the worked
359+
-- decoration-specific wiring (linear-affine-residue,
360+
-- indexed-residue, module CostInstance.cost-residue,
361+
-- search-residue, epistemic-residue, and choreo-residue via
362+
-- echoR-residue with `C = Role`). Each instance's `lower` either
363+
-- discharges definitionally (`linear-affine` / `indexed` /
364+
-- `epistemic`) or requires a parametric witness at the boundary
365+
-- (`cost-meets` for cost / `search-complete` for search) that
366+
-- locates the relevant point in the decoration's quantitative axis.
287367
--
288368
-- The DECORATION RECIPE (`order` / `order-prop` / `join` /
289369
-- `degrade-compose` / `degrade-via-join`) that each of the eight

proofs/agda/Smoke.agda

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ open import EchoResidueTaxonomy using
147147
; linear-affine-residue
148148
; indexed-residue
149149
; module CostInstance
150+
; search-residue
151+
; epistemic-residue
150152
)
151153

152154
-- EchoDecorationStructure — observation-side companion to

0 commit comments

Comments
 (0)