logical: false — programs without logical facts#
The logical: false capability setting.
Prefix LNOG.
This document is an overlay on the base language and runtime specs.
It does not modify any base spec paragraph; it states how those paragraphs
are interpreted or restricted when logical: false is active. Each overlay
section names the base paragraph it constrains.
What logical: false is [LNOG.1]#
Purpose [LNOG.1.1]#
logical: false is a capability setting that bans
logical-lifecycle schemas from a DS file, which allows the engine to
omit the Truth Maintenance System (TMS) entirely from the compiled
deployment unit.
The TMS is the subsystem that tracks which token (matching activation)
caused each logical fact to be asserted, and retracts those facts when
the supporting token is retracted. This cascade can propagate through
chains of logical rules — a retracted input fact may cause a logical
fact to disappear, which may cause a second-order logical fact to
disappear, and so on. Under logical: false this entire subsystem is
absent: no allocation, no cascade bookkeeping, no re-entrancy
constraint.
A program compiled with logical: false trades the "automatically retract
derived facts" property in exchange for a strictly simpler retraction
path, a smaller runtime footprint, and elimination of the TMS term from
the T_wcet formula.
What the user accepts [LNOG.1.2]#
logical: false is an opt-in constraint. Users who choose it accept:
No
logical-lifecycle schema declarations in the program.No
emit X logicalon any schema, including schemas declared in imported files.No automatic retraction of derived facts: every emitted fact persists until it expires via TTL, is explicitly retracted by a rule, or the engine is reset.
With
linear_scan: falseas well: no multi-pattern rules at all (see [LNOG.6]).
In return they get the algorithmic properties in [LNOG.5]: a retraction path that has no TMS lookup, no cascade, and no depth multiplier in T_wcet.
What logical: false is not [LNOG.1.3]#
Not a synonym for
realtime.realtimedoes not implylogical: false. TMS underrealtimeis pre-sized and rt_locked, making it bounded hard-RT.logical: falseis an optional further constraint that eliminates the TMS entirely.Not a performance dial. It is a semantic constraint. A
logical: falseprogram has fundamentally different fact lifecycle behaviour from a program with logical facts.Not equivalent to writing all rules with
emit X(explicit lifecycle) instead ofemit X logical. The difference is thatlogical: falsealso eliminates the TMS data structure from the runtime, whereas a program that happens not to uselogicalbut keepslogical: truestill allocates and initialises the TMS.
Extension-capability registration [LNOG.2]#
Name and registration [LNOG.2.1]#
logical is a construct capability of [LCAP.1]. A program has
logical: false through its dialect or a line of its use block
([LDIA.2.1]), resolved per [LDIA.3.3]. default has logical: true
([LDIA.9.2]).
Combination with other extensions [LNOG.2.2]#
logical: false combines with any other setting. Interactions:
With |
Effect |
|---|---|
|
TMS term eliminated from T_wcet. Retraction path is O(1) per fact. See [LNOG.5.2]. |
|
Multi-pattern rules banned (consequence of LNLS.3.3 + LNOG.3). See [LNOG.6]. |
|
Tightest possible constraint: single-pattern rules only, all operations O(1) in N_max. |
|
Allowed; |
The rows with realtime: true are deferred with that capability, and the
compiler refuses them in this edition ([LCAP.2.1.5]).
see also: LCAP.2.1.5, LNLS.3.3, LNOG.3, LNOG.5.2, LNOG.6
What realtime does not enforce from logical: false [LNOG.2.3]#
realtime does not imply logical: false. Under realtime, the TMS is:
Pre-sized to a fixed capacity before
go_live, in the RT table pre-sizing step.rt_locked = true: a TMS insert returnsDS_ERR_RT_UNSAFEinstead of callingreallocif the inline array overflows.withdraw_scratchpre-allocated toDS_TMS_INLINEentries, covering the common case without malloc.
This makes TMS operations bounded and allocation-free in LIVE mode.
The T_wcet contains a c_tms × n_ids term, but n_ids ≤ DS_TMS_INLINE
= 16 (a compile-time constant), so the term is bounded.
realtime does not require eliminating the TMS because the TMS is already
provably bounded in LIVE mode. logical: false is an optional constraint
for deployments that want to eliminate the TMS term entirely and
guarantee no cascade depth in T_wcet.
Deferred: not binding in this edition.
When to use each [LNOG.2.4]#
Goal |
Dialect |
Overrides |
|---|---|---|
Hard RT with logical derived facts |
|
— |
Hard RT, no derived facts, smallest TMS cost |
|
|
Maximum simplicity, stream-only processing |
|
|
Stream-only, O(1) joins, O(1) retraction |
|
|
Tightest possible T_wcet — all guarantees |
|
|
The rows that use the realtime dialect are deferred with it, and the
compiler refuses them in this edition ([LCAP.2.1.5]).
A combination that sets both logical: false and linear_scan: false
constrains the program to single-pattern rules that perform only
alpha-level tests ([LCAP.3.1]). Every fact lifecycle is explicit,
ttl, activation, or ambient. The retraction path has no TMS
lookup, no cascade, and no join index traversal. This is the
theoretical floor for a Rete engine: pure alpha-network stream
processing.
see also: LCAP.2.1.5, LCAP.3.1
Excluded features and compile errors [LNOG.3]#
When logical: false is active, the following are compile errors. Each
error message must identify the specific paragraph violated.
Logical-lifecycle schema declaration [LNOG.3.1]#
A schema declaration that uses scope logical (or any syntactic
form that maps to the logical lifecycle per [LGRA.5.2]) is a
compile error under logical: false (DS_VALIDATE_CAPABILITY_DISABLED,
[LDIA.3.4.2]), wherever it appears in the compilation unit: in the program or
in any library it imports ([LDIA.2.10.9]).
Rationale: the schema lifecycle is fixed at declaration time and
determines whether the TMS is consulted on retract. A schema declared
logical requires TMS presence; the TMS is absent under logical: false.
ratified — see also: LDIA.2.10.9, LDIA.3.4.2, LGRA.5.2
emit X logical on any schema [LNOG.3.2]#
An emit action with the logical keyword is a compile
error (DS_VALIDATE_CAPABILITY_DISABLED, [LDIA.3.4.2]) regardless of the
schema's declared lifecycle.
Rationale: even if a schema is not declared logical, the logical
qualifier on an emit action would require a TMS entry for the resulting
fact. The TMS is absent under logical: false.
The remedy is to remove the keyword: under logical: false no schema in
the compilation unit is declared logical ([LNOG.3.1]), so the keyword
has nothing it could correctly apply to.
ratified — see also: LDIA.3.4.2, LNOG.3.1
Runtime effect — TMS elimination [LNOG.4]#
No memory is allocated for truth maintenance [LNOG.4.1]#
A logical: false program allocates nothing for truth maintenance —
not the justification table, not its scratch, not any overflow buffer
that serves it — and a runtime pre-sizing its tables for a bounded
deployment reserves nothing for it either.
This is a guarantee about the program, not a permitted optimisation:
an engine that merely leaves the structures empty has not satisfied
it. It is what a realtime integrator sizing a fixed heap needs, and
it is stated here because [LNOG.5] carries only the timing
consequences of TMS elimination and no clause there states the
allocation one.
The reference engine's mechanism is [IRET.18.2.1].
see also: IRET.18.2.1, LNOG.5
Retracting a supporting token withdraws nothing else [LNOG.4.2]#
In a logical: false program, retracting the token that supported a rule
firing removes that token and has no further effect on working
memory. There is no cascade: nothing is withdrawn, no fact is
retracted as a consequence, and therefore no second retraction can be
triggered by the first.
This follows from there being no logical facts to justify: [LNOG.3.1]
and [LNOG.3.2] make declaring a logical-lifecycle schema and emitting
into one compile errors, so nothing exists for a withdrawal to reach.
It is what makes the retraction path's cost independent of what a rule
has previously emitted — the property [LNOG.5.1]'s T_retract bound
rests on.
The reference engine's mechanism is [IRET.8.4].
No cascade [LNOG.4.3]#
Because no logical facts are asserted, there is no TMS cascade. A retraction event propagates through the beta network (ridx-based) to retract joined tokens, but it does not cause further WM retractions beyond those directly joined to the retracted WM fact.
The absence of cascade eliminates:
Re-entrancy constraints on TMS withdrawal.
The
local_ids[DS_TMS_INLINE]stack copy interminal_left_retract.The
caller_must_freepath.Any need to bound cascade depth in T_wcet.
Algorithmic properties [LNOG.5]#
T_retract without TMS [LNOG.5.1]#
The T_retract formula of [RTCT.12.2] under logical: false:
T_retract(fact) = c_wm_remove
+ c_dlheap × log N_ttl (if fact had TTL; dynamic_ttl)
+ c_fifo (if fact had TTL; default FIFO)
+ c_alpha × A_s (alpha mem remove)
+ c_beta_ridx × joined × k (ridx-based retract)
← c_tms × n_ids term absent
The c_tms × n_ids term is dropped entirely. No cascade depth
multiplier applies.
Deferred: not binding in this edition.
see also: RTCT.12.2
T_wcet improvement [LNOG.5.2]#
Under realtime, the TMS term is bounded (n_ids ≤ DS_TMS_INLINE = 16)
but present. Under realtime: true with logical: false, T_wcet
becomes:
T_wcet(realtime, logical=false) =
T_init_cycle
+ n_asserts × T_assert
+ n_retracts × (c_wm_remove + c_alpha × A_s + c_beta_ridx × joined × k)
+ T_tick_ttl(max_expired_per_tick)
+ T_run(max_fires)
Compared to realtime alone:
c_tms × n_ids(≤c_tms × 16) removed from every retraction.No cascade: the retraction of one fact cannot cause the retraction of further facts via TMS. Every
T_retractcall is self-contained.
Adding linear_scan: false, joined in the beta_ridx term is
also bounded to J_max... but see [LNOG.6] — this combination bans
multi-pattern rules, so the beta_ridx term is absent entirely. Retract
reduces to:
T_retract(realtime, linear_scan=false, logical=false) = c_wm_remove
+ c_alpha × A_s
This is the minimum achievable retraction cost for a Rete engine: a hash-table remove from the WM and removal from the alpha memory arrays.
Deferred: not binding in this edition.
see also: LNOG.6
Interaction with linear_scan: false [LNOG.6]#
LNLS.3.3 requires logical-lifecycle schemas [LNOG.6.1]#
The linear_scan: false constraint LNLS.3.3 requires that every multi-pattern
rule have an equality anchor between the identity slots of
logical-lifecycle schemas on both join sides. This guarantees
J_max = 1 (at most one live fact per identity-slot value) and makes the
join O(1).
The proof of J_max = 1 depends on logical retract-and-replace
semantics: the logical lifecycle ensures that asserting a second fact
with the same identity-slot value retracts the first. This guarantee
does not hold for explicit, ttl, ambient, or activation
lifecycle schemas — multiple facts with the same key can coexist.
see also: LNLS.3.3
Consequence: no multi-pattern rules [LNOG.6.2]#
Under logical: false, logical-lifecycle schemas are banned (LNOG.3.1).
Therefore LNLS.3.3 can never be satisfied for any multi-pattern rule.
Any multi-pattern rule in a program with linear_scan: false and
logical: false is a compile error: LNLS.3.3 fires because no
logical-schema identity anchor exists.
Effectively, the two settings together imply single-pattern rules only — every rule's LHS references exactly one schema pattern. The beta network is absent. Every operation is an alpha-level operation:
Operation |
Cost |
|---|---|
Assert |
O(1): working-memory insert, alpha lookup, agenda insert |
Retract |
O(1): working-memory remove, alpha-memory remove; no beta, no TMS |
Rule firing |
per activation, linear in its rule's actions and their expressions |
TTL tick (default) |
O(expired × log n_ttl_schemas + n_ttl_schemas) ([LDTL.6.1]) |
With dynamic_ttl: false, no cost per fact grows with the number of live
facts, and none has a beta or TMS term. This is the alpha-only operating
mode. Under dynamic_ttl: true, an assert and the TTL tick each gain the
deadline heap's O(log N_ttl) term ([LCAP.2.4]).
When this combination makes sense [LNOG.6.3]#
linear_scan: false with logical: false is appropriate for:
High-frequency event detection where each fact is processed independently (no cross-schema correlation needed).
Streaming aggregations where all joins are within a single schema (series patterns are single-schema by construction).
Deployments where operational simplicity and deterministic retraction cost are priorities and cross-schema correlation is not required.
It is not appropriate for any program that needs to correlate facts
across two or more schemas — those programs need either multi-pattern
rules (requiring linear_scan: true) or logical facts (banned by
logical: false).
Interaction with realtime [LNOG.7]#
Deferred: not binding in this edition.
realtime does not imply logical: false [LNOG.7.1]#
Logical facts are valid in hard-RT deployments. Under realtime, the engine
must reserve its truth-maintenance state during INIT, before the transition to
LIVE, and must not allocate for it during LIVE ([RTCT.12.4]). A logical fact
holds up to 16 supporting activations within that reservation; the engine must
refuse a seventeenth with DS_ERR_RT_UNSAFE rather than allocate for it.
The cascade under realtime is bounded by the contract's firing bound,
max_fires_per_pump ([RTCT.6]): the compiler's activation-chain analysis
provides the depth bound. The TMS term in T_wcet, $c_{\mathit{tms}} \times 16$,
is a compile-time constant.
Hard RT is achievable with logical facts. logical: false is an optional
further constraint for deployments that want to eliminate TMS overhead
entirely.
logical: false removes the TMS term from T_wcet [LNOG.7.2]#
Under realtime: true with logical: false, the engine reserves nothing for
truth maintenance ([LNOG.4.1]), and the TMS term of T_wcet,
$c_{\mathit{tms}} \times 16$ ([LNOG.7.1]), is absent. A deployment's realtime
compliance checks lose their truth-maintenance item with it, so the checklist
for a realtime deployment with logical: false is strictly smaller than for
realtime alone.
logical: false and the tick problem [LNOG.8]#
The "tick problem" [LLOG.3] arises when a time-bound LHS test
(e.g., now() - t.ts < 30_s) that supported a logical fact expires
between ticks. The logical fact remains until the next tick, giving a
brief window where a stale derived fact is live in WM.
Under logical: false, the tick problem does not exist: there are no
logical facts, so there is no derived fact that could become stale via
TMS non-retraction. Facts expire only via explicit retraction or TTL
expiry (which is handled by the TTL tick on the correct cycle).
see also: LLOG.3
Compile errors [LNOG.9]#
Code |
Condition |
Paragraph |
|---|---|---|
LNOG.3.1 |
Schema declaration uses |
LNOG.3.1 |
LNOG.3.2 |
|
LNOG.3.2 |
When logical: false and linear_scan: false are both set, multi-pattern
rules additionally produce LNLS.3.3 errors (no logical-schema anchor
available). These are reported under LNLS error codes, not LNOG.
All violations are compile errors. There are no runtime detections.
What logical: false does not affect [LNOG.10]#
explicit-lifecycle schemas — fully supported; no TMS involvement.ttl-lifecycle schemas — fully supported; TTL queue and (withdynamic_ttl) heap remain operational.ambient-lifecycle schemas — unaffected.activation-lifecycle schemas — unaffected.Negation — a
nopattern matches absence of any WM fact. It does not depend on logical lifecycle or the TMS.nopatterns are fully supported underlogical: false.Series patterns and series aggregations — independent of logical lifecycle and TMS.
Agenda and firing — unaffected.
Alpha network, beta network (where rules have multiple patterns) — the beta network is present when multi-pattern rules exist;
logical: falsedoes not ban multi-pattern rules unless combined withlinear_scan: false.