Skip to content

Commit b6c8b97

Browse files
feat(recovery): EchoPartialSection + EchoFibreIntersection; wire EchoTruncation (squeakwell R3/R8/R9/R12/R13) (#370)
## Summary The Agda source of truth for the **repaired** recovery invariants of [hyperpolymath/squeakwell](https://github.com/hyperpolymath/squeakwell) (database recovery through cross-modal constraint propagation on VeriSimDB; route plan rungs R3, R8, R9, R12, R13). Rocq recheck: verisimdb `formal/Recovery.v` ([verisimdb#350](hyperpolymath/verisimdb#350)). Lean side: tropical-types `Resource/HubCeiling.lean` ([tropical-types#67](hyperpolymath/tropical-types#67)). This also lands the "join-semilattice of partial sections" abstraction that verisimdb's `CROSS-REPO-MAP.adoc` flagged as the missing echo-types companion to `Octad.v` R1–R3. ## What lands - **`EchoPartialSection.agda`** (Tier 1: `Echo` + stdlib). Partial sections `(m : M) → Maybe (V m)` of a modality bundle — the octad is an instance. Information order (`⊑-refl`, `⊑-trans`). Resolve-parametric `merge` with the pointwise R1–R3 twins of `Octad.v` (`merge-comm` / `merge-assoc` / `merge-idem`: implications from `resolve`, not CRDT laws). Guarded fill as the left-biased merge against an oracle proposal: `fill-guarded`, `fill-inflationary`, and the counter-model `FillNotMonotone.fill-not-monotone` (two modalities). Restriction to an observed mask and its Echo fibre: `restrict-echo`, `restrict-fibre-agree` (a candidate in `Echo (restrict T) obs` reproduces `obs` on every observed modality — the fragment-granularity observation-fidelity shape), `restrict-blind`. Every law is pointwise; no funext. - **`EchoFibreIntersection.agda`** (Tier 2: `Echo` + `EchoFiberCount`). `fibre-intersection-iso : Echo < f , g > (y , z) ↔ Narrow f g y z` (K-free, `refl` round-trips). Forgetting or adding a constraint keeps the witness (`forget-*-witness`, `narrow-fin-step-to/from` + witness lemmas; the `Fin n` step is deliberately not a `_↔_`, since the function-side round trip would need funext). `narrow-shrinks`: on a finite domain with decidable equality, `FiberSize-fin < f , g > (y , z) ≤ FiberSize-fin f y` (via `dec-×`, lock-step with the count's recursion). - **`EchoTruncation.agda` wired.** Until now compiled only through its corollaries; now in `All.agda` and pinned (`isProp`, `echo-witnesses-distinct`, `preimages⇒distinct-echoes`, `echo-not-prop`). With `FiberSize-fin≡0⇒no-echo` / `no-echo⇒FiberSize-fin≡0` it is the review-queue completeness kernel (R13 theory half). Not claimed: inhabitation of the narrowed fibre; "covering masks ⇒ subsingleton" (needs extensionality over opaque identifiers — dropped in the route plan); termination of the recovery round (Rocq-only, needs the finite octad: `iter_9_fixpoint` in `Recovery.v`). ## Docs `echo-kernel-note.adoc` classification row ("Derived — recovery ladder (2026-11-09)"); `MAP.adoc` Direction "Database recovery — squeakwell / VeriSimDB bridge `[REAL]`"; `cross-repo-bridge-status.adoc` Tracks row + revision entry; `CHANGELOG.adoc` Added entry. ## Verification (this environment, CI-pinned toolchain via `scripts/setup-agda.sh`) Agda 2.7.0.1 (checksum-pinned), agda-stdlib `8326c7475af1fa456ca04a0203c168d5d7ff842b`, absolute-zero `f486c29903434589117fa0662c6f29b0f17d1d5f`: ``` agda --no-libraries -i $AGDA_STDLIB -i $ABSOLUTE_ZERO_AGDA --safe --without-K --cubical-compatible -i proofs/agda proofs/agda/All.agda # exit 0 agda --no-libraries -i $AGDA_STDLIB -i $ABSOLUTE_ZERO_AGDA --safe --without-K --cubical-compatible -i proofs/agda proofs/agda/Smoke.agda # exit 0 sh scripts/kernel-guard.sh # PASS ``` Warnings are `UnsupportedIndexedMatch` only (the class the existing suite already emits). Zero postulates, no escape pragmas. --- _Generated by [Claude Code](https://claude.ai/code/session_01J4QvDizuhJtQDcxHxM2wj8)_ Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent aed13ad commit b6c8b97

8 files changed

Lines changed: 638 additions & 9 deletions

File tree

‎CHANGELOG.adoc‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ Changelog].
77

88
=== [Unreleased]
99

10+
==== Added (2026-11-09)
11+
12+
* _squeakwell / VeriSimDB recovery ladder._ `+EchoPartialSection.agda+`
13+
(partial sections of a modality bundle; information order; resolve-parametric
14+
merge with the pointwise R1–R3 twins of verisimdb `+Octad.v+`; guarded fill as
15+
left-biased merge, inflationary and provably not monotone; restriction to an
16+
observed mask and its Echo fibre) and `+EchoFibreIntersection.agda+` (binary
17+
narrowing as the fibre of a pairing, witness-preserving `+Fin n+` steps,
18+
`+narrow-shrinks+` on `+FiberSize-fin+`). `+EchoTruncation.agda+`, until now
19+
compiled only through its corollaries, is wired into `+All.agda+` and pinned.
20+
Rocq recheck: verisimdb `+formal/Recovery.v+`; Lean side: tropical-types
21+
`+Resource/HubCeiling.lean+`.
22+
1023
==== Changed (2026-11-06)
1124

1225
* Recorded the owner's prospective licence policy: CC-BY-SA-4.0 for new

‎docs/bridges/cross-repo-bridge-status.adoc‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,25 @@ path; citation-level — echo-types proves the general aggregation
229229
principle (and its macro instance), oikos’s alib will _consume_ it. The
230230
alib library itself is not yet built (design-note stage; Route A vs B
231231
pending owner decision).
232+
|squeakwell / VeriSimDB recovery ladder
233+
|`+proofs/agda/EchoPartialSection.agda+`, `+EchoFibreIntersection.agda+`,
234+
`+EchoTruncation.agda+` (wired 2026-11-09)
235+
|verisimdb `+formal/Recovery.v+` (Rocq recheck of R2/R3/R4/R9/R10 over
236+
`+Octad.v+`), tropical-types `+Resource/HubCeiling.lean+` (reach grades,
237+
hub ceilings, weighted residue measure), squeakwell `+docs/ROUTE-PLAN.adoc+`
238+
|*Theory landed, pointwise.* Partial sections with the resolve-parametric
239+
merge (the join-semilattice-of-partial-sections abstraction verisimdb’s
240+
CROSS-REPO-MAP flagged), guarded fill (inflationary, not monotone), the
241+
restriction fibre (fragment observation fidelity), binary and `+Fin n+`
242+
narrowing with `+narrow-shrinks+` on the honest count. Checked here with
243+
Agda 2.7.0.1 and the pinned stdlib / absolute-zero; Recovery.v with Coq
244+
8.18.0; HubCeiling with Lean 4.35.0.
245+
|Correspondence is a refinement, not same-statement: Agda proves the merge
246+
laws pointwise, Rocq as function equalities under
247+
`+functional_extensionality_dep+`. Termination (nine rounds) is Rocq-only
248+
(needs the finite octad). The Creusot export/queue postconditions (R11–R13
249+
engineering half) and the Idris2 wire contracts (R1, R15, R16) are not
250+
started; see squeakwell `+PROOF-STATUS.adoc+`.
232251
|===
233252

234253
=== Immediate next actions
@@ -549,15 +568,16 @@ OND composition, and none should be assumed.
549568

550569
=== Revision history
551570

552-
* 2026-11-09: *Ephapax correspondence + RMR/RMO/OND note.* Added
553-
§"`Ephapax Coq ↔ echo-types Agda correspondence`" (six rows:
554-
`+weaken+`, `+degradeMode-comp+`, no-section, the DecorationStructure
555-
laws, `+reversibility-via-totality+` and `+EchoResidueCell+`). All are
556-
conceptual: `+BRIDGE-PENDING+`, or Agda-only with no Coq leg. None is
557-
`+RECONCILED+` under PROOF-POLICY §2.2. Added
558-
§"`RMR / RMO / OND correspondence note`". Both come from the ephapax v2
559-
survey's cross-repo action list. Docs only; no `+.agda+` file changed.
560-
571+
* 2026-11-09: *squeakwell / VeriSimDB recovery ladder.* Added
572+
`+EchoPartialSection.agda+` (partial sections, information order,
573+
resolve-parametric merge = pointwise R1–R3 twins of verisimdb `+Octad.v+`,
574+
guarded fill inflationary-not-monotone, restriction fibre) and
575+
`+EchoFibreIntersection.agda+` (binary / `+Fin n+` narrowing,
576+
`+narrow-shrinks+`); wired the orphan `+EchoTruncation.agda+` into
577+
`+All.agda+`. New Tracks row. Rocq recheck lands as verisimdb
578+
`+formal/Recovery.v+`; Lean side as tropical-types
579+
`+Resource/HubCeiling.lean+`. `+--safe --without-K --cubical-compatible+`,
580+
zero postulates, funext-free.
561581
* 2026-06-18: *EchoAggregation general/macro split.* Generalised
562582
`+EchoAggregation.agda+` from the macro-economics-specific module into
563583
the general monoid-aggregation form requested by issue #175 (`+Monoid+`

‎docs/echo-types/MAP.adoc‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,46 @@ Connect echo types with MAA's reversibility proofs
512512

513513
* Docs: `roadmap.adoc` §"Deferred research track", `docs/bridges/EchoJanusBridge.adoc`.
514514

515+
=== Database recovery — squeakwell / VeriSimDB bridge `[REAL]`
516+
517+
The Agda source of truth for the repaired recovery invariants of
518+
https://github.com/hyperpolymath/squeakwell[squeakwell] (database
519+
recovery through cross-modal constraint propagation on VeriSimDB; route
520+
plan rungs R3, R8, R9, R12, R13). Landed 2026-11-09, `--safe --without-K
521+
--cubical-compatible`, zero postulates, pointwise (funext-free):
522+
523+
* *Partial sections* — `EchoPartialSection.agda`: a VeriSimDB octad is a
524+
partial section `(m : M) → Maybe (V m)` of a modality bundle. Information
525+
order; `merge resolve` inherits exactly the algebra of `resolve`
526+
(`merge-comm` / `merge-assoc` / `merge-idem`, the pointwise twins of
527+
verisimdb `Octad.v` R1–R3 — implications, not CRDT laws); guarded fill
528+
is the left-biased merge against an oracle proposal, never overwrites
529+
(`fill-guarded`), is inflationary (`fill-inflationary`) and is NOT
530+
monotone (`fill-not-monotone`, two-modality counter-model); restriction
531+
to an observed mask and its Echo fibre (`restrict-fibre-agree`,
532+
`restrict-blind`) — the fragment-granularity observation-fidelity shape.
533+
* *Multi-witness narrowing* — `EchoFibreIntersection.agda`: the fibre of a
534+
pairing is the intersection of fibres over one witness
535+
(`fibre-intersection-iso`); forgetting or adding a constraint keeps the
536+
witness; `narrow-shrinks`: the `EchoFiberCount` count never grows when
537+
an observation is added.
538+
* *Truncation wired* — `EchoTruncation.agda` is now in `All.agda` and
539+
pinned (`echo-not-prop`); with `FiberSize-fin≡0⇒no-echo` /
540+
`no-echo⇒FiberSize-fin≡0` it is the review-queue completeness kernel.
541+
542+
Not claimed: inhabitation of the narrowed fibre; covering masks ⇒
543+
subsingleton (needs extensionality over opaque identifiers; dropped);
544+
termination of the recovery round (finite index set and a conflict test —
545+
proved in Rocq as `iter_9_fixpoint` in verisimdb `formal/Recovery.v`, not
546+
restated over an arbitrary `M`). Lean side (reach grades, hub ceilings,
547+
weighted residue measure): tropical-types `Resource/HubCeiling.lean`.
548+
Ledger of grades per rung: squeakwell `PROOF-STATUS.adoc`.
549+
550+
* Proofs: `proofs/agda/EchoPartialSection.agda`,
551+
`proofs/agda/EchoFibreIntersection.agda`, `proofs/agda/EchoTruncation.agda`.
552+
* Cross-repo: verisimdb `formal/Recovery.v` + `formal/CROSS-REPO-MAP.adoc`;
553+
tropical-types `Resource/HubCeiling.lean`; squeakwell `docs/ROUTE-PLAN.adoc`.
554+
515555
=== Shannon / information theory `[REAL*]`
516556
Partial. The *discrete non-distinguishing* form lands as
517557
`EchoEntropy.agda` — the fibre-count shadow (uniform-prior Shannon

‎docs/echo-types/echo-kernel-note.adoc‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@ kernel** — the boundary is real and lives outside this core.
226226
flat `Echo*.agda` glob that Check B lints; recorded here for
227227
discoverability. Not kernel (the kernel remains exactly `Echo`).
228228

229+
| *Derived — recovery ladder (2026-11-09)*
230+
| `EchoPartialSection` (Tier 1), `EchoFibreIntersection` (Tier 2)
231+
| squeakwell / VeriSimDB recovery bridge. `EchoPartialSection` imports only
232+
`Echo` and stdlib: partial sections of a modality bundle, the information
233+
order, the resolve-parametric merge (pointwise R1–R3 twins of verisimdb
234+
`Octad.v`), guarded fill as left-biased merge (inflationary, not
235+
monotone) and the restriction fibre. `EchoFibreIntersection` imports
236+
`Echo` and `EchoFiberCount`: binary narrowing as the fibre of a pairing,
237+
witness-preserving constraint steps, and `narrow-shrinks` on the honest
238+
count. Both funext-free; Rocq recheck in verisimdb `formal/Recovery.v`.
239+
`EchoTruncation` (Tier 1, already classified) is now wired into `All.agda`.
240+
229241
| *Derived — Tier 1 additions (2026-11-06)*
230242
| `EchoSourcePreserving`, `EchoDependentPushforward`
231243
| Each imports only `Echo` and stdlib. The former proves the source-preserving

‎proofs/agda/All.agda‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ open import EchoSearchInstance
5050
open import EchoSearchExample
5151
open import EchoAccess
5252
open import EchoFiberCount
53+
-- squeakwell recovery ladder (2026-11-09): wires the once-orphan truncation
54+
-- lemma, multi-witness narrowing (R8) and partial sections / guarded fill /
55+
-- restriction fibre (R3, R9, R12). Rocq recheck: verisimdb formal/Recovery.v.
56+
open import EchoTruncation
57+
open import EchoFibreIntersection
58+
open import EchoPartialSection
5359
open import EchoEpistemicResidue
5460
open import EchoRelational
5561
open import EchoCategorical
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{-# OPTIONS --safe --without-K --cubical-compatible --exact-split --no-sized-types --no-guardedness #-}
2+
-- SPDX-License-Identifier: MPL-2.0
3+
-- SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
5+
-- EchoFibreIntersection: multi-witness narrowing (squeakwell rung R8).
6+
--
7+
-- A recovery engine that has observed several modalities of one entity
8+
-- asks for the witnesses satisfying ALL the observations at once. In
9+
-- Echo terms that is the intersection of fibres over one shared
10+
-- witness: `Σ A (λ x → f x ≡ y × g x ≡ z)`. This module pins the three
11+
-- facts hyperpolymath/squeakwell's proof ladder (docs/ROUTE-PLAN.adoc,
12+
-- rung R8) needs about that intersection:
13+
--
14+
-- * Binary narrowing is a fibre. Intersecting the fibres of `f` at
15+
-- `y` and of `g` at `z` IS the fibre of the pairing `< f , g >` at
16+
-- `(y , z)`: `fibre-intersection-iso`, a K-free `_↔_` with `refl`
17+
-- round-trips (no funext — the equations are on pairs, not on
18+
-- functions).
19+
-- * Narrowing never changes the witness. Forgetting either
20+
-- constraint is witness-preserving (`forget-left-witness`,
21+
-- `forget-right-witness`), and adding one more constraint to a
22+
-- family of `n` constraints is again witness-preserving in both
23+
-- directions (`narrow-fin-step-to`, `narrow-fin-step-from`). The
24+
-- `Fin n` family form is stated with pointwise equations, so it
25+
-- needs no funext; it is NOT packaged as a `_↔_` because the
26+
-- round-trip on the function side would.
27+
-- * Narrowing shrinks the candidate fibre. On a finite domain with
28+
-- decidable equality, the honest count of `EchoFiberCount` can
29+
-- only go down when a constraint is added: `narrow-shrinks`
30+
-- (`FiberSize-fin < f , g > (y , z) ≤ FiberSize-fin f y`). This is
31+
-- the quantitative statement behind squeakwell's review queue:
32+
-- every extra observed modality narrows the candidates.
33+
--
34+
-- Honest scope. The survey's proposed "covering masks ⇒ subsingleton
35+
-- fibre" is NOT here: over an opaque value type two full sections that
36+
-- agree on every modality need not be equal without extensionality, and
37+
-- squeakwell's identifiers are opaque. The route plan dropped it; so
38+
-- does this module. Nothing here claims the intersection is inhabited:
39+
-- observations can be jointly unsatisfiable, and the count can be 0.
40+
--
41+
-- Headlines (pinned in Smoke.agda):
42+
--
43+
-- * fibre-intersection-iso -- Echo < f , g > (y , z) ↔ Narrow f g y z
44+
-- * forget-left-witness -- forgetting a constraint keeps the witness
45+
-- * forget-right-witness
46+
-- * narrow-fin-step-to -- Fin (suc n) family = one more binary step
47+
-- * narrow-fin-step-from
48+
-- * narrow-shrinks -- FiberSize-fin of the pairing ≤ FiberSize-fin of f
49+
50+
module EchoFibreIntersection where
51+
52+
open import Function.Base using (_∘_)
53+
open import Level using (Level; _⊔_)
54+
open import Data.Empty using (⊥; ⊥-elim)
55+
import Data.Nat.Base as ℕ
56+
open ℕ using (ℕ; _≤_; z≤n; s≤s)
57+
open import Data.Fin.Base using (Fin; zero; suc)
58+
open import Data.Product.Base using (Σ; _×_; _,_; proj₁; proj₂; <_,_>)
59+
open import Function.Bundles using (_↔_; mk↔ₛ′)
60+
open import Relation.Nullary.Decidable.Core using (Dec; yes; no)
61+
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; cong₂)
62+
63+
open import Echo using (Echo)
64+
open import EchoFiberCount using (FiberSize-fin)
65+
66+
private
67+
variable
68+
ℓa ℓb ℓc : Level
69+
A : Set ℓa
70+
B : Set ℓb
71+
C : Set ℓc
72+
73+
----------------------------------------------------------------------
74+
-- Binary narrowing: two constraints on one witness.
75+
----------------------------------------------------------------------
76+
77+
-- The witnesses `x` with `f x ≡ y` AND `g x ≡ z`: the intersection of
78+
-- the two fibres over a shared witness.
79+
Narrow : (f : A → B) (g : A → C) → B → C → Set _
80+
Narrow {A = A} f g y z = Σ A (λ x → (f x ≡ y) × (g x ≡ z))
81+
82+
pair-fibre→narrow :
83+
{f : A → B} {g : A → C} {y : B} {z : C} →
84+
Echo < f , g > (y , z) → Narrow f g y z
85+
pair-fibre→narrow (x , p) = x , cong proj₁ p , cong proj₂ p
86+
87+
narrow→pair-fibre :
88+
{f : A → B} {g : A → C} {y : B} {z : C} →
89+
Narrow f g y z → Echo < f , g > (y , z)
90+
narrow→pair-fibre (x , p , q) = x , cong₂ _,_ p q
91+
92+
-- Round trips. Both close by matching the equation on `refl`; the
93+
-- indices `y`, `z` are variables, so this is `--without-K`-safe.
94+
narrow-to-from :
95+
{f : A → B} {g : A → C} {y : B} {z : C} →
96+
(e : Echo < f , g > (y , z)) →
97+
narrow→pair-fibre {f = f} {g = g} (pair-fibre→narrow e) ≡ e
98+
narrow-to-from (x , refl) = refl
99+
100+
narrow-from-to :
101+
{f : A → B} {g : A → C} {y : B} {z : C} →
102+
(w : Narrow f g y z) →
103+
pair-fibre→narrow {f = f} {g = g} (narrow→pair-fibre w) ≡ w
104+
narrow-from-to (x , refl , refl) = refl
105+
106+
-- Headline 1: binary narrowing IS the fibre of the pairing.
107+
fibre-intersection-iso :
108+
(f : A → B) (g : A → C) (y : B) (z : C) →
109+
Echo < f , g > (y , z) ↔ Narrow f g y z
110+
fibre-intersection-iso f g y z =
111+
mk↔ₛ′ pair-fibre→narrow narrow→pair-fibre
112+
(narrow-from-to {f = f} {g = g}) (narrow-to-from {f = f} {g = g})
113+
114+
----------------------------------------------------------------------
115+
-- Forgetting a constraint keeps the witness.
116+
----------------------------------------------------------------------
117+
118+
forget-left :
119+
{f : A → B} {g : A → C} {y : B} {z : C} → Narrow f g y z → Echo g z
120+
forget-left (x , _ , q) = x , q
121+
122+
forget-right :
123+
{f : A → B} {g : A → C} {y : B} {z : C} → Narrow f g y z → Echo f y
124+
forget-right (x , p , _) = x , p
125+
126+
-- Headline 2: narrowing is a refinement of the SAME candidate, never a
127+
-- different one. Both are definitional.
128+
forget-left-witness :
129+
{f : A → B} {g : A → C} {y : B} {z : C} (w : Narrow f g y z) →
130+
proj₁ (forget-left {f = f} w) ≡ proj₁ w
131+
forget-left-witness _ = refl
132+
133+
forget-right-witness :
134+
{f : A → B} {g : A → C} {y : B} {z : C} (w : Narrow f g y z) →
135+
proj₁ (forget-right {g = g} w) ≡ proj₁ w
136+
forget-right-witness _ = refl
137+
138+
----------------------------------------------------------------------
139+
-- Families of constraints indexed by `Fin n`.
140+
----------------------------------------------------------------------
141+
142+
-- `n` observations `fs i x ≡ ys i` on one witness `x`, stated pointwise
143+
-- (no function equality, hence no funext).
144+
NarrowFin : ∀ {n} (fs : Fin n → A → B) (ys : Fin n → B) → Set _
145+
NarrowFin {A = A} fs ys = Σ A (λ x → ∀ i → fs i x ≡ ys i)
146+
147+
-- Headline 3: a family of `suc n` constraints is one binary narrowing
148+
-- step on top of a family of `n`, in both directions, and the witness
149+
-- is untouched (both maps are `refl` on `proj₁`).
150+
narrow-fin-step-to :
151+
∀ {n} (fs : Fin (ℕ.suc n) → A → B) (ys : Fin (ℕ.suc n) → B) →
152+
NarrowFin fs ys →
153+
Σ A (λ x → (fs zero x ≡ ys zero) × (∀ i → fs (suc i) x ≡ ys (suc i)))
154+
narrow-fin-step-to fs ys (x , h) = x , h zero , (λ i → h (suc i))
155+
156+
narrow-fin-step-from :
157+
∀ {n} (fs : Fin (ℕ.suc n) → A → B) (ys : Fin (ℕ.suc n) → B) →
158+
Σ A (λ x → (fs zero x ≡ ys zero) × (∀ i → fs (suc i) x ≡ ys (suc i))) →
159+
NarrowFin fs ys
160+
narrow-fin-step-from fs ys (x , p , h) = x , step
161+
where
162+
step : ∀ i → fs i x ≡ ys i
163+
step zero = p
164+
step (suc i) = h i
165+
166+
narrow-fin-step-to-witness :
167+
∀ {n} (fs : Fin (ℕ.suc n) → A → B) (ys : Fin (ℕ.suc n) → B)
168+
(w : NarrowFin fs ys) →
169+
proj₁ (narrow-fin-step-to fs ys w) ≡ proj₁ w
170+
narrow-fin-step-to-witness _ _ _ = refl
171+
172+
narrow-fin-step-from-witness :
173+
∀ {n} (fs : Fin (ℕ.suc n) → A → B) (ys : Fin (ℕ.suc n) → B)
174+
(w : Σ A (λ x → (fs zero x ≡ ys zero) × (∀ i → fs (suc i) x ≡ ys (suc i)))) →
175+
proj₁ (narrow-fin-step-from fs ys w) ≡ proj₁ w
176+
narrow-fin-step-from-witness _ _ _ = refl
177+
178+
----------------------------------------------------------------------
179+
-- Narrowing shrinks the honest fibre count.
180+
----------------------------------------------------------------------
181+
182+
-- Decidable equality on pairs from decidable equality on the components.
183+
dec-× :
184+
((b₁ b₂ : B) → Dec (b₁ ≡ b₂)) →
185+
((c₁ c₂ : C) → Dec (c₁ ≡ c₂)) →
186+
(p q : B × C) → Dec (p ≡ q)
187+
dec-× _≟B_ _≟C_ (b , c) (b′ , c′) with b ≟B b′ | c ≟C c′
188+
... | yes refl | yes refl = yes refl
189+
... | yes _ | no ¬q = no (λ e → ¬q (cong proj₂ e))
190+
... | no ¬p | yes _ = no (λ e → ¬p (cong proj₁ e))
191+
... | no ¬p | no _ = no (λ e → ¬p (cong proj₁ e))
192+
193+
private
194+
≤-step : ∀ {m n} → m ≤ n → m ≤ ℕ.suc n
195+
≤-step z≤n = z≤n
196+
≤-step (s≤s p) = s≤s (≤-step p)
197+
198+
-- Headline 4: adding an observation never enlarges the enumerated
199+
-- candidate fibre. Walks the `FiberSize-fin` recursion on both sides in
200+
-- lock-step: a hit for the pair is a hit for `f`; a hit for `f` alone
201+
-- is a candidate the extra observation has ruled out.
202+
narrow-shrinks :
203+
∀ {n} (f : Fin n → B) (g : Fin n → C) (y : B) (z : C)
204+
(_≟B_ : (b₁ b₂ : B) → Dec (b₁ ≡ b₂))
205+
(_≟C_ : (c₁ c₂ : C) → Dec (c₁ ≡ c₂)) →
206+
FiberSize-fin < f , g > (y , z) (dec-× _≟B_ _≟C_) ≤ FiberSize-fin f y _≟B_
207+
narrow-shrinks {n = ℕ.zero} f g y z _≟B_ _≟C_ = z≤n
208+
narrow-shrinks {n = ℕ.suc m} f g y z _≟B_ _≟C_
209+
with f zero ≟B y | dec-× _≟B_ _≟C_ (< f , g > zero) (y , z)
210+
... | yes _ | yes _ = s≤s (narrow-shrinks (f ∘ suc) (g ∘ suc) y z _≟B_ _≟C_)
211+
... | yes _ | no _ = ≤-step (narrow-shrinks (f ∘ suc) (g ∘ suc) y z _≟B_ _≟C_)
212+
... | no ¬p | yes q = ⊥-elim (¬p (cong proj₁ q))
213+
... | no _ | no _ = narrow-shrinks (f ∘ suc) (g ∘ suc) y z _≟B_ _≟C_
214+
215+
----------------------------------------------------------------------
216+
-- Companion remark.
217+
--
218+
-- What is deliberately NOT claimed:
219+
--
220+
-- * Inhabitation. `Narrow f g y z` may be empty; joint observations
221+
-- can be inconsistent. squeakwell reports that as an empty
222+
-- candidate fibre, routed to review (rung R13), not as a theorem.
223+
-- * Covering ⇒ subsingleton. The survey's "if the observed masks
224+
-- cover every modality the fibre is a subsingleton" needs equality
225+
-- of full sections from pointwise equality, i.e. extensionality, and
226+
-- opaque identifiers. Dropped in the route plan; not here.
227+
-- * A `_↔_` for the `Fin n` family step. The pointwise maps exist and
228+
-- preserve the witness; the function-side round trip would need
229+
-- funext and is left out rather than taken as a hypothesis.
230+
----------------------------------------------------------------------

0 commit comments

Comments
 (0)