Skip to content

Commit f234dbc

Browse files
hyperpolymathclaude
andcommitted
docs: bespoke Lustre documentation for all template files
Replace generic -iser template placeholders with Lustre-specific content across the entire repository. Idris2 ABI now defines LustreNode, Clock, DataflowStream, TemporalOperator (Pre/Fby/When/Merge), WCET timing proofs, StreamBuffer/NodeLayout memory proofs, and SafetyLevel certification tags. Zig FFI implements Lustre compilation, WCET analysis, clock calculus validation, and memory budget verification. README covers synchronous dataflow semantics, clock calculus, safety standards (DO-178C, IEC 61508, ISO 26262), and use cases. ROADMAP defines six phases from scaffold through SCADE interop. TOPOLOGY.md documents module map and data flow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b55cee0 commit f234dbc

16 files changed

Lines changed: 1673 additions & 574 deletions

File tree

.machine_readable/6a2/AGENTIC.a2ml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# AGENTIC.a2ml — AI agent constraints and capabilities
4+
# AGENTIC.a2ml — AI agent constraints and capabilities for lustreiser
55
# Defines what AI agents can and cannot do in this repository.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[agent-permissions]
1212
can-edit-source = true
@@ -22,6 +22,17 @@ can-create-files = true
2222
# - Never use banned languages (TypeScript, Python, Go, etc.)
2323
# - Never place state files in repository root (must be in .machine_readable/)
2424
# - Never use AGPL license (use PMPL-1.0-or-later)
25+
# - Never generate C code with malloc, recursion, or unbounded loops
26+
# - Never weaken WCET proofs or skip timing verification
27+
# - Never generate Lustre code with ambiguous clock assignments
28+
29+
[lustre-specific-constraints]
30+
# Generated C output must be deterministic and certifiable:
31+
# - No dynamic memory allocation (malloc/calloc/realloc)
32+
# - No recursion (bounded call depth only)
33+
# - No unbounded loops (iteration counts known at compile time)
34+
# - All stream buffers statically allocated
35+
# - WCET must be proven less than clock period for every node
2536

2637
[maintenance-integrity]
2738
fail-closed = true

.machine_readable/6a2/ECOSYSTEM.a2ml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,28 @@
66
(version "0.1.0")
77
(name "lustreiser")
88
(type "tool")
9-
(purpose "Generate formally verified real-time embedded code via Lustre")
9+
(purpose "Generate formally verified real-time embedded code via Lustre synchronous dataflow")
1010

1111
(position-in-ecosystem
1212
(family "-iser acceleration frameworks")
1313
(meta-framework "iseriser")
1414
(relationship "sibling")
15+
(domain "safety-critical real-time embedded systems")
1516
(top-3 ("typedqliser" "chapeliser" "verisimiser")))
1617

18+
(target-domain
19+
(primary "Avionics flight control (DO-178C)")
20+
(secondary "Nuclear reactor protection (IEC 61508)")
21+
(tertiary "Automotive powertrain (ISO 26262)")
22+
(additional "PLC programming, sensor fusion, robotic actuator control"))
23+
24+
(lustre-ecosystem
25+
(language "Lustre — Caspi, Pilaud, Halbwachs, Plaice (Grenoble, 1987)")
26+
(industrial-tool "SCADE Suite (Ansys/Esterel Technologies)")
27+
(model-checker "Kind2 (University of Iowa)")
28+
(reference-compiler "Lv6 / Lustre V6")
29+
(related-language "Esterel — synchronous reactive (events, not dataflow)"))
30+
1731
(related-projects
1832
(project "iseriser"
1933
(relationship "meta-framework")
@@ -32,7 +46,7 @@
3246
(description "Database recovery via constraint propagation"))
3347
(project "proven"
3448
(relationship "dependency")
35-
(description "Shared Idris2 verified library"))
49+
(description "Shared Idris2 verified library — timing proofs reuse proven primitives"))
3650
(project "typell"
3751
(relationship "dependency")
38-
(description "Type theory engine"))))
52+
(description "Type theory engine — used for clock calculus type checking"))))

.machine_readable/6a2/META.a2ml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,56 @@
44

55
(meta
66
(version "0.1.0")
7-
(last-updated "2026-03-20")
7+
(last-updated "2026-03-21")
88

99
(architecture-decisions
1010
(adr "001-iser-pattern"
1111
(status "accepted")
12-
(context "Need to make powerful languages accessible without steep learning curves")
13-
(decision "Use manifest-driven code generation: user describes WHAT, tool generates HOW")
14-
(consequences "Users write zero target language code; all complexity in the -iser"))
12+
(context "Need to make Lustre synchronous dataflow programming accessible without requiring Lustre expertise")
13+
(decision "Use manifest-driven code generation: user describes control system in TOML, lustreiser generates Lustre nodes, proves timing bounds, and compiles to deterministic C")
14+
(consequences "Users write zero Lustre code; all clock calculus and temporal operators generated automatically"))
1515

1616
(adr "002-abi-ffi-standard"
1717
(status "accepted")
18-
(context "Need verified interop between Rust CLI, target language, and user code")
19-
(decision "Idris2 ABI for formal proofs, Zig FFI for C-ABI bridge")
20-
(consequences "Compile-time correctness guarantees; zero runtime overhead from proofs"))
18+
(context "Need verified interop between Rust CLI, Lustre compilation, and embedded C output")
19+
(decision "Idris2 ABI for formal timing proofs (WCET bounds, clock calculus soundness), Zig FFI for C-ABI bridge to Lustre compiler")
20+
(consequences "Compile-time guarantee that every node meets its deadline; zero runtime overhead from proofs"))
2121

22-
(adr "003-rsr-template"
22+
(adr "003-synchronous-hypothesis"
23+
(status "accepted")
24+
(context "Lustre assumes all computations complete within one clock tick (synchronous hypothesis)")
25+
(decision "Enforce synchronous hypothesis via Idris2 WCET proofs: prove that worst-case execution time is strictly less than clock period for every node")
26+
(consequences "Generates only code that provably meets hard real-time deadlines; rejects specifications that cannot be proven safe"))
27+
28+
(adr "004-deterministic-c-output"
29+
(status "accepted")
30+
(context "Safety-critical standards (DO-178C, IEC 61508, ISO 26262) require deterministic, bounded-time execution")
31+
(decision "Generated C code must use no malloc, no recursion, no unbounded loops, and only statically allocated buffers")
32+
(consequences "Output is certifiable for safety-critical deployment; memory footprint is known at compile time"))
33+
34+
(adr "005-rsr-template"
2335
(status "accepted")
2436
(context "Need consistent project structure across 29+ -iser repos")
2537
(decision "All repos cloned from rsr-template-repo with full CI/CD and governance")
2638
(consequences "17 workflows, SECURITY.md, CONTRIBUTING, bot directives from day one")))
2739

2840
(development-practices
29-
(language "Rust" (purpose "CLI and orchestration"))
30-
(language "Idris2" (purpose "ABI formal proofs"))
31-
(language "Zig" (purpose "FFI C-ABI bridge"))
41+
(language "Rust" (purpose "CLI, manifest parsing, orchestration"))
42+
(language "Idris2" (purpose "ABI formal proofs — timing bounds, clock calculus, memory layout"))
43+
(language "Zig" (purpose "FFI C-ABI bridge — Lustre compilation and timing analysis"))
44+
(language "Lustre" (purpose "Generated synchronous dataflow code — nodes, clocks, temporal operators"))
45+
(language "C" (purpose "Final embedded output — deterministic, no-malloc, certifiable"))
3246
(build-tool "cargo")
3347
(ci "GitHub Actions (17 workflows)"))
3448

3549
(design-rationale
3650
(principle "Manifest-driven"
3751
(explanation "User intent captured in TOML; all generation is deterministic and reproducible"))
38-
(principle "Formally verified bridges"
39-
(explanation "Idris2 dependent types prove interface correctness at compile time"))
52+
(principle "Formally verified timing"
53+
(explanation "Idris2 dependent types prove WCET < clock period for every generated node"))
54+
(principle "Clock calculus soundness"
55+
(explanation "Every stream has exactly one clock; when/merge operators are type-checked for consistency"))
4056
(principle "Zero target language exposure"
41-
(explanation "Users never write Chapel/Julia/Futhark/etc. — the -iser handles everything"))))
57+
(explanation "Users never write Lustre, C, or Zig — the -iser handles everything"))
58+
(principle "Safety-certifiable output"
59+
(explanation "Generated C code targets DO-178C Level A, IEC 61508 SIL 4, ISO 26262 ASIL D"))))
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# NEUROSYM.a2ml — Neurosymbolic integration metadata
4+
# NEUROSYM.a2ml — Neurosymbolic integration metadata for lustreiser
55
# Configuration for Hypatia scanning and symbolic reasoning.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[hypatia-config]
1212
scan-enabled = true
13-
scan-depth = "standard" # quick | standard | deep
13+
scan-depth = "deep" # Deep scanning for safety-critical code
1414
report-format = "logtalk"
1515

1616
[symbolic-rules]
17-
# Custom symbolic rules for this project
17+
# Custom symbolic rules for lustreiser safety invariants:
1818
# - { name = "no-unsafe-ffi", pattern = "believe_me|unsafeCoerce", severity = "critical" }
19+
# - { name = "no-malloc-in-generated-c", pattern = "malloc|calloc|realloc", severity = "critical" }
20+
# - { name = "no-recursion-in-generated-c", pattern = "recursive", severity = "critical" }
21+
# - { name = "wcet-proof-required", pattern = "MeetsDeadline", severity = "warning" }
22+
# - { name = "clock-consistency", pattern = "ClockError", severity = "critical" }
1923

2024
[neural-config]
21-
# Neural pattern detection settings
22-
# confidence-threshold = 0.85
25+
# Neural pattern detection for dataflow analysis
26+
# confidence-threshold = 0.95 # Higher threshold for safety-critical domain
2327
# model = "hypatia-v2"
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# PLAYBOOK.a2ml — Operational playbook
4+
# PLAYBOOK.a2ml — Operational playbook for lustreiser
55
# Runbooks, incident response, deployment procedures.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[deployment]
12-
# method = "gitops" # gitops | manual | ci-triggered
13-
# target = "container" # container | binary | library | wasm
12+
method = "binary" # CLI binary distributed via cargo install or container
13+
target = "binary" # Primary output is a CLI tool; secondary output is generated C code
14+
15+
[embedded-target-deployment]
16+
# Generated C code deployment to embedded targets:
17+
# 1. Run `lustreiser generate` to produce .lus and .c files
18+
# 2. Cross-compile C output for target architecture (ARM Cortex-M, RISC-V)
19+
# 3. Flash to embedded target
20+
# 4. Verify timing on hardware matches WCET analysis
1421

1522
[incident-response]
16-
# 1. Check .machine_readable/STATE.a2ml for current status
23+
# 1. Check .machine_readable/6a2/STATE.a2ml for current status
1724
# 2. Review recent commits and CI results
18-
# 3. Run `just validate` to check compliance
25+
# 3. Run `just validate` to check RSR compliance
1926
# 4. Run `just security` to audit for vulnerabilities
27+
# 5. For timing-related issues: re-run WCET analysis with updated code paths
2028

2129
[release-process]
22-
# 1. Update version in STATE.a2ml, META.a2ml, Justfile
30+
# 1. Update version in STATE.a2ml, META.a2ml, Cargo.toml, main.zig
2331
# 2. Run `just release-preflight` (validate + quality + security + maint-hard-pass)
24-
# 3. Optional local permission hardening: `just perms-snapshot && just perms-lock`
25-
# 4. Tag and push
26-
# 5. Restore local permissions if needed: `just perms-restore`
32+
# 3. Verify all Idris2 timing proofs compile without holes
33+
# 4. Run integration tests against Zig FFI
34+
# 5. Tag and push
2735
# 6. Run `just container-push` if applicable
2836

2937
[maintenance-operations]
@@ -33,3 +41,5 @@ last-updated = "{{CURRENT_DATE}}"
3341
# just maint-hard-pass
3442
# Permission audit:
3543
# just perms-audit
44+
# Timing proof verification:
45+
# cd src/interface/abi && idris2 --check Types.idr Layout.idr Foreign.idr

.machine_readable/6a2/STATE.a2ml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,37 @@
55
(state
66
(metadata
77
(version "0.1.0")
8-
(last-updated "2026-03-20")
8+
(last-updated "2026-03-21")
99
(author "Jonathan D.A. Jewell"))
1010

1111
(project-context
1212
(name "lustreiser")
13-
(description "Generate formally verified real-time embedded code via Lustre")
14-
(status "scaffold")
13+
(description "Generate formally verified real-time embedded code via Lustre synchronous dataflow")
14+
(status "scaffold-documented")
1515
(priority "—")
16-
(ecosystem "-iser family (https://github.com/hyperpolymath/iseriser)"))
16+
(ecosystem "-iser family (https://github.com/hyperpolymath/iseriser)")
17+
(domain "Safety-critical real-time embedded systems (avionics, nuclear, automotive)")
18+
(target-standards "DO-178C, IEC 61508, ISO 26262"))
1719

1820
(current-position
19-
(phase "initial-scaffold")
20-
(completion-percentage 5)
21-
(milestone "Architecture defined, CLI scaffolded, RSR template complete"))
21+
(phase "scaffold-with-bespoke-docs")
22+
(completion-percentage 10)
23+
(milestone "Architecture defined, CLI scaffolded, RSR template complete, bespoke Idris2 ABI types defined"))
2224

2325
(route-to-mvp
24-
(step 1 "Replace codegen stubs with target-language-specific generation")
25-
(step 2 "Implement Idris2 ABI proofs for core invariants")
26-
(step 3 "Build Zig FFI bridge")
27-
(step 4 "Integration tests with real-world examples")
28-
(step 5 "Documentation and examples"))
26+
(step 1 "Implement control flow analysis — parse manifest to extract dataflow topology")
27+
(step 2 "Implement Lustre node generation — produce .lus files with clock annotations")
28+
(step 3 "Implement clock calculus — when/merge operators, clock consistency checking")
29+
(step 4 "Implement WCET analysis — timing bounds for generated C code paths")
30+
(step 5 "Write Idris2 proofs for timing bounds (WCET < clock period)")
31+
(step 6 "Implement Lustre-to-C compilation backend (no malloc, no recursion)")
32+
(step 7 "Integration tests with real embedded targets (ARM Cortex-M, RISC-V)")
33+
(step 8 "First working end-to-end example (simple flight controller node)"))
2934

3035
(blockers-and-issues
3136
(none "Project is in scaffold phase — no blockers yet"))
3237

3338
(critical-next-actions
34-
(action "Implement codegen for primary use case")
35-
(action "Write first working example end-to-end")))
39+
(action "Implement control flow analysis from lustreiser.toml manifest")
40+
(action "Generate first .lus file from a simple dataflow specification")
41+
(action "Define Lustre-specific manifest schema (nodes, clocks, streams, timing)")))

0 commit comments

Comments
 (0)