Skip to content

Repository files navigation

Causm

A Domain-Specific Language for Temporal and Entropic Memory Models

License: AGPL-3.0 Rust Status

Important

Causm is an experimental toolchain for exploring temporal and entropic memory models. Specifications and implementation are subject to changes.


Causm is a domain-specific research language designed to address inherent non-determinism in concurrent systems. By treating time as a first-class execution primitive and implementing an entropic memory model, Causm provides a framework where race conditions are eliminated through the mathematical enforcement of temporal invariants.

This repository contains the reference implementation of the Causm toolchain, including the compiler, entropic analyzer, and formal SMT-governed Register-based Temporal Virtual Machine (TVM).


Research Objectives

  1. Temporal Execution Primitives: Eliminating race conditions via Isochronous Scheduling.
  2. Entropic Memory Model: Modeling memory safety through state decay (Valid, Leased, Decayed, Consumed, Pending).
  3. The Entropius Relational Model: Declarative Datalog fact extraction and SMT-backed safety verification for linear ownership, active lease safety, causal horizons, and entanglement decay.
  4. SMT-Based Temporal Correctness: Formally proving Worst-Case Execution Time (WCET) bounds and temporal assertions using a pluggable SMT Correctness Kernel (featuring pure-Rust OxiZ as default and optional Z3 integration).

Architecture

graph TD
    Source[".csm Source Code"] --> Parser["Causm Parser (Pest)"]
    Parser --> AST["Abstract Syntax Tree"]

    subgraph "The 4-Stage Decoupled Pipeline"
        AST --> Stage1["Stage 1: ResolveStage (HIR Types & Routines)"]
        Stage1 --> Stage2a["Stage 2a: Entropius Relational Invariant Solver"]
        Stage2a --> Stage2b["Stage 2b: SsaStage (CFG & Phi Renaming)"]
        Stage2b --> Stage2c["Stage 2c: WcetSolver & EGC Check (OxiZ / Z3)"]
    end

    Stage2c -- "UNSAT (Violation)" --> Error["Rich Multi-Span Diagnostic"]
    Stage2c -- "SAT (Safe)" --> Lowering["IR Lowering & Codegen"]

    subgraph "IR Optimization Pipeline"
        Lowering --> CfgSimp["CfgSimplificationPass"]
        CfgSimp --> LeaseOpt["LeaseOptimizationPass"]
        LeaseOpt --> ConcurAn["ConcurrencyAnalysisPass"]
        ConcurAn --> Verifier["VerifierPass (SSA Phi)"]
    end

    Verifier --> TVM["Register-based TVM"]
Loading

Code Example

@0ms: {
    isolate main_system {
        enable cpu(5000ms)
        require System.Log

        from "module_sensor_lib.csm" import compute_telemetry_digest

        let raw_reading = 150
        let ref_reading = &raw_reading

        let digest = compute_telemetry_digest(raw_reading)
        let sensor_pack = struct { status = "active", level = digest }

        lease current_pack = sensor_pack 30ms {
            let active_level = current_pack.level
            print(active_level)
        } reconcile auto

        match entropy(raw_reading) {
            Valid(v) if v == 150: { print("High Precision Match") }
            Consumed: { print("Consumed") }
        }
    }
}

Documentation

See the Full Documentation Hub for complete specifications.


Getting Started & Execution

# Analyze and run a source file
causm run examples/module_import_showcase.csm

# Run with timeline merge diagnostics
causm run --explain-merge examples/module_import_showcase.csm

# Perform formal SMT verification check (OxiZ / Z3)
causm check examples/module_import_showcase.csm

# Run with explicit Z3 solver backend
causm check --z3 examples/module_import_showcase.csm

# Emit intermediate representations (AST, IR, CFG, SSA)
causm emit examples/module_import_showcase.csm --emit cfg-dot

License

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE.


Built with 🦀 & ⏳ by Seuriin

About

Causm is a domain-specific research language designed to address the inherent non-determinism in concurrent systems.

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages