valerie-core is the verified compiler backend and formal semantics library for Valerie. It contains the F* and Pulse formal specifications, operational machine semantics for all supported targets, and the OCaml frontend lexer/parser that compiles .vaf files.
From either the repository root or inside valerie-core/:
valerie compilerThis builds the lexer/parser, extracts the verified AST transformer from F* to OCaml, and compiles the native executable to dist/valerie-compiler.
To install it into your PATH (~/.local/bin/valy, ~/.local/bin/valerie-compiler, and ~/.local/bin/vale):
valerie vale --installYou can verify the formal proofs directly using Valerie:
# Verify the entire Pulse separation logic suite
valerie verify --pulse
# Verify a specific machine specification
valerie verify src/spec/Valerie.AArch64.Machine.fst
# Verify the Pulse separation logic memory model
valerie verify src/pulse/Valerie.Pulse.Memory.fstUse valerie emit or the compiled valy directly:
# Emit verified Pulse separation logic module
valerie emit tests/fixtures/vale/chacha20_quarter.vaf --pulse chacha.fst
# Emit target assembly for AArch64
valerie emit tests/fixtures/vale/chacha20_quarter.vaf -o chacha.s --target aarch64-linux
# Or invoke the backend compiler directly
valy -in tests/fixtures/vale/chacha20_quarter.vaf -pulse chacha.fst -arch aarch64The codebase is organized into four main layers:
valerie-core/
├── src/
│ ├── parser/ # Native lexer & parser (OCaml)
│ ├── compiler/ # Verified AST, validation, lowering, and emitters (F*)
│ ├── spec/ # Target machine states, instruction semantics & WP calculi (F*)
│ ├── pulse/ # Separation logic machine & memory model (#lang-pulse)
│ └── proof/ # Mathematical lemmas & calling convention proofs (F*)
└── valerie.toml # Declarative task & verification manifest
Replaces legacy Vale's #lang-pulse):
Valerie.Pulse.Machine.fst: Machine register banks modeled as linear arrays (reg_array = array U64.t). Instruction steps prove state transitions while framing disjoint registers.Valerie.Pulse.Memory.fst: Memory buffers with typed byte, word32, and word64 views, using separating conjunction (**) for spatial framing.
Each supported target has a complete formal machine state, instruction semantics, instruction lemmas, and Weakest Precondition (WP) calculi:
- AArch64:
Valerie.AArch64.Machine.fst,Valerie.AArch64.Semantics.fst,Valerie.AArch64.WP.fst - x86_64:
Valerie.X64.Machine.fst,Valerie.X64.Semantics.fst,Valerie.X64.WP.fst - Arm32:
Valerie.Arm32.Machine.fst,Valerie.Arm32.Semantics.fst,Valerie.Arm32.WP.fst - RISC-V 64:
Valerie.Riscv64.Machine.fst,Valerie.Riscv64.Semantics.fst,Valerie.Riscv64.WP.fst
The translation from source .vaf to verified artifacts:
- Parsing:
src/parser/lex.mllandsrc/parser/parse.mlyparse Vale source text into an OCaml AST. - Desugaring & Validation:
Valerie.Compiler.Desugar.fstandValerie.Compiler.Validate.fsttransform and check type/register rules. - Lowering: Target-specific passes in
Valerie.Compiler.Lower.*.fstconvert high-level statements into concrete machine instructions. - Emission:
Valerie.Compiler.EmitPulse.fst,Valerie.Compiler.EmitFStar.fst, andValerie.Compiler.Print.fstoutput verified Pulse, F*, or textual assembly.
Valerie.Proof.Core.fst: Algebraic lemmas for XOR involution, arithmetic rings, and bitwise updates.Valerie.Proof.ABI.*.fst: Formal proofs that procedures preserve callee-saved registers under AAPCS64, System V, AAPCS32, and lp64d.
The build and verification rules are declared in valerie.toml:
[verification]: Specifies cache directories (.cache), hints, and include paths acrosssrc/spec,src/pulse,src/compiler, andsrc/proof.[tasks.compiler]: Compiles and links the native OCaml binary usingocamloptandvalerie_parser.cmxa.[tasks.pulse-verify]: Runs Pulse verification with-warn-errorflags.