# viperproject/boogie-proofgen architecture

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

- Interactive diagram: https://gitdiagram.com/viperproject/boogie-proofgen
- Repository: https://github.com/viperproject/boogie-proofgen

## Overview

##### Project type and purpose
- This is an open-source verification tool: a fork of the Boogie verifier extended with a proof-generation backend for Isabelle/HOL. It behaves like a compiler pipeline, taking a Boogie program through parsing, transformation, VC generation, SMT solving, and then emitting Isabelle proof scripts.

##### High-level architecture from the file structure
- Top-level directories
- Source/ — the main C# solution (Boogie.sln) with subprojects for each phase.
- ProofGenerationBenchmarks/ — sample Boogie programs and benchmarks.
- Test/ — regression tests driving BoogieDriver and comparing outputs.
- Util/ & etc/ — scripting, snippets, VM setup.
- Key subprojects under Source/ (each a .csproj)
- BoogieDriver — the CLI entry point.
- Core — AST, parser, scanner, command-line options, control-flow ID mapping.
- AbsInt, BaseTypes, Concurrency, Model, Predication, Graph, Houdini, Isabelle — support libraries for abstract interpretation, type systems, concurrency checking, model extraction, etc.
- ExecutionEngine — orchestration of runs, thread/task scheduling, result caching.
- VCExpr, VCGeneration — building verification conditions (VCs) and interacting with solvers.
- Provers/SMTLib — launching and communicating with external SMT solvers (e.g., Z3).
- ProofGeneration — the new extension that hooks into various transformation phases to collect data and generate Isabelle theories.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input sources
    subgraph "Inputs"
        direction TB
        Bench["Benchmarks"]:::test
        TestHarness["Test Harness"]:::test
    end

    Bench --> CLI
    TestHarness -.-> CLI

    %% Core pipeline
    CLI["User / CLI"]:::core
    ParserAST["Parser & AST"]:::core
    CFG["CFG Builder"]:::core
    Transform["Transformation Phases"]:::core
    VCGen["VC Generation"]:::core
    ProverInt["Prover Interface"]:::core
    SMT["SMT Solver (Z3)"]:::external

    CLI -->|"Boogie AST"| ParserAST
    ParserAST -->|"CFG"| CFG
    CFG -->|"transformed CFG"| Transform
    Transform -->|"VC (SMT2)"| VCGen
    VCGen -->|"SMT2 commands"| ProverInt
    ProverInt -->|"SMT2 process"| SMT

    %% Proof generation extension lane
    subgraph "Proof Generation Extension"
        direction TB
        ProofExt["ProofGeneration Extension"]:::ext
    end

    CFG -->|"hook: CFG data"| ProofExt
    Transform -->|"hook: phase data"| ProofExt
    VCGen -->|"hook: VC data"| ProofExt
    SMT -->|"solver result"| ProofExt
    ProofExt -->|"Isabelle theories"| Isabelle

    %% Isabelle backend
    Isabelle["Isabelle Backend"]:::external
    Isabelle -->|"writes proofs"| FSOutput["Filesystem I/O"]:::external

    %% Outputs verification
    FSOutput --> TestHarness

    %% Click events
    click CLI "https://github.com/viperproject/boogie-proofgen/blob/master/Source/BoogieDriver/BoogieDriver.cs"
    click ParserAST "https://github.com/viperproject/boogie-proofgen/blob/master/Source/Core/Parser.cs"
    click CFG "https://github.com/viperproject/boogie-proofgen/blob/master/Source/Graph/Graph.cs"
    click Transform "https://github.com/viperproject/boogie-proofgen/blob/master/Source/Core/DeadVarElim.cs"
    click VCGen "https://github.com/viperproject/boogie-proofgen/blob/master/Source/VCGeneration/VCGeneration.csproj"
    click ProverInt "https://github.com/viperproject/boogie-proofgen/blob/master/Source/Provers/SMTLib/SMTLib.csproj"
    click ProofExt "https://github.com/viperproject/boogie-proofgen/blob/master/Source/ProofGeneration/ProofGeneration.csproj"
    click Isabelle "https://github.com/viperproject/boogie-proofgen/blob/master/Source/Isabelle/Isabelle.csproj"
    click TestHarness "https://github.com/viperproject/boogie-proofgen/tree/master/Test/"
    click Bench "https://github.com/viperproject/boogie-proofgen/tree/master/ProofGenerationBenchmarks/"

    %% Styles
    classDef core fill:#E3F2FD,stroke:#90CAF9,stroke-width:1px
    classDef ext fill:#FFEBEE,stroke:#EF9A9A,stroke-width:1px
    classDef external fill:#E8F5E9,stroke:#A5D6A7,stroke-width:1px
    classDef test fill:#FFF3E0,stroke:#FFB74D,stroke-width:1px
```
