Reason over complete validity ranges
Before the algorithm
Ordinary closure says which facts follow. Temporal closure also says
when they follow. Premises used together overlap by interval intersection;
independent alternative supports contribute an interval union. A segment is
an interval between change points where the active inputs stay constant.
[a, b) includes its start and excludes its end. See Concepts and Terminology for
valid time, system time, support and witness, and
Facts, Rules, and Explanations for the facts/rules foundation. Historical database
selection remains a separate workflow (Temporal and bitemporal data).
Task |
Temporal storage |
Standalone range reasoning |
|---|---|---|
Inputs |
Recorded node/edge/claim versions, valid instant and system horizon |
Explicit |
Answer |
Which historical version wins at that point? |
On which complete intervals does each conclusion follow? |
Persistence |
Version writes append history; historical reads do not run rules |
Evaluation returns an in-memory result; source admission/publication are separate |
Intersect premises without filling gaps
The first edge below has two disjoint valid intervals; the second bridges part
of each. Both premises must be active together to derive two-hop reachability.
Do not turn their union into the envelope [5, 25): that would invent answers
in the gap. The numbers are integer UTC microseconds on a schematic timeline.
Fact |
[0, 5) |
[5, 10) |
[10, 20) |
[20, 25) |
[25, 30) |
|---|---|---|---|---|---|
edge(a, b) |
Yes |
Yes |
No |
Yes |
Yes |
edge(b, c) |
No |
Yes |
Yes |
Yes |
No |
reach(a, c) |
No |
Yes |
No |
Yes |
No |
Standalone runnable example, base install only. No database, serializer or
solver is selected. TemporalFact pairs a typed fact with an IntervalSet;
all rule variables, inputs and expected intervals are defined here.
Standalone example. Install with python -m pip install "gestaltdb".
1from gestaltdb.reasoning import (
2 GenericEngine, GenericProgram, GenericRule, Interval, IntervalSet,
3 ReasoningLimits, TemporalFact, TypedAtom, TypedFact, Variable, evaluate_range,
4 verify_closure,
5)
6
7x, y, z = Variable("x"), Variable("y"), Variable("z")
8program = GenericProgram([
9 GenericRule("direct", [TypedAtom("edge", [x, y])], (), TypedAtom("reach", [x, y])),
10 GenericRule("extend", [TypedAtom("reach", [x, y]), TypedAtom("edge", [y, z])],
11 (), TypedAtom("reach", [x, z])),
12])
13facts = [TemporalFact(TypedFact("edge", ["a", "b"]),
14 IntervalSet([Interval(0, 10), Interval(20, 30)])),
15 TemporalFact(TypedFact("edge", ["b", "c"]), IntervalSet([Interval(5, 25)]))]
16closure = evaluate_range(program, facts, limits=ReasoningLimits())
17goal = TypedFact("reach", ["a", "c"])
18assert closure.answers(goal).intervals == (Interval(5, 10), Interval(20, 25))
19assert {support.segment for support in closure.evidence(goal)} == {
20 Interval(5, 10), Interval(20, 25),
21}
22for point in (0, 4, 5, 9, 10, 19, 20, 24, 25, 29, 30):
23 active = [item.fact for item in facts if point in item.valid]
24 fresh = GenericEngine().evaluate(program, active, limits=ReasoningLimits())
25 assert set(closure.at(point)) == set(fresh.facts)
26report = verify_closure(program, closure, limits=ReasoningLimits())
27assert not report.proofs_truncated
answers gives the normalized validity union; at returns the logical facts
at a point. evidence returns retained per-segment derivations, not a single
proof that applies throughout the min/max envelope. In this standalone API those
premises are logical facts, not authenticated historical database version IDs.
Why segment evaluation covers the range
Every validity start/end is a change point. Between adjacent change points the active input set is constant, so evaluation covers that entire elementary segment. The result unions only segments where a conclusion follows. A coarse grid of sampled instants could miss short intervals or gaps; range evaluation does not approximate the timeline with such a grid.
Active inputs use an event sweep instead of a complete input scan at each
segment. verify_closure reconstructs segmentation and reevaluates points
through its separate scan path. This checks conformance against the supplied
program/base facts; it is not independent source authentication, verification of
real-world truth, or permission to publish caller-supplied results. Physical
sweep details are in Bounded temporal event-sweep scheduler; reference measurements are
in Temporal conformance and audit workflows.
Continue with scope, updates and storage
Use Update and inspect interval-valued conclusions for independently runnable absence, aggregation, maintenance and equality-scope examples. Equality representatives belong to a single selected segment, never a physical/global graph merge. Supported scoped negation/aggregates run against completed per-segment inputs, not an implicit closed-world policy for all time.
Budgets and evidence completeness
max_segments, max_supports, sweep limits and per-segment engine limits
bound their documented work dimensions; they do not guarantee wall time or RSS.
Logical budget/cancellation failures do not yield successful partial closures.
Proof-node/edge budgets can instead truncate retained explanations while leaving
logical conclusions complete; check proofs_truncated and missing_evidence.
Pure-positive support discovery and stratified first-witness evidence have
distinct contracts (Temporal delta maintenance and interval publication).
For authenticated finite-range database input use Authenticated temporal-range evaluation and re-admission.
For computation-owned guarded persistence use Authenticated interval-batch publication.
These are separate stages with exact source/program/state and target checks, not
automatic consequences of evaluate_range. Temporal conformance and audit workflows explains
verification, and Temporal delta maintenance and interval publication retains update and publication contracts.