Skip to main content

Module epistemic

Module epistemic 

Source
Expand description

Dynamic Epistemic Logic (DEL) layer — separating objective and subjective reality.

§Core design

Standard databases have one “God’s eye” table. QualiaDB separates:

  • Objective reality (OBJECTIVE_CONTEXT) — cryptographically proven facts. A quin here has prov:wasGeneratedBy pointing to a q42ep:CryptoSensor or q42ep:SignedObjectiveEvent. SHACL ObjectiveKnowledgeShape validates this.

  • Per-agent epistemic space (agent_epistemic_context(did)) — beliefs, inferences, and hearsay scoped to one agent. Multiple agents can hold different valid epistemic states about the same proposition at the same time.

§John / Frank / Jane scenario

t₁: John directly observes the matter.
    → assert_objective_knowledge(john_did, matter_hash, sensor_hash, t1)

t₂: Frank queries the matter — his query is itself an epistemic event.
    → record_query_observation(frank_did, matter_hash, t2)

t₃: Jane observes Frank's query (not the original matter).
t₄: Jane derives her own version.
    → assert_inferred_belief(jane_did, jane_variant_hash, frank_query_hash, t4)

Jane’s context (agent_epistemic_context(jane_did)) never overwrites John’s context. SPARQL queries traverse either timeline independently.

§SHACL classification

classify_epistemic_state() evaluates the quin slice against three shapes:

  1. ObjectiveKnowledgeprov:wasGeneratedBy → CryptoSensor/SignedObjectiveEvent
  2. InferredBeliefprov:wasDerivedFrom → AgentQuery/HearsayEvent
  3. HearsayBeliefq42ep:believesViaHearsay present
  4. Unknown — no matching modality predicate found

Integration with deontic_logic.rs: OP_PERMIT read IF classify() == ObjectiveKnowledge OP_CONDITIONALLY_PERMIT read IF classify() == InferredBelief

Enums§

EpistemicState
The epistemic weight of an agent’s belief about a proposition.

Constants§

C_AGENT_QUERY
q42ep:AgentQuery class hash — a query event is itself an epistemic event.
C_CRYPTO_SENSOR
q42ep:CryptoSensor class hash — hardware-attested or cryptographically signed source.
C_HEARSAY_EVENT
q42ep:HearsayEvent class hash — information from an unverified peer.
C_SIGNED_OBJECTIVE_EVENT
q42ep:SignedObjectiveEvent class hash — notarized or DID-signed objective event.
EPISTEMIC_CONTEXT
Base epistemic metadata context (query events, propagation records).
OBJECTIVE_CONTEXT
Cryptographically verified facts, shared across all agents.
P_BELIEVES_VIA_HEARSAY
q42ep:believesViaHearsay — belief received from an unverified peer.
P_COG_BELIEVES
cog:believes — the core JTB belief relation.
P_COG_INFERS
cog:infers — an agent infers a new belief.
P_COG_OBSERVES
cog:observes — an agent observes an event.
P_COG_QUERIES
cog:queries — an agent queries about a proposition.
P_INFERS_FROM
q42ep:infersFrom — agent derived a belief via local logic from a source event.
P_KNOWS_DIRECTLY
q42ep:knowsDirectly — agent has direct cryptographic or sensory proof.
P_WAS_DERIVED_FROM
prov:wasDerivedFrom — derivation edge in the PROV-O provenance chain.

Functions§

agent_epistemic_context
Derive the per-agent epistemic context for did_hash.
all_beliefs_of
Write the propositions that agent_did believes via any modality into out.
assert_hearsay_belief
Record that agent_did holds a HearsayBelief about proposition_hash, received from informant_did (an unverified peer).
assert_inferred_belief
Record that agent_did holds an InferredBelief about proposition_hash, derived from source_hash (an AgentQuery or HearsayEvent).
assert_objective_knowledge
Record that agent_did has ObjectiveKnowledge of proposition_hash, justified by proof_hash (e.g. a q42ep:CryptoSensor or q42ep:SignedObjectiveEvent).
classify_epistemic_state
Classify the epistemic state of agent_did regarding proposition_hash.
has_objective_proof
Return true if any quin in the slice classifies proposition as ObjectiveKnowledge for at least one agent.
objective_knowledge_of
Write the propositions that agent_did holds ObjectiveKnowledge of into out.
record_query_observation
Record a query event — observer_did queries about query_subject_hash.
register_crypto_sensor_output
Record that agent_did typed event_hash as a q42ep:CryptoSensor result. Call this when wiring hardware-attested data into the objective context.
register_query_event
Record that agent_did typed event_hash as a q42ep:AgentQuery. Call this alongside record_query_observation so SHACL shapes can validate it.