Skip to content

Commit a0d6bee

Browse files
committed
docs(echo): re-center on retained-loss lineage; refine echo decisions
Per authoritative Echo design decisions: - Principle: Echo = structured, proof-relevant loss; the semantic object is retained-loss lineage/provenance, not a generic Σ-type or decorative effect. Reframed echo.rs + JtvEcho.lean accordingly (fibre = lineage carrier). - Echo source: infer-by-default + @echo(safe|neutral|breaking) checked annotations (not infer-only; needed at boundaries/foreign/audited APIs). Added @echo to spec §7. - Numeric conversions carry echo (3-way): exact⇒Safe, lossy+residue⇒Neutral, lossy-no-residue⇒Breaking; Float→Int per residue retention. Revised spec §12. - Effect-now/value-later: reserve AST/grammar for value-level Echo<T>. - Formal: JtvEcho.lean authoritative for JtV semantics; Agda↔Lean bridge deferred to Phase 4; grammar v2 not blocked on it. https://claude.ai/code/session_01EJLZKDtcF1RGdKx6TcUTQG
1 parent 39d9a9d commit a0d6bee

5 files changed

Lines changed: 67 additions & 29 deletions

File tree

ALIGNMENT-AFFINESCRIPT.adoc

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,32 @@ truthing discipline, because a mechanized proof cannot lie.
117117

118118
==== Design decisions (2026-06-02)
119119

120-
. *Echo is effect-only (value type later)* — a static dimension alongside
121-
`Purity`, not a value type (spec §12). A first-class `Echo<T>` value type is
122-
deferred; the AST/`Type` are to be designed so it can be added *without
123-
rework*.
120+
Echo's semantic object is *retained-loss lineage* — proof-relevant provenance of
121+
collapsed/weakened/sampled/projected/degraded information. It is **not** a
122+
generic wrapper, a generic Σ-type, or a decorative effect.
123+
124+
. *Echo is effect-only (value type later)* — for grammar v2, Echo is an effect
125+
*classification dimension* alongside `Purity`, not a first-class runtime
126+
residue type. The AST/grammar shape is reserved so a value-level `Echo<T>`
127+
(carrying the residue) can be added later *without redesign*.
124128
. *Safe-only reversal* — reverse blocks accept only `EchoSafe`; `Neutral` and
125-
`Breaking` are rejected (see §9 implementation note).
126-
. *Echo source = inference only (no annotation)* — echo is inferred from
127-
operation shape; there is no `@echo` annotation. *Lossy numeric widening*
128-
(e.g. `Float→Int`) carries `EchoNeutral`, which revises spec §12's "widening
129-
independent of echo" (the value type is still unaffected — echo is a separate
130-
dimension). [Phase-2 implementation: wire echo through `infer_data_expr`.]
131-
. *Agda↔Lean proof bridge: independent* — `JtvEcho.lean` re-mechanizes the
132-
model; `echo-types` remains the sibling Agda source of truth, cited not linked.
129+
`Breaking` are rejected (see §9 implementation note). This is stricter than the
130+
earlier spec but matches current interpreter reality. Later, `EchoNeutral` may
131+
be admitted *only* with an explicit carried Bennett residue / residue inversion.
132+
. *Echo source = infer + `@echo` annotations* — inferred from operation shape by
133+
default, with `@echo(safe|neutral|breaking)` accepted as *checked*
134+
declarations/overrides. Not infer-only (boundaries, foreign calls, and audited
135+
APIs need declarations) and not annotation-everywhere. [Phase-2: wire echo
136+
through `infer_data_expr` + parse `@echo`.]
137+
. *Numeric conversions carry echo* (revises spec §12 "independent of echo"):
138+
exact/injective representation-preserving ⇒ `EchoSafe`; lossy but
139+
residue-retained ⇒ `EchoNeutral`; lossy without usable residue ⇒ `EchoBreaking`.
140+
`Float→Int` is `Neutral` or `Breaking` per residue retention. The *value* type
141+
is still unaffected — echo is a separate dimension.
142+
. *Formal layer: independent Lean for Phase 2* — `JtvEcho.lean` is authoritative
143+
for JtV implementation semantics now; `echo-types` Agda remains the conceptual
144+
source/reference. The Agda↔Lean bridge is deferred to Phase 4; grammar v2 is
145+
*not* blocked on a cross-prover bridge.
133146

134147
=== Phase 2 — Echo Types in the checker (commenced here)
135148

crates/jtv-core/src/echo.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
66
// This implements the type-checker side of JtV's Echo system (spec v2 §8–9,
77
// §12) and is the executable counterpart of the formal model in
88
// `jtv_proofs/JtvEcho.lean`. The taxonomy aligns with the `echo-types` Agda
9-
// library (hyperpolymath/echo-types) and its companion `EchoTypes.jl`:
9+
// library (hyperpolymath/echo-types) and its companion `EchoTypes.jl`.
10+
//
11+
// PRINCIPLE: Echo is about *structured, proof-relevant loss* — information may
12+
// be collapsed, weakened, sampled, projected, or degraded, but the
13+
// residue / provenance / lineage of that loss is still representable. Echo is
14+
// NOT a generic wrapper, a generic Σ-type, or a decorative effect; the object
15+
// of interest is *retained-loss lineage*.
1016
//
1117
// * `Safe` — no loss: the operation is injective / reversible
12-
// (`+` ↔ `-`). Its fibre over any output is a subsingleton.
13-
// * `Neutral` — structured loss (non-total erasure): information is lost
14-
// but a residue witness is retained.
15-
// * `Breaking` — total erasure: information is destroyed; not invertible.
18+
// (`+` ↔ `-`). Its fibre over any output is a subsingleton,
19+
// so the lineage is trivial.
20+
// * `Neutral` — structured loss: information is collapsed, but a residue
21+
// carrying the loss lineage/provenance is retained.
22+
// * `Breaking` — total erasure: lineage is destroyed; not invertible.
1623
//
1724
// Lattice order: `Safe ⊑ Neutral ⊑ Breaking` (join loses guarantees). The
1825
// headline rule, proved as `blockEcho_admissible` in Lean, is that a reverse

jtv_proofs/JtvEcho.lean

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
with the `echo-types` Agda library (hyperpolymath/echo-types) and its
66
executable companion `EchoTypes.jl`.
77
8-
An **Echo** classifies the information-loss behaviour of an operation:
9-
10-
* `safe` — no loss. The operation is injective / reversible
11-
(its fibre over any output is a subsingleton).
12-
* `neutral` — *structured loss* (non-total erasure). Information is lost,
13-
but a residue witness is retained: the fibre
14-
`Echo f y := Σ x, f x = y` is non-trivial yet bounded.
15-
* `breaking` — *total erasure*. Information is destroyed and cannot be
16-
recovered or inverted.
8+
PRINCIPLE: Echo is about *structured, proof-relevant loss* — information may
9+
be collapsed, weakened, sampled, projected, or degraded, but the
10+
residue / provenance / lineage of that loss is still representable. The fibre
11+
`Echo f y := Σ x, f x = y` is used not as a generic Σ-type but as the carrier
12+
of *retained-loss lineage*: it records which inputs were collapsed into `y`.
13+
14+
An **Echo** classifies the loss behaviour of an operation:
15+
16+
* `safe` — no loss. The operation is injective / reversible; its fibre
17+
over any output is a subsingleton, so lineage is trivial.
18+
* `neutral` — *structured loss*. Information is collapsed, but the fibre
19+
retains the loss lineage (non-trivial yet bounded).
20+
* `breaking` — *total erasure*. Lineage is destroyed; cannot be inverted.
1721
1822
Lattice order: `safe ⊑ neutral ⊑ breaking` (join moves rightward, losing
1923
guarantees — mirroring the effect lattice `Total ⊑ Pure ⊑ Impure`).

spec/jtv_v2_type_system_corrected.adoc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ Note: termination is per-input, not bounded.
8989
@impure:
9090
- unrestricted
9191

92+
Echo annotations (orthogonal to purity):
93+
94+
@echo(safe|neutral|breaking):
95+
- checked declaration/override of an operation's loss class
96+
- inferred from operation shape when absent
97+
- required at boundaries, foreign calls, and audited APIs (not inferred there)
98+
9299
== 8. Echo System
93100

94101
The Echo system tracks *structured loss (non-total erasure)*. Its canonical
@@ -171,7 +178,10 @@ Future:
171178
- Safe fragment termination holds
172179
- Halting boundary is syntactic
173180
- Echo does not affect value typing (Echo is a separate effect dimension)
174-
- Lossy widening (e.g. Float→Int) raises echo to EchoNeutral; lossless widening
175-
stays EchoSafe. (Revises the earlier "widening independent of echo": widening
176-
may raise the echo dimension, though it still never changes the value type.)
181+
- Numeric conversions carry echo (revises "widening independent of echo"):
182+
* exact / injective representation-preserving conversion ⇒ EchoSafe
183+
* lossy but residue-retained conversion ⇒ EchoNeutral
184+
* lossy without usable residue ⇒ EchoBreaking
185+
(e.g. Float→Int is EchoNeutral or EchoBreaking per residue retention.)
186+
The conversion still never changes the *value* type — echo is separate.
177187

verification/PROOF-CAPABILITY-MATRIX.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ induction. Corrected as part of the Phase-1 doc-truthing pass.
9494
The Rust gate (`TypeChecker::check_echo_admissible`) raises
9595
`JtvError::EchoViolation` exactly when `blockEcho_admissible` returns `false`.
9696

97+
*Authority:* `JtvEcho.lean` is authoritative for JtV implementation semantics;
98+
the `echo-types` Agda library is the conceptual source/reference. The Agda↔Lean
99+
bridge is deferred to Phase 4 — grammar v2 is not blocked on a cross-prover bridge.
100+
97101
== Outstanding proof work (sequenced in ALIGNMENT-AFFINESCRIPT.adoc)
98102

99103
* PROOF-1 `parser_correctness` (High) — `absent`.

0 commit comments

Comments
 (0)