veri

    Proof models, verified runtime APIs, and differential checks for MoonBit

    Download zip
    Author
    Version
    0.2.0
    License
    Apache-2.0
    Last updated
    15 days ago
    Downloads
    8

    Dependencies

    #veri

    English | 日本語

    A small foundation for formal verification in MoonBit, with reusable logical models and lemmas, implementations with contracts, and runtime differential checks.

    #QuickStart

    To use a published release, add it to your own project:

    moon add mizchi/veri

    Add the import and proof setting to the consuming package's moon.pkg:

    import {
    "mizchi/veri/bounds",
    }

    options("proof-enabled": true)

    Put this code in digit.mbt. Like core Int::clamp, clamp includes both bounds. Use clamp_half_open(value, lower, upper) for an exclusive upper bound. Both functions require valid bounds; their proof preconditions are not runtime checks.

    pub fn digit(value : Int) -> Int {
    proof_ensure: result => 0 <= result && result <= 9,
    } {
    @bounds.clamp(value, 0, 9)
    }

    test "clamp includes its upper bound" {
    assert_eq(digit(10), 9)
    }

    moon test --target js moon prove

    This minimal proof uses bundled Why3 and Z3 on PATH.

    #Documentation

    GuideContents
    Package indexAvailable models, APIs, and guarantees
    Runtime APIs and graph checkingMap / Set, search, checked arithmetic, codecs, Union-Find, parsers, paths, and topology
    Collections and arraysLists, stacks, queues, priority queues, trees, and FixedArray update contracts
    Bitvectors and numeric modelsFixed-width bits, orders, number theory, reals, and rounding errors
    Verification guideSolver setup, moon prove, QuickCheck, and shrinking
    BenchmarksCore comparisons, measurement conditions, and tuning results
    Proof architectureWhy3 / SMT-LIB bindings, runtime correspondence, and trusted boundaries
    IEEE 754Float / Double APIs, reference checks, proof scope, and limitations
    Temporal model checkingmoonx, Z3 / Apalache, and TaskGroup / lease-clock examples
    Practical verification workflowsCI suites, saved counterexamples, model builders, and implementation comparisons

    #License