Skip to content

Commit f4a97b4

Browse files
docs(readme): convert README.adoc -> Markdown README.md (#36)
README must be real Markdown to render in GitHub community-health, the GitHub profile, and external MCP directories (Glama) — AsciiDoc shows as raw markup there. pandoc asciidoc->GFM, badges fixed to clickable, SPDX header kept as an HTML comment, duplicate README.adoc removed. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f5c9f31 commit f4a97b4

2 files changed

Lines changed: 159 additions & 139 deletions

File tree

README.adoc

Lines changed: 0 additions & 139 deletions
This file was deleted.

README.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<!--
2+
SPDX-License-Identifier: CC-BY-SA-4.0
3+
SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
-->
5+
6+
# What Is This?
7+
8+
Idrisiser is the **meta-prover** of the [-iser
9+
family](https://github.com/hyperpolymath/iseriser). It takes any
10+
interface definition — OpenAPI specs, C header files, `.proto` schemas,
11+
or bare type signatures — and generates **Idris2 dependent-type
12+
wrappers** that *formally prove* the interface contract is correct, then
13+
compiles those proofs down to a native wrapper via Zig FFI.
14+
15+
Idris2 is the sole formal verification language in the hyperpolymath
16+
ecosystem (chosen over ATS2, Coq, Lean, and Agda for its dependent
17+
types, first-class elaborator reflection, and quantitative type theory).
18+
Idrisiser therefore sits just below `iseriser` itself in the -iser
19+
hierarchy: every other -iser that needs formal guarantees routes through
20+
Idrisiser.
21+
22+
# Why Idrisiser?
23+
24+
Idris2 can prove code correct at compile time, but the learning curve is
25+
brutal. Idrisiser makes dependent-type proofs accessible to developers
26+
who should not need a PhD in type theory:
27+
28+
- **Automatic formal verification of *any* interface** — preconditions,
29+
postconditions, invariants, and totality are proved, not tested.
30+
31+
- **Impossible states become impossible** — dependent types enforce
32+
contracts at the type level; invalid calls cannot compile.
33+
34+
- **Zero runtime cost** — proofs are erased at compile time; the final
35+
native wrapper carries no proof overhead.
36+
37+
# How It Works
38+
39+
Describe your interface in an `idrisiser.toml` manifest. Idrisiser then
40+
executes a six-stage pipeline:
41+
42+
```text
43+
idrisiser.toml ①
44+
45+
Interface Parser <2> OpenAPI / .h / .proto / type sigs → IR
46+
47+
Idris2 ABI Generation <3> Dependent types + proof obligations
48+
49+
Proof Compilation <4> Totality checker, elaborator reflection
50+
51+
Zig FFI Bridge <5> C-ABI native wrapper, zero overhead
52+
53+
Native Wrapper <6> Statically linked, provably correct
54+
```
55+
56+
<div class="callout-list">
57+
58+
1. User writes only the manifest.
59+
60+
2. Parser extracts interface contracts from heterogeneous sources.
61+
62+
3. Generates `Types.idr`, `Layout.idr`, `Foreign.idr` with proof
63+
obligations.
64+
65+
4. Idris2 compiler verifies totality, termination, and invariant
66+
preservation.
67+
68+
5. Zig FFI implements C-ABI functions declared in the Idris2 ABI layer.
69+
70+
6. Output is a native shared/static library with formally verified
71+
behaviour.
72+
73+
</div>
74+
75+
# Architecture
76+
77+
```text
78+
idrisiser/
79+
├── Cargo.toml # Rust CLI orchestrator
80+
├── src/
81+
│ ├── main.rs # CLI entry point (init, validate, generate, build, run)
82+
│ ├── lib.rs # Library API
83+
│ ├── manifest/ # idrisiser.toml parser & validator
84+
│ ├── codegen/ # Idris2 + Zig code generation
85+
│ ├── core/ # Proof obligation engine
86+
│ ├── definitions/ # Interface definition IR
87+
│ ├── contracts/ # Contract extraction from parsed interfaces
88+
│ ├── errors/ # Structured diagnostics
89+
│ ├── bridges/ # Bridge adapters (OpenAPI, protobuf, C headers)
90+
│ └── interface/
91+
│ ├── abi/ # Idris2 ABI — formal proofs (Types.idr, Layout.idr, Foreign.idr)
92+
│ ├── ffi/ # Zig FFI — C-ABI bridge implementation
93+
│ └── generated/ # Auto-generated C headers
94+
├── verification/ # Property-based and proof verification harnesses
95+
├── examples/ # End-to-end worked examples
96+
└── docs/ # Technical documentation
97+
```
98+
99+
## Key Idris2 Concepts Used
100+
101+
- **Dependent types** — types that depend on values, so a function’s
102+
return type can encode its postcondition.
103+
104+
- **Totality checking** — the compiler proves every function terminates
105+
and handles every input; partial functions are rejected.
106+
107+
- **Elaborator reflection** — Idris2 metaprogramming that generates
108+
proof terms at compile time from the parsed interface definition.
109+
110+
- **Quantitative type theory (QTT)** — track how many times a value is
111+
used; enforce linear or affine resource protocols in the generated
112+
wrapper.
113+
114+
# Use Cases
115+
116+
- **Proving REST API contracts** — parse an OpenAPI spec, generate
117+
Idris2 types that prove request/response schemas, status codes, and
118+
auth flows.
119+
120+
- **Safe database query wrappers** — generate wrappers that prove query
121+
parameters are well-typed and result sets match declared schemas.
122+
123+
- **Protocol state machine verification** — prove that a protocol (TLS
124+
handshake, OAuth flow) can only transition through valid states.
125+
126+
- **Provably-correct serialisation** — generate encoders/decoders with
127+
proofs that round-tripping preserves data identity.
128+
129+
- **C header safety** — parse `.h` files, generate wrappers proving null
130+
safety, bounds checking, and resource cleanup.
131+
132+
# Quick Start
133+
134+
```bash
135+
# Initialise a manifest
136+
idrisiser init
137+
138+
# Edit idrisiser.toml to describe your interface
139+
140+
# Validate the manifest
141+
idrisiser validate
142+
143+
# Generate proven-correct wrapper
144+
idrisiser generate -o generated/my-api
145+
146+
# Build native artifacts
147+
idrisiser build --release
148+
```
149+
150+
# Status
151+
152+
**Codebase in progress.** Scaffold phase is complete (CLI, manifest
153+
parser, ABI/FFI stubs, RSR template with full CI/CD). Interface parser
154+
and proof generation are the active implementation frontier. See
155+
`ROADMAP.adoc`.
156+
157+
# License
158+
159+
SPDX-License-Identifier: CC-BY-SA-4.0

0 commit comments

Comments
 (0)