Setup Guide

What You Need

Every experiment on this site is a standalone .sx file written in the Simplex programming language. To run an experiment you need three things:

  1. The Simplex compiler (sxc) — compiles .sx files to LLVM IR
  2. A C compiler (Clang) — links the IR with the Simplex runtime into a binary
  3. The experiment source file (.sx) — downloadable from each experiment page

There are two paths: download pre-built binaries from GitHub releases (fastest) or build from source (full control).

Option A: Pre-Built Binaries (Fastest)

A1. Download

Go to github.com/senuamedia/lab/releases and download the latest release for your platform (macOS or Linux). The release contains:

  • sxc — the Simplex compiler binary
  • standalone_runtime.c — the C runtime (needed for linking)

A2. Install Dependencies

You need Clang (C compiler) and OpenSSL (for the runtime's crypto functions).

# macOS — Clang ships with Xcode Command Line Tools
xcode-select --install

# Install OpenSSL and Python 3 via Homebrew
brew install openssl python3
# Ubuntu / Debian Linux
sudo apt update
sudo apt install clang libssl-dev python3

A3. Verify Installation

# Check Clang is available
clang --version

# Check the Simplex compiler runs
./sxc --version
# Should print: sxc 0.17.0 (or later)

Option B: Build From Source

B1. Install Dependencies

Same as Option A — you need Clang, OpenSSL, and Python 3.

# macOS
xcode-select --install
brew install openssl python3

# Linux
sudo apt update && sudo apt install clang libssl-dev python3

B2. Clone the Repository

git clone https://github.com/senuamedia/lab.git
cd lab

B3. Build the Compiler

./build.sh

This uses the Python bootstrap compiler (stage0.py) to compile the Simplex compiler (sxc) from its own source code. The resulting binary is at build/sxc. The runtime source is at runtime/standalone_runtime.c.

B4. Verify the Build

./build/sxc --version
# Should print: sxc 0.17.0 (or later)

Running an Experiment

Every experiment page on this site includes a Download .sx button. Download the file, then follow these three steps.

Step 1: Compile the Simplex Source to LLVM IR

# Replace EXPERIMENT with the filename (e.g., exp_iratio_proof)
./sxc EXPERIMENT.sx -o EXPERIMENT.ll

This produces an LLVM IR file (.ll). The compiler will print Compilation successful. if the source is valid.

Step 2: Link with the Runtime

# macOS
OPENSSL=$(brew --prefix openssl)
clang -O2 EXPERIMENT.ll standalone_runtime.c \
  -o EXPERIMENT \
  -lm -lssl -lcrypto -L${OPENSSL}/lib

# Linux
clang -O2 EXPERIMENT.ll standalone_runtime.c \
  -o EXPERIMENT \
  -lm -lssl -lcrypto -lpthread

This produces a native executable. You need standalone_runtime.c in the same directory (or provide the full path). If you built from source, it's at simplex/runtime/standalone_runtime.c.

Step 3: Run

./EXPERIMENT

The experiment prints its results to the terminal. Exit code 0 means all tests passed. Non-zero means one or more tests failed — the output will indicate which.

Running All Experiments at Once

If you built from source and have the experiment files in a directory alongside the Simplex source:

# Directory structure expected:
# simplex/          ← the compiler source
#   build/sxc       ← compiled compiler
#   runtime/standalone_runtime.c
# theorem-proof/    ← experiment files
#   exp_contraction.sx
#   exp_lyapunov.sx
#   run_all.sh
#   run_math_tests.sh

cd theorem-proof

# Run 6 core theorem experiments
./run_all.sh

# Run 188 compiler math validation tests
./run_math_tests.sh

Troubleshooting

ProblemSolution
sxc: command not found Use the full path: ./build/sxc or add to your PATH
Undefined symbols ... _SSL_* OpenSSL not linked. Add -L$(brew --prefix openssl)/lib (macOS) or install libssl-dev (Linux)
standalone_runtime.c: No such file Provide the full path to the runtime file, e.g., ../simplex/runtime/standalone_runtime.c
warning: overriding module target triple Harmless. The compiler targets x86_64; Clang adjusts to your system automatically
Experiment prints FAIL Check the output — it indicates which specific test failed and the expected vs actual values
xcode-select: error On macOS, you need the Command Line Tools. Run xcode-select --install and follow the prompt

Understanding .sx Files

Simplex (.sx) files are plain text source code. You can open them in any text editor. Each experiment is self-contained — no imports, no dependencies beyond the compiler and runtime.

Key syntax patterns you'll see:

// Variables: 'let' for immutable, 'var' for mutable
let x: f64 = 3.14;
var count: i64 = 0;

// Functions
fn add(a: f64, b: f64) -> f64 {
    a + b
}

// Loops
while count < 100 {
    count = count + 1;
}

// Output
println("Hello from Simplex");
print_f64(x);

// Entry point — returns 0 for success
fn main() -> i64 {
    // ... experiment code ...
    0
}

For the full language reference, see the Simplex documentation.

Complete Experiment Index

Core Theorem Validation

FileWhat it proves
exp_contraction.sx5 subsystems contract in Fisher metric
exp_gradient_interference.sxCosine-scaled projection: 100% resolution
exp_lyapunov.sxNormalised Lyapunov: 0% violations
exp_invariants.sxFoundational constraints: 0 violations / 20K steps
exp_timescale.sxTimescale separation: 100%
exp_composition.sxFull composed system converges
exp_interaction_matrix.sxInteraction matrix converges in 5 cycles
exp_convergence_order.sxHigher-order score S → 0
exp_iratio_proof.sxI = -0.5 for K=2..20 (138/138)
exp_iratio_proof_statistical.sxI = -0.5 for 70 random problems
exp_balance_residual.sxB-flow: 375B× precision

Cognitive / Belief System

FileWhat it proves
exp_anima_deep.sxBelief interaction, consolidation, desires
exp_anima_correlated.sxCorrelated beliefs: 55% improvement
exp_belief_cascade.sxChain, circular, and delayed beliefs
exp_skeptical_annealing.sxSkeptic wins at ALL horizons
exp_memory_dynamics.sxForgetting, transfer, self-reference, phase

Cross-Domain Applications

FileWhat it proves
exp_chaos_boundary.sxS detects Feigenbaum point
exp_s_vs_lyapunov.sxS-λ complementarity
exp_nash_equilibrium.sx83.5% Pareto via skeptical desire
exp_gan_convergence.sxGAN stabilisation
exp_ode_solvers.sxLearned solver blending
exp_prime_gaps.sxPrime gap derivative series
exp_iratio_applications.sxI = -0.5 in 5 domains
exp_code_gates.sxCode structure convergence
exp_compiler_passes.sxPer-program pass interaction
exp_structure_discovery.sxGradient topology as probe
exp_equilibrium_mapping.sxB-flow equilibrium location

Stress Tests and Robustness

FileWhat it proves
exp_sensitivity.sx3 OOM learning rate stability
exp_stress_test.sxRosenbrock + Rastrigin
exp_stress_rosenbrock.sxBanana valley at 4-10D
exp_stress_adversarial.sxAnti-parallel objectives
exp_symmetry_breaking.sxGroups, perturbation, phase transition
exp_convergence_ratios.sxRatio series, entropy, dominant pair
exp_stochastic_projection.sxNoise unnecessary (implicit exploration)
exp_stochastic_rastrigin.sxNoise on multimodal landscape

Compiler Math Validation

FileTestsCoverage
test_math_arithmetic.sx75f64/i64 +, -, *, /, casts, edge cases
test_math_comparisons.sx23All 6 operators, both types, mixed
test_math_transcendental.sx66sqrt, sin, cos, tan, exp, ln, pow, tanh, identities
test_math_loops.sx10Accumulation, Newton, series, convergence
test_math_functions.sx14Composition, recursion, dot product, nested calls

Total: 188/188 pass.