Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
51dee07
fix(lean4): make RmdirPrecondition inhabited; record 2026-11-09 proof…
claude Nov 9, 2026
5bd68d1
docs(audit): record Idris2 holes outside the ledger and the census be…
claude Nov 9, 2026
b8e4c7f
feat(agda): check the Agda tree under --safe --without-K --cubical-co…
claude Nov 9, 2026
34e9235
chore(proofs): archive Isabelle and Mizar; make the Z3 checks non-cir…
claude Nov 9, 2026
97db7f9
docs(plan): record owner rulings OD-30 to OD-34 (proof-policy conform…
claude Nov 9, 2026
38b947f
fix: address SonarCloud and review findings on the proof-ground-truth PR
claude Nov 9, 2026
0439301
docs(experiment): Dedukti transport of the Agda proofs to Rocq/Lean
claude Nov 9, 2026
5b62887
docs: clear two Hypatia text-match alerts
claude Nov 9, 2026
1f570a3
fix: address the second CodeRabbit review on the proof-ground-truth PR
claude Nov 9, 2026
dfae63c
test(proofs): negative Z3 check for non-empty rmdir; Agda sequence wi…
claude Nov 9, 2026
5dab827
fix: point remaining Isabelle/Mizar consumers at archive/proofs/
claude Nov 9, 2026
20b9234
fix: address the third CodeRabbit review on the proof-ground-truth PR
claude Nov 9, 2026
2cd6a56
fix: drop the remaining six-system claims from the CLI and README
claude Nov 9, 2026
1bd7897
style: use [[ ]] tests in check-agda.sh (SonarCloud S7688)
claude Nov 9, 2026
f86614b
docs: correct the remaining current-status six-system claims
claude Nov 9, 2026
b9a0c4e
docs(readme): qualify the 478-candidate feature bullet as the 2026-06…
claude Nov 9, 2026
a9dc341
proofs(agda): witness every precondition; build recipes match CI
claude Nov 9, 2026
4768a7c
fix: drop six-system claims from the Zig and Elixir runtime output
claude Nov 9, 2026
e6c589b
docs: mark unbuilt Lean and axiomatic Z3 rows; fix SECURITY trust dia…
claude Nov 9, 2026
9b277fd
docs(security): drop Isabelle/Mizar from the type-safety and toolchai…
claude Nov 9, 2026
18e80c5
proof(lean4): Require an existing directory parent for rmdir and prov…
coderabbitai[bot] Nov 9, 2026
519e13a
docs(cli): Clarify Rust and Zig command behavior, errors, and proof r…
coderabbitai[bot] Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/agda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# SPDX-License-Identifier: MPL-2.0
# Agda is the theory source of truth (standards PROOF-POLICY §1). This lane
# checks every module through proofs/agda/All.agda under the canonical
# invocation (§2.1): --safe --without-K --cubical-compatible.
#
# PROOF-POLICY §6 deviation (state: open). The toolchain is not installed from
# the Guix manifest or a container, because this repository has neither for
# Agda yet. Leg: Agda theory source. Tool: Agda 2.7.0.1 upstream release
# archive, sha256 975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a;
# agda-stdlib tag v2.2 at commit 6cd04e46e5f8c740a5ec584a108bbb3380fa92d7.
# The run asserts both and fails on a mismatch. Also recorded in PROOF-NEEDS.adoc.
name: Agda proofs

on:
push:
branches: [main]
paths:
- 'proofs/agda/**'
- '.github/workflows/agda.yml'
- 'scripts/check-agda.sh'
pull_request:
paths:
- 'proofs/agda/**'
- '.github/workflows/agda.yml'
- 'scripts/check-agda.sh'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check:
name: Agda (--safe --without-K --cubical-compatible)
runs-on: ubuntu-latest
timeout-minutes: 30
env:
AGDA_VERSION: 2.7.0.1
AGDA_SHA256: 975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a
STDLIB_TAG: v2.2
STDLIB_COMMIT: 6cd04e46e5f8c740a5ec584a108bbb3380fa92d7
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4

- name: Install Agda (pinned release, digest-checked)
run: |
set -euo pipefail
curl --proto '=https' --tlsv1.2 -sSfL -o agda.tar.xz \
"https://github.com/agda/agda/releases/download/v${AGDA_VERSION}/Agda-v${AGDA_VERSION}-linux.tar.xz"
echo "${AGDA_SHA256} agda.tar.xz" | sha256sum -c -
mkdir -p "$HOME/agda"
tar -xJf agda.tar.xz -C "$HOME/agda"
echo "$HOME/agda/Agda-v${AGDA_VERSION}/bin" >> "$GITHUB_PATH"
echo "Agda_datadir=$HOME/agda/Agda-v${AGDA_VERSION}/data" >> "$GITHUB_ENV"

- name: Install agda-stdlib (pinned commit)
run: |
set -euo pipefail
git clone --depth 1 --branch "${STDLIB_TAG}" https://github.com/agda/agda-stdlib.git "$HOME/agda-stdlib"
got="$(git -C "$HOME/agda-stdlib" rev-parse HEAD)"
if [ "$got" != "${STDLIB_COMMIT}" ]; then
echo "::error::agda-stdlib ${STDLIB_TAG} is ${got}, expected ${STDLIB_COMMIT}"; exit 1
fi
mkdir -p "$HOME/.agda"
echo "$HOME/agda-stdlib/standard-library.agda-lib" > "$HOME/.agda/libraries"
Comment on lines +67 to +68

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load the registered Agda standard library

On a fresh GitHub runner, this only registers the standard library but does not select it, while the later bare agda ... All.agda invocation imports modules such as Data.String and Data.List; the new proof lane will therefore fail before type-checking the repository. Agda 2.7.0.1's official documentation says to use agda -l standard-library ..., or that a bare invocation works only after adding standard-library to the defaults file (Agda command-line examples), so create that file or pass the library explicitly.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't reproduce, so there's no change. Agda checks All.agda inside a project library: proofs/agda/valence-shell.agda-lib declares depend: standard-library. Agda resolves that dependency through ~/.agda/libraries, which this step writes. Library dependencies declared in a project .agda-lib are loaded without -l or a defaults file. defaults only applies to files outside any library.

The same setup works locally: stdlib registered in ~/.agda/libraries, no defaults file, bash scripts/check-agda.sh (the CI step since 20b9234), exit 0. The CI run on this head will confirm it on a fresh runner.


Generated by Claude Code


- name: Assert Agda version
run: |
set -euo pipefail
ver="$(agda --version | head -n1)"
echo "$ver"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
case "$ver" in
*"version ${AGDA_VERSION}"*) : ;;
*) echo "::error::expected Agda ${AGDA_VERSION}, got: $ver"; exit 1 ;;
esac

# Postulates and escape pragmas need no separate grep: `--safe` rejects
# `postulate`, TERMINATING, NO_POSITIVITY_CHECK and the rest. The script
# checks All.agda under the estate invocation, then fails if any module
# is missing from the import graph Agda reports (--dependency-graph), so
# a commented-out import cannot pass.
- name: Check All.agda and module coverage
run: bash scripts/check-agda.sh
10 changes: 9 additions & 1 deletion .github/workflows/rust-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ jobs:

- name: Build Lean proofs
working-directory: proofs/lean4
run: lake build
# A bare `lake build` builds only the default target (FilesystemModel),
# so the other libraries were never checked here. Build every library
# that compiles on v4.34.1, by name. FileContentOperations,
# RMOOperations, CopyMoveOperations and PermissionOperations do not
# build (see lakefile.lean); they are open work, not silently green.
run: |
lake build FilesystemModel FileOperations FilesystemComposition \
FilesystemEquivalence SymlinkOperations Extraction \
CrashConsistency PathTraversal PreconditionWitnesses

- name: Check for proof completeness
working-directory: proofs/lean4
Expand Down
52 changes: 20 additions & 32 deletions .machine_readable/contractiles/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default:
@just --list

# Build all proofs across all systems
build-all: build-coq build-lean4 build-agda build-isabelle build-mizar build-idris2
build-all: build-coq build-lean4 build-agda build-idris2
@echo "✓ All proofs built"

# Verify all proofs
Expand All @@ -25,30 +25,23 @@ build-coq:
@echo "✓ Coq proofs compiled"

# Build Lean 4 proofs
# Same named libraries as CI (.github/workflows/rust-cli.yml). A bare `lean File.lean`
# cannot resolve imports outside `lake env`, and a bare `lake build` builds only the
# default target. FileContentOperations, RMOOperations, CopyMoveOperations and
# PermissionOperations do not build on the pinned toolchain and are excluded.
build-lean4:
@echo "Building Lean 4 proofs..."
cd proofs/lean4 && lean FilesystemModel.lean
cd proofs/lean4 && lean FileOperations.lean
@echo "✓ Lean 4 proofs checked"
cd proofs/lean4 && lake build FilesystemModel FileOperations FilesystemComposition FilesystemEquivalence SymlinkOperations Extraction CrashConsistency PathTraversal PreconditionWitnesses
@echo "✓ Lean 4 proofs checked (CI library set)"

# Build Agda proofs
build-agda:
@echo "Building Agda proofs..."
cd proofs/agda && agda FilesystemModel.agda
cd proofs/agda && agda FileOperations.agda
@echo "✓ Agda proofs type-checked"

# Build Isabelle proofs
build-isabelle:
@echo "Building Isabelle proofs..."
cd proofs/isabelle && isabelle build -D .
@echo "✓ Isabelle proofs verified"

# Build Mizar proofs (requires Mizar setup)
build-mizar:
@echo "Building Mizar proofs..."
cd proofs/mizar && mizf filesystem_model.miz || echo "⚠ Mizar not configured"
cd proofs/mizar && mizf file_operations.miz || echo "⚠ Mizar not configured"
bash scripts/check-agda.sh
@echo "✓ Agda proofs checked (estate invocation, all modules in the import graph)"

# Isabelle and Mizar were archived to archive/proofs/ on 2026-11-09 (owner
# ruling; see archive/proofs/README.adoc). They have no build recipe.

# Requires Idris2 0.8.0. Install via:
# nix-shell -p idris2 # recommended for reproducibility
Expand Down Expand Up @@ -236,8 +229,8 @@ ci: clean build-all verify-all test-all
stats:
@echo "=== Valence Shell Statistics ==="
@echo ""
@echo "Proof Code (Coq/Lean/Agda/Isabelle/Mizar):"
@find proofs -name "*.v" -o -name "*.lean" -o -name "*.agda" -o -name "*.thy" -o -name "*.miz" 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo " 0 total"
@echo "Proof Code (Agda/Rocq/Lean; Isabelle and Mizar archived):"
@find proofs -name "*.v" -o -name "*.lean" -o -name "*.agda" 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo " 0 total"
@echo ""
@echo "Zig FFI Code:"
@find impl/zig -name "*.zig" 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo " 0 total"
Expand Down Expand Up @@ -269,7 +262,7 @@ watch:
echidna-verify:
@if command -v echidna &> /dev/null; then \
echo "Running ECHIDNA multi-prover verification..."; \
echidna verify --all --targets coq,lean4,agda,isabelle,mizar; \
echidna verify --all --targets coq,lean4,agda; \
else \
echo "⚠ ECHIDNA not installed. Using built-in verification."; \
just verify-all; \
Expand All @@ -292,7 +285,7 @@ certify:
"version": "${VERSION}",
"generated": "${TIMESTAMP}",
"prover": "valence-shell",
"proof_systems": ["coq", "lean4", "agda", "isabelle", "mizar", "z3"],
"proof_systems": ["coq", "lean4", "agda", "z3"],
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
"verified_properties": [
{
"theorem": "mkdir_rmdir_reversible",
Expand All @@ -319,7 +312,6 @@ certify:
"description": "transactions are atomic - fully committed or fully rolled back"
}
],
"total_theorems": 256,
"signature": "sha256:$(sha256sum certs/verification-certificate.json 2>/dev/null | cut -d' ' -f1 || echo 'pending')"
}
EOF
Expand All @@ -340,8 +332,6 @@ certify:
- Coq (primary)
- Lean 4 (cross-verification)
- Agda (dependent types)
- Isabelle/HOL (classical logic)
- Mizar (mathematical proofs)
- Z3 (SMT verification)

### Key Theorems Verified
Expand All @@ -351,10 +341,10 @@ certify:
3. **operation_sequence_reversible** - Operation sequences can be undone
4. **transaction_atomicity** - Transactions maintain ACID properties

### Total Coverage
- 256 theorems verified across 6 proof systems
- 100% precondition checking for all filesystem operations
- Memory safety verified via Zig implementation
### Coverage
This certificate asserts no theorem count or percentage. Current coverage,
with each obligation's status, is in EXPLAINME.adoc#proof-ledger and
docs/audits/2026-11-09-proof-ground-truth.adoc.

EOF

Expand Down Expand Up @@ -388,8 +378,6 @@ help:
@echo " just build-coq - Build Coq proofs"
@echo " just build-lean4 - Build Lean 4 proofs"
@echo " just build-agda - Build Agda proofs"
@echo " just build-isabelle - Build Isabelle proofs"
@echo " just build-mizar - Build Mizar proofs"
@echo " just build-idris2 - Build Idris2 proofs"
@echo " just verify-idris2 - Build + hole-count Idris2 proofs"
@echo ""
Expand Down
43 changes: 22 additions & 21 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ The Rust CLI is a functional interactive shell with these features:
normative for this repository; this section is a short map for agents and changes in
the same change as that file. Which verifier carries which obligation:

* *Rust code* → Creusot, on the code itself (no Creusot contracts exist in
`impl/rust-cli/` yet). Kani is the standing exception for `unsafe`/FFI seams; Aeneas
only where Rust implements a theorem proved in Agda.
* *Rust code* → Creusot with Pearlite contracts, and Verus (ruling 2026-11-07), on
the code itself; no contracts exist in `impl/rust-cli/` yet. Kani is the standing
exception for `unsafe`/FFI seams. Aeneas runs only as an optional, labelled side
lane (route plan OD-31): it never gates or grades anything, and its Rust-to-model
row is `ASSUMED`.
* *Ada code* → SPARK (none in this repo).
* *APIs, ABIs, wire formats, engineering properties* → Idris2 (`proofs/idris2/`).
* *Theory* → Agda as the source of truth, rechecked in Rocq and Lean. This repo's
theory rows are currently Coq/Lean-sourced, which is the reverse of that order; see
`docs/audits/2026-11-01-assurance-boundary-audit.adoc` AP-3.
* Isabelle/Mizar/Z3 are §4 exceptions and need a recorded exception note.
* *Theory* → Agda as the source of truth, rechecked in Rocq and Lean. Owner
ruling 2026-11-09 adopts this order here: the Agda tree is the source and checks
under the canonical invocation; the existing Lean and Rocq proofs are target-only
evidence until compared (`docs/audits/2026-11-09-proof-ground-truth.adoc`).
* Z3 is a §4 exception; its notes are recorded in each `.smt2` header. Isabelle and
Mizar were archived unchecked to `archive/proofs/` (owner ruling 2026-11-09).

Status vocabulary is closed (`PROOF-POLICY` §5): `proven`,
`proven-with-postulates`, `argued`, `tested-only`, `open`. Every obligation's status
Expand Down Expand Up @@ -107,8 +111,8 @@ Grade 2 or Grade 1 obligation.
### Codebase Metrics

- 21,331 lines of Rust across 32 source files (`find impl/rust-cli/src -name '*.rs' | wc -l`; `wc -l` aggregate, measured 2026-06-01)
- ~478 theorem candidates across 6 proof systems + Idris2 ABI layer (per issue #42 deep-audit inventory, 2026-06-01)
- 2 proof holes remaining, **0 real gaps**: 1 justified axiom (Coq `is_empty_dir_dec` — infinite-domain decidability), 1 structural axiom (Agda `funext` — standard in intensional TT). The former real gap (Coq `obliterate_overwrites_all_blocks`) is CLOSED — re-verified 2026-07-16 via `Print Assumptions` (*Closed under the global context*) under Coq 8.18.0 — see `docs/PROOF_HOLES_AUDIT.adoc`
- ~478 theorem candidates across the 6 proof systems then in use + Idris2 ABI layer (per issue #42 deep-audit inventory, 2026-06-01); Isabelle and Mizar were archived unchecked 2026-11-09, so that census overstates current checked evidence
- Proof-hole count (Coq/Agda escape hatches only; *not* a measure of open proof work, which is listed in `docs/audits/2026-11-09-proof-ground-truth.adoc`, e.g. the Lean oracle/spec emptiness mismatch and the four Lean libraries that do not build): **0 real gaps**: 1 justified classical dependency (Coq `is_empty_dir_dec` — a `Theorem` proved with `Classical.classic` and `ClassicalEpsilon`, not a custom `Axiom`; corrected 2026-11-09), 0 Agda postulates (the structural `funext` was removed 2026-11-09: filesystem equality is now pointwise and the tree checks under `--safe --without-K --cubical-compatible`). The former real gap (Coq `obliterate_overwrites_all_blocks`) is CLOSED — re-verified 2026-07-16 via `Print Assumptions` (*Closed under the global context*) under Coq 8.18.0 — see `docs/PROOF_HOLES_AUDIT.adoc`
- Idris2 ABI layer: **0 proof holes** (all closed 2026-07-01, issue #151 root — builds under `--total`), 0 `partial` markers, 2 registered primitive-eq axioms (`axStringEqRefl`, `axBits8EqRefl`; gated by `.github/scripts/check-idris2-believe-me.sh`)
- 7 fuzz targets in `impl/rust-cli/fuzz/fuzz_targets/` (parser, arith, job-spec, signal-parse, path-ops, glob-expansion, state-machine)

Expand All @@ -117,7 +121,7 @@ Grade 2 or Grade 1 obligation.
### Critical Priority

1. **No mechanized Lean -> Rust correspondence** — `argued` + `tested-only`, never `proven`; the v1.0 blocker
2. **0 real proof gaps** — the former Coq `obliterate_overwrites_all_blocks` gap is CLOSED (re-verified 2026-07-16, *Closed under the global context*); 2 documented axioms remain (1 justified decidability + 1 structural funext) — see `docs/PROOF_HOLES_AUDIT.adoc`
2. **0 real proof gaps** — the former Coq `obliterate_overwrites_all_blocks` gap is CLOSED (re-verified 2026-07-16, *Closed under the global context*); 1 documented classical dependency remains (Coq `is_empty_dir_dec`; the Agda `funext` postulate was removed 2026-11-09) — see `docs/PROOF_HOLES_AUDIT.adoc`
3. **NOT production-ready** — research prototype only

### High Priority
Expand Down Expand Up @@ -183,13 +187,12 @@ deep-audit session). The corresponding Phase 4C design docs under

### Technology Stack

**Formal Verification (6 systems)**:
- Lean 4 — primary source of truth
**Formal Verification (4 active systems; Isabelle/HOL and Mizar archived)**:
- Agda — theory source of truth (owner ruling 2026-11-09)
- Lean 4 — recheck leg; also the executable model oracle
- Coq — CIC foundation, extraction to OCaml
- Isabelle/HOL — cross-validation
- Agda — intensional type theory
- Mizar — set theory foundation
- Z3 SMT — automated verification
- Z3 SMT — automated checks (ASSUMED under PROOF-POLICY §5)
- Isabelle/HOL and Mizar — archived unchecked 2026-11-09 (`archive/proofs/`)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

**Runtime**:
- Rust — primary shell implementation (`impl/rust-cli/`)
Expand All @@ -212,12 +215,10 @@ valence-shell/
zig/ # Zig FFI scaffolding
mcp/ # MCP server bindings
proofs/
lean4/ # Primary proof source (101 theorems)
lean4/ # Lean recheck leg + executable model oracle (101 theorems)
coq/ # CIC proofs + extraction (131 theorems, 0 admits — re-verified 2026-07-16, Coq 8.18.0)
agda/ # Type theory proofs (85 theorems, 3 postulates including funext)
isabelle/ # HOL proofs (76 theorems)
mizar/ # Set theory proofs (63 theorems)
z3/ # SMT proofs (125 asserts)
agda/ # Theory source of truth (owner ruling 2026-11-09); 10 modules, 0 postulates, --safe --without-K --cubical-compatible
z3/ # SMT checks (ASSUMED; 2 files definitional, 3 axiomatic)
idris2/ # ABI carrier (0 holes, 0 partials, 2 primitive-eq axioms)
docs/ # Design docs, roadmaps, PROOF_HOLES_AUDIT.adoc
audits/ # Deep-audit log (per estate standards)
Expand Down
7 changes: 2 additions & 5 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ perimeters:
*Who*: Project maintainers with formal methods expertise

*Files*: - `+proofs/coq/*.v+` - Coq proofs - `+proofs/lean4/*.lean+` -
Lean 4 proofs - `+proofs/agda/*.agda+` - Agda proofs -
`+proofs/isabelle/*.thy+` - Isabelle proofs - `+proofs/mizar/*.miz+` -
Mizar proofs - `+impl/ocaml/filesystem_ffi.ml+` - FFI layer
Lean 4 proofs - `+proofs/agda/*.agda+` - Agda proofs (theory source) - `+impl/ocaml/filesystem_ffi.ml+` - FFI layer

*Requirements*: - Formal verification expertise - Proof assistant
proficiency - Security review process - Maintainer approval required
Expand Down Expand Up @@ -86,7 +84,7 @@ Matters`"
Bash

*Full Development* (to modify proofs): - Coq 8.18+ - Lean 4.3+ - Agda
2.6.4+ - Isabelle 2024 - Z3 4.12+ - Just (command runner) - Nix
2.7.0.1 with agda-stdlib v2.2 - Z3 4.8+ - Just (command runner) - Nix
(recommended for reproducible builds)

==== Setup Instructions
Expand Down Expand Up @@ -276,7 +274,6 @@ just verify-proofs
just build-coq
just build-lean4
just build-agda
just build-isabelle
----

==== Implementation Testing
Expand Down
Loading
Loading