Comparisons

Related languages

Origins

Vary started out Python-shaped. The early syntax borrowed def, for...in, if/elif/else, import and from...import directly. If you had written Python, the first version of Vary looked familiar.

It diverged quickly. Static types are enforced at compile time. Blocks use braces. Mutation testing is a compiler command. The test runner is built into the language. Enums carry payloads. None of this exists in Python.

If terms like ghost code, proof obligations, invariants, or exhaustive match are unfamiliar, see the Glossary.

Python

Python showed that code can be readable without being verbose. Short keywords, minimal ceremony, no semicolons.

AreaPythonVary
TypingDynamic, optional hintsStatic, enforced at compile time
ExecutionInterpretedCompiled to JVM bytecode
Variablesx = 42 (always mutable)let x = 42 / mut x = 0
Null handlingAnything can be NoneOnly T? types can be None
Data types@dataclassdata keyword
Enumsenum.Enumenum with payloads and exhaustive match
Testingpytest, unittestBuilt-in test DSL + observe
Mutation testingThird-party (mutmut)Built-in vary mutate

For a full comparison, see Python comparison.

Eiffel

Eiffel pioneered Design by Contract: preconditions, postconditions, and class invariants checked at runtime. Vary's contract system (in/out/old) draws directly from Eiffel's model.

AreaEiffelVary
Preconditionsrequire blockin {}
Postconditionsensure blockout (result) {}
Entry-state captureold exprold(expr)
Class invariantsinvariant blockinvariant {} on classes and data types
Contract enforcementRuntime, can be disabled per buildRuntime, always on in vary mutate
Mutation integrationNoneContract violations are mutation kill signals

Eiffel treats contracts as documentation and correctness aids. Vary treats them as oracle surfaces for mutation testing. A contract that fails under mutation means the program is well-constrained. A contract that no mutation can break is too weak. Contracts in Vary make vary mutate more powerful, and the same contracts can be proven for all inputs with vary prove, which Eiffel's own static verifier (AutoProof) does for Eiffel.

D

Two D ideas influence Vary: the pure function qualifier and built-in contract syntax.

AreaDVary
Puritypure qualifier, compiler-enforcedpure def, compiler-enforced
Contractsin {} / out {} blocks on functionsin {} / out (result) {}
Contract scopePreconditions, postconditions, invariantsPreconditions, postconditions, old(expr)
Mutation testingNone built inBuilt-in vary mutate
Compilation targetNative machine codeJVM bytecode

D enforces purity for safe parallelism and optimization. Vary enforces purity to improve mutation testing signal. A pure def guarantees no hidden state, so surviving mutants point to genuine gaps in contracts or tests rather than side-effect interference. D proved that purity enforcement is practical in a mainstream-style language. Vary applies it to a different problem.

Dafny

Dafny is a verification-aware language. Programs are proved correct at compile time using an SMT solver (Boogie and Z3). Contracts written in Dafny are not run-time checks: they are static proof obligations that must hold before the compiler will emit code. Dafny is the main model for vary prove, and Vary borrowed its annotation vocabulary: invariant, decreases, ghost code, lemmas, modifies, and quantifiers.

AreaDafnyVary
VerificationStatic proof via SMT solver (Boogie and Z3)vary prove with a bundled SMT solver (SMTInterpol), plus optional Z3 and cvc5. Contracts are also run-time checks
Preconditionsrequiresin {}
Postconditionsensuresout (result) {} and post {}
Pre-state captureold(expr)old(expr)
Invariantsinvariant on classes and loopsinvariant {} on classes, data types and loops
Terminationdecreases clause, compiler-checkeddecreases on loops and recursion, checked by the prover and at run time
Frame controlreads and modifies clausesmodifies, inferred when omitted, checked on every write
Ghost codeGhost variables and functions, erased at compile timeghost let, ghost mut and lemma, erased from compiled output
Quantifiersforall and exists with triggersforall and exists with {:trigger ...} hints, also executable at run time
Failed proofCompile errorA reported status (refuted, unknown, unsupported). The program still compiles and runs
Null handlingT? for nullable typesT? for nullable types
Variablesvar (mutable) and const (immutable)mut (mutable) and let (immutable)
Compilation targetsC#, Java, JavaScript, Go, C++JVM bytecode
Mutation testingNone built inBuilt-in vary mutate, which can use proofs to kill mutants
TestingSpecifications replace most testsBuilt-in test DSL and observe

The two approaches differ in commitment. In Dafny every method must verify, so verification is the language. In Vary a contract is a run-time check from day one, and vary prove is something you add, function by function, where a proof is worth the effort. A result that is not proven is reported as such, and the program still builds. Dafny proofs can require heavy annotation. Vary's bundled solver is weaker than Z3, so some goals that Dafny settles come back unknown until you switch solvers or add a lemma. Vary targets cheap verification of ordinary application code. Dafny targets provable correctness of everything.

Dafny also supplies the test material for the prover. Verified Dafny programs are being translated to Vary to measure how vary prove behaves on specifications that other people wrote.

SPARK (Ada)

SPARK is a verifiable subset of Ada. Its prover, GNATprove, generates conditions through Why3 and discharges them with several SMT solvers. It is used in avionics, rail and security-critical systems, and it is the main evidence that contract-based proof works at industrial scale.

AreaSPARKVary
ContractsPre, Post, Loop_Invariant, Loop_Variant aspectsin, out, invariant, decreases
Contracts at run timeCan be compiled as run-time assertionsAlways run-time checks, unless proven and removed by an opt-in setting
Removing proven checksSupportedelide_proven_contracts
SubsetA defined subset of Ada. Anything outside it is excludedAny Vary program. Unmodelled constructs are reported unsupported by name
MaturityDecades of industrial useNew

Like SPARK, Vary lets one contract serve both the run-time check and the proof. Unlike SPARK, Vary does not restrict the language to a verifiable subset. It proves what it can model and says plainly what it could not.

Why3, Frama-C, and the JVM contract tools

ToolRoleRelation to Vary
Why3A platform and intermediate language (WhyML) with many solver back-ends. SPARK, Frama-C and Creusot build on itVary has its own small pipeline and does not use an intermediate verifier
Frama-C (WP)Verifies C programs with ACSL annotations in commentsThe same idea on an unsafe language. The contracts are not part of the language
JML, OpenJML, KeYContract annotations for Java with static toolsVary targets the same VM. JML lives in comments

Lean, F*, Liquid Haskell, and Rust verifiers

ToolApproachRelation to Vary
Lean, Coq, IsabelleInteractive proof assistants. A person writes each step and a small kernel checks itvary prove --export-lean writes a goal the SMT solver could not settle as a Lean 4 file. A checked proof is imported back and reported as proven-external
F*Dependently typed with SMT-assisted proofs and verified code extractionMore expressive and harder to learn. Vary keeps ordinary types
Liquid HaskellRefinement types checked by an SMT solverThe logic lives in the type. In Vary it lives in contracts
Prusti, Creusot, KaniVerifiers for Rust. Kani is a bounded model checkerKani resembles vary prove --bounded
CrossHair, NaginiSymbolic checking of Python contracts and a verified typed Python subsetClosest in spirit to bounded mode

For the full comparison with what each tool is good at, and where vary prove is weaker, see Other verification tools.

AI-native languages and libraries

Vary's AI features (ai using, feels, and match ... by meaning, documented in Semantic AI control flow) were designed against several existing projects. They are design precedents, not claims of equal maturity or API compatibility.

ProjectWhat it doesWhat Vary took from itWhat Vary does differently
ProbablySemantic conditions, uncertainty branches, semantic routing, bounded execution and replayReadable workflow-level syntax, visible uncertainty, replayable effectsKeeps literal match, types and Result errors, with a shared configurable budget. No random branch sampling
Jac byLLMTyped function declarations delegate their implementation to a model, with semantic annotations and validated outputsTyped operations and reusable ordinary functions, with provider setup kept away from the workflowInput is supplied explicitly and failures are Result values. No implicit capture of object or module context and no automatic coercion
LMQLGeneration takes part in control flow, with constraints that guide decodingA clear line between structural guarantees and semantic judgmentsNo token-decoding engine, and prompt instructions are never presented as enforced constraints
BAMLFunctions separate typed arguments and results from prompt templates and configured model clientsStable operation contracts and interchangeable adaptersReuses Vary functions, data and enums. No second schema language and no required prompt-template dialect

Two choices follow from these comparisons. The compiler knows typed AI operations but never provider URLs, model names or credentials, which live in an adapter. And every retry consumes the workflow's shared budget, so a loop can never spend without limit.

← Hypothesis comparison