LeaTTa

 LeaTTa: A Machine-Checked Operational Semantics and Metatheory of MeTTa in Lean 4🔗

The LeaTTa Project

Alpha. This is an early, alpha-stage release and a starting foundation. It currently formalises Hyperon Experimental's minimal interpreter and standard library, the published MeTTa operational semantics, the MeTTaIL formalization, and the Cordial Miners safety core. The limitations chapter states the remaining gaps directly.

LeaTTa is a formalization of MeTTa, the language at the heart of OpenCog Hyperon  (Goertzel, 2021)Ben Goertzel, 2021. “Reflective Metagraph Rewriting as a Foundation for an AGI Language of Thought”. arXiv:2112.08272, carried out in the de Moura and Ullrich (2021)Leonardo de Moura and Sebastian Ullrich, 2021. “The Lean 4 Theorem Prover and Programming Language”. In Automated Deduction - CADE 28. interactive theorem prover. If you are a MeTTa developer, you can think of it as a machine-checked specification: every rule that fires, every type that is checked, every result that comes back is defined by Lean code that Lean's own kernel verifies. The formalization covers:

  • the minimal interpreter;

  • the standard library;

  • the gradual type system;

  • the published four-register operational semantics;

  • the MeTTaIL formalization;

  • a body of machine-checked metatheory: determinism, confluence of the deterministic fragment, type soundness, gradual-typing consistency, soundness and completeness of first-argument indexing, and a bisimulation connecting the kernel's rule-firing core to the published operational semantics of MeTTa at the level of which rules fire  (Meredith et al., 2023)Lucius Gregory Meredith, Ben Goertzel, Jonathan Warrell, and Adam Vandervorst, 2023. “Meta-MeTTa: an Operational Semantics for MeTTa”. arXiv:2305.17218.

Every theorem in this book is checked by Lean's kernel. The development contains no sorry, admit, native_decide, partial, or unsafe; the central axiom audit reports only the three standard classical axioms of Mathlib  (Community, 2020)The mathlib Community, 2020. “The Lean Mathematical Library”. In Certified Programs and Proofs (CPP 2020)., and the gradual-typing non-transitivity result depends on no axioms at all. The executable interpreter is validated against Hyperon's own test corpus (270/270 assertions). CI fails on root Lean/Lake warnings and on any unreviewed book warning; the only allowed book warning is the known upstream Verso v4.31.0 @[expose] warning.

LeaTTa is written for two audiences:

  • MeTTa/Hyperon developers, who get an independent, executable specification of the language. The MeTTa operational-semantics paper  (Meredith et al., 2023)Lucius Gregory Meredith, Ben Goertzel, Jonathan Warrell, and Adam Vandervorst, 2023. “Meta-MeTTa: an Operational Semantics for MeTTa”. arXiv:2305.17218 envisions exactly this role: a "JVM-specification" of MeTTa against which implementations can be judged compliant.

  • Programming-language researchers, who get a worked formalization in the gradual-typing line of work begun by Siek and Taha (2006)Jeremy G. Siek and Walid Taha, 2006. “Gradual Typing for Functional Languages”. In Scheme and Functional Programming Workshop., in the tradition of mechanized language metatheory.

Contents

  1. 1. Why Formalize MeTTa? Blockchain, AGI, and Verifiable Semantics
  2. 2. A Note on This Document
  3. 3. The Object Language: Atoms
  4. 4. The Minimal Interpreter and Its Standard Library
  5. 5. The Gradual Type System
  6. 6. The Metatheory
  7. 7. The Operational Semantics
  8. 8. Interpreter ⇔ Specification
  9. 9. Paving the Way: MeTTa on the Blockchain
  10. 10. MeTTaIL: A Machine-Checked Meta-Language of Graph-Structured Lambda Theories
  11. 11. PoR-Weighted Cordial Miners: Machine-Checked Consensus Safety
  12. 12. The future-work Branch
  13. 13. Discussion and Limitations
  14. 14. Appendix: Proof Status, Coverage, and Improvements