Skip to content

Commit 4403fe0

Browse files
committed
docs: weave visible-decomposition narrative into spec, curriculum, examples, manifests
Second pass after the survey — extend the Echo "decomposition must be visible" narrative consistently across the remaining human and bot documentation, and add a runnable example. Kept strictly Error-Lang-specific. Human docs: - docs/Error-Lang.adoc: new "Structured Loss Is Visible (Echo)" design principle beside Jenga Semantics; Echo/EchoR keywords; Echo statement + annotation syntax. - docs/Curriculum.adoc: new "Lesson 11: Structured Loss (Echo)". - docs/Educational-Framework.adoc: Echo decomposition bullet in Week 5-6. - docs/Error-Categories.adoc: Echo-erasure stability debit under Stability Score Impact (noted as a deliberate cost, not an error category). Example: - examples/11-echo-decomposition.err: runnable demo — echo, projection, echo_to_residue with a visible stability drop, residue_strictly_loses, and echo_input-on-residue rejected in a gutter zone. Bot manifests: - ECOSYSTEM.a2ml: fill purpose/role/category; record the Echo lineage (echo-types, EchoTypes.jl) under related-projects. - AGENTIC.a2ml: agent constraint preserving visible decomposition.
1 parent 198fa0a commit 4403fe0

7 files changed

Lines changed: 129 additions & 4 deletions

File tree

.machine_readable/6a2/AGENTIC.a2ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ can-create-files = true
2020
# - Never use banned languages (TypeScript, Python, Go, etc.)
2121
# - Never place state files in repository root (must be in .machine_readable/)
2222
# - Never use AGPL license (use MPL-2.0)
23+
# - Never break VISIBLE DECOMPOSITION for Echo types:
24+
# * do not make echo_to_residue a silent cast
25+
# * do not let EchoR<A,B> behave like / coerce to Echo<A,B>
26+
# * do not hide the erasure stability debit ([Stab-Erase])
27+
# (see docs/Echo-Decomposition.adoc, spec/type-system.md §7)
2328

2429
[maintenance-integrity]
2530
fail-closed = true

.machine_readable/6a2/ECOSYSTEM.a2ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ last-updated = "2026-04-11"
88

99
[project]
1010
name = "Error Lang"
11-
purpose = ""
12-
role = ""
11+
purpose = "A dissembling/decompositional educational language that makes the decay and structured loss of programs, semantics, and types VISIBLE."
12+
role = "Operational, stability-aware embedding of the Echo (structured-loss) lineage; the decomposition-visible member of the Echo family."
1313

1414
[position-in-ecosystem]
15-
category = ""
15+
category = "educational-programming-language"
1616

1717
[related-projects]
1818
projects = [
19-
# No related projects recorded
19+
# The Echo (structured-loss) lineage that Error-Lang's Echo<A,B>/EchoR<A,B> embed.
20+
# Error-Lang stays Error-Lang-specific (visible decomposition); it does not
21+
# re-export these repos' exposition.
22+
{ name = "echo-types", owner = "hyperpolymath", role = "source of mechanized truth (Agda): Echo f y := Σ(x:A), (f x ≡ y)" },
23+
{ name = "EchoTypes.jl", owner = "hyperpolymath", role = "finite-domain executable model (Julia) — a model, not a proof" },
2024
]

docs/Curriculum.adoc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,40 @@ end
296296
* Error cascades
297297
* Panic mode recovery
298298

299+
=== Lesson 11: Structured Loss (Echo)
300+
301+
**Concept**: Decomposition made visible — loss can be structured, but it is never free or hidden
302+
303+
**The Problem**:
304+
Most languages discard information silently. Error-Lang makes the *moment of loss*
305+
observable: an `Echo<A, B>` holds a witness and its output; `echo_to_residue`
306+
erases the witness into an `EchoR<A, B>`, debiting the Stability Score.
307+
308+
**Example**:
309+
[source,err]
310+
----
311+
main
312+
let e = echo(42, "answer") # Echo<Int, String>
313+
println(echo_input(e)) # 42 — witness still here
314+
println(echo_output(e)) # "answer"
315+
316+
let r = echo_to_residue(e) # erasure — stability drops here
317+
println(echo_output(r)) # "answer" survives
318+
println(residue_strictly_loses(r)) # true — loss is observable
319+
320+
gutter
321+
println(echo_input(r)) # ERROR: the witness is gone
322+
end
323+
end
324+
----
325+
326+
**Learning Objectives**:
327+
328+
* Structured loss vs. silent discard
329+
* Irreversibility: `EchoR` never coerces back to `Echo`
330+
* Consequence amplification: the erasure stability debit is visible, charged once
331+
* The invariant *decomposition must be visible*
332+
299333
== Assessment Ideas
300334

301335
=== Quiz Format

docs/Educational-Framework.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ Students can see and modify aspects interactively!
437437
- AST visualization
438438
- How code becomes data structures
439439
- Tree traversal and transformation
440+
- Structured loss with Echo: `echo_to_residue` as a visible, irreversible decomposition step (`Echo<A,B>` → `EchoR<A,B>`), and why the witness cannot be recovered — see `docs/Echo-Decomposition.adoc`
440441
- **Layer focus:** AST (Layer 3)
441442

442443
=== Week 7-8: Parsing and Grammars

docs/Error-Categories.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,13 @@ The `gutter` (ошибка) block is where errors are injected:
256256
| Arithmetic | -10 | Numeric edge cases
257257
| Interface | -15 | Design concepts
258258
| Security | -20 | Critical importance
259+
| Echo erasure | -15 | Structured loss is not free: `echo_to_residue` debits stability ([Stab-Erase]), charged once and never on projection
259260
|===
260261

262+
NOTE: The Echo-erasure debit is not an *error* category — it is a deliberate,
263+
visible decomposition cost. It appears here because it feeds the same Stability
264+
Score. See `docs/Echo-Decomposition.adoc` and `spec/type-system.md` §7.
265+
261266
== Implementation Notes
262267

263268
=== Compiler Phases

docs/Error-Lang.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ error reduces the score. At S=0, execution still works but output becomes
4343

4444
This creates the "it's working, but it's falling apart" aesthetic.
4545

46+
=== Structured Loss Is Visible (Echo)
47+
48+
Where Jenga Semantics decay the *whole program*, Echo types decay a *single
49+
value* — deliberately, observably, and irreversibly. Error-Lang is a
50+
decompositional language: when structure is lost, the loss must be **seen**.
51+
52+
* `Echo<A, B>` — a retained witness `x : A` plus the visible output `y : B` it reached.
53+
* `EchoR<A, B>` — the non-recoverable residue after erasure (the witness is gone).
54+
* `echo_to_residue(e)` — the explicit decomposition step, `Echo<A,B> → EchoR<A,B>`,
55+
which **debits the Stability Score**.
56+
57+
The governing rule is **decomposition must be visible**: `echo_to_residue` is
58+
never a silent cast, `EchoR` is never an `Echo` with a missing field, and the
59+
stability debit is never hidden. See `docs/Echo-Decomposition.adoc` and
60+
`spec/type-system.md` §7.
61+
4662
=== Always Recoverable
4763

4864
The parser is error-tolerant. Every injected error is:
@@ -88,6 +104,8 @@ end
88104
| `gutter` | Error injection zone (safe to break)
89105
| `if` / `else` | Conditionals (Stage 2+)
90106
| `function` | Function definition (Stage 2+)
107+
| `Echo` | Fibre type: retained witness + visible output (`Echo<A, B>`)
108+
| `EchoR` | Residue type: non-recoverable remains after erasure (`EchoR<A, B>`)
91109
|===
92110

93111
==== Literals
@@ -124,6 +142,21 @@ end
124142
let x = 42
125143
let message = "Hello"
126144
let result = x + 10
145+
let e: Echo<Int, String> = echo(42, "answer") # type annotation: a fibre witness
146+
----
147+
148+
==== Echo: Structured Loss
149+
150+
[source,err]
151+
----
152+
let e = echo(42, "answer") # Echo<Int, String>: witness 42 reached "answer"
153+
let i = echo_input(e) # 42 — recover the witness
154+
let o = echo_output(e) # "answer" — the visible output
155+
156+
let r = echo_to_residue(e) # EchoR<Int, String> — witness erased; stability drops
157+
let still = echo_output(r) # "answer" — output survives erasure
158+
let lost = residue_strictly_loses(r) # true — non-recoverability is observable
159+
# echo_input(r) # ERROR: the witness is gone (decomposition is real)
127160
----
128161

129162
==== Output

examples/11-echo-decomposition.err

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Example: Structured Loss with Echo
3+
# Learning: decomposition must be VISIBLE — loss can be structured, but never free or hidden
4+
5+
main
6+
# An Echo is a retained witness plus the visible output it reached.
7+
# echo(42, "answer") : Echo<Int, String> — "input 42 reached output answer"
8+
let e = echo(42, "answer")
9+
10+
# While we hold the Echo, both halves are recoverable:
11+
println("witness:", echo_input(e)) # 42
12+
println("output: ", echo_output(e)) # "answer"
13+
14+
# THE DECOMPOSITION STEP.
15+
# echo_to_residue erases the witness, leaving a non-recoverable residue.
16+
# This is not a silent cast — it debits the Stability Score ([Stab-Erase]).
17+
let r = echo_to_residue(e) # EchoR<Int, String> ; stability 100 -> 85
18+
19+
# The output survives erasure...
20+
println("output still:", echo_output(r)) # "answer"
21+
# ...and the loss itself is observable:
22+
println("strictly loses:", residue_strictly_loses(r)) # true
23+
24+
gutter
25+
# The witness is genuinely gone. This is a type error AND a runtime error:
26+
# a residue is non-recoverable — EchoR never behaves like an Echo.
27+
println(echo_input(r))
28+
end
29+
30+
println("Still running — but the witness is not coming back.")
31+
end
32+
33+
# 🎓 LEARNING OUTCOME:
34+
# Echo<A, B> = retained witness + visible output
35+
# EchoR<A, B> = non-recoverable residue after erasure
36+
# echo_to_residue = the explicit, stability-costed decomposition step
37+
#
38+
# The invariant: DECOMPOSITION MUST BE VISIBLE.
39+
# - echo_to_residue is never a silent cast (watch the stability score drop)
40+
# - EchoR is never an Echo with a missing field (echo_input on it is rejected)
41+
# - the stability debit is charged exactly once, never on mere projection
42+
#
43+
# See docs/Echo-Decomposition.adoc and spec/type-system.md §7.

0 commit comments

Comments
 (0)