Liking cljdoc? Tell your friends :D
Clojure only.

vaelii.impl.sentex

The sentex constructor (sentex), which canonicalizes the structural connectives into a LiteralSentex or RuleSentex record and the sentence into canonical form, the symbol pool, and the reads of the canonical form: the trie key and the term index's terms. See docs/canonicalization.md, docs/storage.md and docs/indexing.md.

The sentex constructor (`sentex`), which canonicalizes the structural connectives into a
`LiteralSentex` or `RuleSentex` record and the sentence into canonical form, the symbol
pool, and the reads of the canonical form: the trie key and the term index's terms.  See
docs/canonicalization.md, docs/storage.md and docs/indexing.md.
raw docstring

*min-indexed-depth*clj

How deep inside a content literal a ground compound must sit to earn its own inverted-index key: 0 is the literal itself, 1 a subterm of it, and 2 and up also drop the sentence an (ist Ctx S) wraps. Read at write time: moving it over a populated store leaves the written keys, and reindex applies a new setting.

How deep inside a content literal a ground **compound** must sit to earn its own
inverted-index key: `0` is the literal itself, `1` a subterm of it, and `2` and up also
drop the sentence an `(ist Ctx S)` wraps.  Read at write time: moving it over a populated
store leaves the written keys, and `reindex` applies a new setting.
sourceraw docstring

*symbol-pool-limit*clj

The most entries the symbol pool holds across its two generations; each generation holds at most half (docs/storage.md, "Symbol interning"). Dynamic so a test binds a small limit, which size-symbol-pool leaves alone.

The most entries the symbol pool holds across its two generations; each generation holds
at most half (docs/storage.md, "Symbol interning").  Dynamic so a test binds a small
limit, which `size-symbol-pool` leaves alone.
sourceraw docstring

aggregate-bodyclj

(aggregate-body form)

The query an aggregate reduces the solutions of.

The query an aggregate reduces the solutions of.
sourceraw docstring

aggregate-functorsclj

The five aggregation operators, mapped to the reduction each names. All five take the shape (<op> ?n ?v <body>).

The five aggregation operators, mapped to the reduction each names.  All five take
the shape `(<op> ?n ?v <body>)`.
sourceraw docstring

aggregate-value-varclj

(aggregate-value-var form)

The variable an aggregate reduces over — the one projected out. Nil when the slot holds something that is not a variable, which wff refuses separately.

The variable an aggregate reduces over — the one projected out.  Nil when the slot
holds something that is not a variable, which `wff` refuses separately.
sourceraw docstring

aggregate?clj

(aggregate? form)

Is form an (<aggregate-op> ?n ?v <body>) literal?

Is `form` an `(<aggregate-op> ?n ?v <body>)` literal?
sourceraw docstring

and-functorclj

source

arg-projectionsclj

Each binary projection of arg, with the position it projects: (argN P T) states what (arg P N T) states. The declaration checks and the integrity census read it.

Each binary projection of `arg`, with the position it projects: `(argN P T)` states
what `(arg P N T)` states.  The declaration checks and the integrity census read it.
sourceraw docstring

argument-ordersclj

(argument-orders t {:keys [opaque?] :as marks})

every-order of compound t, or [t] for a non-list or an application held-as-written? under marks' :opaque?.

`every-order` of compound `t`, or `[t]` for a non-list or an application
`held-as-written?` under `marks`' `:opaque?`.
sourceraw docstring

arity-bindingclj

(arity-binding s)

[P kind value] for the sentence s of a stored fact that binds a relation's length, else nil: (arity P n) and an exact-arity class membership bind :exact n, a variable-arity class membership (variable-arity-classes) :var nil, and (arityMin P m) :min m. The index posts each under its binding family (vaelii.impl.kv), which arity/relation-length reads.

`[P kind value]` for the sentence `s` of a stored fact that binds a relation's length,
else nil: `(arity P n)` and an exact-arity class membership bind `:exact n`, a
variable-arity class membership (`variable-arity-classes`) `:var nil`, and
`(arityMin P m)` `:min m`.  The index posts each under its binding family
(`vaelii.impl.kv`), which `arity/relation-length` reads.
sourceraw docstring

arity-binding-functorsclj

The functors of the facts arity-binding answers a length binding for.

The functors of the facts `arity-binding` answers a length binding for.
sourceraw docstring

arrangements-overclj

(arrangements-over form comps)

commuting-arrangements against components already in hand. Forward chaining reads the components off an arriving fact and builds the arrangements over an antecedent that may name a super-predicate of the fact's functor (chain/symmetric-mirror is the binary case).

`commuting-arrangements` against components already in hand.  Forward chaining reads the
components off an arriving fact and builds the arrangements over an antecedent that may
name a super-predicate of the fact's functor (`chain/symmetric-mirror` is the binary
case).
sourceraw docstring

assumption-rule-wrapperclj

(set/assumptionRule (implies …)) — the rule's head is a choice offered to a solve, not a truth to derive. Canonicalizes into :effect :choose; the rule never forward-chains into belief and is consulted only when grounding a solve (docs/solving.md).

`(set/assumptionRule (implies …))` — the rule's head is a *choice* offered to a
solve, not a truth to derive.  Canonicalizes into `:effect :choose`; the rule never
forward-chains into belief and is consulted only when grounding a solve
(docs/solving.md).
sourceraw docstring

authored-sentenceclj

(authored-sentence sx)

A stored sentex's sentence with the author's variable names restored through its own :varmap; a fact carries no varmap and its sentence comes back unchanged. vaelii.core/readable-sentence delegates here.

A stored sentex's sentence with the author's variable names restored through its own
`:varmap`; a fact carries no varmap and its sentence comes back unchanged.
`vaelii.core/readable-sentence` delegates here.
sourceraw docstring

bodyclj

(body {:keys [sentence antecedent]})

The positive atomic form a sentex asserts (a fact's sentence without its not); nil for a rule.

The positive atomic form a sentex asserts (a fact's sentence without its `not`);
nil for a rule.
sourceraw docstring

canonclj

(canon x)

Canonicalize a sentence to one sequential representation (PersistentList, recursively), interning every symbol (intern-sym). A lazy seq, a vector and a list are = but freeze to different nippy bytes, so anything that reaches a key or a value goes through here.

Canonicalize a sentence to one sequential representation (PersistentList, recursively),
interning every symbol (`intern-sym`).  A lazy seq, a vector and a list are `=` but freeze
to different nippy bytes, so anything that reaches a key or a value goes through here.
sourceraw docstring

canonical-conjunctionclj

(canonical-conjunction literals)
(canonical-conjunction literals start)

[canonical varmap] for a conjunction: every variable across all of literals renumbered ?var0 ?var1 … by first occurrence under one shared numbering, and the map from each canonical name back to the name it replaced. Two conjunctions differing only in variable names become the same value, so a search can recognize a repeat. varmap carries a solution back to the caller's names, applied with rename-vars in one pass because the map can be a permutation.

start numbers from ?var<start>, which renames a form clear of another whose variables are ?var0 … ?var<start-1>, as unifying a stored rule against a conjunction requires.

`[canonical varmap]` for a conjunction: every variable across all of `literals` renumbered
`?var0 ?var1 …` by first occurrence under one shared numbering, and the map from each
canonical name back to the name it replaced.  Two conjunctions differing only in variable
names become the same value, so a search can recognize a repeat.  `varmap` carries a
solution back to the caller's names, applied with `rename-vars` in one pass because the map
can be a permutation.

`start` numbers from `?var<start>`, which renames a form clear of another whose variables
are `?var0 … ?var<start-1>`, as unifying a stored rule against a conjunction requires.
sourceraw docstring

canonical-enginesclj

(canonical-engines engines)

The shared instance of the engine set engines.

The shared instance of the engine set `engines`.
sourceraw docstring

canonical-exceptionclj

(canonical-exception conjuncts rule-vars)

An exceptWhen exception's conjuncts, already in the rule's canonical variables rule-vars, in their stored form: sorted (sort-conjuncts), with every variable a quantifier inside them binds numbered past the rule's own, so exceptions differing only in a binder's name are one meta-sentex. Each conjunct is numbered alone first, its conjunctions ordered as a rule's unknown antecedent's are (sort-query-conjunctions, naf-numberings), then once more across the sorted conjuncts. A deferred literal keeps its written place among the deferred literals of its conjunction, after the generators.

An `exceptWhen` exception's conjuncts, already in the rule's canonical variables
`rule-vars`, in their stored form: sorted (`sort-conjuncts`), with every variable a
quantifier inside them binds numbered past the rule's own, so exceptions differing only in a
binder's name are one meta-sentex.  Each conjunct is numbered alone first, its conjunctions
ordered as a rule's `unknown` antecedent's are (`sort-query-conjunctions`,
`naf-numberings`), then once more across the sorted conjuncts.  A deferred literal keeps its
written place among the deferred literals of its conjunction, after the generators.
sourceraw docstring

canonical-subtermclj

(canonical-subterm t {:keys [opaque?] :as marks})

Term t in the form the store holds it in as an argument (canonical-args): a compound not held-as-written? with its own and every inner application in canonical form, any other term itself. marks is sentex's canonicalization reads.

Term `t` in the form the store holds it in as an argument (`canonical-args`): a compound
not `held-as-written?` with its own and every inner application in canonical form, any
other term itself.  `marks` is `sentex`'s canonicalization reads.
sourceraw docstring

census-bound-varsclj

(census-bound-vars body)

The variables an aggregate's census body binds for itself: what its generator conjuncts match, plus what its computed conjuncts write. An inner thereExists binder is not among them. Read by check-naf-closed's census check and by provers/AggregateProver's applicability (docs/aggregate.md, "Grouping").

The variables an aggregate's census `body` binds **for itself**: what its generator
conjuncts match, plus what its computed conjuncts write.  An inner `thereExists` binder
is not among them.  Read by `check-naf-closed`'s census check and by
`provers/AggregateProver`'s applicability (docs/aggregate.md, "Grouping").
sourceraw docstring

chained-comparisonsclj

Variable-arity, transitive comparisons whose chains collapse into one literal: (lessThan ?a ?b) + (lessThan ?b ?c) ⇒ (lessThan ?a ?b ?c).

Variable-arity, transitive comparisons whose chains collapse into one literal:
`(lessThan ?a ?b)` + `(lessThan ?b ?c)` ⇒ `(lessThan ?a ?b ?c)`.
sourceraw docstring

check-exception-closedclj

(check-exception-closed antecedents exception)

Throw unless the exceptWhen exception is closed over antecedents: every free variable it reads is bound before it runs, so the rule's bindings never wait on the exception. The mirror of rules/check-range-restricted, pointed at the exception instead of the consequent.

Free as free-vars counts it, so a thereExists the exception carries binds its own witness — "birds fly unless they have a sick child" is (thereExists ?c (and (childOf ?b ?c) (sick ?c))). That binder must be local (:quantifier-not-local): one the antecedents also name would be substituted with the rule's binding before the query runs, leaving a quantifier over a constant.

Throw unless the `exceptWhen` exception is **closed** over `antecedents`: every
free variable it reads is bound before it runs, so the rule's bindings never wait on
the exception.  The mirror of `rules/check-range-restricted`, pointed at the
exception instead of the consequent.

Free as `free-vars` counts it, so a `thereExists` the exception carries binds its own
witness — "birds fly unless they have a sick child" is
`(thereExists ?c (and (childOf ?b ?c) (sick ?c)))`.  That binder must be **local**
(`:quantifier-not-local`): one the antecedents also name would be substituted with
the rule's binding before the query runs, leaving a quantifier over a constant.
sourceraw docstring

check-naf-closedclj

(check-naf-closed antes conseq exc)

Throw unless rule antecedents antes (with consequent conseq and exception exc) use their NAF and deferred literals soundly:

  • every free variable of an unknown, aggregate or other deferred literal is bound by a generator antecedent or by a deferred literal written before it (:naf-not-closed);
  • a thereExists binder or an aggregate's reduction variable appears nowhere outside its own literal (:quantifier-not-local);
  • a quantified variable a computed conjunct of an unknown query reads is produced by a generator conjunct of the same query (unproducible-inputs, :naf-not-closed), and an aggregate's local census variables are ones census-bound-vars reaches;
  • an unknown query is not an empty conjunction, and a reduction slot and every thereExists, forall and head exists binder hold a variable (:not-well-formed).

See docs/naf.md, "Fully bound to evaluate", and docs/aggregate.md, "Grouping".

Throw unless rule antecedents `antes` (with consequent `conseq` and exception `exc`) use
their NAF and deferred literals soundly:

- every free variable of an `unknown`, aggregate or other deferred literal is bound by a
  generator antecedent or by a deferred literal written before it (`:naf-not-closed`);
- a `thereExists` binder or an aggregate's reduction variable appears nowhere outside its
  own literal (`:quantifier-not-local`);
- a quantified variable a computed conjunct of an `unknown` query reads is produced by a
  generator conjunct of the same query (`unproducible-inputs`, `:naf-not-closed`), and an
  aggregate's local census variables are ones `census-bound-vars` reaches;
- an `unknown` query is not an empty conjunction, and a reduction slot and every
  `thereExists`, `forall` and head `exists` binder hold a variable (`:not-well-formed`).

See docs/naf.md, "Fully bound to evaluate", and docs/aggregate.md, "Grouping".
sourceraw docstring

closed?clj

(closed? sx)

True when the sentence has no free variable: every variable occurrence is bound by an enclosing quantifier or sits inside a (Quote …), the quoted form being syntax the sentence mentions. A ground? sentence answers at once. This is the test for "is this sentence closed"; ground? is the test for "does it hold any variable".

True when the sentence has no free variable: every variable occurrence is bound by an
enclosing quantifier or sits inside a `(Quote …)`, the quoted form being syntax the
sentence mentions.  A `ground?` sentence answers at once.  This is the test for "is
this sentence closed"; `ground?` is the test for "does it hold any variable".
sourceraw docstring

commuting-arrangementsclj

(commuting-arrangements form groups-of)

Every rearrangement of form a lookup has to probe for, given the components groups-of licences at this literal's arity, pruned to the arrangements a stored fact can hold (docs/canonicalization.md, "Commuting arguments sorted"). form is first; a literal that commutes nothing yields only itself. Distinct by form, so (P ?a ?a) is one probe.

Every rearrangement of `form` a lookup has to probe for, given the components `groups-of`
licences at this literal's arity, pruned to the arrangements a stored fact can hold
(docs/canonicalization.md, "Commuting arguments sorted").  `form` is first; a literal
that commutes nothing yields only itself.  Distinct by form, so `(P ?a ?a)` is one
probe.
sourceraw docstring

commuting-componentsclj

(commuting-components groups arity)

The components groups licences at runtime arity arity: sorted position vectors, in sorted order, overlapping groups merged and a component of one position dropped.

The components `groups` licences at runtime arity `arity`: sorted position vectors, in
sorted order, overlapping groups merged and a component of one position dropped.
sourceraw docstring

comparison-siblingsclj

Comparison predicates that fold onto a canonical sibling by reversing their arguments, so (greaterThan A B) is stored as (lessThan B A). Add a pair here and both directions canonicalize to one literal.

Comparison predicates that fold onto a canonical sibling by reversing their
arguments, so `(greaterThan A B)` is stored as `(lessThan B A)`.  Add a pair here
and both directions canonicalize to one literal.
sourceraw docstring

compound-functorsclj

(compound-functors form opaque?)

The functors whose permuting marks spell form (canonical-args): its own, and the functor of every list compound below it that the walk enters. A set; atoms only.

The functors whose permuting marks spell `form` (`canonical-args`): its own, and the
functor of every list compound below it that the walk enters.  A set; atoms only.
sourceraw docstring

conjunction?clj

(conjunction? form)

Is form an (and …) conjunction?

Is `form` an `(and …)` conjunction?
sourceraw docstring

conjunctsclj

(conjuncts form)

form's conjunct literals: an (and …) flattened all the way down, anything else as a one-element vector. An (and) yields none (docs/naf.md, "S may be a conjunction").

`form`'s conjunct literals: an `(and …)` flattened all the way down, anything else as
a one-element vector.  An `(and)` yields none (docs/naf.md, "`S` may be a
conjunction").
sourceraw docstring

connective-problemclj

(connective-problem sentence)

connective-problems as one :not-well-formed problem map, or nil. assert and check read it right after the sentence shape, and an import reads it over each frame, so a malformed connective frame is refused before it can store as an opaque fact or a rule that answers wrongly.

`connective-problems` as one `:not-well-formed` problem map, or nil.  `assert` and
`check` read it right after the sentence shape, and an import reads it over each frame,
so a malformed connective frame is refused before it can store as an opaque fact or a
rule that answers wrongly.
sourceraw docstring

connective-problemsclj

(connective-problems sentence)

Structural problems with sentence's connective frames, as strings (empty if OK), read by check and thrown by assert under :not-well-formed before anything is stored:

  • a structural connective at an arity it does not have;
  • a rule or exception literal that is not itself a sentence; a bare variable is a term, and a derived sentence whose predicate a firing binds is written (?pred . ?args);
  • a head existential outside consequent position;
  • an (ist Ctx S) in any rule position (ist-rule-problem);
  • a nested implies anywhere but a rule's consequent, where it is a generator (docs/generators.md), checked at each level in the ordinary rule roles;
  • a negated rule: not over an implies, bare or wrapped;
  • a top-level and, or a top-level or, or a not over one (docs/canonicalization.md);
  • a not over unknown, thereExists, forall, stored or monotonic in an antecedent or an exception, at any depth (docs/naf.md). A stored in a consequent or over a non-literal is refused. So is a monotonic over anything but a genl literal.
  • a combination of set/* wrappers the record cannot hold (wrapper-stack-problems).
Structural problems with `sentence`'s connective frames, as strings (empty if OK), read by
`check` and thrown by `assert` under `:not-well-formed` before anything is stored:

- a structural connective at an arity it does not have;
- a rule or exception literal that is not itself a sentence; a bare variable is a term, and
  a derived sentence whose predicate a firing binds is written `(?pred . ?args)`;
- a head existential outside consequent position;
- an `(ist Ctx S)` in any rule position (`ist-rule-problem`);
- a nested `implies` anywhere but a rule's consequent, where it is a generator
  (docs/generators.md), checked at each level in the ordinary rule roles;
- a negated rule: `not` over an `implies`, bare or wrapped;
- a top-level `and`, or a top-level `or`, or a `not` over one (docs/canonicalization.md);
- a `not` over `unknown`, `thereExists`, `forall`, `stored` or `monotonic` in an
  antecedent or an exception, at any depth (docs/naf.md).  A `stored` in a consequent or over a non-literal is refused.  So is a `monotonic` over anything but a `genl` literal.
- a combination of `set/*` wrappers the record cannot hold (`wrapper-stack-problems`).
sourceraw docstring

constraint-rule-wrappersclj

(set/hardConstraint (implies …)) / (set/softConstraint (implies …)) — the rule's head is a contradiction marker and its body a conjunctive nogood over background facts and choice-head patterns. Canonicalizes into :effect (:forbid / :penalize); like an assumptionRule the rule never forward-chains, and a solve grounds its body (docs/solving.md). A hard constraint renders as an ASPIF integrity constraint (models violating it are excluded); a soft one as a minimized violation.

`(set/hardConstraint (implies …))` / `(set/softConstraint (implies …))` — the rule's
head is a *contradiction marker* and its body a conjunctive nogood over background
facts and choice-head patterns.  Canonicalizes into `:effect` (`:forbid` / `:penalize`);
like an assumptionRule the rule never forward-chains, and a solve grounds its body
(docs/solving.md).  A hard constraint renders as an ASPIF integrity constraint (models
violating it are excluded); a soft one as a minimized violation.
sourceraw docstring

content-formsclj

(content-forms sentex)

The connective-free literals a sentex is indexed and searchable by: a rule's antecedents and consequent, or a fact's positive body — each with its structural connective heads stripped, so not / implies / and never reach the term index.

The connective-free literals a sentex is indexed and searchable by: a rule's
antecedents and consequent, or a fact's positive body — each with its structural
connective heads stripped, so `not` / `implies` / `and` never reach the term index.
sourceraw docstring

default-rule-wrapperclj

source

defeat-functorclj

(defeat <handle>) — a meta-sentex the engine derives that removes the sentex the handle names from belief at the context it is stored in and every context that sees it, read at read time. assert refuses it in every literal (checks/check-no-defeat).

`(defeat <handle>)` — a meta-sentex the engine derives that removes the sentex the handle
names from belief at the context it is stored in and every context that sees it, read at
read time.  `assert` refuses it in every literal (`checks/check-no-defeat`).
sourceraw docstring

deferred-input-varsclj

(deferred-input-vars g)
(deferred-input-vars g bound)

The variables a deferred literal must have bound before it can run: free-vars for unknown and the aggregates, and every argument it does not write for the rest. Under bound, a corresponding predicate whose structure is bound reads only the structure.

The variables a deferred literal must have bound before it can run: `free-vars` for
`unknown` and the aggregates, and every argument it does not write for the rest.  Under
`bound`, a corresponding predicate whose structure is bound reads only the structure.
sourceraw docstring

deferred-literal?clj

(deferred-literal? l)

Is this literal one of the deferred (evaluable) ones? The canonical order here and the query planner (vaelii.impl.plan) hold back this one set.

Is this literal one of the deferred (evaluable) ones?  The canonical order here and the
query planner (`vaelii.impl.plan`) hold back this one set.
sourceraw docstring

deferred-output-varsclj

(deferred-output-vars g)
(deferred-output-vars g bound)

The variables a deferred literal binds — evaluate's first argument, an aggregate's ?n, and nothing at all for a pure test like lessThan or different. Under bound, a corresponding predicate whose structure is bound binds its elements.

The variables a deferred literal **binds** — `evaluate`'s first argument, an
aggregate's `?n`, and nothing at all for a pure test like `lessThan` or `different`.
Under `bound`, a corresponding predicate whose structure is bound binds its elements.
sourceraw docstring

deferred-predicatesclj

Predicates that consume bindings rather than produce them: evaluable tests and computations, which canonical ordering holds back after the generators in the author's relative order (docs/canonicalization.md, "Canonical literal order", lists them). thereExists is absent: a standalone one is desugared to its body (desugar-there-exists). different and the quantity comparisons fold onto no sibling (docs/defenses.md, docs/quantity.md).

Predicates that *consume* bindings rather than produce them: evaluable tests and
computations, which canonical ordering holds back after the generators in the author's
relative order (docs/canonicalization.md, "Canonical literal order", lists them).
`thereExists` is absent: a standalone one is desugared to its body
(`desugar-there-exists`).  `different` and the quantity comparisons fold onto no sibling
(docs/defenses.md, docs/quantity.md).
sourceraw docstring

defn-companion-rulesclj

(defn-companion-rules [pred coll cond])

The forward rule sentence(s) a defn* sentence expands into, each relating (Coll ?x) to the condition on the member ?x:

(defnNecessary  Coll C) -> [(implies (Coll ?x) C)]   ; member => condition
(defnSufficient Coll C) -> [(implies C (Coll ?x))]   ; condition => member
(defnIff        Coll C) -> both

Built from the sentence as written and canonicalized when stored; a conjunctive necessary condition splits into one rule per conjunct. A sufficient condition with no generator conjunct naming ?x expands to no rule (check-naf-closed would refuse it), and DefnSufficientProver answers membership.

The forward rule sentence(s) a `defn*` sentence expands into, each relating `(Coll ?x)` to
the condition on the member `?x`:

    (defnNecessary  Coll C) -> [(implies (Coll ?x) C)]   ; member => condition
    (defnSufficient Coll C) -> [(implies C (Coll ?x))]   ; condition => member
    (defnIff        Coll C) -> both

Built from the sentence as written and canonicalized when stored; a conjunctive necessary
condition splits into one rule per conjunct.  A sufficient condition with no generator
conjunct naming `?x` expands to no rule (`check-naf-closed` would refuse it), and
`DefnSufficientProver` answers membership.
sourceraw docstring

defn-condition-problemsclj

(defn-condition-problems [pred _coll cond :as s])

Why the defn* sentence s is not well-formed, as problem strings (empty if OK). The condition must mention the member variable ?x: a condition that does not name the member says nothing about membership, and would expand to a rule that concludes it vacuously (necessary) or is not range-restricted (sufficient).

Why the `defn*` sentence `s` is not well-formed, as problem strings (empty if OK).
The condition must mention the member variable `?x`: a condition that does not name
the member says nothing about membership, and would expand to a rule that concludes it
vacuously (necessary) or is not range-restricted (sufficient).
sourceraw docstring

defn-member-varclj

The distinguished variable a defn* sentence names the member by. (defnNecessary Coll <cond>) reads <cond> as a condition on ?x and expands to a rule relating (Coll ?x) to it. One fixed spelling, so the member stays identifiable after canonicalization renames every other variable in the condition.

The distinguished variable a `defn*` sentence names the member by.  `(defnNecessary
Coll <cond>)` reads `<cond>` as a condition on `?x` and expands to a rule relating
`(Coll ?x)` to it.  One fixed spelling, so the member stays identifiable after
canonicalization renames every other variable in the condition.
sourceraw docstring

defn-predicatesclj

The three definitional collection relations, each expanded into forward rules at assert (docs/defns.md). A syntactic set, read where a defn* sentence must be recognized: exempted from the ground check (its condition carries ?x), given a well-formedness arm, and materialized into companion rules.

The three definitional collection relations, each expanded into forward rules at
assert (docs/defns.md).  A syntactic set, read where a `defn*` sentence must be
recognized: exempted from the ground check (its condition carries `?x`), given a
well-formedness arm, and materialized into companion rules.
sourceraw docstring

defn-sentence?clj

(defn-sentence? sentence)

Is sentence one of the definitional collection relations — defnNecessary, defnSufficient or defnIff? Read off the functor, so it recognizes the fact a defn* assertion stores rather than any rule it expands into.

Is `sentence` one of the definitional collection relations — `defnNecessary`,
`defnSufficient` or `defnIff`?  Read off the functor, so it recognizes the fact a
`defn*` assertion stores rather than any rule it expands into.
sourceraw docstring

desugar-forall-literalclj

(desugar-forall-literal form)

The nested NAF an antecedent (forall ?y (implies Body Head)) is:

(unknown (thereExists ?y (and Body… (unknown Head))))

A conjunctive Body contributes its conjuncts; Head is left whole. Throws :not-well-formed when the second argument is not an (implies …) (docs/naf.md, "forall is sugar for a nested unknown").

The nested NAF an antecedent `(forall ?y (implies Body Head))` is:

    (unknown (thereExists ?y (and Body… (unknown Head))))

A conjunctive `Body` contributes its conjuncts; `Head` is left whole.  Throws
`:not-well-formed` when the second argument is not an `(implies …)` (docs/naf.md,
"`forall` is sugar for a nested `unknown`").
sourceraw docstring

desugar-forall-ruleclj

(desugar-forall-rule rule-form)

rule-form with every (forall …) antecedent replaced by desugar-forall-literal's nested NAF. A form with none, and a form that is not a rule, is returned unchanged. Called by the sentex constructor and rules/inner-rule (docs/naf.md).

`rule-form` with every `(forall …)` antecedent replaced by `desugar-forall-literal`'s
nested NAF.  A form with none, and a form that is not a rule, is returned unchanged.
Called by the sentex constructor and `rules/inner-rule` (docs/naf.md).
sourceraw docstring

desugar-there-existsclj

(desugar-there-exists antes)

Rule antecedents antes with each standalone positive (thereExists ?x S) replaced by the conjuncts of S, spliced in (docs/naf.md, "Standalone positive thereExists desugars").

Rule antecedents `antes` with each standalone positive `(thereExists ?x S)` replaced
by the `conjuncts` of `S`, spliced in (docs/naf.md, "Standalone positive
`thereExists` desugars").
sourceraw docstring

direction-enginesclj

The engines each set/*Rule direction runs a rule in, as the :direction opt and the wrappers spell them. :forward and :both are one set: a forward rule answers backward goals too. :lazy makes a backward rule's conclusion one a forward join proves on demand (docs/inference.md, "A lazy-forward rule").

The engines each `set/*Rule` direction runs a rule in, as the `:direction` opt and the
wrappers spell them.  `:forward` and `:both` are one set: a forward rule answers
backward goals too.  `:lazy` makes a backward rule's conclusion one a forward join
proves on demand (docs/inference.md, "A lazy-forward rule").
sourceraw docstring

disjunction?clj

(disjunction? form)

Is form a disjunction (or <alternative> ...)? Arity is not checked here — an empty (or) is a disjunction that no alternative satisfies, and naming it as one is what lets rules/disjunction-problems refuse it by that name.

Is `form` a disjunction `(or <alternative> ...)`?  Arity is *not* checked here — an
empty `(or)` is a disjunction that no alternative satisfies, and naming it as one is
what lets `rules/disjunction-problems` refuse it by that name.
sourceraw docstring

disjunctsclj

(disjuncts form)

The alternatives a disjunction offers.

The alternatives a disjunction offers.
sourceraw docstring

do-form?clj

(do-form? form)

Is form a do/ imperative?

Used both to dispatch one at the top level of assert and to refuse one anywhere it would run inside a fixpoint — a rule antecedent, a rule consequent, an exceptWhen query, or anything derived. Forward chaining's defining property is that the same knowledge in any order yields the same beliefs; an imperative firing during it would run a number of times that depends on firing order, and would mutate the KB the fixpoint is still computing over. That breaks order independence and locality at once (docs/nmtms.md), so do/ is legal only where a caller put it: at the top level of an assert, once, after settling.

Is `form` a `do/` imperative?

Used both to dispatch one at the top level of `assert` and to **refuse** one
anywhere it would run inside a fixpoint — a rule antecedent, a rule consequent, an
`exceptWhen` query, or anything derived.  Forward chaining's defining property is
that the same knowledge in any order yields the same beliefs; an imperative firing
during it would run a number of times that depends on firing order, and would mutate
the KB the fixpoint is still computing over.  That breaks order independence and
locality at once (docs/nmtms.md), so `do/` is legal only where a caller put it:
at the top level of an `assert`, once, after settling.
sourceraw docstring

do-namespaceclj

The namespace marking an imperative — a form given to assert that instructs the engine to do something rather than stating that something is true. (do/labeling Ctx) is the first (docs/labeling.md). Nothing in the namespace is ever stored.

The namespace marking an **imperative** — a form given to `assert` that instructs
the engine to do something rather than stating that something is true.
`(do/labeling Ctx)` is the first (docs/labeling.md).  Nothing in the namespace is ever
stored.
sourceraw docstring

dot-markerclj

source

dot-problemclj

(dot-problem k form)

The :shape problem a sentence or goal holding a misplaced . is refused with, under key k (:sentence or :goal), or nil. . is the rest marker's syntax and names no term, so the write, import and read entry points refuse it whatever :naming says.

The `:shape` problem a sentence or goal holding a misplaced `.` is refused with, under
key `k` (`:sentence` or `:goal`), or nil.  `.` is the rest marker's syntax and names no
term, so the write, import and read entry points refuse it whatever `:naming` says.
sourceraw docstring

dotted?clj

(dotted? form)

Is form a dotted rest pattern, (?pred . ?args) or (rel A . ?rest): a list that ends in the dot marker and one variable?

Is `form` a dotted rest pattern, `(?pred . ?args)` or `(rel A . ?rest)`: a list that
ends in the dot marker and one variable?
sourceraw docstring

effect-constraintclj

(effect-constraint effect)

The constraint class of an :effect — :hard for :forbid, :soft for :penalize, nil otherwise.

The constraint class of an `:effect` — `:hard` for `:forbid`, `:soft` for `:penalize`,
nil otherwise.
sourceraw docstring

engines-directionclj

(engines-direction engines)

The direction whose set/*Rule wrapper spells the base engines of engines (the modifier-wrappers members aside) — :backward, :forward, :forward-only, :lazy-forward or :inert. A forward rule stores its conclusions, so :lazy beside :forward spells :forward.

The direction whose `set/*Rule` wrapper spells the base engines of `engines` (the
`modifier-wrappers` members aside) — `:backward`, `:forward`, `:forward-only`,
`:lazy-forward` or `:inert`.  A forward rule stores its conclusions, so `:lazy` beside
`:forward` spells `:forward`.
sourceraw docstring

every-orderclj

(every-order t {:keys [symmetric? groups-of]})

Every argument order compound t may have been written in under its own functor's permuting marks: each permutation within each commuting component, or the mirror of a symmetric binary application. t first.

Every argument order compound `t` may have been written in under its own functor's
permuting marks: each permutation within each commuting component, or the mirror of a
symmetric binary application.  `t` first.
sourceraw docstring

exact-arity-classesclj

What each exact-arity class membership says the arity is. The arity sentexes and these memberships derive each other through the core.txt rules, but a {:chain? false} assert or a KB loaded without the rules has only what was written, so both spellings are read.

core.txt ships fifteen classes: unary … quinary are relation-wide and ten specialize them by kind, so a function's arity may be written (binary_function F). The arity readers read a stored membership by its own functor (arity-binding). The spellings of one term never disagree: a class and its specializations map to one number. The table lives here, below the index, because arity/relation-length and kb/relation? read it.

What each exact-arity class membership says the arity is.  The `arity` sentexes and these
memberships derive each other through the core.txt rules, but a `{:chain? false}` assert or
a KB loaded without the rules has only what was written, so both spellings are read.

core.txt ships fifteen classes: `unary` … `quinary` are relation-wide and ten specialize
them by kind, so a function's arity may be written `(binary_function F)`.  The arity readers
read a stored membership by its own functor (`arity-binding`).  The spellings of one term
never disagree: a class and its specializations map to one number.  The table lives here,
below the index, because `arity/relation-length` and `kb/relation?` read it.
sourceraw docstring

except-functorclj

(except <handle>) — a meta-sentex removing the sentex the handle names from belief at the context it is asserted in and that context's descendants (everything that sees it). An except is forced-monotonic, so no defeat removes it. Retracting it restores the hidden sentex, and so does an except of it (the meta-except cascade).

`(except <handle>)` — a meta-sentex removing the sentex the handle names from
belief at the context it is asserted in and that context's descendants (everything
that *sees* it).  An except is forced-monotonic, so no defeat removes it.  Retracting
it restores the hidden sentex, and so does an except of it (the meta-except cascade).
sourceraw docstring

except-wrapperclj

(exceptWhen <query> <rule>) — the rule does not conclude for a binding its exception holds of. Unlike the other wrappers this one takes two arguments and captures one: the query. The wrapper is split off at the assert layer and stored as a (exceptWhen <query> (sentexHandle <rule-id>)) meta-sentex naming the rule, rather than folded into the rule record (see exceptWhen-meta).

`(exceptWhen <query> <rule>)` — the rule does not conclude for a binding its
exception holds of.  Unlike the other wrappers this one takes *two* arguments and
captures one: the query.  The wrapper is split off at the assert layer and stored as
a `(exceptWhen <query> (sentexHandle <rule-id>))` meta-sentex naming the rule, rather
than folded into the rule record (see `exceptWhen-meta`).
sourceraw docstring

exception-conjunctsclj

(exception-conjuncts form)

Normalize an exceptWhen query to its one internal shape — a vector of literals, all of which must hold. A conjunction is written as a vector, the way core/prove spells one; a single literal may be written bare.

A forall conjunct is the nested NAF it is (desugar-forall-literal), as a forall antecedent is, so the re-check index and the stratification graph read the predicates under it. A malformed one is left for check-exception-closed to refuse: this runs inside peel-rule-wrapper, which reports rather than throws.

Normalize an `exceptWhen` query to its one internal shape — a vector of literals,
*all* of which must hold.  A conjunction is written as a vector, the way
`core/prove` spells one; a single literal may be written bare.

A `forall` conjunct is the nested NAF it is (`desugar-forall-literal`), as a `forall`
antecedent is, so the re-check index and the stratification graph read the
predicates under it.  A malformed one is left for `check-exception-closed` to refuse:
this runs inside `peel-rule-wrapper`, which reports rather than throws.
sourceraw docstring

exception-query-conjunctsclj

(exception-query-conjuncts sentence)

The conjunct literals of an exceptWhen meta-sentence's query — the inner (and …) unwrapped, or a bare single literal as a one-element vector. The inverse of exceptWhen-meta.

The conjunct literals of an exceptWhen meta-sentence's query — the inner `(and …)`
unwrapped, or a bare single literal as a one-element vector.  The inverse of
`exceptWhen-meta`.
sourceraw docstring

exception-strength-problemclj

(exception-strength-problem form)

The :shape problem a malformed strength wrapper on an exceptWhen query, or a (set/monotonic …) / (set/inert …) elsewhere on the wrapper chain or inside the sentence, is refused with, or nil. A value for check, and the ex-info peel-exception-strength throws — so the two entry points refuse the same input in the same words, differing only in the delivery.

The `:shape` problem a malformed strength wrapper on an `exceptWhen` query, or a
`(set/monotonic …)` / `(set/inert …)` elsewhere on the wrapper chain or inside the
sentence, is refused with, or nil.  A value for `check`, and the `ex-info`
`peel-exception-strength` throws — so the two entry points refuse the same input in the same words, differing only in the
delivery.
sourceraw docstring

exceptWhen-metaclj

(exceptWhen-meta conjuncts rule-id)

The exceptWhen meta-sentence for conjuncts (a seq of literals, all of which must hold) qualifying the rule at rule-id. A single literal is stored bare, several as an (and …) — canon-stable either way (a vector would flatten to a list and lose the shape).

The exceptWhen meta-sentence for `conjuncts` (a seq of literals, all of which must
hold) qualifying the rule at `rule-id`.  A single literal is stored bare, several as
an `(and …)` — canon-stable either way (a vector would flatten to a list and lose the
shape).
sourceraw docstring

exceptWhen-meta?clj

(exceptWhen-meta? sentence)

Is sentence a (exceptWhen <query> (sentexHandle <id>)) meta-sentex — the stored form, whose second argument is a handle (as opposed to the (exceptWhen <query> <rule>) wrapper, whose second argument is a rule form)?

Is `sentence` a `(exceptWhen <query> (sentexHandle <id>))` meta-sentex — the stored
form, whose second argument is a handle (as opposed to the `(exceptWhen <query>
<rule>)` *wrapper*, whose second argument is a rule form)?
sourceraw docstring

exceptWhen-rule-handleclj

(exceptWhen-rule-handle sentence)

The rule handle an exceptWhen meta-sentence names.

The rule handle an exceptWhen meta-sentence names.
sourceraw docstring

exists-functorclj

source

fact-arity-bindingclj

(fact-arity-binding sx)

arity-binding of the sentence of a record sx holding a fact, else nil.

`arity-binding` of the sentence of a record `sx` holding a fact, else nil.
sourceraw docstring

fact-shapeclj

(fact-shape sx)

[f n] for a record sx holding a positive fact of n arguments with a plain symbol functor, else nil. A sentence about to be written is asked as {:sentence s}.

`[f n]` for a record `sx` holding a positive fact of `n` arguments with a plain symbol
functor, else nil.  A sentence about to be written is asked as `{:sentence s}`.
sourceraw docstring

fielded-rule-slotsclj

(fielded-rule-slots direction assumption constraint)

The [engines effect] of a rule frame that spells its wrappers as the three fields direction / assumption / constraint — the disk codec's rule tags 1, 3, 5, 7, 8 and 9, a record thawed whole under those keys, and a dump frame keyed by them. Such a frame always carries a direction.

The `[engines effect]` of a rule frame that spells its wrappers as the three fields
`direction` / `assumption` / `constraint` — the disk codec's rule tags 1, 3, 5, 7, 8 and
9, a record thawed whole under those keys, and a dump frame keyed by them.  Such a frame
always carries a direction.
sourceraw docstring

forall-functorclj

source

forall?clj

(forall? form)

Is form a (forall <var-or-vars> (implies Body Head)) universal?

Is `form` a `(forall <var-or-vars> (implies Body Head))` universal?
sourceraw docstring

form-peelclj

(form-peel form)

[sentence opts problem] for one whole form: (set/monotonic S) is S with {:strength :monotonic}, (set/inert S) is S with {:inert true}, and anything else is itself with nil. problem is the :shape refusal of a wrapper around no sentence or two, or around the other wrapper, since an inert sentex has no strength.

`[sentence opts problem]` for one whole form: `(set/monotonic S)` is `S` with
`{:strength :monotonic}`, `(set/inert S)` is `S` with `{:inert true}`, and anything
else is itself with nil.  `problem` is the `:shape` refusal of a wrapper around no
sentence or two, or around the other wrapper, since an inert sentex has no strength.
sourceraw docstring

form-variablesclj

(form-variables form)

Every variable anywhere in form, as a set — #{} rather than symbols-where's nil, since every caller folds the answer into something or calls it as a fn. The one set walk: resolution, plan, quality, provers and asp.solve-context call it.

Every variable anywhere in `form`, as a set — `#{}` rather than `symbols-where`'s nil,
since every caller folds the answer into something or calls it as a fn.  The one set
walk: `resolution`, `plan`, `quality`, `provers` and `asp.solve-context` call it.
sourceraw docstring

form-varsclj

(form-vars form)

Every variable anywhere in form, in order of occurrence and with duplicates, so a variable used twice counts twice (locality reads occurrence counts). Lazy. The one walk for a variable sequence: rules, skolem, rewrite, asp.solve-context and the exception closure check call it; form-variables is the set form.

Every variable anywhere in `form`, in order of occurrence and with duplicates, so a
variable used twice counts twice (locality reads occurrence counts).  Lazy.  The one
walk for a variable sequence: `rules`, `skolem`, `rewrite`, `asp.solve-context` and
the exception closure check call it; `form-variables` is the set form.
sourceraw docstring

forms-whereclj

(forms-where pred form)

Every sub-form satisfying pred, depth-first pre-order, as a vector. The collecting form of some-form — a vector rather than nil, because its callers report each form they find rather than stopping at the first.

Every sub-form satisfying `pred`, depth-first pre-order, as a vector.  The collecting
form of `some-form` — a vector rather than nil, because its callers report *each* form
they find rather than stopping at the first.
sourceraw docstring

free-varsclj

(free-vars form)

The variables of form that must be bound before it can be evaluated: every variable it mentions, minus those a quantifier inside it binds. unknown is transparent, thereExists and forall subtract their binder, and an aggregate subtracts its ?v and its ?n (docs/naf.md, "Fully bound to evaluate").

The variables of `form` that must be bound before it can be evaluated: every variable
it mentions, minus those a quantifier inside it binds.  `unknown` is transparent,
`thereExists` and `forall` subtract their binder, and an aggregate subtracts its `?v`
and its `?n` (docs/naf.md, "Fully bound to evaluate").
sourceraw docstring

ground-term?clj

(ground-term? t)

True when t contains no pattern variable anywhere.

True when `t` contains no pattern variable anywhere.
sourceraw docstring

ground?clj

(ground? sx)

True when the sentence contains no pattern variables (anywhere, nested). A plain tree search: a variable inside a (Quote …) or under a quantifier counts. closed? is the test for a sentence with no free variable.

True when the sentence contains no pattern variables (anywhere, nested).  A plain tree
search: a variable inside a `(Quote …)` or under a quantifier counts.  `closed?` is the
test for a sentence with no free variable.
sourceraw docstring

handle-idclj

(handle-id form)

The sentex id a handle names, or nil when form is not a handle.

The sentex id a handle names, or nil when `form` is not a handle.
sourceraw docstring

head-exists-bodyclj

(head-exists-body form)

The consequent C inside a head (exists <vars> C).

The consequent `C` inside a head `(exists <vars> C)`.
sourceraw docstring

head-exists-varsclj

(head-exists-vars form)

The existential variables a head (exists <vars> C) introduces, as a set — a single variable or a sequence of them (quantified-vars reads either shape).

The existential variables a head `(exists <vars> C)` introduces, as a set —
a single variable or a sequence of them (`quantified-vars` reads either shape).
sourceraw docstring

head-exists?clj

(head-exists? form)

Is form a head existential (exists <var-or-vars> C)?

Is `form` a head existential `(exists <var-or-vars> C)`?
sourceraw docstring

implies?clj

(implies? form)

Is form a rule form (implies <ante> <conseq>)? Arity checked: an implies at any other arity is never read as a rule — rule-consequent is an nth, so an arity-4 form read as a rule would silently drop its tail. connective-problems refuses the malformed form at both entry points before this question is asked.

Is `form` a rule form `(implies <ante> <conseq>)`?  Arity checked: an `implies` at
any other arity is never read as a rule — `rule-consequent` is an `nth`, so an
arity-4 form read as a rule would silently drop its tail.  `connective-problems`
refuses the malformed form at both entry points before this question is asked.
sourceraw docstring

index-termsclj

(index-terms sentex)

The distinct terms that make a sentex findable: the atoms of its connective-free content at every depth, plus each ground compound between *min-indexed-depth* and max-indexed-compound. The dot marker of a rest pattern is syntax and names no term. The sentex's context is added separately by the index.

The distinct terms that make a sentex findable: the atoms of its connective-free
content at every depth, plus each ground compound between `*min-indexed-depth*` and
`max-indexed-compound`.  The dot marker of a rest pattern is syntax and names no term.
The sentex's context is added separately by the index.
sourceraw docstring

indexable-term?clj

(indexable-term? t)

A subterm worth an inverted-index entry: a non-variable symbol (predicate, individual, type, context) or a fully-ground compound. Numbers, strings, and variables are dropped — useless lookup keys that only bloat the index.

A subterm worth an inverted-index entry: a non-variable symbol (predicate,
individual, type, context) or a fully-ground compound.  Numbers, strings, and
variables are dropped — useless lookup keys that only bloat the index.
sourceraw docstring

inert-wrapperclj

(set/inert S) — S stored through assert-inert: indexed and durable, never a premise. Read by the text KB format alone, around a whole form; assert, check and assert-inert refuse it on the wrapper chain and inside the sentence (:shape), since it names another entry point rather than an option of theirs.

`(set/inert S)` — `S` stored through `assert-inert`: indexed and durable, never a
premise.  Read by the text KB format alone, around a whole form; `assert`, `check` and
`assert-inert` refuse it on the wrapper chain and inside the sentence (`:shape`), since
it names another entry point rather than an option of theirs.
sourceraw docstring

intern-deepclj

(intern-deep x)

x with every symbol replaced by its pooled instance, preserving shape: a list stays a list, a vector a vector and a map a map, where canon flattens to lists. A rule's :antecedent is a vector and a [::subterm k] marker must stay one, so the paths that rebuild a canonical structure from bytes call this: the record frames (vaelii.impl.disk.codec) and the index snapshot's token dictionary (vaelii.impl.disk.index-snapshot).

`x` with every symbol replaced by its pooled instance, preserving shape: a list stays a
list, a vector a vector and a map a map, where `canon` flattens to lists.  A rule's
`:antecedent` is a vector and a `[::subterm k]` marker must stay one, so the paths that
rebuild a canonical structure from bytes call this: the record frames
(`vaelii.impl.disk.codec`) and the index snapshot's token dictionary
(`vaelii.impl.disk.index-snapshot`).
sourceraw docstring

intern-symclj

(intern-sym s)

The pooled instance of symbol s (or s unchanged when it is not a symbol). Interning changes identity, never equality, so a pooled ?var0 still matches a fresh one as a binding key. A thread racing a rotation can put into the map that has just become previous; the entry stays findable there, so the race costs at most a missed sharing and never a wrong symbol.

The pooled instance of symbol `s` (or `s` unchanged when it is not a symbol).
Interning changes identity, never equality, so a pooled `?var0` still matches a
fresh one as a binding key.  A thread racing a rotation can put into the map that has
just become `previous`; the entry stays findable there, so the race costs at most a
missed sharing and never a wrong symbol.
sourceraw docstring

ist-functorclj

source

key-streamclj

(key-stream body)

The structural token stream for a fact body: the functor at the top level (no leading marker, so the [pred …] prefix and the predicate extent's node [pred] stay the trie's first level), then each argument linearized. Deterministic and compound-blind, so it composes with α-rename and dedup unchanged — an atom body degenerates to [body].

The structural token stream for a fact body: the functor at the top level (no
leading marker, so the `[pred …]` prefix and the predicate extent's node `[pred]` stay
the trie's first level), then each argument linearized.  Deterministic and
compound-blind, so it composes with α-rename and dedup unchanged — an atom body
degenerates to `[body]`.
sourceraw docstring

max-indexed-compoundclj

Largest ground compound subterm (node count) the inverted term index gives its own key, the ceiling *min-indexed-depth* is the floor of. Indexing a compound stores a key holding the whole subtree, so a deep ground term would cost O(depth²) index bytes. Scoped to [:term-index]: indexable-term?, which also drives the [:argument-root] roots, is untouched.

Largest ground compound subterm (node count) the inverted term index gives its own key,
the ceiling `*min-indexed-depth*` is the floor of.  Indexing a compound stores a key
holding the whole subtree, so a deep ground term would cost O(depth²) index bytes.
Scoped to `[:term-index]`: `indexable-term?`, which also drives the `[:argument-root]`
roots, is untouched.
sourceraw docstring

mention-arrangementsclj

(mention-arrangements form {:keys [opaque?] :as marks} split?)

Every spelling of literal form a fact may be stored under at a mention position split? names ((fn [functor position])): each compound there, and every compound inside it, in every argument order its own functor's permuting marks allow (every-order). The walk descends where canonical-args does. form first, and [form] when no such position holds a compound.

Every spelling of literal `form` a fact may be stored under at a mention position
`split?` names (`(fn [functor position])`): each compound there, and every compound
inside it, in every argument order its own functor's permuting marks allow
(`every-order`).  The walk descends where `canonical-args` does.  `form` first, and
`[form]` when no such position holds a compound.
sourceraw docstring

mentions?clj

(mentions? sentex term)

Does sentex's connective-free content hold term as a subterm? The question the term index answers wherever it has a key, asked of the record instead — the verify half of a compound probe, which turns probe-atoms' superset into the exact answer.

Does `sentex`'s connective-free content hold `term` as a subterm?  The question the
term index answers wherever it has a key, asked of the record instead — the verify half
of a compound probe, which turns `probe-atoms`' superset into the exact answer.
sourceraw docstring

mirror-literalclj

(mirror-literal form)

The argument-swapped twin of a binary literal, for symmetric lookup.

The argument-swapped twin of a binary literal, for symmetric lookup.
sourceraw docstring

misplaced-dotclj

(misplaced-dot form)

The first list in form, depth-first, that holds a . other than its rest marker, or nil when every . in it opens a rest (rest-marker?).

The first list in `form`, depth-first, that holds a `.` other than its rest marker,
or nil when every `.` in it opens a rest (`rest-marker?`).
sourceraw docstring

modifier-wrappersclj

The wrappers that each add one member to a :derive rule's :engines beside its direction, by wrapper.

The wrappers that each add one member to a `:derive` rule's `:engines` beside its
direction, by wrapper.
sourceraw docstring

modifiersclj

(modifiers form)

The :engines members of the modifier-wrappers written at any depth of form's wrapper stack, as a set, or nil.

The `:engines` members of the `modifier-wrappers` written at any depth of `form`'s
wrapper stack, as a set, or nil.
sourceraw docstring

monotonic-read-functorclj

source

monotonic-read?clj

(monotonic-read? form)

Is form a (monotonic S) literal, which only a route held at :monotonic satisfies? See docs/inference.md.

Is `form` a `(monotonic S)` literal, which only a route held at `:monotonic` satisfies?  See docs/inference.md.
sourceraw docstring

naf-query-conjunctsclj

(naf-query-conjuncts unk)

The conjunct literals an (unknown S) antecedent's query is evaluated as: conjuncts of S. The unknown spelling of exception-query-conjuncts.

The conjunct literals an `(unknown S)` antecedent's query is evaluated as:
`conjuncts` of `S`.  The `unknown` spelling of `exception-query-conjuncts`.
sourceraw docstring

names-a-handle?clj

(names-a-handle? sentence)

Does sentence name a stored sentex by handle: a (sentexHandle N) term anywhere inside?

Does `sentence` name a stored sentex by handle: a `(sentexHandle N)` term anywhere
inside?
sourceraw docstring

nat-quoting-predicatesclj

Predicates whose expression argument is a verbatim NAT payload, neither reified nor type-checked as a term.

Predicates whose expression argument is a verbatim NAT payload, neither reified nor
type-checked as a term.
sourceraw docstring

negation?clj

(negation? form)

Is form a negation (not <body>)? Arity checked, so a not at any other arity is not one.

Is `form` a negation `(not <body>)`?  Arity checked, so a `not` at any other arity
is not one.
sourceraw docstring

negative?clj

(negative? sx)

Is sx a negative literal — a sentex whose sentence is (not S)? The record keeps no separate sign: construction leaves at most one not, at the head (peel-not), so the head is the whole answer. False for a rule, which holds no sentence.

Is `sx` a negative literal — a sentex whose sentence is `(not S)`?  The record keeps
no separate sign: construction leaves at most one `not`, at the head (`peel-not`), so
the head is the whole answer.  False for a rule, which holds no sentence.
sourceraw docstring

nested-arrangementsclj

(nested-arrangements form {:keys [opaque?] :as marks})

Every spelling of literal form a lookup probes for the compounds below it: each compound holding a variable, at any depth, in each argument order its own functor's permuting marks let a stored fact hold it in (own-arrangements), innermost first. form is first, and its own arguments keep their order, which res/raw-match-with fans. Under a not the body's arguments keep theirs. The walk stops where canonical-args does. [form] when no argument is an open compound.

Every spelling of literal `form` a lookup probes for the compounds below it: each
compound holding a variable, at any depth, in each argument order its own functor's
permuting marks let a stored fact hold it in (`own-arrangements`), innermost first.
`form` is first, and its own arguments keep their order, which `res/raw-match-with`
fans.  Under a `not` the body's arguments keep theirs.  The walk stops where
`canonical-args` does.  `[form]` when no argument is an open compound.
sourceraw docstring

no-matchclj

The reserved constant a read-mode reify resolves a never-minted NAT to, and a goal's application with no correspondence is replaced by. No stored sentex names it, and it denotes no term, so only the stored-fact prover reads a literal holding it at a term position (res/names-no-match?).

The reserved constant a read-mode reify resolves a never-minted NAT to, and a goal's
application with no correspondence is replaced by.  No stored sentex names it, and it
denotes no term, so only the stored-fact prover reads a literal holding it at a term
position (`res/names-no-match?`).
sourceraw docstring

normalize-literalclj

(normalize-literal form marks)

One literal in canonical form. marks carries the KB reads canonicalization makes — :symmetric?, whether a functor is declared symmetric, :groups-of, the commutativity groups it declares at a given arity, :opaque?, whether an application of a functor keeps its arguments as written, :mention-at?, whether a functor's argument position is kept as written, and the term marks canonical-term reads below the literal (:associative?, :idempotent?, :meet-order, :distinct-from). Each defaults to answering nothing, so a KB-free construction reorders no arguments. The compounds below the literal are put in canonical form first (canonical-args), then the literal's own arguments in order.

One literal in canonical form.  `marks` carries the KB reads canonicalization makes —
`:symmetric?`, whether a functor is declared symmetric, `:groups-of`, the commutativity
groups it declares at a given arity, `:opaque?`, whether an application of a functor
keeps its arguments as written, `:mention-at?`, whether a functor's argument position is
kept as written, and the term marks `canonical-term` reads below the literal
(`:associative?`, `:idempotent?`, `:meet-order`, `:distinct-from`).  Each defaults to
answering nothing, so a KB-free construction reorders no arguments.  The compounds below
the literal are put in canonical form first (`canonical-args`), then the literal's own
arguments in order.
sourceraw docstring

not-functorclj

source

one-justification-rule-wrapperclj

(set/oneJustificationRule (implies …)): a forward firing of the rule places nothing where a stored justification of the rule for the same conclusion stands at every reader and outranks it. Adds :one-justification to the record's :engines, beside the direction wrapper's engines, and changes only what a forward firing stores (docs/inference.md, "A rule that stores one justification per conclusion").

`(set/oneJustificationRule (implies …))`: a forward firing of the rule places nothing
where a stored justification of the rule for the same conclusion stands at every reader
and outranks it.  Adds `:one-justification` to the record's `:engines`, beside the
direction wrapper's engines, and changes only what a forward firing stores
(docs/inference.md, "A rule that stores one justification per conclusion").
sourceraw docstring

or-functorclj

source

originalizeclj

(originalize form varmap)

Restore the author's variable names in form using a sentex's :varmap ({?var0 ?x}), for display. rename-vars under the name the display path calls it.

Restore the author's variable names in `form` using a sentex's `:varmap`
(`{?var0 ?x}`), for display.  `rename-vars` under the name the display path calls it.
sourceraw docstring

pathclj

(path sentex)

The full trie path for a sentex: its (connective-free, α-renamed, structurally linearized) key tokens with the context appended as the final level.

The full trie path for a sentex: its (connective-free, α-renamed, structurally
linearized) key tokens with the context appended as the final level.
sourceraw docstring

peel-exception-strengthclj

(peel-exception-strength sentence)

[sentence monotonic?]: sentence with the strength wrapper taken off its exceptWhen query, and the class that wrapper stated for the exception alone. assert passes one opts to both halves of an (exceptWhen Q R), which cannot state a known-true exception on a default rule. Nothing below the assert entry point sees the wrapper. A sentence with no wrapper is returned as the same object.

`[sentence monotonic?]`: `sentence` with the strength wrapper taken off its `exceptWhen`
query, and the class that wrapper stated for the exception alone.  `assert` passes one
`opts` to both halves of an `(exceptWhen Q R)`, which cannot state a known-true exception on
a default rule.  Nothing below the assert entry point sees the wrapper.  A sentence with no
wrapper is returned as the same object.
sourceraw docstring

peel-rule-wrapperclj

(peel-rule-wrapper form)

Strip the virtual rule wrappers, returning [direction defeasible exception assumption constraint inner]. Wrappers may nest in any order — a defeasible forward rule with an exception, an assumption rule, a hard constraint — and two exceptWhens conjoin. exception is nil or a vector of literals; assumption is true or nil; constraint is :hard / :soft or nil. A modifier-wrappers wrapper is stripped too, and modifiers reports it.

Strip the virtual rule wrappers, returning
[direction defeasible exception assumption constraint inner].  Wrappers may nest in
any order — a defeasible forward rule with an exception, an assumption rule, a hard
constraint — and two `exceptWhen`s conjoin.  `exception` is nil or a vector of
literals; `assumption` is true or nil; `constraint` is `:hard` / `:soft` or nil.  A
`modifier-wrappers` wrapper is stripped too, and `modifiers` reports it.
sourceraw docstring

peel-strengthclj

(peel-strength sentence opts)

[sentence opts]: a whole-form (set/monotonic S) read as S asserted {:strength :monotonic}, as the text KB format reads it, and anything else as it came. Throws :shape for a malformed wrapper and for one beside an opts :strength other than :monotonic.

`[sentence opts]`: a whole-form `(set/monotonic S)` read as `S` asserted
`{:strength :monotonic}`, as the text KB format reads it, and anything else as it came.
Throws `:shape` for a malformed wrapper and for one beside an `opts` `:strength` other
than `:monotonic`.
sourceraw docstring

permute-argsclj

(permute-args form {:keys [symmetric? groups-of]})

form's own arguments in the order its permuting marks give a ground application: the symmetric sort, then the commuting sort. The literal, every compound below it (canonical-args) and the expression a reified constant is named by (nat-read/sorted-expression) take their argument order from this one list of arms.

`form`'s own arguments in the order its permuting marks give a ground application: the
symmetric sort, then the commuting sort.  The literal, every compound below it
(`canonical-args`) and the expression a reified constant is named by
(`nat-read/sorted-expression`) take their argument order from this one list of arms.
sourceraw docstring

permuting-mark?clj

(permuting-mark? f)

Is f one of permuting-marks? A set lookup: every placement asks it of its conclusion's functor (special/deduce-lifts).

Is `f` one of `permuting-marks`?  A set lookup: every placement asks it of its
conclusion's functor (`special/deduce-lifts`).
sourceraw docstring

permuting-marksclj

The marks under which the matcher reads a stored fact in more than one argument order: the functors whose arms install tax/props :symmetric and the :commuting table, which are what res/matches-hierarchical permutes a literal by (commuting-arrangements). A late one moves what a rule's antecedent reaches over facts already stored, so inherit/moved-predicates and chain/permuting-rejoin-rules both key on it.

The marks under which the matcher reads a stored fact in more than one argument order:
the functors whose arms install `tax/props :symmetric` and the `:commuting` table, which
are what `res/matches-hierarchical` permutes a literal by (`commuting-arrangements`).
A late one moves what a rule's antecedent reaches over facts already stored, so
`inherit/moved-predicates` and `chain/permuting-rejoin-rules` both key on it.
sourceraw docstring

plain-symbol?clj

(plain-symbol? x)

A symbol that is not a variable.

A symbol that is not a variable.
sourceraw docstring

polarityclj

(polarity sx)

:negative for a negative literal, :positive for any other sentex — the keyword a reader compares or hashes where it wants one value for the sign.

`:negative` for a negative literal, `:positive` for any other sentex — the keyword a
reader compares or hashes where it wants one value for the sign.
sourceraw docstring

positionalclj

(positional form)

The elements of form before its rest marker, or all of them when it is not dotted.

The elements of `form` before its rest marker, or all of them when it is not dotted.
sourceraw docstring

positive-bodyclj

(positive-body sentence)

The double-negation-eliminated positive body of a sentence, or nil when the sentence is genuinely negative. Constraint checks use this rather than the full canonical form: they must see the predicate and argument order the author wrote, not a folded sibling (greaterThan ⇒ lessThan) or sorted symmetric arguments, or an arg would be enforced against the wrong position.

The double-negation-eliminated positive body of a sentence, or nil when the
sentence is genuinely negative.  Constraint checks use this rather than the full
canonical form: they must see the predicate and argument order the *author* wrote,
not a folded sibling (`greaterThan` ⇒ `lessThan`) or sorted symmetric arguments,
or an `arg` would be enforced against the wrong position.
sourceraw docstring

positive-fact?clj

(positive-fact? sx)

Is sx a stored literal that is not negative: not nil, no rule, no (not S)?

Is `sx` a stored literal that is not negative: not nil, no rule, no `(not S)`?
sourceraw docstring

probe-atomsclj

(probe-atoms term)

The keys a compound probe narrows by: the indexable atoms it contains, read as keyed-subterms reads them (term-children). Every sentex holding the compound holds all of them — atoms are keyed at every depth under every bound — so their intersection is a superset of the answer, whatever key the compound itself does or does not earn. A compound holding no indexable atom — no symbol anywhere in it — has nothing to narrow by and probes by its own key: at the default floor it can only occur nested, which is where it has one.

The keys a **compound** probe narrows by: the indexable atoms it contains, read as
`keyed-subterms` reads them (`term-children`).  Every sentex holding the compound holds
all of them — atoms are keyed at every depth under every bound — so their intersection
is a superset of the answer, whatever key the compound itself does or does not earn.  A
compound holding no indexable atom — no symbol anywhere in it — has nothing to narrow by
and probes by its own key: at the default floor it can only occur nested, which is where
it has one.
sourceraw docstring

quantified-varsclj

(quantified-vars form)

The variables a thereExists or forall binder introduces, as a set: its second element is a variable or a sequence of them. A written vector becomes a list under canon, so this keys on sequential?, not vector?. Non-variables are dropped; check-naf-closed refuses a rule whose binder holds one.

The variables a `thereExists` or `forall` binder introduces, as a set: its second
element is a variable or a sequence of them.  A written vector becomes a list under
`canon`, so this keys on `sequential?`, not `vector?`.  Non-variables are dropped;
`check-naf-closed` refuses a rule whose binder holds one.
sourceraw docstring

quasiquote-functorclj

The template-constructing quoting function: (Quasiquote T) mentions T with its (Unquote v) holes spliced. quasiquote/quasiquote-function is this symbol.

The template-constructing quoting function: `(Quasiquote T)` mentions T with its
`(Unquote v)` holes spliced.  `quasiquote/quasiquote-function` is this symbol.
sourceraw docstring

quote-form?clj

(quote-form? form)

Is form a (Quote X) mention? unquoted-free-vars, res/unify, res/substitute and the literal cache's renaming all read a form this answers true for as a constant.

Is `form` a `(Quote X)` mention?  `unquoted-free-vars`, `res/unify`, `res/substitute`
and the literal cache's renaming all read a form this answers true for as a constant.
sourceraw docstring

quote-functorclj

The quoting function whose argument is a form taken as syntax: (Quote X) mentions X. quasiquote/quote-function is this symbol.

The quoting function whose argument is a form taken as syntax: `(Quote X)` mentions X.
`quasiquote/quote-function` is this symbol.
sourceraw docstring

quoting-functor?clj

(quoting-functor? head)

Is head one of the quoting-functors?

Is `head` one of the `quoting-functors`?
sourceraw docstring

quoting-functorsclj

The quoting functions — Quote and Quasiquote, fixed by the engine. A quoting function's arguments are a mention, a term named as syntax rather than used: they are held opaque to identity congruence (res/representative-term rewrites them by a rewriteOf spelling rename only, never by a sameAs / equals merge), not reified on their own when the application is (nat/reify-or-mint-nat), and not typed by what they denote (checks). The set is not declared in the KB and no assertion changes it, so whether an argument is a mention is a fact about the sentence alone.

The quoting functions — `Quote` and `Quasiquote`, fixed by the engine.  A quoting
function's arguments are a **mention**, a term named as syntax rather than used: they are
held opaque to identity congruence (`res/representative-term` rewrites them by a
`rewriteOf` spelling rename only, never by a `sameAs` / `equals` merge), not reified on
their own when the application is (`nat/reify-or-mint-nat`), and not typed by what they
denote (`checks`).  The set is not declared in the KB and no assertion changes it, so
whether an argument is a mention is a fact about the sentence alone.
sourceraw docstring

read-literalclj

(read-literal form)

The literal a (stored S) or (monotonic S) form matches, S; any other form as itself.

The literal a `(stored S)` or `(monotonic S)` form matches, `S`; any other form as itself.
sourceraw docstring

reader-arrangementsclj

(reader-arrangements form {:keys [opaque?] :as marks} fs)

Every spelling of literal form with each compound below the literal that applies a functor in the set fs, ground or open, in every argument order its marks allow (every-order), innermost first: the spellings a reader that does not believe those marks may hold a fact in. The literal's own arguments keep their order, and the walk descends where canonical-args does. form first, and [form] when no compound below it applies one.

Every spelling of literal `form` with each compound below the literal that applies a
functor in the set `fs`, ground or open, in every argument order its marks allow
(`every-order`), innermost first: the spellings a reader that does not believe those
marks may hold a fact in.  The literal's own arguments keep their order, and the walk
descends where `canonical-args` does.  `form` first, and `[form]` when no compound
below it applies one.
sourceraw docstring

redirected-enginesclj

(redirected-engines engines direction)

engines with its direction's members replaced by direction's (direction-engines), the modifier-wrappers members it holds kept.

`engines` with its direction's members replaced by `direction`'s
(`direction-engines`), the `modifier-wrappers` members it holds kept.
sourceraw docstring

rename-varsclj

(rename-vars form m)

form with every variable m names replaced by the name it maps to, in one pass: each position is rewritten at most once. Unmapped terms are left alone and a vector stays a vector. A renaming is a permutation and has cycles, so {?var0 ?var1, ?var1 ?var0} over (P ?var0 ?var1) gives (P ?var1 ?var0), where res/substitute would chase ?var0 → ?var1 → ?var0. It carries a form between two canonical namings: the map canonical-conjunction returns, a rule's :varmap, a cache's rename-back.

`form` with every variable `m` names replaced by the name it maps to, in one pass: each
position is rewritten at most once.  Unmapped terms are left alone and a vector stays a
vector.  A renaming is a permutation and has cycles, so `{?var0 ?var1, ?var1 ?var0}` over
`(P ?var0 ?var1)` gives `(P ?var1 ?var0)`, where `res/substitute` would chase
`?var0 → ?var1 → ?var0`.  It carries a form between two canonical namings: the map
`canonical-conjunction` returns, a rule's `:varmap`, a cache's rename-back.
sourceraw docstring

rest-marker?clj

(rest-marker? xs)

Does xs, a list or a suffix of one, open a dotted rest: the dot marker, then one variable, then nothing? A . in any other place is refused (dot-problem).

Does `xs`, a list or a suffix of one, open a dotted rest: the dot marker, then one
variable, then nothing?  A `.` in any other place is refused (`dot-problem`).
sourceraw docstring

root-contextclj

The context the upper ontology is stored in, every genlCx edge with it, and the one every context the shipped topology wires in sees (docs/contexts.md).

The context the upper ontology is stored in, every `genlCx` edge with it, and the one
every context the shipped topology wires in sees (docs/contexts.md).
sourceraw docstring

rule-antecedentsclj

(rule-antecedents form)

The antecedent patterns of a rule form (unwrapping a leading and; a single antecedent needs no and).

The antecedent patterns of a rule form (unwrapping a leading `and`; a single
antecedent needs no `and`).
sourceraw docstring

rule-consequentclj

(rule-consequent form)

The consequent pattern of a rule form.

The consequent pattern of a rule form.
sourceraw docstring

rule-direction-wrappersclj

source

rule-functorclj

source

rule-sentenceclj

(rule-sentence antes conseq)

Build the rule form from antecedent patterns and a consequent pattern; a single antecedent needs no and. The one builder: the constructor stores this spelling, and rules/rule-sentence delegates here.

Build the rule form from antecedent patterns and a consequent pattern; a single
antecedent needs no `and`.  The one builder: the constructor stores this spelling, and
`rules/rule-sentence` delegates here.
sourceraw docstring

rule-slotsclj

(rule-slots dir assumption constraint generator?)
(rule-slots dir assumption constraint mods generator?)

The record's [engines effect] for a rule written with direction dir (nil when no direction wrapper was written) under the head wrappers assumption / constraint, and under the modifier-wrappers whose members mods holds. An unwrapped rule runs backward, and an unwrapped generator forward, since no backward goal asks for a rule. A choice or constraint rule runs in a solve whatever dir says.

The record's `[engines effect]` for a rule written with direction `dir` (nil when no
direction wrapper was written) under the head wrappers `assumption` / `constraint`, and
under the `modifier-wrappers` whose members `mods` holds.  An unwrapped rule runs
backward, and an unwrapped generator forward, since no backward goal asks for a rule.
A choice or constraint rule runs in a solve whatever `dir` says.
sourceraw docstring

sentence-ofclj

(sentence-of sx)

A sentex's canonical sentence: a literal's :sentence, or for a rule the (implies <antecedent> <consequent>) form rule-sentence builds from its two fields. A rule record holds only the fields, so this is the one place its whole form comes from — the form path keys on and core/readable-sentence renames for display. Keyword reads only, so a sentex map off the wire answers the same as the record.

A sentex's canonical sentence: a literal's `:sentence`, or for a rule the
`(implies <antecedent> <consequent>)` form `rule-sentence` builds from its two fields.
A rule record holds only the fields, so this is the one place its whole form comes
from — the form `path` keys on and `core/readable-sentence` renames for display.
Keyword reads only, so a sentex map off the wire answers the same as the record.
sourceraw docstring

sentexclj

(sentex sentence)
(sentex sentence context)
(sentex sentence
        context
        {:keys [symmetric? groups-of opaque? mention-at? associative?
                idempotent? meet-order distinct-from]
         :or {symmetric? (constantly false)
              groups-of (constantly nil)
              opaque? (constantly false)
              mention-at? (constantly false)
              associative? (constantly false)
              idempotent? (constantly false)
              meet-order (constantly nil)
              distinct-from (constantly nil)}
         :as _opts})

Construct a sentex, a LiteralSentex or a RuleSentex, canonicalizing the structural connectives into the record and the sentence into canonical form (docs/canonicalization.md). Context defaults to 'default; id is nil until the record store assigns a handle. opts carries the canonicalization reads normalize-literal names; without them no predicate commutes anything.

Construct a sentex, a `LiteralSentex` or a `RuleSentex`, canonicalizing the structural
connectives into the record and the sentence into canonical form
(docs/canonicalization.md).  Context defaults to 'default; id is nil until the record
store assigns a handle.  `opts` carries the canonicalization reads `normalize-literal`
names; without them no predicate commutes anything.
sourceraw docstring

sentex-handleclj

(sentex-handle n)

The handle term naming the sentex stored at id n.

The handle term naming the sentex stored at id `n`.
sourceraw docstring

sentex-handle-functorclj

source

sentex-handle?clj

(sentex-handle? form)

Is form a (sentexHandle <id>) term?

Is `form` a `(sentexHandle <id>)` term?
sourceraw docstring

size-symbol-poolclj

(size-symbol-pool tokens)

Raise the root of *symbol-pool-limit* to twice tokens, the entry count of a token dictionary a store is opening, and never lower it. A caller calls it before the dictionary interns its tokens, so one generation holds them all. A thread binding is left alone. See docs/storage.md, "Symbol interning".

Raise the root of `*symbol-pool-limit*` to twice `tokens`, the entry count of a token
dictionary a store is opening, and never lower it.  A caller calls it before the
dictionary interns its tokens, so one generation holds them all.  A thread binding is
left alone.  See docs/storage.md, "Symbol interning".
sourceraw docstring

solve-enginesclj

The engines of a choice or constraint rule: a solve alone reads it.

The engines of a choice or constraint rule: a solve alone reads it.
sourceraw docstring

solve-rule-wrapperclj

(set/solveRule (implies …)) — the rule also runs in a solve, as a normal rule (h :- b): a solve derives its head in every answer set whose atoms satisfy its body, and a constraint may name it. Adds :solve to the record's :engines; a direction wrapper beside it says how the rule runs in base (backward when there is none), and set/inertRule makes it a rule that runs in a solve alone (docs/solving.md).

`(set/solveRule (implies …))` — the rule also runs in a solve, as a normal rule
(`h :- b`): a solve derives its head in every answer set whose atoms satisfy its body,
and a constraint may name it.  Adds `:solve` to the record's `:engines`; a direction
wrapper beside it says how the rule runs in base (backward when there is none), and
`set/inertRule` makes it a rule that runs in a solve alone (docs/solving.md).
sourceraw docstring

some-formclj

(some-form pred form)

The first sub-form of form satisfying pred — form itself included, depth-first pre-order, the order (first (filter pred (tree-seq …))) yields — or nil. Descends compounds and asks pred of every node, so pred decides what a node has to be.

Nil is the whole of "no match", so a pred that holds of nil or false reads as one; every caller's holds of compounds, which are neither.

The first sub-form of `form` satisfying `pred` — `form` itself included, depth-first
pre-order, the order `(first (filter pred (tree-seq …)))` yields — or nil.  Descends
compounds and asks `pred` of every node, so `pred` decides what a node has to be.

Nil is the whole of "no match", so a `pred` that holds of `nil` or `false` reads as
one; every caller's holds of compounds, which are neither.
sourceraw docstring

some-symbol?clj

(some-symbol? pred form)

Does any symbol anywhere in form satisfy pred? Short-circuits on the first, and allocates nothing on a false answer (docs/defenses.md, "A shape check walks the sentence directly").

Does any symbol anywhere in `form` satisfy `pred`?  Short-circuits on the first, and
allocates nothing on a false answer (docs/defenses.md, "A shape check walks the sentence
directly").
sourceraw docstring

sort-compoundsclj

(sort-compounds form marks)

form with every compound below it in the argument order the store gives a ground one (canonical-args), and its own arguments as written. A pattern's ground subterms are matched in this spelling, since a stored fact holds them in it. marks is sentex's canonicalization reads.

`form` with every compound below it in the argument order the store gives a ground
one (`canonical-args`), and its own arguments as written.  A pattern's ground subterms
are matched in this spelling, since a stored fact holds them in it.  `marks` is
`sentex`'s canonicalization reads.
sourceraw docstring

sort-conjunctsclj

(sort-conjuncts literals)

Put a conjunction of literals into canonical order (cmp-term) and drop duplicates.

Put a conjunction of literals into canonical order (`cmp-term`) and drop duplicates.
sourceraw docstring

sortable-term?clj

(sortable-term? t)

True when t holds no pattern variable outside a (Quote …). A quoted form is a constant (quote-form?), so the permuting sorts order a term whose only variables are quoted as they order a ground one: (RulePairFn (Quote r1) (Quote r2)) over two quoted rules sorts under (commutative RulePairFn).

True when `t` holds no pattern variable outside a `(Quote …)`.  A quoted form is a
constant (`quote-form?`), so the permuting sorts order a term whose only variables are
quoted as they order a ground one: `(RulePairFn (Quote r1) (Quote r2))` over two quoted
rules sorts under `(commutative RulePairFn)`.
sourceraw docstring

stored-sentence-functorclj

source

stored-sentence?clj

(stored-sentence? form)

Is form a (stored S) literal, which only a stored sentex satisfies? See docs/inference.md.

Is `form` a `(stored S)` literal, which only a stored sentex satisfies?  See docs/inference.md.
sourceraw docstring

strength-peelclj

(strength-peel sentence opts)

[sentence opts problem]: sentence with a whole-form (set/monotonic S) read as S and :strength :monotonic in opts, or both as they came with the :shape problem that refuses them, or nil. A (set/inert S) comes back as it came, for the wrapper chain to refuse.

`[sentence opts problem]`: `sentence` with a whole-form `(set/monotonic S)` read as `S`
and `:strength :monotonic` in `opts`, or both as they came with the `:shape` problem
that refuses them, or nil.  A `(set/inert S)` comes back as it came, for the wrapper
chain to refuse.
sourceraw docstring

strength-wrapperclj

(set/monotonic S) — S asserted known-true; the wrapper never reaches the store. Read in two positions. Around a whole sentence it is {:strength :monotonic}, read by the text KB format and by assert, check and try-assert alike (peel-strength). Around an exceptWhen's query it states the exception's own class, the one thing an opts cannot say, since one opts reaches both halves of an exceptWhen (peel-exception-strength). Anywhere else, on the wrapper chain or inside the sentence, it is refused (:shape).

`(set/monotonic S)` — `S` asserted **known-true**; the wrapper never reaches the store.
Read in two positions.  Around a **whole sentence** it is `{:strength :monotonic}`,
read by the text KB format and by `assert`, `check` and `try-assert` alike
(`peel-strength`).  Around an `exceptWhen`'s *query* it states the **exception's** own
class, the one thing an `opts` cannot say, since one `opts` reaches both halves of an
`exceptWhen` (`peel-exception-strength`).  Anywhere else, on the wrapper chain or
inside the sentence, it is refused (`:shape`).
sourceraw docstring

structure-constructorsclj

The data-structure constructors and the kind of structure each builds.

The data-structure constructors and the kind of structure each builds.
sourceraw docstring

structure-functionsclj

The functions whose open application a rule or a goal reads through its corresponding predicate rather than matches as written (docs/nat.md, "A data structure is a structural term").

The functions whose open application a rule or a goal reads through its corresponding
predicate rather than matches as written (docs/nat.md, "A data structure is a
structural term").
sourceraw docstring

structure-predicatesclj

Each constructor's corresponding predicate, the structure first: (setOf ?set . ?elements) holds when ?set is (SetFn . ?elements), and (entryOf ?entry ?key ?value) when ?entry is (EntryFn ?key ?value).

Each constructor's corresponding predicate, the structure first: `(setOf ?set .
?elements)` holds when `?set` is `(SetFn . ?elements)`, and `(entryOf ?entry ?key
?value)` when `?entry` is `(EntryFn ?key ?value)`.
sourceraw docstring

structure-relationsclj

The relations over a structure term, the structure last and the outputs first: (elementOf ?x ?s), (cardinalityOf ?n ?s), (multiplicityOf ?n ?x ?s) and (valueAt ?v ?k ?s), with the number of leading outputs each. provers/StructureProver computes them and the corresponding predicates, so both are deferred.

The relations over a structure term, the structure last and the outputs first:
`(elementOf ?x ?s)`, `(cardinalityOf ?n ?s)`, `(multiplicityOf ?n ?x ?s)` and
`(valueAt ?v ?k ?s)`, with the number of leading outputs each.  `provers/StructureProver`
computes them and the corresponding predicates, so both are deferred.
sourceraw docstring

subterm-arityclj

The element count an arity marker carries.

The element count an arity marker carries.
sourceraw docstring

subterm-markclj

An arity marker for a k-element subterm.

An arity marker for a `k`-element subterm.
sourceraw docstring

subterm-mark?clj

Is x an arity marker?

Is `x` an arity marker?
sourceraw docstring

subtermsclj

(subterms sentence)

Every subterm of a sentence — each atom and each compound subterm, recursively, the whole sentence included.

Every subterm of a sentence — each atom and each compound subterm, recursively,
the whole sentence included.
sourceraw docstring

symbols-whereclj

(symbols-where pred form)

The set of symbols anywhere in form satisfying pred, or nil when none does. The collecting form of some-symbol?, and nil rather than #{} so a caller can branch on it without allocating for the common empty answer.

The set of symbols anywhere in `form` satisfying `pred`, or **nil** when none does.
The collecting form of `some-symbol?`, and nil rather than `#{}` so a caller can branch
on it without allocating for the common empty answer.
sourceraw docstring

symmetric-literal?clj

(symmetric-literal? form symmetric?)

A binary literal whose predicate is declared symmetric (and not a dotted form).

A binary literal whose predicate is declared symmetric (and not a dotted form).
sourceraw docstring

term-headclj

(term-head t)

The plain symbol heading term t: t when it is one, the first element of a list or vector whose first element is one, and nil otherwise. Two terms whose heads differ and are both non-nil unify in no argument order (resolution/unify, resolution/unifiers).

The plain symbol heading term `t`: `t` when it is one, the first element of a list or
vector whose first element is one, and nil otherwise.  Two terms whose heads differ and
are both non-nil unify in no argument order (`resolution/unify`, `resolution/unifiers`).
sourceraw docstring

there-exists-antecedent?clj

(there-exists-antecedent? form)

Is antecedent form a standalone positive thereExists? On an antecedent list a thereExists under unknown is never an element.

Is antecedent `form` a standalone positive `thereExists`?  On an antecedent list a
`thereExists` under `unknown` is never an element.
sourceraw docstring

there-exists-functorclj

source

there-exists?clj

(there-exists? form)

Is form a (thereExists <var-or-vars> S) existential?

Is `form` a `(thereExists <var-or-vars> S)` existential?
sourceraw docstring

underlying-bodyclj

(underlying-body sentence)

The body a sentence's not wrappers enclose, whatever its polarity: S for both S and (not S). A trigger keyed on a predicate reads it, since (not (penguin X)) is content about penguin.

The body a sentence's `not` wrappers enclose, whatever its polarity: `S` for both `S`
and `(not S)`.  A trigger keyed on a predicate reads it, since `(not (penguin X))` is
content about `penguin`.
sourceraw docstring

unknown-functorclj

source

unknown?clj

(unknown? form)

Is form an (unknown S) NAF literal?

Is `form` an `(unknown S)` NAF literal?
sourceraw docstring

unquoted-free-varsclj

(unquoted-free-vars form)

The variables of form free in it: every variable occurrence that no enclosing forall, thereExists or head exists binds and no (Quote …) holds. A Quasiquote is not opaque, since its variables are meant to be bound from outside.

The variables of `form` free in it: every variable occurrence that no enclosing
`forall`, `thereExists` or head `exists` binds and no `(Quote …)` holds.  A `Quasiquote`
is not opaque, since its variables are meant to be bound from outside.
sourceraw docstring

variable-arity-classesclj

The memberships that release a relation from one exact length: variable_arity and its predicate and function specializations, and unbounded_arity and its two, which core.txt places below them. A membership in any of the six binds the relation's length (arity-binding).

The memberships that release a relation from one exact length: `variable_arity` and its
predicate and function specializations, and `unbounded_arity` and its two, which core.txt
places below them.  A membership in any of the six binds the relation's length
(`arity-binding`).
sourceraw docstring

variable?clj

A pattern variable: a symbol whose name starts with ?, or _ (vaelii.impl.types.sentex/variable?, which the columnar trie calls).

A pattern variable: a symbol whose name starts with `?`, or `_`
(`vaelii.impl.types.sentex/variable?`, which the columnar trie calls).
sourceraw docstring

wrapper-effectclj

(wrapper-effect assumption constraint)

The :effect a rule's head wrappers give it: :choose under set/assumptionRule, :forbid / :penalize under a hard / soft constraint, :derive under neither.

The `:effect` a rule's head wrappers give it: `:choose` under `set/assumptionRule`,
`:forbid` / `:penalize` under a hard / soft constraint, `:derive` under neither.
sourceraw docstring

wrapper-stack-problemsclj

(wrapper-stack-problems form)

What is wrong with the combination of set/* wrappers around one rule, as strings. A direction wrapper or set/defaultRule states how a rule runs; set/assumptionRule (a choice), set/hardConstraint and set/softConstraint state its head. Four combinations state nothing the record can hold:

  • two different direction wrappers;
  • two different head wrappers;
  • a head wrapper with a direction wrapper, set/defaultRule or a modifier-wrappers wrapper, since a choice or constraint head is decided by a solve and never chained or believed (docs/solving.md);
  • set/solveRule with set/defaultRule, since one answer set has no defeat to apply.
What is wrong with the combination of `set/*` wrappers around one rule, as strings.  A
direction wrapper or `set/defaultRule` states how a rule runs; `set/assumptionRule` (a
choice), `set/hardConstraint` and `set/softConstraint` state its head.  Four combinations
state nothing the record can hold:

- two different direction wrappers;
- two different head wrappers;
- a head wrapper with a direction wrapper, `set/defaultRule` or a `modifier-wrappers`
  wrapper, since a choice or constraint head is decided by a solve and never chained or
  believed (docs/solving.md);
- `set/solveRule` with `set/defaultRule`, since one answer set has no defeat to apply.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close