Commit 2105e11
feat: echo-search-product — bounded product (sequential) search composition (#254)
## What
Closes the **last** "where next" gap in `EchoSearch` — product
(sequential) composition of bounded searches. This is gap 3-of-3 from
the proof survey (decidability #251 and Lipschitz #252 already merged).
## The correction
The module's original sketch — `EchoS … f b n₁ → EchoS … g y n₂ → EchoS
… (g ∘ f) y (n₁ * n₂)` — is **ill-typed**: the second search produces a
`g`-preimage of `y` over its *own* enumerator, with no tie to the first
search's output `b`, so `g (f x) ≡ y` doesn't follow. The well-typed
composition is the **product** of two independent searches:
```agda
productEnum n₂ enum₁ enum₂ k = (enum₁ (k / n₂) , enum₂ (k % n₂))
echo-search-product :
EchoS enum₁ f₁ y₁ n₁ → EchoS enum₂ f₂ y₂ n₂ →
EchoS (productEnum n₂ enum₁ enum₂) (productMap f₁ f₂) (y₁ , y₂) (n₁ * n₂)
```
## How (the row-major pairing)
The witness pairs the two step indices as `k₂ + k₁ * n₂`:
- **bound** `< n₁ * n₂`: `k₂ + k₁*n₂ < n₂ + k₁*n₂ = suc k₁ * n₂ ≤ n₁ *
n₂` (`+-monoˡ-<` then `*-monoˡ-≤`);
- **recovery**: `/ n₂ ≡ k₁` (`+-distrib-/-∣ʳ` + `m*n/n≡m` + `m<n⇒m/n≡0`)
and `% n₂ ≡ k₂` (`[m+kn]%n≡m%n` + `m<n⇒m%n≡m`).
The `n₁ * n₂` budget **provably requires** this budget-dependent pairing
— a global `ℕ × ℕ ↔ ℕ` cannot keep `pair (n₁-1) (n₂-1) < n₁ * n₂` —
which is exactly why it divides by `n₂` and carries `NonZero n₂` (a
zero-width second dimension admits no witness anyway). That's the
bijection the module deferred "to the slice that wants it".
## Discipline
- `--safe --without-K`, **zero postulates**, structural.
- 3 Smoke pins (`productMap`, `productEnum`, `echo-search-product`); the
"where next" note marked LANDED with the ill-typed-sketch correction.
- **Verified on latest `main`:** `EchoSearch`, `Smoke.agda`, `All.agda`
all exit 0; `kernel-guard.sh` PASS (existing module — no new module).
## Context
This is the **final** gap from the proof-surface survey. With it, the
echo-types proof surface is gap-free apart from the deliberately
**parked** ordinal/fidelity ladder and the author-driven Pillar E paper.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_018CaSgNjNURC7ocsyjYh9We
---
_Generated by [Claude
Code](https://claude.ai/code/session_018CaSgNjNURC7ocsyjYh9We)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1d6c035 commit 2105e11
2 files changed
Lines changed: 74 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| |||
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | | - | |
| 85 | + | |
81 | 86 | | |
82 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
88 | | - | |
| 96 | + | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
| |||
194 | 202 | | |
195 | 203 | | |
196 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
488 | 491 | | |
489 | 492 | | |
490 | 493 | | |
| |||
0 commit comments