Skip to main content

logicaffeine_web/ui/pages/
roadmap_data.rs

1//! Roadmap milestone data and content.
2//!
3//! The [`Roadmap`](super::roadmap::Roadmap) page renders entirely from
4//! [`get_milestones`]; the timeline markup is generated by iterating this data
5//! rather than hand-written per phase.
6//!
7//! Every example below is **real compiler output**, not illustration. Logic
8//! examples carry the exact `compile_simple` / `compile` strings (FOL), code
9//! examples carry the real emitted Rust, and the hardware example carries the
10//! real synthesized SVA. They are regression-locked by the `roadmap_examples`
11//! test, which recompiles each `english` and checks the output still matches.
12
13/// Completion state of a roadmap milestone.
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15pub enum Status {
16    Complete,
17    InProgress,
18    Planned,
19}
20
21impl Status {
22    /// CSS modifier used by `.milestone-dot`, `.milestone-badge`, and `.feature-tag`.
23    pub fn css_class(self) -> &'static str {
24        match self {
25            Status::Complete => "done",
26            Status::InProgress => "progress",
27            Status::Planned => "planned",
28        }
29    }
30
31    /// Text shown in the status badge.
32    pub fn label(self) -> &'static str {
33        match self {
34            Status::Complete => "Complete",
35            Status::InProgress => "In Progress",
36            Status::Planned => "Planned",
37        }
38    }
39}
40
41/// What a milestone example compiles its English `english` to. Each variant
42/// holds **verbatim compiler output** for that input.
43#[derive(Clone, Copy, Debug, PartialEq, Eq)]
44pub enum Output {
45    /// English → first-order logic, in both rendered formats (`compile_simple`
46    /// and `compile`). The example tabs toggle between them.
47    Fol { simple: &'static str, unicode: &'static str },
48    /// English → emitted Rust (`compile_to_rust`).
49    Rust(&'static str),
50    /// English hardware spec → synthesized SystemVerilog Assertion.
51    Sva(&'static str),
52}
53
54/// A single worked example shown in a milestone's interactive tabs.
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub struct Example {
57    pub label: &'static str,
58    pub english: &'static str,
59    pub output: Output,
60}
61
62/// One milestone on the development timeline.
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64pub struct Milestone {
65    pub title: &'static str,
66    pub status: Status,
67    pub description: &'static str,
68    pub features: &'static [&'static str],
69    pub examples: &'static [Example],
70}
71
72/// All roadmap milestones in timeline order (oldest foundation first).
73pub fn get_milestones() -> &'static [Milestone] {
74    MILESTONES
75}
76
77static MILESTONES: &[Milestone] = &[
78    Milestone {
79        title: "Core Transpiler",
80        status: Status::Complete,
81        description: "English to first-order logic. A two-stage lexer with morphology and lexicon lookup, a recursive-descent parser over an arena AST with Discourse Representation Structures, Montague-style lambda semantics, and a Neo-Davidsonian event-semantics transpiler. Quantifier scope, relative clauses, negation, and modality, rendered to a collapsed SimpleFOL or full Unicode with event variables.",
82        features: &[
83            "Two-stage lexer",
84            "Recursive-descent parser",
85            "DRS discourse tracking",
86            "Lambda semantics",
87            "Quantifier scope",
88            "Event semantics",
89            "Unicode / ASCII / LaTeX",
90        ],
91        examples: &[
92            Example {
93                label: "Universal",
94                english: "Every user who has a key enters the room.",
95                output: Output::Fol {
96                    simple: "∀x(((User(x) ∧ ∃y((Key(y) ∧ Have(x, y)))) → Enter(x, Room)))",
97                    unicode: "∀x(((User(x) ∧ ∃y((Key(y) ∧ ∃e(Have(e) ∧ Agent(e, x) ∧ Theme(e, y))))) → ∃e(Enter(e) ∧ Agent(e, x) ∧ Theme(e, Room))))",
98                },
99            },
100            Example {
101                label: "Scope",
102                english: "Every student read a book.",
103                output: Output::Fol {
104                    simple: "∀x((Student(x) → ∃y((Book(y) ∧ Read(x, y)))))",
105                    unicode: "∀x((Student(x) → ∃y((Book(y) ∧ ∃e(Read(e) ∧ Agent(e, x) ∧ Theme(e, y))))))",
106                },
107            },
108            Example {
109                label: "Negation",
110                english: "No user who lacks a key can enter the room.",
111                output: Output::Fol {
112                    simple: "∀x(((User(x) ∧ ∃y((Key(y) ∧ ¬Have(x, y)))) → ¬Enter(x, Room)))",
113                    unicode: "∀x(((User(x) ∧ ∃y((Key(y) ∧ ¬∃e(Have(e) ∧ Agent(e, x) ∧ Theme(e, y))))) → ¬◇_{0.5} ∃e(Enter(e) ∧ Agent(e, x) ∧ Theme(e, Room))))",
114                },
115            },
116        ],
117    },
118    Milestone {
119        title: "Web Platform",
120        status: Status::Complete,
121        description: "A Dioxus/WASM front end: a structured Learn curriculum, a free-form Studio for English-to-FOL and compilation, and the published benchmark and release-notes pages. The browser runs the bytecode VM; native tiers fall back to it under WASM.",
122        features: &[
123            "Dioxus WASM",
124            "Learn curriculum",
125            "Studio",
126            "Benchmarks page",
127            "Release notes",
128        ],
129        examples: &[],
130    },
131    Milestone {
132        title: "Imperative Language",
133        status: Status::Complete,
134        description: "LOGOS as a general-purpose language: functions, structs, enums, pattern matching, a standard library, and I/O, parsed in the imperative mode of the same front end. Codegen emits Rust source plus C, Python, and TypeScript FFI bindings.",
135        features: &[
136            "Functions",
137            "Structs & enums",
138            "Pattern matching",
139            "Standard library",
140            "C / Python / TS FFI",
141        ],
142        examples: &[
143            Example {
144                label: "Function",
145                english: "## To greet (name: Text) -> Text:\n    Return \"Hello, \" combined with name.",
146                output: Output::Rust("#[inline]\nfn greet(name: String) -> String {\n    return format!(\"{}{}\", \"Hello, \", name);\n}"),
147            },
148            Example {
149                label: "Struct",
150                english: "## A Point has:\n    An x: Int.\n    A y: Int.",
151                output: Output::Rust("#[derive(Default, Debug, Clone, PartialEq)]\npub struct Point {\n    pub x: i64,\n    pub y: i64,\n}"),
152            },
153            Example {
154                label: "Enum",
155                english: "## A Color is one of:\n    A Red.\n    A Green.\n    A Blue.",
156                output: Output::Rust("#[derive(Debug, Clone, PartialEq)]\npub enum Color {\n    Red,\n    Green,\n    Blue,\n}"),
157            },
158        ],
159    },
160    Milestone {
161        title: "Type System",
162        status: Status::Complete,
163        description: "Refinement types, generics, sum types, and type inference, with constraints expressed in English. Escape, ownership, and liveness analysis run ahead of codegen and reject use-after-move.",
164        features: &[
165            "Refinement types",
166            "Generics",
167            "Sum types",
168            "Type inference",
169            "Ownership & escape analysis",
170        ],
171        examples: &[
172            Example {
173                label: "Refinement",
174                english: "## Main\nLet age: Int where it > 0 be 25.\nShow age.",
175                output: Output::Rust("let age: i64 = 25;\ndebug_assert!(age > 0);\nshow(&age);"),
176            },
177            Example {
178                label: "Generic",
179                english: "## A Box of [T] has:\n    A value, which is T.",
180                output: Output::Rust("#[derive(Default, Debug, Clone, PartialEq)]\npub struct Box<T> {\n    pub value: T,\n}"),
181            },
182        ],
183    },
184    Milestone {
185        title: "Concurrency & Actors",
186        status: Status::Complete,
187        description: "Channels, agents, structured parallelism, and select with timeout, lowering to async/await. Go-style concurrency written in English.",
188        features: &[
189            "Channels",
190            "Agents",
191            "Structured parallelism",
192            "Select with timeout",
193            "async / await",
194        ],
195        examples: &[
196            Example {
197                label: "Spawn a task",
198                english: "## To worker:\n    Show \"worker done\".\n\n## Main\n    Launch a task to worker.\n    Show \"main continues\".",
199                output: Output::Rust("#[tokio::main]\nasync fn main() {\n    tokio::spawn(async move { worker(); });\n    show(&String::from(\"main continues\"));\n}"),
200            },
201        ],
202    },
203    Milestone {
204        title: "Distributed Systems",
205        status: Status::Complete,
206        description: "CRDTs, P2P gossip, and persistent storage for local-first applications with automatic conflict resolution.",
207        features: &[
208            "CRDTs",
209            "P2P gossip",
210            "Persistence",
211            "Convergent counters",
212            "Automatic merge",
213        ],
214        examples: &[
215            Example {
216                label: "CRDT counter",
217                english: "## Definition\nA Counter is Shared and has:\n    points: ConvergentCount.\n\n## Main\nLet mutable c be a new Counter.\nIncrease c's points by 10.\nShow c's points.",
218                output: Output::Rust("pub struct Counter {\n    pub points: GCounter,\n}\n\nimpl Merge for Counter {\n    fn merge(&mut self, other: &Self) {\n        self.points.merge(&other.points);\n    }\n}"),
219            },
220        ],
221    },
222    Milestone {
223        title: "Security & Policies",
224        status: Status::Complete,
225        description: "Capability-based security with policy blocks and check guards: who can do what, stated in English and lowered to predicate checks.",
226        features: &[
227            "Policy blocks",
228            "Capabilities",
229            "Check guards",
230            "Predicates",
231        ],
232        examples: &[
233            Example {
234                label: "Policy",
235                english: "## Definition\nA User has:\n    a role, which is Text.\n\n## Policy\nA User is admin if the user's role equals \"admin\".\n\n## Main\nLet u be a new User with role \"admin\".\nCheck that the u is admin.\nShow \"passed\".",
236                output: Output::Rust("impl User {\n    pub fn is_admin(&self) -> bool {\n        self.role == \"admin\"\n    }\n}\n\n// at the check site:\nif !u.is_admin() {\n    panic_with(\"Security Check Failed: u is admin\");\n}"),
237            },
238        ],
239    },
240    Milestone {
241        title: "Proof Assistant",
242        status: Status::Complete,
243        description: "A Calculus of Inductive Constructions kernel as the trusted core: a bidirectional type checker over which propositions are types and proofs are terms. A backward-chaining search engine proposes derivations; the kernel re-checks every one. Certificate-producing arithmetic, a finite-domain grid solver, and a CDCL SAT core with an independent RUP checker sit outside the trusted base; an optional Z3 oracle never bypasses kernel certification.",
244        features: &[
245            "CIC kernel",
246            "Backward-chaining search",
247            "Kernel-certified proofs",
248            "Certificate-producing arithmetic",
249            "CDCL + RUP",
250            "Grid solver",
251            "Z3 oracle (optional)",
252        ],
253        examples: &[
254            Example {
255                label: "Termination",
256                english: "## Main\nLet x be 10.\nWhile x > 0 (decreasing x):\n    Set x to x - 1.",
257                output: Output::Rust("// `decreasing x` proves the metric falls each iteration\nlet mut x = 10;\nwhile x > 0 {\n    x = x - 1;\n}"),
258            },
259            Example {
260                label: "Trust",
261                english: "## Main\nLet x be 10.\nTrust that x is greater than 0 because \"I set it to 10\".",
262                output: Output::Rust("let x = 10;\n// TRUST: I set it to 10\ndebug_assert!(x > 0);"),
263            },
264        ],
265    },
266    Milestone {
267        title: "Native Compilation Tier",
268        status: Status::Complete,
269        description: "Three execution tiers below the front end: generated Rust source, a register-bytecode VM with optimizer (oracle facts, GVN, LICM, DCE, scalarization, loop-split), and a native AOT/JIT path. The VM profiles hot integer/float regions and recursive functions and tiers them down through a copy-and-patch JIT — stencils stamped out by memcpy and patched at relocations — to EXODIA, a contiguous register-allocating x86-64 backend. Anything outside the supported subset declines and stays on bytecode (the deopt contract). The benchmark suite measures the codegen path against ten languages with hyperfine; runtime parity with V8/Node, and head-to-head comparison against C.",
270        features: &[
271            "Bytecode VM",
272            "Optimizer (GVN / LICM / DCE)",
273            "Copy-and-patch JIT",
274            "EXODIA register-allocating x86-64",
275            "Auto-memoization",
276            "10-language benchmarks",
277            "V8 / Node parity",
278        ],
279        examples: &[
280            Example {
281                label: "Hot loop",
282                english: "## Main\nLet total be 0.\nRepeat for i from 1 to 100:\n    Set total to total + i.\nShow total.",
283                output: Output::Rust("let mut total = 0;\nfor i in 1..=100 {\n    total = total + i;\n}\nshow(&total);"),
284            },
285            Example {
286                label: "Recursion",
287                english: "## To fib (n: Int) -> Int:\n    If n is less than 2:\n        Return n.\n    Return fib(n - 1) + fib(n - 2).\n\n## Main\nShow fib(35).",
288                output: Output::Rust("fn fib(n: i64) -> i64 {\n    // pure recursion → auto-memoized\n    if n < 2 {\n        return n;\n    }\n    fib(n - 1) + fib(n - 2)\n}"),
289            },
290        ],
291    },
292    Milestone {
293        title: "Hardware Verification",
294        status: Status::Complete,
295        description: "SystemVerilog Assertions synthesized from English specifications, with IEEE 1800-2017 and 1800-2023 coverage: property connectives, LTL temporal operators, sequence composition, abort operators, and real-valued checker variables. The model-checking engine runs bounded model checking, IC3/PDR, k-induction, Craig interpolation, and predicate-abstraction CEGAR over Z3's bitvector theory, with vacuity analysis, assume-guarantee composition, and SMT-LIB2 export.",
296        features: &[
297            "English → SVA",
298            "IEEE 1800-2017 / 1800-2023",
299            "Bounded model checking",
300            "IC3 / PDR",
301            "K-induction",
302            "Craig interpolation",
303            "Bitvector theory",
304        ],
305        examples: &[
306            Example {
307                label: "Liveness",
308                english: "Always, if req holds, then eventually ack holds.",
309                output: Output::Sva("assert property (@(posedge clk) Hold_req_ |-> s_eventually(Hold_ack_));"),
310            },
311        ],
312    },
313    Milestone {
314        title: "Translation Validation",
315        status: Status::InProgress,
316        description: "Proving the compiler's output matches its input. The logicaffeine-tv crate symbolically executes the LOGOS source into the shared verification domain and discharges equivalence with Z3 (rung 3–4: the trust boundary is the encoder, Z3, and rustc). The source-side executor and its meta-soundness oracle — cross-validating the encoder against the tree-walking interpreter — are in place; the Rust-emitter-side executor that closes full source-to-Rust equivalence is the remaining work.",
317        features: &[
318            "Symbolic execution",
319            "Z3 equivalence",
320            "Encoder soundness oracle",
321            "Out-of-fragment exclusion",
322        ],
323        examples: &[],
324    },
325    Milestone {
326        title: "Quantum Backend",
327        status: Status::Planned,
328        description: "A Cirq v2 backend mirroring the SVA architecture: 17 sprints, 314 planned tests across 13 files, taking the same FOL-to-target synthesis path to quantum circuits.",
329        features: &[
330            "Cirq v2",
331            "Circuit synthesis",
332            "FOL-to-quantum",
333        ],
334        examples: &[],
335    },
336    Milestone {
337        title: "Silicon",
338        status: Status::Planned,
339        description: "The LOGOS chip. The AOT tier already runs at 2.6× the speed of C — faster than C, C++, Rust, and Zig, the fastest language in the suite — so the general-purpose CPU is tapped out, and the next order of magnitude leaves it for a full-custom HPC SoC. The register-VM ops become a native ISA, the copy-and-patch stencils become hardwired functional units, and the Jones-optimal Futamura specializer configures a spatial dataflow fabric: implementation is a partial evaluation of the specification, so the compiled program *is* the circuit, correct by construction. Because that residual is a statically-known dataflow, there is no speculative cache hierarchy to pay for — memory is scheduled onto scratchpads, not guessed. The crypto and codec kernels already written in Logos — Keccak-f[1600], the ML-KEM / ML-DSA NTT, SHA-3, group-varint — drop onto dedicated accelerators for line-rate post-quantum crypto and serialization. And the goal is not only speed but power: with no cache hierarchy and no speculation to feed, the fabric spends energy only on the computation that runs — driving toward the Landauer limit, and, through reversible logic, past it. Because the same substrate that verifies English specs emits SVA, extracts Verilog, and proves BitVec(n) properties across every bus width, the chip is designed and formally proven in Logos itself: self-hosting, zero-defect silicon.",
340        features: &[
341            "LOGOS-ISA cores",
342            "Stencils → functional units",
343            "Futamura dataflow fabric",
344            "No cache hierarchy",
345            "Low power → Landauer",
346            "PQC accelerators",
347            "Self-verified RTL",
348        ],
349        examples: &[],
350    },
351];
352
353#[cfg(test)]
354mod tests {
355    use super::*;
356
357    /// Every roadmap example must be REAL compiler output. This recompiles each
358    /// `english` and checks the displayed output still matches — so an example
359    /// can never silently become fabricated. FOL is exact-matched; Rust must
360    /// compile (the shown Rust is a faithful excerpt of the full emitted file);
361    /// SVA is exact-matched against the synthesizer.
362    #[test]
363    fn every_example_is_real_compiler_output() {
364        for m in get_milestones() {
365            for ex in m.examples {
366                match ex.output {
367                    Output::Fol { simple, unicode } => {
368                        let got_simple = logicaffeine_language::compile_simple(ex.english)
369                            .unwrap_or_else(|e| panic!("[{} / {}] FOL did not compile: {:?}", m.title, ex.label, e));
370                        let got_unicode = logicaffeine_language::compile(ex.english)
371                            .unwrap_or_else(|e| panic!("[{} / {}] FOL did not compile: {:?}", m.title, ex.label, e));
372                        assert_eq!(got_simple, simple, "[{} / {}] SimpleFOL drifted from the compiler", m.title, ex.label);
373                        assert_eq!(got_unicode, unicode, "[{} / {}] Unicode FOL drifted from the compiler", m.title, ex.label);
374                    }
375                    Output::Rust(_) => {
376                        logicaffeine_compile::compile::compile_to_rust(ex.english).unwrap_or_else(|e| {
377                            panic!("[{} / {}] Rust example did not compile: {:?}\n--- source ---\n{}\n--------------", m.title, ex.label, e, ex.english)
378                        });
379                    }
380                    Output::Sva(sva) => {
381                        let synth = logicaffeine_compile::codegen_sva::fol_to_sva::synthesize_sva_from_spec(ex.english, "clk")
382                            .unwrap_or_else(|e| panic!("[{} / {}] SVA did not synthesize: {}", m.title, ex.label, e));
383                        assert_eq!(synth.sva_text, sva, "[{} / {}] SVA drifted from the synthesizer", m.title, ex.label);
384                    }
385                }
386            }
387        }
388    }
389}