Bounded Modal and Epistemic Evaluation

Start with Sourced claims and conflicting evidence for sourced evidence and four-valued status, then Stored rules and support maintenance for persisted derivations. This guide adds explicit world links; modal evaluation is read-only and does not run rules or authenticate the real-world truth of a belief. KNOWS selects a named logical frame, not an independent certification that an agent knows a true proposition.

Terms before formulas

Epistemic concerns knowledge; modal operators express claims such as belief, knowledge or possibility relative to other contexts. A world is a named claim context, and accessibility explicitly links contexts for an agent. A frame is the relevant world/link structure. These are logical contexts and relations, not separate physical databases.

Contradictory evidence can coexist: paraconsistent means that a contradiction does not make unrelated propositions follow. A missing positive claim is not automatically a negative claim. The Concepts and Terminology explains the related bitemporal, valid time and system time terminology.

World models

GestaltDB evaluates finite world models over the existing bitemporal claim history. Accessibility is not inferred: each agent and frame has explicit, temporal links created with assert_world_accessibility. belief, knowledge, and modal are independent frames, so BELIEVES and KNOWS cannot silently collapse to the same relation.

Semantics

Every formula has independent truth and falsity support. The resulting ClaimStatus is supported, refuted, both, or unknown. NOT swaps support and refutation. AND and OR use the standard four-valued, paraconsistent truth tables; a contradiction therefore does not entail an unrelated proposition.

BELIEVES, KNOWS, and NECESSARY require their formula in every accessible world and are refuted by a refuting accessible world. POSSIBLE is supported by a supporting accessible world and refuted only when every accessible world refutes its formula. A modal expression with no matching positive accessibility facts is unknown, not vacuously true. Negative accessibility claims do not create links.

Atoms read all visible claims in their world unless the atom includes an agent field. Accessibility always requires the evaluating agent. Reads are pinned to one GraphReadView at the requested valid time and system horizon. max_depth bounds formula nesting and max_states bounds memoized expression/world states; exhaustion raises ModalEvaluationLimitError.

Compare belief, knowledge and possibility

This standalone example links Alice’s belief frame to a positive report and her knowledge frame to a denial. A separate modal frame reaches both worlds. Different results reflect the explicit frames, not confidence voting. All reads share one authenticated history horizon; a missing agent link remains unknown.

Standalone example. Choose the capability-qualified installation tab below.

Modal evaluation reads one authenticated temporal view; this is distinct from verifiable mutable-state snapshot capability. Claims and frame links retain their own serializer-neutral encoding.

1python -m pip install "gestaltdb[lmdb]"
 1from tempfile import TemporaryDirectory
 2from gestaltdb import ClaimStatus
 3from gestaltdb.graphdb import GraphDB
 4
 5with TemporaryDirectory() as root:
 6    graph = GraphDB.create(f"{root}/graph", backend='lmdb', serializer='json')
 7    try:
 8        proposition = {"subject": "bob", "predicate": "LOCATED_IN", "object": "paris"}
 9        for world, polarity in (("rumor", "positive"), ("verified", "negative")):
10            graph.epistemic.assert_claim(
11                **proposition, polarity=polarity, agent="source:" + world,
12                world=world, valid=(0, 100),
13            )
14        for kind, target in (("belief", "rumor"), ("knowledge", "verified"),
15                             ("modal", "rumor"), ("modal", "verified")):
16            graph.epistemic.assert_world_accessibility(
17                agent="alice", from_world="actual", to_world=target,
18                kind=kind, valid=(0, 100),
19            )
20        with graph.temporal.open_read_view(
21            graph, manifest=graph.manifest, database_id=graph.database_id, valid_time=50,
22        ) as view:
23            statuses = {mode: graph.epistemic.entails(
24                view, "alice", proposition, mode, world="actual", max_depth=4, max_states=100,
25            ).status for mode in ("BELIEVES", "KNOWS", "POSSIBLE", "NECESSARY")}
26            assert statuses == {
27                "BELIEVES": ClaimStatus.SUPPORTED, "KNOWS": ClaimStatus.REFUTED,
28                "POSSIBLE": ClaimStatus.SUPPORTED, "NECESSARY": ClaimStatus.REFUTED,
29            }
30            missing = graph.epistemic.entails(
31                view, "outsider", proposition, "KNOWS", world="actual",
32                max_depth=4, max_states=100,
33            )
34            assert missing.status is ClaimStatus.UNKNOWN
35    finally:
36        graph.close()

The example uses UTC microseconds on a small schematic timeline. Pass system_time or through_commit to open_read_view for an older horizon. The result contains a conservative confidence and a deterministic explanation with the read horizon, visited states, accessibility versions, claim validity and system times, source metadata, and rule-derivation provenance. Its confidence is evidence metadata, not a calibrated modal probability. Keep depth/state bounds finite; a limit exception is not an unknown result or a successful partial answer.

Validated Formula Shape

An atom is {"subject": ..., "predicate": ..., "object": ...}; use objectKind: "literal" for a literal object and optional agent to scope atomic evidence. Logical and nested modal forms are:

Shape fragments: atom, left and right stand for validated formula objects, not additional variables supplied by a runnable setup.

Illustrative fragment (not standalone).

1{"operator": "NOT", "formula": atom}
2{"operator": "AND", "operands": [left, right]}
3{"operator": "OR", "operands": [left, right]}
4{"operator": "KNOWS", "agent": "bob", "formula": atom}
5{"operator": "BELIEVES", "agent": "bob", "formula": atom}
6{"operator": "POSSIBLE", "agent": "bob", "formula": atom}
7{"operator": "NECESSARY", "agent": "bob", "formula": atom}

Unknown fields, unknown operators, missing agents for modal operators, and non-finite expression shapes are rejected before evaluation.

Cypher Procedure

kg.entails is explicitly allowlisted. Its options require world and validTime and accept systemTime, throughCommit, maxDepth, and maxStates. systemTime and throughCommit are mutually exclusive.

The following is a query fragment for the example’s still-open graph, at the same valid instant. Ordinary MATCH does not materialize claims or modal results.

Illustrative fragment (not standalone).

1CALL kg.entails(
2  'alice',
3  {subject: 'bob', predicate: 'LOCATED_IN', object: 'paris'},
4  'KNOWS',
5   {world: 'actual', validTime: 50, maxDepth: 4, maxStates: 100}
6)
7YIELD status, confidence, explanation
8RETURN status, confidence, explanation