Skip to content

Commit 86f8b12

Browse files
hyperpolymathclaude
andcommitted
docs: add FOUNDATIONS-BRIDGE.adoc (CC-BY-SA-4.0) under docs/
The two-foundations integration brief — echo-types (residual-modality axis, Agda Echo.*) + tropical-resource-typing (resource-grade axis, Lean Resource.*) — as AsciiDoc under docs/ per the estate doc-format rule, with a single-SPDX CC-BY-SA-4.0 prose header (ShareAlike, owner ruling 2026-06-04). Supersedes the root FOUNDATIONS_BRIDGE.md's non-conformant multi-SPDX header. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9fbb6be commit 86f8b12

1 file changed

Lines changed: 197 additions & 0 deletions

File tree

docs/FOUNDATIONS-BRIDGE.adoc

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
// SPDX-License-Identifier: CC-BY-SA-4.0
2+
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
// Prose documentation → CC-BY-SA-4.0 per the hyperpolymath licence policy
4+
// (sole-owner repos: code = MPL-2.0, prose docs = CC-BY-SA-4.0; owner ruling
5+
// 2026-06-04). The MPL-2.0 / CC-BY-SA-4.0 split this brief describes is a
6+
// REPO-level fact, expressed one-SPDX-per-file by file type — never two SPDX
7+
// ids in one file (the estate spdx-policy-guard fails on contradictory
8+
// multi-SPDX). The "two badges" belong in repo settings / LICENSES/, not here.
9+
= Foundations bridge — consuming `echo-types` and `tropical-resource-typing`
10+
:toc: macro
11+
:toclevels: 2
12+
:source-highlighter: rouge
13+
14+
[.lead]
15+
This is a downstream integration brief for `my-lang` or any other consumer of
16+
the two foundations. It coordinates their outputs; it *adds no new proofs*.
17+
Every theorem named below is already mechanised upstream — this document only
18+
tells a downstream language _how to depend on the two foundations without
19+
collapsing them into each other_.
20+
21+
.Source of truth
22+
[cols="1,1,1,2", options="header"]
23+
|===
24+
| Foundation | Axis exported | Contract | Machine-checked in
25+
26+
| `tropical-resource-typing`
27+
| resource-grade axis
28+
| `FOUNDATION_CONTRACT.md`
29+
| Lean 4 `Resource.*`
30+
31+
| `echo-types`
32+
| residual-modality axis
33+
| `FOUNDATION_CONTRACT.md`
34+
| Agda `Echo.*` (`--safe --without-K`)
35+
|===
36+
37+
toc::[]
38+
39+
== 1. Two independent axes
40+
41+
A consumer tracks *two orthogonal things*. They are not refinements of one
42+
another and they meet only at the one-directional seam in <<_2_the_seam,§2>>.
43+
44+
NOTE: The numbering (`1`, `3`) follows the upstream axis taxonomy. Only these
45+
two axes are in scope for this brief; they are mutually independent at the core.
46+
47+
=== Axis 1 — Resource algebra (`tropical-resource-typing`)
48+
49+
* *What it is:* binder/resource _quantities_ — usage, cost, latency, critical
50+
path, bottleneck — living in an ordered-semiring / usage-algebra interface.
51+
* *Interface:* `Resource.ResourceAlgebra` (= `Resource.ResourceSemiring` + an
52+
order). `⊞` = choice/alternative, `⊠` = sequential composition.
53+
* *Instances:* `Resource.Instances.{Linear, Affine, MaxPlus, MinPlus, MinMax}`
54+
— i.e. linear / affine usage and the tropical (max-plus / min-plus / min-max)
55+
algebras. The tropical instances double as an *infinite-carrier stress test*
56+
(`Resource.Stress`, `Resource.Infinite`).
57+
* *Used by:* QTT-style / quantitative *resource soundness*. Prove soundness
58+
_parametrically_ over the interface via `Resource.ConsumerLawBundle`
59+
(`parametric_resource_transport`, alias `resource_laws_sufficient_for_consumers`),
60+
then instantiate at any algebra above with no algebraic re-proof.
61+
62+
=== Axis 3 — Echo modality (`echo-types`)
63+
64+
* *What it is:* structured *residue / loss / forgetting / projection* — the
65+
remainder of an information-losing map, `Echo f y := Σ (x : A), (f x ≡ y)`.
66+
* *Indexed by a thin poset:* `Echo.Index.ThinPoset`; the canonical index is the
67+
three-point loss order `keep ≤ residue ≤ forget` (`grade-thinPoset`). Thinness
68+
(order proofs are propositional) is load-bearing, not cosmetic.
69+
* *Proves residual metatheory:* `Echo.Modality.Core` /
70+
`Echo.Modality.Interface` give `degrade`, the unit law `degrade-id`, the
71+
path-independence law `degrade-compose`, and the no-section theorem
72+
`no-section-of-collapsing-map`; the downstream-instantiable record is
73+
`EchoModality` (canonical witness `grade-echoModality`).
74+
* *Independent of the resource algebra at the core:* `Echo.Modality.Core`,
75+
`Echo.Modality.Interface`, and `Echo.Index.ThinPoset` import *no*
76+
semiring / resource-algebra machinery. The proof-relevant content of `degrade`
77+
is carried by the thin order of the index, not by any semiring-valued grade.
78+
79+
== 2. The seam
80+
81+
The only sanctioned connection between the axes is a *measure*, pointing in
82+
exactly one direction:
83+
84+
[source]
85+
----
86+
ResidueMeasure : Echo residue ──▶ ResourceAlgebra carrier
87+
----
88+
89+
* *Direction:* a resource algebra is _consumed as a measure by_ Echo. The
90+
residue carrier is opaque; only the codomain is a resource algebra.
91+
* *Never the reverse:* Echo is *not* produced as a resource instance, nor as
92+
a `Soundness(R)` instance.
93+
94+
The seam is mechanised on both sides — pick whichever framing matches your
95+
downstream proof obligation; both fix the same `E → R` direction:
96+
97+
*echo-types side (order-monotone view)* — `Echo.Measure.Interface`:
98+
99+
[source,agda]
100+
----
101+
record ResidueMeasure (E : EchoModality P ℓc) (R : OrderedCarrier ℓm ℓo) where
102+
field
103+
measure : ∀ {i} → ⟦ i ⟧ → Carrier R
104+
monotone : ∀ {i j} (p : i ≤ j) (x : ⟦ i ⟧) →
105+
measure x ≤R measure (degrade p x)
106+
----
107+
108+
*tropical side (monoid-homomorphism view)* — `Resource.EchoBridge`:
109+
110+
[source,lean]
111+
----
112+
structure ResidueMeasure (E : Type) (R : Type) [ResourceAlgebra R] where
113+
combine : E → E → E -- Echo-side residue accumulation (opaque)
114+
empty : E
115+
measure : E → R -- the measurement into a resource grade
116+
measure_empty : measure empty = one
117+
measure_combine : ∀ e₁ e₂, measure (combine e₁ e₂) = measure e₁ ⊠ measure e₂
118+
----
119+
120+
In both, the residue carrier `E` carries *no* `ResourceAlgebra` instance and
121+
nothing gives it one. `echo-types` and `tropical-resource-typing` have *no
122+
dependency on each other*; the seam is supplied downstream.
123+
124+
== 3. Downstream import pattern
125+
126+
A consuming language (e.g. `my-lang`) should expose:
127+
128+
[source]
129+
----
130+
Resource parameter R : ResourceAlgebra -- Axis 1
131+
Echo parameter E : EchoModality -- Axis 3
132+
Optional seam M : ResidueMeasure E R -- §2, only if you measure residues
133+
----
134+
135+
Prove resource soundness against `R` parametrically (quote
136+
`Resource.ConsumerLawBundle`), instantiate Echo at your own fibration via
137+
`EchoModality`, and reach for `M` _only_ when you genuinely measure residues.
138+
139+
It should *not* introduce any of:
140+
141+
* ✗ Echo as an instance of `ResourceAlgebra`
142+
* ✗ Echo as an instance of `Soundness(R)` (resource soundness)
143+
* ✗ Tropical (any of the resource instances) as an Echo modality
144+
145+
These three are exactly the collapses the foundations are built to prevent.
146+
147+
== 4. Vocabulary
148+
149+
Use these three terms precisely — they name three orthogonal things:
150+
151+
[cols="1,3", options="header"]
152+
|===
153+
| Use | Meaning
154+
155+
| *resource grade*
156+
| a binder/resource quantity on the resource-algebra axis (Axis 1)
157+
158+
| *echo index*
159+
| an inhabitant of the thin-poset index of the Echo modality, e.g.
160+
`keep ≤ residue ≤ forget` (Axis 3)
161+
162+
| *residue measure*
163+
| a resource-algebra-valued _observation_ of an Echo residue (the §2 seam)
164+
|===
165+
166+
*Avoid / deprecate `echo-grade`.* It ambiguously fuses the _echo index_ (the
167+
retention axis of the modality) with the _resource grade_ (the semiring axis) —
168+
which is precisely the collapse this bridge forbids. If the term must be
169+
explained, explain it as that ambiguity.
170+
171+
== 5. Boundary invariants
172+
173+
These hold as mechanised upstream results; downstream code must not violate them.
174+
175+
. *Echo IS-NOT a resource instance.* Do not model Echo as a `Soundness(S)` /
176+
resource-algebra instance. (Upstream: `Echo.Separation.NotResourceInstance`;
177+
the proof-relevant Echo structure is carried by thinness of the index, not by
178+
any semiring grade.)
179+
. *Tropical IS a resource-algebra instance.* Max-plus / min-plus / min-max are
180+
instances of `Resource.ResourceAlgebra` and belong on the resource-grade axis
181+
— they are not Echo modalities.
182+
. *Residue measures are observations, not definitions of Echo.* A
183+
`ResidueMeasure` is a lossy, one-directional read-out; `Echo.Modality.Core`
184+
never depends on it, and never may.
185+
. *Equal residue measure does not imply equal Echo.* A measure can send two
186+
genuinely-distinct Echo residues to the same value while the modality keeps
187+
them apart — so no measure is the identity criterion of Echo. (Upstream:
188+
`equal-measure-does-not-imply-equal-echo`, and the sharper informative-measure
189+
witness `equal-informative-measure-does-not-imply-equal-echo`.)
190+
191+
'''
192+
193+
[.text-right]
194+
_This brief restates the two `FOUNDATION_CONTRACT.md` files for the downstream
195+
direction and adds nothing to them. For the full contracts and the parametric
196+
transport / anti-collapse theorems, read each foundation's `FOUNDATION_CONTRACT.md`
197+
and (tropical) `docs/ECHO-RESIDUE-BRIDGE.adoc`._

0 commit comments

Comments
 (0)