# leventerkok/sbv architecture

> Architecture diagram of the GitHub repository leventerkok/sbv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leventerkok/sbv
- Repository: https://github.com/leventerkok/sbv

## Overview

##### Main Components

a. Core Engine Layer:
- Data.SBV.Core components (Symbolic, Concrete, Operations, Kind)
- Model and Data handling components

b. Type System Layer:
- Supported symbolic types (SBool, SWord, SInt, etc.)
- Type conversion and operations modules

c. Solver Integration Layer:
- Supported SMT solvers (Z3, CVC4/5, Yices, etc.)
- SMT-Lib interface components
- Query and control mechanisms

d. Tools and Utilities Layer:
- High-level tools (BMC, CodeGen, Induction, etc.)
- Utility modules for various operations

##### Component Relationships
- Data flow between components
- Dependencies between modules
- Integration points with external solvers
- API boundaries

##### Specific Elements

a. Core Components:
- [Core Engine]
- Symbolic Computation
- Concrete Evaluation
- Model Management
- Kind System

b. Type System:
- [Type System]
- Basic Types (Bool, Word, Int)
- Complex Types (Float, Array, String)
- Custom Types (Set, Maybe, Either)
- Type Operations

c. Solver Integration:
- [SMT Interface]
- SMT-Lib Protocol
- Solver Management
- Query System
- Result Processing

##### Interface Points
- Public API boundaries
- Integration points with Haskell ecosystem
- External tool connections

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Engine Layer
    subgraph CoreEngine["Core Engine Layer"]
        SymComp["Symbolic Computation"]
        ConcreteEval["Concrete Evaluation"]
        ModelMgmt["Model Management"]
        KindSys["Kind System"]
        CoreOps["Core Operations"]
    end

    %% Type System Layer
    subgraph TypeSystem["Type System Layer"]
        BasicTypes["Basic Types"]
        FloatType["Float Types"]
        StringType["String Type"]
        SetType["Set Type"]
        MaybeType["Maybe Type"]
        EitherType["Either Type"]
        ListType["List Type"]
    end

    %% Solver Integration Layer
    subgraph SolverIntegration["Solver Integration Layer"]
        SMTInterface["SMT Interface"]
        SMTLibProtocol["SMTLib Protocol"]
        QuerySystem["Query System"]
        
        subgraph Solvers["SMT Solvers"]
            Z3["Z3"]
            CVC4["CVC4"]
            CVC5["CVC5"]
            Yices["Yices"]
        end
    end

    %% Tools and Utilities Layer
    subgraph ToolsUtils["Tools and Utilities Layer"]
        BMC["Bounded Model Checking"]
        CodeGen["Code Generation"]
        Induction["Induction"]
        Optimization["Optimization"]
        Polynomial["Polynomial"]
        WeakestPre["Weakest Preconditions"]
        Utils["Utilities"]
    end

    %% Relationships
    CoreEngine --> TypeSystem
    TypeSystem --> CoreEngine
    CoreEngine --> SolverIntegration
    SolverIntegration --> CoreEngine
    CoreEngine --> ToolsUtils
    ToolsUtils --> CoreEngine

    SMTInterface --> Solvers
    SMTLibProtocol --> SMTInterface
    QuerySystem --> SMTInterface

    %% Component Styling
    classDef core fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef type fill:#90EE90,stroke:#333,stroke-width:2px
    classDef solver fill:#FFB366,stroke:#333,stroke-width:2px
    classDef tools fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef external fill:#E6E6E6,stroke:#333,stroke-width:2px

    class SymComp,ConcreteEval,ModelMgmt,KindSys,CoreOps core
    class BasicTypes,FloatType,StringType,SetType,MaybeType,EitherType,ListType type
    class SMTInterface,SMTLibProtocol,QuerySystem solver
    class BMC,CodeGen,Induction,Optimization,Polynomial,WeakestPre,Utils tools
    class Z3,CVC4,CVC5,Yices external

    %% Click Events
    click SymComp "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Symbolic.hs"
    click ConcreteEval "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Concrete.hs"
    click ModelMgmt "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Model.hs"
    click KindSys "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Kind.hs"
    click CoreOps "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Operations.hs"
    click BasicTypes "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Sized.hs"
    click FloatType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Float.hs"
    click StringType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/String.hs"
    click SetType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Set.hs"
    click MaybeType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Maybe.hs"
    click EitherType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Either.hs"
    click ListType "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/List.hs"
    click SMTInterface "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/SMT/SMT.hs"
    click SMTLibProtocol "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/SMT/SMTLib2.hs"
    click Z3 "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Provers/Z3.hs"
    click CVC4 "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Provers/CVC4.hs"
    click CVC5 "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Provers/CVC5.hs"
    click Yices "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Provers/Yices.hs"
    click QuerySystem "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Control/Query.hs"
    click BMC "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/BMC.hs"
    click CodeGen "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/CodeGen.hs"
    click Induction "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/Induction.hs"
    click Optimization "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/BVOptimize.hs"
    click Polynomial "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/Polynomial.hs"
    click WeakestPre "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Tools/WeakestPreconditions.hs"
    click Utils "https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Utils/Lib.hs"
```
