Skip to content

Commit d91e587

Browse files
committed
docs: substantive CRG C annotation (EXPLAINME.adoc)
1 parent c7cf2bc commit d91e587

1 file changed

Lines changed: 124 additions & 20 deletions

File tree

EXPLAINME.adoc

Lines changed: 124 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,145 @@
33
:toc:
44
:icons: font
55

6-
The README makes claims. This file backs them up.
6+
The README makes claims. This file backs them up with evidence from real code.
77

8-
[quote, README]
8+
== Core Claims & Evidence
9+
10+
=== Claim 1: "602 Tests Passing, 0 Failures — 250+ Theorems Across 6 Proof Systems"
11+
12+
**From README** (lines 44, 60):
913
____
10-
Every operation backed by machine-checkable proofs, enabling GDPR compliance with mathematical certainty.
14+
* [x] 555 Tests Passing: Unit, correspondence, integration, property, security
15+
* [x] ~250+ Theorems: Proven across different logical foundations (4 proof gaps remain)
1116
____
1217

13-
== Technology Choices
18+
**Evidence**: `/var/mnt/eclipse/repos/valence-shell/impl/rust-cli/tests/` contains 602 passing tests (updated 2026-03-08): 277 unit tests, 28 correspondence tests, 55 extended, 35 integration, 10 extra, 16 lean4 proptest, 28 property, 15 security, 52 doctests. Proof files at `/var/mnt/eclipse/repos/valence-shell/proofs/coq/` (~1,200 lines), `/var/mnt/eclipse/repos/valence-shell/proofs/lean4/` (~900 lines), `/var/mnt/eclipse/repos/valence-shell/proofs/agda/`, `/var/mnt/eclipse/repos/valence-shell/proofs/isabelle/`, `/var/mnt/eclipse/repos/valence-shell/proofs/mizar/`, `/var/mnt/eclipse/repos/valence-shell/proofs/z3/`.
1419

15-
[cols="1,2"]
16-
|===
17-
| Technology | Learn More
20+
**Caveat**: Test suite proves the *Rust implementation works correctly*. Proofs verify abstract *models* of reversibility. **The extraction gap between Lean 4 proofs → Rust implementation is NOT mechanically verified**—it's ~85% confidence via property testing only. This is not production-ready.
1821

19-
| **Zig** | https://ziglang.org
20-
| **Idris2 ABI** | https://www.idris-lang.org
21-
|===
22+
=== Claim 2: "Formally Proven Reversibility: rmdir(mkdir(p, fs)) = fs"
23+
24+
**From README** (lines 40, 192-209):
25+
____
26+
* [x] Formally Proven Reversibility: `rmdir(mkdir(p, fs)) = fs`
27+
...
28+
Theorem mkdir_rmdir_reversible :
29+
forall p fs,
30+
mkdir_precondition p fs ->
31+
rmdir p (mkdir p fs) = fs.
32+
____
33+
34+
**Evidence**: `/var/mnt/eclipse/repos/valence-shell/proofs/coq/FileSystem.v` contains the theorem `mkdir_rmdir_reversible` proven in Coq with ~200 lines of tactics. Same theorem proven in `/var/mnt/eclipse/repos/valence-shell/proofs/lean4/Reversibility.lean` (Lean 4), `/var/mnt/eclipse/repos/valence-shell/proofs/agda/`, etc. Cross-validation across 5-6 proof systems increases confidence.
35+
36+
**Caveat**: Proofs operate on *abstract filesystem models* (not real POSIX). The Rust FFI layer (`src/commands.rs`) calls real syscalls (`mkdir`, `rmdir`) which are NOT proven to match the abstract model. A POSIX implementation bug could violate the proofs.
37+
38+
=== Claim 3: "Advanced Research Prototype (v0.9.0) — NOT Production-Ready"
39+
40+
**From README** (lines 22-27):
41+
____
42+
[IMPORTANT]
43+
====
44+
**Current Status**: v0.9.0 — Advanced Research Prototype +
45+
**NOT production-ready.** Functional shell with formally proven reversibility, but POSIX compliance is incomplete and Lean→Rust correspondence is testing-based (~85% confidence), not mechanized. +
46+
**Progress**: ~72% of full roadmap complete, 602 tests passing (0 failures) +
47+
====
48+
____
49+
50+
**Evidence**: `/var/mnt/eclipse/repos/valence-shell/CLAUDE.md` (lines 15-47) provides honest status: v0.9.0, ~72% complete, 4 real proof gaps (documented in `/var/mnt/eclipse/repos/valence-shell/docs/PROOF_HOLES_AUDIT.md`). Main gaps: no mechanized Lean→Rust correspondence, RMO/GDPR compliance stubs only, shell functions/script execution missing.
51+
52+
**Caveat**: This is refreshingly *honest* about limitations. Most projects would claim v1.0.0 and "production-ready"—this one correctly downgrades false claims from the Sonnet audit.
2253

2354
== Dogfooded Across The Account
2455

25-
Uses the hyperpolymath ABI/FFI standard (Idris2 + Zig). Same pattern used across
26-
https://github.com/hyperpolymath/proven[proven],
27-
https://github.com/hyperpolymath/burble[burble], and
28-
https://github.com/hyperpolymath/gossamer[gossamer].
56+
Uses polyglot formal verification stack (Coq + Lean 4 + Agda + Isabelle + Mizar + Z3). Same pattern across:
57+
- https://github.com/hyperpolymath/absolute-zero[absolute-zero] — Compositional algebra with CNO (Certified Null Operation) theory
58+
- https://github.com/hyperpolymath/proven-servers[proven-servers] — Protocol verification (Idris2 ABI)
59+
- https://github.com/hyperpolymath/burble[burble] — Telecom control plane (Lean 4 core)
60+
61+
All share: *Multiple proof systems for cross-validation, honest status reporting, no extraction claims without mechanization.*
2962

3063
== File Map
3164

32-
[cols="1,2"]
65+
[cols="1,3"]
3366
|===
34-
| Path | What's There
67+
| Path | Contents & Purpose
68+
69+
| `impl/rust-cli/src/main.rs` | Rust CLI entry: REPL loop, command parsing, interactive shell with reedline
70+
71+
| `impl/rust-cli/src/lib.rs` | Library root: module declarations, public API
72+
73+
| `impl/rust-cli/src/state.rs` | ShellState: file system state, operation history, undo/redo stacks. Core reversibility tracking.
74+
75+
| `impl/rust-cli/src/commands.rs` | Built-in commands: mkdir, rmdir, touch, rm, cp, mv, ln, undo, redo, explain, checkpoint, restore, diff
76+
77+
| `impl/rust-cli/src/parser.rs` | Command parsing: tokenization, variable expansion, glob expansion, quote processing. No formal proofs—empirical parsing.
78+
79+
| `impl/rust-cli/src/external.rs` | External command execution: PATH lookup, subprocess spawning, pipe handling, redirection setup
80+
81+
| `impl/rust-cli/src/pipeline.rs` | Unix pipeline implementation: multi-stage pipes with proper file descriptor management
82+
83+
| `impl/rust-cli/src/redirection.rs` | I/O redirection: > (write), >> (append), < (read), 2> (stderr), 2>> (append stderr), &> (both), 2>&1 (combine)
3584

36-
| `src/` | Source code
37-
| `ffi/` | Foreign function interface
38-
| `test(s)/` | Test suite
85+
| `impl/rust-cli/src/glob.rs` | POSIX-compliant glob expansion: *, ?, [...], {...}. Hidden file handling (requires explicit leading dot).
86+
87+
| `impl/rust-cli/src/job_control.rs` | Job control: bg, fg, jobs, kill commands. Signal handling for Ctrl+Z (SIGTSTP), Ctrl+C (SIGINT).
88+
89+
| `impl/rust-cli/src/process_substitution.rs` | Process substitution: <(cmd) and >(cmd) via FIFOs
90+
91+
| `impl/rust-cli/src/arithmetic.rs` | Arithmetic expansion: $((expr)) with full operator support, shift overflow protection
92+
93+
| `impl/rust-cli/src/here_doc.rs` | Here documents: <<DELIM, <<-DELIM, <<<word
94+
95+
| `impl/rust-cli/src/test_builtin.rs` | test/[ and [[ ]] builtins for conditionals
96+
97+
| `impl/rust-cli/src/correction.rs` | Command correction: Levenshtein distance for "Did you mean?" suggestions
98+
99+
| `impl/rust-cli/src/repl.rs` | Interactive REPL with reedline, syntax highlighting, multi-line input for control structures
100+
101+
| `proofs/coq/FileSystem.v` | Coq proofs: ~1,200 lines. Theorems for mkdir/rmdir, create/delete, write reversibility.
102+
103+
| `proofs/lean4/Reversibility.lean` | Lean 4 proofs: ~900 lines. Same theorems, dependent type theory style.
104+
105+
| `proofs/agda/` | Agda proofs: ~700 lines. Intensional type theory foundation.
106+
107+
| `proofs/isabelle/` | Isabelle/HOL proofs: ~650 lines. Higher-order logic approach.
108+
109+
| `proofs/mizar/` | Mizar proofs: ~400 lines. Tarski-Grothendieck set theory.
110+
111+
| `proofs/z3/` | Z3 SMT proofs: ~150 lines. Automated first-order logic verification.
112+
113+
| `impl/rust-cli/tests/correspondence_tests.rs` | Correspondence tests: Lean 4 theorem validation via property testing (~85% confidence, not mechanized)
114+
115+
| `impl/rust-cli/tests/integration_test.rs` | Full end-to-end shell tests: pipes, redirections, glob expansion, job control
116+
117+
| `impl/rust-cli/tests/security_tests.rs` | Security tests: path traversal prevention, injection resistance, resource limits
118+
119+
| `impl/rust-cli/tests/property_tests.rs` | Property-based tests: glob correctness, arithmetic soundness, operation sequence reversibility
120+
121+
| `docs/PROOF_HOLES_AUDIT.md` | Honest audit: 4 real proof gaps, 4 axioms, 2 structural gaps. Clear about what's NOT proven.
122+
123+
| `docs/POSIX_COMPLIANCE.md` | Detailed POSIX compliance roadmap: M1-M11 milestones, current status (M1-M9 complete, M10-11 partial)
124+
125+
| `CLAUDE.md` | Comprehensive AI context: honest status (v0.9.0, ~72% complete), architecture, test results, critical issues
39126
|===
40127

128+
== Status
129+
130+
**Honest Assessment**: Advanced research prototype. NOT production-ready. Extraction gap (Lean→Rust) is **the critical blocker** for any production claim.
131+
132+
**What Works**:
133+
- Functional shell: 602 tests passing, interactive REPL working
134+
- Formal proofs: 250+ theorems across 6 systems (about abstract models)
135+
- Reversibility tracking: undo/redo fully functional
136+
- Most POSIX features: pipes, redirections, glob, job control, variables
137+
138+
**What's Broken**:
139+
- NO mechanized Lean→Rust correspondence (85% confidence only)
140+
- NO shell functions (`func() { ... }`)
141+
- NO shell script execution (`.sh` files)
142+
- RMO/GDPR compliance: stubs only
143+
- POSIX compliance: ~72% (functions + script execution missing)
144+
41145
== Questions?
42146

43-
Open an issue or reach out directly — happy to explain anything in more detail.
147+
Open an issue or reach out at j.d.a.jewell@open.ac.uk — happy to explain the proof architecture, reversibility guarantees, or the honest gap between proofs and implementation.

0 commit comments

Comments
 (0)