# phannhatminh/vproof architecture

> Architecture diagram of the GitHub repository phannhatminh/vproof, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phannhatminh/vproof
- Repository: https://github.com/phannhatminh/vproof

## Overview

VProof is a command-line runner for V, a language for writing and checking formal proofs. The main workflow reads a source file, parses statements incrementally, and has the interpreter dispatch them to proof operations and the shared world of objects and propositions; the CLI prints a trace and check totals. The runtime also supports exact arithmetic, symbolic simplification, and a minimal embedded prelude. The tree and excerpts establish the module boundaries; relationships for unsampled implementation details are omitted rather than inferred.

Main entry points: [`src/interp.cpp`](https://github.com/phannhatminh/vproof/blob/main/src/interp.cpp) (Statement interpreter), [`src/world.cpp`](https://github.com/phannhatminh/vproof/blob/main/src/world.cpp) (World state), [`src/parser.cpp`](https://github.com/phannhatminh/vproof/blob/main/src/parser.cpp) (Incremental parser), [`include/v/core.hpp`](https://github.com/phannhatminh/vproof/blob/main/include/v/core.hpp) (Object model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Program entry"]
  node_cli["CLI runner<br/>[main.cpp]"]
end

subgraph group_language["Language runtime"]
  node_interpreter["Statement interpreter<br/>[interp.cpp]"]
  node_parser["Incremental parser<br/>[parser.cpp]"]
  node_syntax["Statement forms<br/>[syntax.hpp]"]
  node_prelude["Embedded prelude<br/>[prelude.hpp]"]
end

subgraph group_proof["Proof engine"]
  node_prover["Proof operations<br/>[prover.cpp]"]
end

subgraph group_model["Proof model"]
  node_world[("World state<br/>[world.cpp]")]
  node_objects["Object model<br/>[core.hpp]"]
  node_propositions["Proposition model<br/>[prop.cpp]"]
end

subgraph group_math["Mathematics"]
  node_rational["Exact rationals<br/>[rational.cpp]"]
  node_symbolic["Symbolic algebra<br/>[symbolic.cpp]"]
end

node_user(("V program author"))

node_user -->|"runs file"| node_cli
node_cli -->|"runs source"| node_interpreter
node_interpreter -->|"parses statements"| node_parser
node_parser -->|"builds statements"| node_syntax
node_interpreter -->|"dispatches proofs"| node_prover
node_interpreter -->|"maintains state"| node_world
node_interpreter -->|"loads prelude"| node_prelude
node_prover -->|"records proofs"| node_world
node_parser -->|"builds propositions"| node_world
node_world -->|"stores objects"| node_objects
node_world -->|"stores propositions"| node_propositions
node_propositions -->|"uses object IDs"| node_objects
node_interpreter -->|"simplifies expressions"| node_symbolic
node_symbolic -->|"resolves terms"| node_world
node_objects -->|"stores values"| node_rational

click node_cli "https://github.com/phannhatminh/vproof/blob/main/src/main.cpp"
click node_interpreter "https://github.com/phannhatminh/vproof/blob/main/src/interp.cpp"
click node_parser "https://github.com/phannhatminh/vproof/blob/main/src/parser.cpp"
click node_syntax "https://github.com/phannhatminh/vproof/blob/main/include/v/syntax.hpp"
click node_prelude "https://github.com/phannhatminh/vproof/blob/main/include/v/prelude.hpp"
click node_prover "https://github.com/phannhatminh/vproof/blob/main/src/prover.cpp"
click node_world "https://github.com/phannhatminh/vproof/blob/main/src/world.cpp"
click node_objects "https://github.com/phannhatminh/vproof/blob/main/include/v/core.hpp"
click node_propositions "https://github.com/phannhatminh/vproof/blob/main/src/prop.cpp"
click node_rational "https://github.com/phannhatminh/vproof/blob/main/src/rational.cpp"
click node_symbolic "https://github.com/phannhatminh/vproof/blob/main/src/symbolic.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli toneBlue
class node_interpreter,node_parser,node_syntax,node_prelude toneAmber
class node_prover toneMint
class node_world,node_objects,node_propositions toneRose
class node_rational,node_symbolic,node_user toneIndigo
```

## Components

### Program entry

- [CLI runner](https://github.com/phannhatminh/vproof/blob/main/src/main.cpp): `src/main.cpp`

### Language runtime

- [Statement interpreter](https://github.com/phannhatminh/vproof/blob/main/src/interp.cpp): `src/interp.cpp`
- [Incremental parser](https://github.com/phannhatminh/vproof/blob/main/src/parser.cpp): `src/parser.cpp`
- [Statement forms](https://github.com/phannhatminh/vproof/blob/main/include/v/syntax.hpp): `include/v/syntax.hpp`
- [Embedded prelude](https://github.com/phannhatminh/vproof/blob/main/include/v/prelude.hpp): `include/v/prelude.hpp`

### Proof engine

- [Proof operations](https://github.com/phannhatminh/vproof/blob/main/src/prover.cpp): `src/prover.cpp`

### Proof model

- [World state](https://github.com/phannhatminh/vproof/blob/main/src/world.cpp): `src/world.cpp`
- [Object model](https://github.com/phannhatminh/vproof/blob/main/include/v/core.hpp): `include/v/core.hpp`
- [Proposition model](https://github.com/phannhatminh/vproof/blob/main/src/prop.cpp): `src/prop.cpp`

### Mathematics

- [Exact rationals](https://github.com/phannhatminh/vproof/blob/main/src/rational.cpp): `src/rational.cpp`
- [Symbolic algebra](https://github.com/phannhatminh/vproof/blob/main/src/symbolic.cpp): `src/symbolic.cpp`

### Other components

- **V program author**

## Connections

- V program author → CLI runner: runs file (evidence: `src/main.cpp`)
- CLI runner → Statement interpreter: runs source (evidence: `src/main.cpp`)
- Statement interpreter → Incremental parser: parses statements
- Incremental parser → Statement forms: builds statements
- Statement interpreter → Proof operations: dispatches proofs
- Statement interpreter → World state: maintains state
- Statement interpreter → Embedded prelude: loads prelude (evidence: `src/interp.cpp`)
- Proof operations → World state: records proofs
- Incremental parser → World state: builds propositions
- World state → Object model: stores objects
- World state → Proposition model: stores propositions
- Proposition model → Object model: uses object IDs
- Statement interpreter → Symbolic algebra: simplifies expressions (evidence: `src/interp.cpp`)
- Symbolic algebra → World state: resolves terms
- Object model → Exact rationals: stores values (evidence: `include/v/core.hpp`)
