Skip to main content

Simple symbolic Virtual Machine in Python and Z3

Project description

Micro-SVM

A simple and very basic symbolic virtual machine.

[!IMPORTANT] This is a major piece for an ongoing research project. We are currently working hard on preparing our results for a publication.

Overview

Micro-SVM is a standalone symbolic execution engine designed to:

  • Explore program execution paths.
  • Analyze control flow and state transitions.
  • Validate program specifications against expected behaviors.
  • Detect potential defects (e.g., unhandled exceptions, infinite loops).

This package provides the core symbolic execution engine used in research projects for defect discovery and path validation. It is not a full programming language implementation but rather a tool for analyzing executable specifications.

Supported features

  • A range of primitive types: boolean, int8/16/32/64, integer, real, char, string.
  • Symbolic primitive values.
  • Built-in containers for primitives: array<T>, set<T>, map<K,V>, transform<K,V> (same as map, more limited but sometimes faster).
  • Functions and/or static methods.
  • Java/C#-like reference values (ref<T> for references of known type, plain ref for "opaque" cases).
  • Structures and "classes" (i.e., structures with methods) with multiple inheritance.
  • Handling of abstract methods and virtual calls.
  • Intrinsics for specific operations.
  • Basic library/program specification serialization (JSON).
  • Ability to discover and validate both normal and failing execution paths (see examples).
  • Basic class-based user-defined exception handling (i.e. the usual try-catch-finally triplet and throw).
  • Basic decoding of complex structures (containers and structures/classes) as Python objects (i.e. as a list, a list of pairs or a dictionary).

Installation

pip install micro-svm

Known limitations

  • No function/method overload.
  • No type checks. It is expected for a specification to be validated and type-checked by external tools.
  • Little to no type conversion. The implementation relies heavily on Z3 in that aspect.
  • No support for IEEE floats.
  • Eager function/method execution. For every discovered program path, the machine checks if the whole path can be executed or not. For example, when processing x = parse_bool(input) or panic() or similar expression the panic() call would always be visited unless modelled otherwise in the user specification.
  • Very crude fault handling for certain language- and runtime-specific edge-cases. It is only possible to:
    • not allowing any fault to occur during a path's execution (default),
    • check if they might have happened (i.e., using CompilerContext.get_fault_status/clear_fault_status),
    • ignore faulty operations.
  • Exceptions regarding null-dereferencing, invalid array indexing and alike cannot be raised and caught automatically. It is advised to use CompilerContext.get_fault_status and throw to raise a suitable exception object. Note that get_fault_status is unhelpful unless SymbolicStateMachine.fault_mode is set to STORE.

Cite

@software{microsvm2026,
  title={Micro-SVM: A simple symbolic VM in Python and Z3},
  author={Mikhail Onischuck},
  year={2026},
  url={https://github.com/dog-m/micro-svm-engine}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.


AI usage disclosure: 100% of code and ~50% of documentation were written by a human developer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micro_svm-1.0.3.tar.gz (57.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

micro_svm-1.0.3-py3-none-any.whl (57.1 kB view details)

Uploaded Python 3

File details

Details for the file micro_svm-1.0.3.tar.gz.

File metadata

  • Download URL: micro_svm-1.0.3.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for micro_svm-1.0.3.tar.gz
Algorithm Hash digest
SHA256 69f1056adc52b1c4c5ded92c19a2ab4f13678b8a8b0832b518554a9f996933d4
MD5 b7ff7318529671b3e3b908fe026b65b8
BLAKE2b-256 b1c015795a8d7318de5439ca588d8b9f2fc059e10d267c8f65b96ea2ea95a518

See more details on using hashes here.

Provenance

The following attestation bundles were made for micro_svm-1.0.3.tar.gz:

Publisher: python-publish.yml on dog-m/micro-svm-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micro_svm-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: micro_svm-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 57.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for micro_svm-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a26f52b02e92067350ba64117874710d0c9c402b1da7ecc216ccb33b6134300b
MD5 3ea8aaa3fc3f4ae3e718030ff98e3c9e
BLAKE2b-256 cb8a16facd913def9ea5b6424dc429139f0d98966ede57c627455618037bc501

See more details on using hashes here.

Provenance

The following attestation bundles were made for micro_svm-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on dog-m/micro-svm-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page