Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started

This tutorial installs Spindle-Rust and runs a theory where a penguin exception defeats the usual bird rule.

Installation

Use Rust 1.87 or newer (edition 2024).

Building from Source

git clone https://git.anuna.io/anuna-research/spindle-rust
cd spindle-rust
cargo build --release

Installing the CLI

cargo install --path crates/spindle-cli

This installs the spindle command to your Cargo bin directory.

Your First Theory

Create a file called hello.spl:

; Facts
(given bird)

; Rules
(normally r1 bird flies)
(normally r2 bird has_feathers)

Run it:

spindle reason hello.spl

Output:

+D bird
+d bird
+d flies
+d has_feathers
-D flies
-D has_feathers

Understanding the Output

ConclusionMeaning
+D birdbird is definitely provable (it's a fact)
+d birdbird is defeasibly provable
+d fliesflies is defeasibly provable via r1
-D fliesflies is not definitely provable (no strict rule)

The Penguin Example

Create penguin.spl:

; Tweety is a bird and a penguin
(given bird)
(given penguin)

; Birds typically fly
(normally r1 bird flies)

; Penguins typically don't fly
(normally r2 penguin (not flies))

; Penguin rule is more specific
(prefer r2 r1)

Run it:

spindle reason penguin.spl

Output:

+D bird
+D penguin
+d bird
+d penguin
+d ~flies
-D flies
-D ~flies
-d flies

Key result: +d ~flies - Tweety defeasibly doesn't fly because the penguin rule (r2) beats the bird rule (r1).

Next steps

The result +d ~flies completes this tutorial: the explicit priority resolves the conflict.