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 - NullLabTests/metta-demo: OpenCog Hyperon MeTTa โ€” 7 guided demos of the MeTTa language (successor to OpenCog Atomese). Taxonomy, combinators, types, reasoning, state, spaces, grounded functions. Built on hyperon-experimental.

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
demo
demo
 
 
scripts
scripts
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
run-all.sh
run-all.sh
 
 
run.sh
run.sh
 
 
run_demo.py
run_demo.py
 
 
test-all.sh
test-all.sh
 
 

Repository files navigation

๐Ÿง  OpenCog Hyperon MeTTa โ€” Demo Suite

12 interactive demos โ€ข 624 lines of MeTTa โ€ข Built on hyperon-experimental v0.2.10 (Rust) + PyPI hyperon

Live MeTTa REPL session
Live MeTTa REPL session: atoms, pattern matching, type queries.


What is MeTTa?

MeTTa (Meta Type Talk) is the successor to OpenCog Classic's Atomese โ€” an "Atomese 2" for the OpenCog Hyperon AGI architecture. It is a symbolic expression language with:

  • Pattern matching as the core computation primitive
  • Dependent types for expressing logical constraints
  • Spaces for knowledge isolation and modularity
  • Mutable state via state monads
  • Grounded functions for host-language interop (Python, Rust)
  • Rewriting rules for graph transformation and inference
  • Non-determinism โ€” queries return all matching results

Implemented in Rust by TrueAGI (hyperon-experimental) and available on PyPI.


Quick Start

pip install hyperon
./run.sh                    # Run all 12 demos in sequence
python run_demo.py          # Annotated output with pass/fail
metta-py demo/01_symbols.metta  # Single demo
python scripts/load_kb.py demo/03_taxonomy.metta  # Interactive

Demo Index

# File Topic Concepts Lines
1 demo/01_symbols.metta Symbols & Matching Atoms, variables, match, expression patterns 35
2 demo/02_combinators.metta Combinatory Logic SKI combinators, Peano arithmetic, lists, recursion 87
3 demo/03_taxonomy.metta Taxonomy KB Inheritance chains, property queries, multi-condition joins 70
4 demo/04_types.metta Type System Type hierarchy, function types, GADTs, parametric types, functors 66
5 demo/05_grounded.metta Grounded Functions Arithmetic, comparisons, string ops, type errors 45
6 demo/06_nondeterminism.metta Non-Determinism collapse, superpose, HVAC controller (PLN example) 66
7 demo/07_state.metta State (Simple) new-state, change-state!, bind!, counter 40
8 demo/08_state_agent.metta State Agent Compound state, agent position/health, typed transitions 65
9 demo/09_reasoning.metta Reasoning Socrates syllogism, family tree, recursive ancestor 43
10 demo/10_backchaining.metta Backward Chaining Deduction, proof trees, Implication, explain 68
11 demo/11_spaces.metta Spaces Multi-space queries, cross-condition joins 49
12 demo/12_truth_values.metta Truth Values PLN stv, conjunction/implication TV rules, Fritz story 67

Features Demonstrated

MeTTa Feature Demo(s) Lines of code
match pattern matching 1, 3, 9, 11 ~20
= function definition 2, 5, 6, 7, 8, 9, 10, 12 ~60
(: ...) type declarations 2, 4, 9 ~30
get-type type inference 4 ~10
new-state / change-state! 7, 8 ~25
bind! token binding 7, 8 ~5
GADT & parametric types 4 ~15
collapse / superpose 6 ~8
Grounded arithmetic 2, 5 ~15
if conditionals 5, 6, 12 ~8
let bindings 6, 7, 8 ~10
assertEqual / println! 4, 7, 8 ~10
Recursive functions 2, 9 ~15
Backward chaining 10 ~30
PLN-style truth values 12 ~40

Architecture

Hyperon Architecture
Hyperon system architecture: Rust core, C API, Python bindings, REPL.

Data Flow
Data flow through the MeTTa interpreter pipeline.

Query Pipeline
Pattern matching pipeline: atom indexing โ†’ unification โ†’ result streaming.

Component Stack

metta-py  (CLI / REPL)       โ† pip install hyperon
hyperon  (Python lib)        โ† Python API
libhyperonpy  (pybind11)     โ† C++/Python bridge
libhyperonc  (C API)         โ† C bindings
hyperon-common / -atom / -space  โ† Rust crates
libhyperon  (Rust core)      โ† interpreter, matcher, type system

Build Options & Times (4 cores)

Component Time Command
Rust core ~3 min cargo build --release
C/Python API ~3 min cmake --build .
Docker ~8 min docker build -t trueagi/hyperon .
PyPI install 5 sec pip install hyperon

See hyperon-experimental/README.md for full build instructions.


Repo Layout

metta-demo/
โ”œโ”€โ”€ README.md                 โ† you are here
โ”œโ”€โ”€ LICENSE                   Apache 2.0
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ run.sh                    Run all 12 demos (shell)
โ”œโ”€โ”€ run_demo.py               Annotated Python runner
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ load_kb.py            Interactive REPL on a loaded KB
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ repl-demo.gif          Animated REPL (2.4 MB)
โ”‚   โ”œโ”€โ”€ architecture.svg       Hyperon architecture
โ”‚   โ”œโ”€โ”€ data-flow.svg          Interpreter pipeline
โ”‚   โ””โ”€โ”€ query-pipeline.svg     Pattern matching pipeline
โ””โ”€โ”€ demo/
    โ”œโ”€โ”€ 01_symbols.metta        Symbols & pattern matching
    โ”œโ”€โ”€ 02_combinators.metta    SKI combinators & Peano arithmetic
    โ”œโ”€โ”€ 03_taxonomy.metta       Taxonomy knowledge base
    โ”œโ”€โ”€ 04_types.metta          Type system & functors
    โ”œโ”€โ”€ 05_grounded.metta       Grounded functions
    โ”œโ”€โ”€ 06_nondeterminism.metta Non-determinism & PLN HVAC
    โ”œโ”€โ”€ 07_state.metta          Simple mutable state
    โ”œโ”€โ”€ 08_state_agent.metta    Compound agent state
    โ”œโ”€โ”€ 09_reasoning.metta      Syllogisms & family trees
    โ”œโ”€โ”€ 10_backchaining.metta   Deduction & proof trees
    โ”œโ”€โ”€ 11_spaces.metta         Spaces & cross-condition queries
    โ””โ”€โ”€ 12_truth_values.metta   PLN truth value propagation

Classic โ†’ MeTTa Mapping

OpenCog Classic (Atomese) MeTTa equivalent
InheritanceLink (C "cat") (C "mammal") (Isa cat mammal)
EvaluationLink (Predicate "fly") (ListLink (C "eagle")) (can-fly eagle True)
GetLink ... / BindLink ... (match &self pattern result)
(cog-evaluate! (Plus (Number 1) (Number 2))) !(+ 1 2)
StateLink (new-state ...) / (change-state! ...)
cog-execute! ! prefix
Typed variables (: name type) declarations
(cog-count-atoms) No direct equivalent (use match + collapse)

Resources

Resource Link
MeTTa Language https://metta-lang.dev
hyperon-experimental (Rust) https://github.com/trueagi-io/hyperon-experimental
hyperon (PyPI) https://pypi.org/project/hyperon/
MeTTa-WAM (Prolog) https://github.com/trueagi-io/metta-wam
MeTTa Spec https://wiki.opencog.org/w/File:MeTTa_Specification.pdf
Hyperon Docs https://trueagi-io.github.io/hyperon-experimental
OpenCog Hyperon https://opencog.org
OpenCog Classic Demo https://github.com/NullLabTests/opencog-codespace-demo
Hyperon arXiv paper https://arxiv.org/abs/2310.18318

Development

git clone https://github.com/NullLabTests/metta-demo
cd metta-demo
pip install hyperon
vim demo/04_types.metta
metta-py demo/04_types.metta
./run.sh

License

Apache 2.0 โ€” see LICENSE. MeTTa runtime (hyperon-experimental) is MIT-licensed by SingularityNET / TrueAGI.


MeTTa-lang.dev ยท Hyperon ยท OpenCog.org ยท Classic Demo ยท Built with OpenCode

About

OpenCog Hyperon MeTTa โ€” 7 guided demos of the MeTTa language (successor to OpenCog Atomese). Taxonomy, combinators, types, reasoning, state, spaces, grounded functions. Built on hyperon-experimental.

Topics

agiatomspacedemohyperonknowledge-graphmettametta-langneuro-symbolicopencogpythonrusttutorial

Resources

Readme
Apache-2.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 โ€” 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.