Skip to content

Commit e47d128

Browse files
hyperpolymathclaude
andcommitted
docs: bespoke documentation for idrisiser meta-prover
Replace all template placeholders with idrisiser-specific content. Idrisiser is the meta-prover of the -iser family: it takes interface definitions (OpenAPI, C headers, .proto, type signatures) and generates Idris2 dependent-type wrappers with formal proofs of correctness. - README.adoc: architecture pipeline, Idris2 concepts (dependent types, totality, elaborator reflection, QTT), use cases, quick start - ROADMAP.adoc: Phase 0-6 (scaffold → parser → proof gen → compilation → multi-interface → self-bootstrapping → ecosystem) - TOPOLOGY.md: new file — module map, data flow diagram, ecosystem position - Types.idr: InterfaceContract, ProofObligation, DependentWrapper, QuantitativeUsage, Totality, ProofFailure result code - Layout.idr: ProofWitnessLayout (erased at runtime), contract struct layout bridge, bespoke documentation - Foreign.idr: proof engine lifecycle, interface parsing, proof generation, proof compilation, wrapper emission — all idrisiser_* functions - main.zig: EngineState with proof tracking, idrisiser_* FFI exports matching Foreign.idr, InterfaceFormat enum, operation ordering - build.zig: idrisiser library names, bespoke step descriptions - integration_test.zig: proof workflow ordering tests, format validation, proof count tests, build info verification - 0-AI-MANIFEST.a2ml: idrisiser-specific invariants (no believe_me, proof completeness, ABI-FFI agreement) - 6a2/*.a2ml: bespoke STATE, META, ECOSYSTEM, AGENTIC, NEUROSYM, PLAYBOOK - All sub-directory README.adoc files updated with specific content Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e657d30 commit e47d128

File tree

21 files changed

+1462
-733
lines changed

21 files changed

+1462
-733
lines changed

.machine_readable/6a2/AGENTIC.a2ml

Lines changed: 14 additions & 5 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 idrisiser
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
@@ -16,12 +16,21 @@ can-edit-config = true
1616
can-create-files = true
1717

1818
[agent-constraints]
19-
# What AI agents must NOT do:
20-
# - Never use banned language patterns (believe_me, unsafeCoerce, etc.)
19+
# What AI agents must NOT do in idrisiser:
20+
# - Never use believe_me, assert_total, sorry, unsafeCoerce in generated Idris2 code
2121
# - Never commit secrets or credentials
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 partial Idris2 functions — all generated code must be total
26+
# - Never emit a DependentWrapper with undischarged proof obligations
27+
28+
[idrisiser-specific-constraints]
29+
# Proof soundness is non-negotiable:
30+
# - All generated Types.idr must use %default total
31+
# - All proof witnesses must have 0-multiplicity (erased at runtime)
32+
# - Foreign.idr exports must exactly match Zig FFI function signatures
33+
# - Layout.idr proofs must cover all target platforms
2534

2635
[maintenance-integrity]
2736
fail-closed = true
@@ -31,6 +40,6 @@ require-rerun-after-fix = true
3140
release-claim-requires-hard-pass = true
3241

3342
[automation-hooks]
34-
# on-enter: Read 0-AI-MANIFEST.a2ml, then STATE.a2ml
43+
# on-enter: Read 0-AI-MANIFEST.a2ml, then .machine_readable/6a2/STATE.a2ml
3544
# on-exit: Update STATE.a2ml with session outcomes
3645
# on-commit: Run just validate-rsr

.machine_readable/6a2/ECOSYSTEM.a2ml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,44 @@
55
(ecosystem
66
(version "0.1.0")
77
(name "idrisiser")
8-
(type "tool")
9-
(purpose "Generate proven-correct wrappers using Idris2 dependent types")
8+
(type "meta-prover tool")
9+
(purpose "Generate proven-correct wrappers from interface definitions using Idris2 dependent types")
1010

1111
(position-in-ecosystem
1212
(family "-iser acceleration frameworks")
1313
(meta-framework "iseriser")
14-
(relationship "sibling")
15-
(top-3 ("typedqliser" "chapeliser" "verisimiser")))
14+
(rank "Most foundational -iser after iseriser itself")
15+
(role "Universal proof generation frontend — every -iser needing formal verification routes through idrisiser")
16+
(unique-property "Only -iser that generates proofs, not just code"))
1617

1718
(related-projects
1819
(project "iseriser"
1920
(relationship "meta-framework")
20-
(description "Generates new -iser project scaffolding"))
21+
(description "Generates new -iser project scaffolding; idrisiser was scaffolded by iseriser"))
22+
(project "proven"
23+
(relationship "dependency")
24+
(description "Shared Idris2 verified library — idrisiser reuses proven primitives"))
25+
(project "proven-servers"
26+
(relationship "consumer")
27+
(description "Server implementations that use idrisiser-generated proof wrappers"))
2128
(project "typedqliser"
2229
(relationship "sibling-priority-1")
23-
(description "Formal type safety for any query language"))
30+
(description "Formal type safety for query languages — uses idrisiser for proof generation"))
2431
(project "chapeliser"
2532
(relationship "sibling-priority-2")
2633
(description "Chapel distributed computing acceleration"))
2734
(project "verisimiser"
2835
(relationship "sibling-priority-3")
2936
(description "VeriSimDB octad database augmentation"))
30-
(project "squeakwell"
37+
(project "halideiser"
3138
(relationship "sibling")
32-
(description "Database recovery via constraint propagation"))
33-
(project "proven"
34-
(relationship "dependency")
35-
(description "Shared Idris2 verified library"))
39+
(description "Halide image processing acceleration"))
3640
(project "typell"
3741
(relationship "dependency")
38-
(description "Type theory engine"))))
42+
(description "Type theory engine — provides type-level reasoning foundations"))
43+
(project "squeakwell"
44+
(relationship "sibling")
45+
(description "Database recovery via cross-modal constraint propagation"))
46+
(project "boj-server"
47+
(relationship "future-consumer")
48+
(description "MCP server — idrisiser will be exposed as a BoJ cartridge"))))

.machine_readable/6a2/META.a2ml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,60 @@
44

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

99
(architecture-decisions
10-
(adr "001-iser-pattern"
10+
(adr "001-idris2-as-sole-prover"
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 a formal verification language for the hyperpolymath ecosystem; candidates were ATS2, Coq, Lean, Agda, and Idris2")
13+
(decision "Idris2 is the sole formal verification language — dependent types, totality checking, elaborator reflection, and quantitative type theory")
14+
(consequences "Single prover simplifies tooling; idrisiser is the universal proof generation frontend"))
1515

16-
(adr "002-abi-ffi-standard"
16+
(adr "002-meta-prover-architecture"
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")
18+
(context "Developers should not need to learn Idris2 to get formal guarantees")
19+
(decision "Idrisiser parses interface definitions and generates Idris2 proofs automatically — users write manifests, not proof terms")
20+
(consequences "Proof generation is deterministic and reproducible; users get compile-time guarantees without type theory expertise"))
21+
22+
(adr "003-multi-format-interface-parsing"
23+
(status "accepted")
24+
(context "Interfaces come in many formats: REST APIs, C headers, protobuf, type signatures")
25+
(decision "Pluggable parser architecture with bridge adapters per format, all producing a common IR")
26+
(consequences "New interface formats can be added without changing the proof engine"))
27+
28+
(adr "004-abi-ffi-standard"
29+
(status "accepted")
30+
(context "Need verified interop between Idris2 proof engine and native output")
31+
(decision "Idris2 ABI for formal proofs, Zig FFI for C-ABI bridge — per hyperpolymath universal standard")
2032
(consequences "Compile-time correctness guarantees; zero runtime overhead from proofs"))
2133

22-
(adr "003-rsr-template"
34+
(adr "005-proof-erasure"
35+
(status "accepted")
36+
(context "Proofs must not impose runtime cost on generated wrappers")
37+
(decision "All proof witnesses are erased during Idris2 compilation (QTT 0-usage)")
38+
(consequences "Native wrapper is as fast as hand-written C; proofs exist only at compile time"))
39+
40+
(adr "006-no-unsafe-patterns"
2341
(status "accepted")
24-
(context "Need consistent project structure across 29+ -iser repos")
25-
(decision "All repos cloned from rsr-template-repo with full CI/CD and governance")
26-
(consequences "17 workflows, SECURITY.md, CONTRIBUTING, bot directives from day one")))
42+
(context "Generated Idris2 code must be trustworthy")
43+
(decision "Never use believe_me, assert_total, sorry, unsafeCoerce, or any escape hatch in generated code")
44+
(consequences "If a proof cannot be discharged, idrisiser reports a clear error rather than silently unsound output")))
2745

2846
(development-practices
29-
(language "Rust" (purpose "CLI and orchestration"))
30-
(language "Idris2" (purpose "ABI formal proofs"))
31-
(language "Zig" (purpose "FFI C-ABI bridge"))
32-
(build-tool "cargo")
47+
(language "Rust" (purpose "CLI orchestrator — parses manifest, invokes parsers and codegen"))
48+
(language "Idris2" (purpose "ABI layer — formal proofs of interface correctness"))
49+
(language "Zig" (purpose "FFI layer — C-ABI bridge implementing proof engine operations"))
50+
(build-tool "cargo" (purpose "Rust CLI build"))
51+
(build-tool "zig build" (purpose "FFI shared/static library build"))
52+
(build-tool "idris2" (purpose "Proof compilation and totality checking"))
3353
(ci "GitHub Actions (17 workflows)"))
3454

3555
(design-rationale
36-
(principle "Manifest-driven"
37-
(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"))
40-
(principle "Zero target language exposure"
41-
(explanation "Users never write Chapel/Julia/Futhark/etc. — the -iser handles everything"))))
56+
(principle "Interface-first"
57+
(explanation "The parsed interface is the single source of truth; all proofs, FFI, and native output derive from it"))
58+
(principle "Proof obligations, not proof terms"
59+
(explanation "Idrisiser derives WHAT must be proven from the interface; Idris2 elaborator reflection builds HOW"))
60+
(principle "Deterministic generation"
61+
(explanation "Same manifest + same interface = same output, always; no randomness, no heuristics"))
62+
(principle "Fail loudly on unproven obligations"
63+
(explanation "A proof that cannot be discharged halts generation with a clear diagnostic; never emit unsound code"))))
Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
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 idrisiser
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 because proof soundness is critical
1414
report-format = "logtalk"
1515

1616
[symbolic-rules]
17-
# Custom symbolic rules for this project
18-
# - { name = "no-unsafe-ffi", pattern = "believe_me|unsafeCoerce", severity = "critical" }
17+
# Idrisiser-specific rules for Hypatia scanning:
18+
# - Detect believe_me, assert_total, sorry in any .idr file
19+
# - Detect unsafeCoerce, Obj.magic in any generated code
20+
# - Verify %default total is present in every generated module
21+
# - Check that all proof witnesses have 0-multiplicity
22+
# - Verify Foreign.idr function names match Zig FFI exports
23+
rules = [
24+
{ name = "no-believe-me", pattern = "believe_me", severity = "critical", scope = "*.idr" },
25+
{ name = "no-assert-total", pattern = "assert_total", severity = "critical", scope = "*.idr" },
26+
{ name = "no-sorry", pattern = "\\bsorry\\b", severity = "critical", scope = "*.idr" },
27+
{ name = "no-unsafe-coerce", pattern = "unsafeCoerce|Obj\\.magic", severity = "critical", scope = "*" },
28+
{ name = "total-default", pattern = "%default total", severity = "warning", scope = "*.idr", expect = "present" },
29+
]
1930

2031
[neural-config]
21-
# Neural pattern detection settings
22-
# confidence-threshold = 0.85
23-
# model = "hypatia-v2"
32+
# Neural pattern detection for proof quality
33+
confidence-threshold = 0.90
34+
# Higher threshold because proof soundness errors are catastrophic
Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
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 idrisiser
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 = "ci-triggered"
13+
targets = ["binary", "library"]
14+
# binary: idrisiser CLI (Rust, cargo build --release)
15+
# library: libidrisiser.so / libidrisiser.a (Zig FFI, zig build)
1416

1517
[incident-response]
16-
# 1. Check .machine_readable/STATE.a2ml for current status
18+
# 1. Check .machine_readable/6a2/STATE.a2ml for current status
1719
# 2. Review recent commits and CI results
18-
# 3. Run `just validate` to check compliance
19-
# 4. Run `just security` to audit for vulnerabilities
20+
# 3. Run `cargo test` to verify Rust CLI
21+
# 4. Run `cd src/interface/ffi && zig build test` to verify FFI
22+
# 5. Check that all generated Idris2 code passes `idris2 --check`
23+
# 6. Run `just validate` to check RSR compliance
2024

2125
[release-process]
22-
# 1. Update version in STATE.a2ml, META.a2ml, Justfile
26+
# 1. Update version in STATE.a2ml, META.a2ml, Cargo.toml, build.zig
2327
# 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`
28+
# 3. Run full test suite: cargo test && zig build test && zig build test-integration
29+
# 4. Verify no holes in generated Idris2: grep -r 'sorry\|believe_me\|assert_total' src/
30+
# 5. Tag and push
2731
# 6. Run `just container-push` if applicable
2832

33+
[proof-verification-runbook]
34+
# When a proof obligation fails to discharge:
35+
# 1. Check the proof obligation source (which contract clause?)
36+
# 2. Check the proof kind (totality? termination? invariant?)
37+
# 3. Examine the generated Types.idr for the failing obligation
38+
# 4. Verify the interface definition is well-formed
39+
# 5. If the interface has an inherently unprovable property, report it clearly
40+
# 6. NEVER work around the failure with believe_me or sorry
41+
2942
[maintenance-operations]
30-
# Baseline audit:
31-
# just maint-audit
32-
# Hard release gate:
33-
# just maint-hard-pass
34-
# Permission audit:
35-
# just perms-audit
43+
# Baseline audit: just maint-audit
44+
# Hard release gate: just maint-hard-pass
45+
# Permission audit: just perms-audit

.machine_readable/6a2/STATE.a2ml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,38 @@
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 "idrisiser")
13-
(description "Generate proven-correct wrappers using Idris2 dependent types")
14-
(status "scaffold")
15-
(priority "—")
16-
(ecosystem "-iser family (https://github.com/hyperpolymath/iseriser)"))
13+
(description "Meta-prover: generates proven-correct wrappers from interface definitions using Idris2 dependent types")
14+
(status "scaffold — codebase in progress")
15+
(priority "foundational — most critical -iser after iseriser")
16+
(ecosystem "-iser family (https://github.com/hyperpolymath/iseriser)")
17+
(role "Every -iser needing formal verification routes through idrisiser"))
1718

1819
(current-position
19-
(phase "initial-scaffold")
20-
(completion-percentage 5)
21-
(milestone "Architecture defined, CLI scaffolded, RSR template complete"))
20+
(phase "scaffold-complete")
21+
(completion-percentage 10)
22+
(milestone "Scaffold complete: CLI, manifest parser, ABI/FFI stubs, bespoke documentation"))
2223

2324
(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"))
25+
(step 1 "Interface parser: OpenAPI 3.x spec → intermediate representation")
26+
(step 2 "Interface parser: C headers (.h) → intermediate representation")
27+
(step 3 "Interface parser: Protocol Buffers (.proto) → intermediate representation")
28+
(step 4 "Proof obligation engine: derive proof obligations from parsed contracts")
29+
(step 5 "Idris2 code generation: Types.idr with dependent types encoding contracts")
30+
(step 6 "Idris2 code generation: Layout.idr with memory layout proofs")
31+
(step 7 "Idris2 code generation: Foreign.idr with FFI declarations")
32+
(step 8 "Proof compilation: invoke Idris2 totality checker on generated code")
33+
(step 9 "Zig FFI code generation: emit main.zig implementing Foreign.idr")
34+
(step 10 "End-to-end: OpenAPI spec → proven native wrapper"))
2935

3036
(blockers-and-issues
3137
(none "Project is in scaffold phase — no blockers yet"))
3238

3339
(critical-next-actions
34-
(action "Implement codegen for primary use case")
35-
(action "Write first working example end-to-end")))
40+
(action "Implement OpenAPI 3.x parser as the first bridge adapter")
41+
(action "Define intermediate representation for parsed interface contracts")
42+
(action "Build proof obligation derivation from contract IR")))

0 commit comments

Comments
 (0)