GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Abhinav-Rust/REFAL-SUPERSYSTEM: Valentin Turchin's four-layer Refal supersystem, in Rust: a self-hosting Refal-5 compiler that drives (supercompilation over a graph of states), a reflection engine and a meta-prover. Metacomputation, term rewriting, partial evaluation, all three Futamura projections -- each measured against Turchin's own papers.

BranchesTags
Open more actions menu

Latest commit

 

History

310 Commits
310 Commits

Folders and files

NameName
Last commit message
Last commit date
.cargo
.cargo
 
 
.github
.github
 
 
crates
crates
 
 
docs
docs
 
 
examples
examples
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CITATION.cff
CITATION.cff
 
 
CODEBUDDY.md
CODEBUDDY.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE-MIT
LICENSE-MIT
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 

Repository files navigation

REFAL SUPER SYSTEM. An actively developed computational prototype, growing toward an ecosystem of programs, models, evidence, and shared knowledge.

CI License: MIT Rust 2024 Active development

A Refal language system for transforming programs—and connecting knowledge to executable models and evidence.

What it is · Current status · Try it · Tool workflow · Development

Note

Active research and development. The project includes a Refal runtime, symbolic reflection, a supercompiler, and a compiler written in Refal. Transformation and analysis tools are experimental; generated programs and analysis results need validation within their intended use. The capability overview below describes the current implementation.

What it is

Ordinary programs work on data. Refal also makes it natural to treat programs themselves as data: inspect their structure, follow their possible computations, specialize them for a known task, and emit a new program.

That is the computational foundation of this project. The wider goal, inspired by Valentin Turchin's work on metasystem transitions and Principia Cybernetica, connects those tools to a collaborative network of concepts, sources, formal models, and evidence. A claim should lead to its meaning, its source, and the computation or observation that supports it.

The repository currently provides a Rust bootstrap and runtime, a compiler written in Refal, symbolic transformation tools, and experimental proving and inversion. A shared knowledge-network application is not included in the current release.

Current status

Status reviewed: 2026-11-04.

Capability status: language and runtime implemented; reflection implemented; self-hosting demonstrated; compilation, proofs, certificates, inversion, and higher-projection interfaces are experimental; a knowledge-network application is not available in this release.
The capability ledger — the same status in text
Capability Status What that means
Language and runtime Implemented Programs run with Classic syntax and builtins.
Symbolic reflection Implemented Entry configurations and successors are exposed.
Compiler / supercompiler Experimental Symbolic specialization emits residual Refal.
Self-hosting Demonstrated The Refal compiler compiles its own source.
Proofs and certificates Experimental Equivalence and termination analyses are available.
Function inversion Experimental Synthesizes inverses for supported patterns.
Higher projections Experimental Commands expose generated transformation artifacts.
Knowledge network Not available No knowledge-network application is shipped.

“Implemented” identifies an available capability; “demonstrated” identifies a concrete result. “Experimental” indicates evolving behavior and coverage. The repository's tests and reproducible examples define the evidence for each capability.

Try it

Install a stable Rust toolchain, clone the repository, and run:

git clone https://github.com/Abhinav-Rust/REFAL-SUPERSYSTEM.git
cd REFAL-SUPERSYSTEM
cargo run --release -p refal -- run examples/hello.ref
cargo run --release -p refal -- metasystem examples/metasystem-unroll.ref

The first command runs a Refal program. The second specializes a small interpreter and compares its result with the original on the demonstration's inputs.

Interpreter + known program
             ↓ specialize
Residual Refal program

Runtime steps:              172 → 4
Residual interpreter calls: 0
Inputs checked:             4

Those numbers describe this example. The transformation removes interpretive work and emits straight-line Refal; the recorded run includes the generated program.

A taste of Refal

Refal matches a sequence of symbols and terms, binds variables, and constructs a result. Here a function returns its input unchanged:

$EXTERN Prout;

$ENTRY Go {
  e.Input = <Prout <Identity e.Input>>;
}

Identity {
  e.Value = e.Value;
}

s. matches a symbol, t. a term, and e. a sequence. Parentheses group terms; angle brackets call functions. This structural vocabulary is also useful for writing interpreters and program transformers.

Explore the tools

Use cargo run --release -p refal -- before each command below, or build once and use the refal executable.

Command Purpose Current boundary
run <file.ref> Execute a Refal program Bootstrap runtime and supported builtins.
check <file.ref> Check syntax and semantics Classic acceptance and documented diagnostic modes.
reflect <file.ref> Inspect a symbolic entry configuration A bounded report with explicit completeness.
drive <file.ref> Follow computations A bounded exploration.
compile <file.ref> Emit transformed Refal Experimental specialization; compare source and generated behavior.
metasystem <interpreter.ref> Demonstrate specialization Tested interpreter-elimination examples.
prove <file.ref> <Predicate> Attempt a predicate proof Experimental reasoning with explicit unresolved outcomes.
prove <file.ref> --equiv <Left> <Right> Attempt an equivalence proof Compares expressions over a shared argument pattern.
feasibility <file.ref> --certificate Analyze feasibility and termination Experimental analysis and certificate checking.
invert <file.ref> <Function> Attempt inverse synthesis Supported behavior and coverage remain incomplete.
project2 / project3 Explore compiler-generation artifacts Proper higher-projection staging is not established.

The self-hosting result

The compiler is itself a Refal program in examples/compiler.ref. Tests run generated compiler generations and check a byte-stable result. A separate gate checks that driving actually transforms the compiler's dispatch.

Both generations are 116,715 bytes, identical in the published driven fixpoint.

The fixpoint demonstrates self-hosting. Source/generated execution comparisons provide separate evidence for the semantics of transformed programs.

Tool workflow

The command-line tools support a cycle of writing, checking, inspecting, transforming, comparing, and running Refal programs.

Available tool workflow: write a Refal program, check it, inspect symbolic configurations, transform it with the experimental supercompiler, compare original and generated behavior, and run concrete inputs.

Turchin's 1996 metacomputation paper explicitly connects his computer-science work to metasystem transitions. The Phenomenon of Science describes formal scientific knowledge and machine assistance as conceptual and semantic work. The official Principia Cybernetica introduction describes a collaborative semantic network with different relationships and perspectives.

The source catalog records publications, coauthors, editions, translations, URLs, and hashes for readers exploring these foundations.

Development

Development is active across the language tools and their verification.

  • Equivalence checking preserves shared free-variable identities and keeps terminal symbolic equations unresolved when structural equality does not establish them. Coverage includes all three variable kinds, nested results, repeated variables, and proof budgets.
  • Termination analysis retains distinct call paths throughout size-change composition. Certificate checks reconstruct those paths from the source, with coverage for decreasing recursion, non-decreasing alternatives, and mutual recursion.
  • Function inversion reconstructs source input patterns, preserving their order, repeated bindings, literals, and brackets. Round-trip tests cover repeated output values and fresh variable names; unsupported reconstruction cases return an explicit error.
  • Symbolic conditions preserve existing bindings and retain unresolved equality and expression-split choices. Both compiler paths keep pending calls in evaluation order. Execution comparisons cover the append-law example, condition fallbacks, nested values, and observable effects. Exhausted predicate searches report incomplete, including runs with no terminal values.
  • Generated compiler checks measure a closed project2 walk for the Dispatch fixture at 75 driving steps. The emitted Refal is validated and compiles four representative examples identically to refal compile.

For contributors

The workspace separates syntax (refal-ast, refal-syntax), checks (refal-semantics), execution (refal-runtime), transformations (refal-core), the CLI (refal), and tooling (xtask). The Refal-authored compiler is retained alongside the Rust bootstrap so their behavior can be compared.

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --profile test-fast --all -j 2 -- --test-threads=1
cargo xtask gen-readme-diagrams

The full suite runs serially because its self-hosting tests are expensive. The custom profile keeps debug assertions and overflow checks while using optimized execution. Focused tests exercise individual semantic rules; integration tests cover the CLI and self-hosting workflows.

The status panel is generated from the capability ledger above, so its light and dark variants share the same descriptions. Development conventions are documented in CONTRIBUTING.md.

Read more What it covers
Primary-source catalog Verified source editions and reproducible retrieval.
Language scope The Classic Refal-5 target.
Frontend coverage Syntax clauses and fixtures.
Verification contract Diagnostic design and verification terminology.
Contributing Development conventions.

Project code is MIT licensed. Third-party publications retain their own rights and are referenced through the source catalog.

About

Valentin Turchin's four-layer Refal supersystem, in Rust: a self-hosting Refal-5 compiler that drives (supercompilation over a graph of states), a reflection engine and a meta-prover. Metacomputation, term rewriting, partial evaluation, all three Futamura projections -- each measured against Turchin's own papers.

Topics

compilercompiler-generatorcyberneticsformal-verificationfutamura-projectionshomoiconicmetacomputationmetasystem-transitionpartial-evaluationprincipia-cyberneticaprogram-transformationrefalrefal-5rustself-hostingsupercompilationsymbolic-computationterm-rewritingtheorem-provingvalentin-turchin

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

4 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.