4 DFL Syntax Reference
DFL (Defeasible Logic Format) is the primary textual syntax for Spindle theories.
4.1 Facts
Facts are unconditional truths, declared with >>:
>> bird |
>> penguin |
Facts with labels:
f1: >> bird |
f2: >> penguin |
4.2 Rules
4.2.1 Strict Rules
Strict rules always apply and cannot be defeated. Use ->:
r1: human -> mortal |
r2: a, b -> c |
4.2.2 Defeasible Rules
Defeasible rules typically apply but can be overridden. Use =>:
r1: bird => flies |
r2: student => busy |
4.2.3 Defeaters
Defeaters block conclusions without asserting the opposite. Use ~>:
d1: broken_wing ~> ¬flies |
4.2.4 Rule Syntax
General form:
label: body -> head (strict) |
label: body => head (defeasible) |
label: body ~> head (defeater) |
label is a unique identifier (letters, numbers, underscores)
body is a comma-separated list of literals (premises)
head is a single literal (conclusion)
4.3 Literals
4.3.1 Simple Literals
Identifiers starting with a letter:
bird |
is_employee |
hasAccess |
4.3.2 Negated Literals
Use ¬ or - prefix:
¬flies |
-authorized |
4.4 Superiority Relations
Declare which rules defeat others:
r2 > r1 |
specific_rule > general_rule |
Multiple superiorities:
r3 > r2 |
r2 > r1 |
4.5 Comments
Single-line comments start with #:
# This is a comment |
>> bird # Inline comment |
4.6 Annotations
Rules can have metadata annotations in a front-matter block:
--- |
description: "Birds typically fly" |
dc:source: "ornithology-handbook.pdf" |
confidence: 0.95 |
--- |
r1: bird => flies |
description —
Human-readable explanation dc:source —
Provenance (Dublin Core) confidence —
Numeric confidence (0.0-1.0) justification —
Why this rule exists @id —
Unique URI identifier
4.7 Imports
Import conclusions from other files:
@import "./base-rules.dfl" . |
@import "./policies.dfl" as policy . |
Imports must appear at the top of the file, before any rules.
4.8 Complete Example
# Penguin Exception Theory |
|
@import "./animals.dfl" . |
|
# Facts |
f1: >> tweety_is_bird |
f2: >> tweety_is_penguin |
|
# Rules with annotations |
--- |
description: "Birds typically fly" |
confidence: 0.9 |
--- |
r1: tweety_is_bird => tweety_flies |
|
--- |
description: "Penguins don't fly" |
dc:source: "biology-textbook" |
--- |
r2: tweety_is_penguin => ¬tweety_flies |
|
# Superiority |
r2 > r1 |