pub enum Statement<'a> {
Domain(Located<'a, &'a str>),
Import {
path: Located<'a, &'a str>,
alias: Option<Located<'a, &'a str>>,
},
Fact(Located<'a, Atom<'a>>),
Negation(Located<'a, Atom<'a>>),
Assume(Located<'a, Literal<'a>>),
Set {
name: Located<'a, &'a str>,
elements: Vec<Located<'a, &'a str>>,
},
Close {
relation: Located<'a, &'a str>,
kind: CloseKind,
},
Var {
name: Located<'a, &'a str>,
default: Option<bool>,
},
Provide {
atom: Located<'a, Atom<'a>>,
value: bool,
},
Premise {
name: Located<'a, &'a str>,
quant: Option<Quant<'a>>,
body: Body<'a>,
},
Rule {
name: Located<'a, &'a str>,
quant: Option<Quant<'a>>,
body: Body<'a>,
},
Check {
subject: Option<Located<'a, &'a str>>,
bidirectional: bool,
},
}Expand description
A top-level statement.
Variants§
Domain(Located<'a, &'a str>)
DOMAIN <name> — declare the domain this file’s atoms belong to. Required
once per file, as the first statement; it is the identity namespace into
which bare atoms fall.
Import
IMPORT "path" [AS <alias>] — reuse another source (resolved by the
compiler). The optional alias is the local name the imported domain is
referenced by; without it, the imported file’s own declared domain name is
used.
Fields
Fact(Located<'a, Atom<'a>>)
FACT <atom> — a TRUE assertion.
Negation(Located<'a, Atom<'a>>)
NOT <atom> — a FALSE assertion.
Assume(Located<'a, Literal<'a>>)
ASSUME [NOT] <atom> — a soft (retractable) assertion. Same shape as a
FACT/NOT, but it is a hypothesis, not a commitment: when the
assumptions cannot all hold the solver names which to drop, and it never
blames a FACT/PREMISE. The Literal carries the optional NOT.
Set
SET <name> then one element identifier per line — declare a finite set
to quantify a PREMISE/RULE over via FOR EACH <binder> IN <name>.
Fields
Close
CLOSE <relation> <kind> — close a relation’s FACT pairs under the given
CloseKind at compile time (a graph operation, no solver cost). With
TRANSITIVE a cycle is a compile error (DAG required); the other kinds
allow cycles.
Fields
Var
VAR <name> [DEFAULT true|false] — declare an external boolean port: a
single-word proposition whose truth is supplied from outside (CLI/API/data).
<name> doubles as the proposition usable in bodies (WHEN <name> THEN …)
and as the key external values bind to. With no supplied value it falls back
to default, or stays UNKNOWN when there is none.
Fields
Provide
PROVIDE [<domain>.]<port|atom>: true|false — bind an external value. The
data-carrying counterpart of VAR: it supplies a value (like a CLI/API
binding) rather than declaring a port. The target is parsed as a full
Atom, so a lone word binds a VAR port (PROVIDE db_ready: true), a
multi-word form asserts an atom (PROVIDE engine has_fuel: true), and a
domain. prefix disambiguates across imports (PROVIDE self.has_vision: true). Used in a data-only file (loaded via --data) or alongside the
program. Conflicting bindings for one target are a hard error.
Fields
Premise
PREMISE <name> [FOR EACH …]: ... — a checked first principle, optionally
quantified over a declared set.
Fields
Rule
RULE <name> [FOR EACH …]: ... — a fact-producing inference rule.
Fields
Check
CHECK [subject] [BIDIRECTIONAL] — a query.