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. It is not intended for production environments. Specifications and implementation are subject to radical changes.


Causm is a domain-specific research language designed to address the 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, analyzer, and the Z3-governed Register-based Temporal Virtual Machine (TVM).

Table of Contents


Research Objectives

Causm investigates the feasibility of the following hypotheses:

  1. Temporal Execution Primitives: Can race conditions be mitigated by making time a verifiable execution primitive? Causm explores "Isochronous Scheduling" to prevent unexpected interleaving by enforcing rigid temporal alignment.
  2. Entropic Memory Model: Is it feasible to model memory safety through state decay rather than borrow checking? Causm tests if data access as a destructive operation can provide a symbolically verifiable alternative to traditional models.
  3. Causal Synchronization: Can cross-timeline state be synchronized without traditional locking? The project researches how independent execution branches communicate state transitions while maintaining consistent causal order.
  4. SMT-Based Temporal Correctness: How effectively can kernels verify correctness in non-linear code? The project uses an experimental Z3-governed kernel to unroll loops and branches into symbolic constraints.

Architecture

Causm employs a multi-pass pipeline to ensure programs are only executed if their temporal and entropic safety is mathematically proven.

graph TD
    Source[".csm Source Code"] --> Parser["Causm Parser (Pest)"]
    Parser --> AST["Abstract Syntax Tree"]
    
    subgraph "Correctness Kernel"
        AST --> Analyzer["Entropic Analyzer"]
        Analyzer --> Z3Guard["Formal Verification Guard (Z3)"]
        Z3Guard --> Proofs{{"Symbolic Proofs"}}
    end
    
    Proofs -- "UNSAT (Violation)" --> Error["Semantic Error"]
    Proofs -- "SAT (Safe)" --> Lowering["IR Lowering"]
    
    Lowering --> TVM["Register-based TVM"]
    
    subgraph "TVM Execution"
        TVM --> Sched["Isochronous Scheduler"]
        TVM --> Arena["Entropic Arena"]
        Sched --> Padding["Deterministic Padding"]
        Arena --> EGC["Entropic GC"]
    end
Loading

Documentation

Technical specifications and research documentation are in the docs/ directory. See the Full Documentation Hub for a structured overview.

Language Specifications (docs/spec/)

TVM Internals (docs/tvm/)


Getting Started

Prerequisites

  • Rust: Version 1.75.0 or later
  • Z3 Solver: Required for formal verification

Execution Interface

# Analyze and run a source file
cargo run -- examples/time_travel_showcase.csm

# Perform formal verification without execution
cargo run -- --check examples/sample.csm

# Execute with full entropic tracing
cargo run -- --run --trace-entropy examples/sample.csm

Research Patterns

Entropic Transfer

isolate Producer {
    require Chan.Outbound(id="sensor_bus", type=int)
    
    let reading = 42
    chan_send sensor_bus(reading)
    // 'reading' is now Consumed.
}

isolate Consumer {
    require Chan.Inbound(id="sensor_bus", type=int, latency=5ms)
    
    await_chan sensor_bus
    let data = chan_recv(sensor_bus)
}

Temporal Pacing

routine process_packet(p: PacedIterable<int, 2ms>) taking 10ms {
    for item in p {
        compute(item)
    }
}

Object-Oriented Programming (OOP) & Entropic Safety

type Actor = struct {
    name: string
}

type Robot = Actor + struct decay_after 100ms {
    model: string
}

routine Actor.introduce(peek self) -> int taking 10ms {
    let name = self.name
    print("Hello, I am Actor: " + name)
    yield 0
}

interface Worker {
    routine work(consume self) -> int taking 20ms
}

routine Robot.work(consume self) -> int taking 20ms {
    print("Robot " + self.name + " is working...")
    yield 0
}

let r: Robot = struct { name = "T-800", model = "Model 101" }
r.introduce() // Dynamic lookup resolves to Actor.introduce

let w: Worker = r // Structural subtyping implementation
w.work() // Polymorphic dispatch (consumes the robot structure)

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

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages