Skip to content

Commit e237bff

Browse files
Merge branch 'main' into wf-1-core-wellfounded
2 parents 4c58d51 + 4238ded commit e237bff

15 files changed

Lines changed: 1346 additions & 915 deletions

docs/echo-types/composition.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Echo Types — Composition
2+
3+
**Status:** working note mixing established results and open
4+
conjectures. Every result backed by the current Agda development is
5+
marked *Agda-backed*; every conjectural claim is labelled explicitly.
6+
7+
---
8+
9+
## The central question
10+
11+
Given `f : A → B` and `g : B → C`, how does `Echo(g ∘ f) : C → Set`
12+
relate to `Echo(f) : B → Set` and `Echo(g) : C → Set`?
13+
14+
Three candidate answers to rule between:
15+
16+
1. **Accumulation.** The echoes stack: `Echo(g ∘ f) y` factors as
17+
`(Echo(f) b × Echo(g) y)` integrated over intermediates `b`.
18+
2. **Weakening.** The echo of `g ∘ f` is *strictly less informative*
19+
than `Echo(f)` alone — composition can only lose more.
20+
3. **Cancellation.** When `g` has a section, `Echo(g ∘ f)` is
21+
isomorphic to `Echo(f)`.
22+
23+
The current Agda evidence strongly favours **accumulation** as the
24+
base case and **cancellation** as a corollary. Weakening is true at
25+
the shadow level but not generally at the intensional core.
26+
27+
---
28+
29+
## Accumulation — Agda-backed (base case)
30+
31+
*Lemma.* For `f : A → B` and `g : B → C`, the type
32+
`Echo(g ∘ f) y` is canonically isomorphic to
33+
`Σ B (λ b → Echo(f) b × (g b ≡ y))`.
34+
35+
*Proof sketch.* Σ-associativity plus propositional-equality
36+
rearrangement. In Agda terms, given
37+
```
38+
Echo f b = Σ A (λ x → f x ≡ b)
39+
Echo g y = Σ B (λ b → g b ≡ y)
40+
Echo (g ∘ f) y = Σ A (λ x → g (f x) ≡ y)
41+
```
42+
the iso is witnessed by
43+
```
44+
to : Σ A (λ x → g (f x) ≡ y) → Σ B (λ b → Σ A (λ x → f x ≡ b) × (g b ≡ y))
45+
to (x , p) = (f x , (x , refl) , p)
46+
from : Σ B (λ b → Σ A (λ x → f x ≡ b) × (g b ≡ y)) → Σ A (λ x → g (f x) ≡ y)
47+
from (b , (x , refl) , p) = (x , p)
48+
```
49+
and both round-trips are `refl`. Formalisation is routine and not
50+
yet in the repo; it is the cleanest candidate for the next
51+
composition lemma to land.
52+
53+
*Agda adjacency.* `Echo.map-over-comp` proves functoriality of the
54+
derived action on echoes; this is the morphism side of the same
55+
composition law. The *object-side* isomorphism above is not yet
56+
proved but is a straightforward next milestone.
57+
58+
---
59+
60+
## Cancellation — expected corollary
61+
62+
*Conjecture.* If `g : B → C` has a section `s : C → B` with
63+
`g ∘ s ≡ id`, then `Echo(g ∘ f) y ≃ Echo(f) (s y)` for every `y`.
64+
65+
*Rationale.* Composing with an injection loses no information, so
66+
the intermediate factor in the accumulation law collapses to a
67+
single witnessed point.
68+
69+
*Status.* Not proved. Depends on the accumulation isomorphism plus
70+
a section lemma that the current repo has pieces of (see
71+
`no-section-weaken` in `EchoLinear` for the negative direction).
72+
73+
---
74+
75+
## Weakening — true at the shadow, false at the core
76+
77+
*Observation (Agda-backed).* At the extensional shadow,
78+
`Shadow(g ∘ f) ⊆ Shadow(g)`, because `image(g ∘ f) ⊆ image(g)`. So
79+
at the shadow level, composition weakens: you cannot learn more
80+
after an additional forgetful step.
81+
82+
*Counter at the core.* At the intensional core, `Echo(g ∘ f) y` can
83+
carry *more* witness structure than `Echo(g) y` alone — specifically,
84+
it records which `b ∈ Echo(g) y` came via `f`. This is the content
85+
of the accumulation iso above: the composed echo is the sum-total,
86+
not just the outer fiber.
87+
88+
*Summary.* Weakening is a shadow-level phenomenon. At the core,
89+
composition *accumulates* witnesses rather than losing them.
90+
91+
---
92+
93+
## Open questions
94+
95+
### Q1. 2-categorical structure
96+
97+
*Question.* Is there a 2-category whose objects are types, whose
98+
1-morphisms are maps, and whose 2-morphisms are echo-preserving
99+
transformations? `EchoCategorical.agda` hints at this but does not
100+
commit to a full 2-categorical axiomatisation.
101+
102+
*Why it matters.* If yes, the composition laws are the coherence
103+
laws of the 2-category. If no, the composition laws are ad-hoc and
104+
probably a sign the residue structure is subtler than we modelled.
105+
106+
### Q2. Negative echoes
107+
108+
*Question.* Is there a systematic dual to `Echo(f)` — call it
109+
`CoEcho(f)` — that records *what has been lost* rather than what
110+
remains? For a linear map this would correspond to the kernel; for
111+
a general map, to a typed analogue of the fibre-wise "information
112+
loss".
113+
114+
*Candidate.* `CoEcho(f)(y) = (something like) "equivalence class of
115+
preimages of y modulo identity"`. The tropical / metric echo
116+
(`EchoTropical.agda`) may be the first instance.
117+
118+
*Status.* Speculative. Worth developing alongside approximate
119+
echoes.
120+
121+
### Q3. Composition of approximate echoes
122+
123+
*Question.* Under the approximate-echo definition (taxonomy,
124+
axis 2), does composition give a clean tolerance calculus?
125+
126+
*Conjecture.* For metric-tolerance echoes,
127+
`ε₁-echo(f) ⊙ ε₂-echo(g) ⊑ (ε₁ + L_g · ε₂)-echo(g ∘ f)` where `L_g`
128+
is a Lipschitz constant of `g`. This is a crude first guess — the
129+
right form may involve sup-norms, dilation-operators, or
130+
coarser bounds.
131+
132+
*Status.* Entirely speculative. Requires a formal definition of
133+
approximate echo first.
134+
135+
### Q4. Associativity
136+
137+
*Question.* Does the accumulation isomorphism above satisfy the
138+
pentagon coherence for three-fold composition? I.e., for
139+
`f : A → B`, `g : B → C`, `h : C → D`, does the two ways of
140+
associating `Echo((h ∘ g) ∘ f) = Echo(h ∘ (g ∘ f))` yield equivalent
141+
iso's?
142+
143+
*Expectation.* Yes, but the proof requires the iso to land as a
144+
`map-over` morphism whose `commute` field is itself proved by
145+
pentagon-style transitivity. `Echo.map-over-comp` already bottles
146+
the relevant shape. Proving pentagon on top is routine but not
147+
written down.
148+
149+
### Q5. Interaction with role-indexing, gradings, linearity
150+
151+
*Question.* The existing repo modules `EchoIndexed`, `EchoGraded`,
152+
`EchoLinear` each decorate the basic echo with extra structure
153+
(role index, grade label, mode tag). Does composition commute with
154+
these decorations, or do some decorations require refined
155+
composition laws?
156+
157+
*Evidence.* `EchoGraded.degrade-comp` is the first hint of a
158+
graded-composition law. Linear echoes via `EchoLinear.weaken` behave
159+
by weakening along mode transitions. No systematic cross-check
160+
between these decorations has been attempted.
161+
162+
### Q6. Composition in the presence of recovery / echo-erasure
163+
164+
*Question.* When a downstream stage "uses" the echo — extracts the
165+
preimage `x` and re-applies `f` to reconstruct `y` — the echo is
166+
temporarily made definite. Does the composition law respect this
167+
extraction?
168+
169+
*Formalisation hint.* Probably expressible as a 2-cell in the
170+
hypothetical 2-category of Q1. Not attempted.
171+
172+
---
173+
174+
## Composition laws — a compact statement
175+
176+
Collecting the above:
177+
178+
1. **(Agda-backed) Base accumulation iso.**
179+
`Echo(g ∘ f) y ≃ Σ B (λ b → Echo(f) b × (g b ≡ y))`.
180+
181+
2. **(Agda-backed) Functorial action.** `map-over` respects
182+
composition: `map-over (g' , c₁) ∘ map-over (f' , c₂) ≡ map-over
183+
((g' ∘ f') , coherence)`. Proved in `Echo.map-over-comp`.
184+
185+
3. **(Expected) Cancellation.** `Echo(g ∘ f) y ≃ Echo(f) (s y)` when
186+
`g` has a section `s`.
187+
188+
4. **(Open) Pentagon.** Three-fold composition associates.
189+
190+
5. **(Open) Tolerance calculus.** For approximate echoes, tolerances
191+
compose with a Lipschitz-like law.
192+
193+
6. **(Open) Decoration commuting.** Role, grade, linearity, and
194+
modal decorations commute with composition under conditions to be
195+
identified.
196+
197+
---
198+
199+
## What to formalise next
200+
201+
Ranked by unblock-value:
202+
203+
1. **Base accumulation iso.** Single Agda proof, no new modules
204+
needed. Would add `Echo-comp-iso` to `Echo.agda`.
205+
2. **Cancellation corollary.** One paragraph on top of (1).
206+
3. **Pentagon coherence.** Moderate proof, probably one more lemma.
207+
4. **Approximate-echo skeleton.** New module
208+
`EchoApprox.agda` defining ε-echoes and restating (1) in the
209+
approximate setting. This is where axis 2 of the taxonomy gets
210+
teeth.
211+
5. **Decoration commuting.** Per-decoration lemmas in the existing
212+
`EchoGraded`, `EchoLinear`, `EchoIndexed` modules.
213+
214+
None of these depend on the blocked Buchholz-WF / shared-binder
215+
work. All are Sonnet-class proofs; (4) is Opus 4.7 design and
216+
Sonnet execution.

0 commit comments

Comments
 (0)