Skip to main content

A epistemic logic-programming knowledge base toolkit.

Project description

doxa

Warning Doxa is currently in an early, unstable stage. APIs, query semantics, file formats, and behavior may change without notice. It is not yet recommended for production use.

An epistemic knowledge representation language — Datalog/Prolog-grounded, temporally-aware, conflict-sensitive, and auditable.

The Problem

Existing knowledge systems collapse important epistemic distinctions into a single dimension:

  • Classical Datalog / SQL — facts are ground truth. Conflict is a bug, ignorance is absence, decay requires manual deletion.
  • Probabilistic systems — a scalar p ∈ [0,1] cannot distinguish no evidence from equal evidence both ways; conflict, ignorance, and uncertainty all look the same.
  • Graph / triple stores — no first-class uncertainty model at all.

None of these can represent: "Source A strongly believes X, Source B strongly disbelieves X, valid between D1–D2, and the conflict is unresolved."

What Doxa Does

Every fact in Doxa is a BeliefRecord — a ground atom paired with:

  • b / d — independent degrees of evidence for and against (b + d ≤ 1)
  • src — who asserts this belief
  • vf / vt — real-world validity period
  • et — epistemic time (when the belief entered the KB)

This yields four qualitatively distinct epistemic states grounded in Belnap's four-valued logic:

State b d Meaning
None 0 0 No evidence either way
True > 0 0 Evidence for, not against
False 0 > 0 Evidence against, not for
Both > 0 > 0 Conflicting evidence

No single confidence scalar can represent all four — the distinction between None and Both is categorical, not a matter of degree.

bird(owl) @{b:0.98, src:"https://en.wikipedia.org/wiki/Owl", et:"2026-03-24"}.
weight_g(owl, 1500) @{b:0.98, src:"https://en.wikipedia.org/wiki/Owl", et:"2026-03-24"}.
wingspan_cm(owl, 110) @{b:0.97, src:"https://en.wikipedia.org/wiki/Owl", et:"2026-03-24"}.

bird(penguin) @{b:1.0, src:"https://en.wikipedia.org/wiki/Penguin", et:"2026-03-24"}.
weight_g(penguin, 30000) @{b:0.95, src:"https://en.wikipedia.org/wiki/Penguin", et:"2026-03-24"}.
wingspan_cm(penguin, 60) @{b:0.90, src:"https://en.wikipedia.org/wiki/Penguin", et:"2026-03-24"}.

can_fly(X) :-
    bird(X),
    weight_g(X, W),
    wingspan_cm(X, S),
    div(W, S, R),
    lt(R, 20) @{
        b:0.98, 
        src:"simplified heuristic inspired by wing loading (weight / wing area)", 
        et:"2026-03-24"
    }.
doxa> ?- can_fly(owl).
  1: b=0.913, d=0, status=true
doxa> ?- can_fly(penguin). 
  1: b=0, d=0, status=neither

Key Properties

  • Conflict without corruption — disagreeing sources produce Both, not an average; conflict is queryable, and the query policy (credulous/skeptical) resolves it at query time
  • Ignorance without inference — unasserted facts return None, not a prior or default false
  • Time as a language primitive — temporal validity and epistemic time are enforced uniformly via asof query semantics, not modeling conventions
  • Auditability built in — derivation traces (explain) name every supporting BeliefRecord, its source, validity window, and belief degree
  • Guaranteed termination — Datalog semantics ensure every query over a finite KB terminates

Foundations

Doxa's parametric combination algebra follows Lakshmanan & Shiri (2001). Its (b, d) semantics are grounded in Belnap (1977) and instantiated with Jøsang's subjective logic (2016). Doxa's contribution is the co-design of these elements into a single language with first-class provenance, temporal annotation, and audit traces — promoted from modeling conventions to language primitives enforced by the parser.

Language Specification

For the full formal syntax, semantics, builtins, query options, and edge cases see the Language Specification.

Repository Layout

Path Description
doxa/core/ Core language model types and parsing
doxa/query/ Query execution engine
doxa/persistence/ Storage backends (memory, native, PostgreSQL)
doxa/cli/ CLI entry points and interactive terminal
tests/ Automated tests and fixtures

Install

pip install doxa-lang

Optional PostgreSQL dependencies:

pip install "doxa-lang[postgres]"

For local development from source:

pip install -e ".[dev,postgres]"
pytest

Native Build Prerequisites

  • Python >=3.11
  • Rust toolchain 1.89 (pinned in rust-toolchain.toml and CI)
  • A working C/C++ compiler toolchain (build-essential on Linux, Xcode CLT on macOS, MSVC Build Tools on Windows)

Prebuilt wheels are published for Linux/macOS/Windows on CPython 3.11-3.13. The prerequisites above are required when building from source.

Backend Matrix

--memory backend --engine backend Status
memory memory supported
memory native supported
native memory supported
native native supported
postgres postgres supported
memory postgres not supported
postgres memory not supported
postgres native not supported
native postgres not supported

Environment Variables

  • DOXA_POSTGRES_URL (default: postgresql://localhost/doxa): PostgreSQL connection URL used by --memory postgres.
  • DOXA_POSTGRES_NATIVE_SQL (1 to enable): route eligible PostgreSQL queries through the native SQL fast path.

Quick Start

doxa --help
doxa
doxa --memory postgres --engine postgres

The CLI supports memory, native, and postgres backends via --memory and --engine.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doxa_lang-0.1.0.tar.gz (152.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

doxa_lang-0.1.0-cp313-cp313-win_amd64.whl (911.4 kB view details)

Uploaded CPython 3.13Windows x86-64

doxa_lang-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

doxa_lang-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

doxa_lang-0.1.0-cp312-cp312-win_amd64.whl (911.6 kB view details)

Uploaded CPython 3.12Windows x86-64

doxa_lang-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

doxa_lang-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

doxa_lang-0.1.0-cp311-cp311-win_amd64.whl (912.6 kB view details)

Uploaded CPython 3.11Windows x86-64

doxa_lang-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

doxa_lang-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file doxa_lang-0.1.0.tar.gz.

File metadata

  • Download URL: doxa_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 152.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for doxa_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ceeddb4d72bfab24a73b7daf86725d7b73eab8ad533961d8201710f801b25436
MD5 f661b111a87d914e2a673bf2f23ab584
BLAKE2b-256 8ab6ae46a7ab506b2c30a6beed16da30ea217e95e6bc443f1debbddc45408b3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0.tar.gz:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: doxa_lang-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 911.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for doxa_lang-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e9403b07a36e22248aaf573f7409982422586c1ff4daaffabb732696dd1be0f8
MD5 86728c46e0a43fc73ad7c4500e0acd7f
BLAKE2b-256 5ec406fa9b02af6bec288eee7753250280d95f98c1c5ee8946c0a73934ef9f65

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3396263df47a2240f2398fcaec95fab33d43ff331558f721bd4a9d40e772be3d
MD5 c86fc70e8438ba256ff5a62c639de221
BLAKE2b-256 378d7f88c2bbbad16789faecfc313a5c6cde398e951a2af04814b137c8208736

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6105dad5ea2fb8d829fe89fa2dd179410bd12eeeace8c16501bad0b79dcf4215
MD5 5fab3d7af6930e33ece7d01ee5492f20
BLAKE2b-256 ecc151cd1cbd3c6ceb78f311287bcdef0cf357396b577a632a8e21b0099905a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: doxa_lang-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 911.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for doxa_lang-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 69e062ef031a00b0a5a15c289244691293f461088601d22252774d3bab196af9
MD5 a2258f9627cd83dab5ea67119faed262
BLAKE2b-256 5535c37ac5630c6dd55beb425c72713b2a3ce99e57e74d712d62a09aa9d9dacc

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e681aca1596f41c8b077aeb10e9fcf381226b5ea5faa7d1500af6eab4b32f7fe
MD5 c8e1da94098daa60c2a1e029d5105474
BLAKE2b-256 02591d1590a5e0f7a5bf9ea677e757e1add14e11e5b4e041c969ef3f1fed783b

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 112961553f4a0976f6df78982081de8aee12a18264be43f3e15dd7ae160ed731
MD5 8ac3bb087723891afe8dc2614886888f
BLAKE2b-256 3a2b2aaa45ba54ad50e062bc756e9ccadbd96362d2eb80763afa96ac66b5a13c

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: doxa_lang-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 912.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for doxa_lang-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 56cfbb0cb7d44967fc253f3162abc139a19b9637a3758736b4aadf800c8a6c6d
MD5 7caa6afd8133215444a61324e53a95b0
BLAKE2b-256 d294ab6cb31486e742584de2746f5971b1f2d92f6f604498fc871edce982476c

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp311-cp311-win_amd64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ac66a19f7dac7fac80c843ff895a08fd7ccd7099fe31ef4c3061522b76f069fc
MD5 25bf1cdb3696d953e63e10d34456e00d
BLAKE2b-256 64dab60187fdc43f3f015a5479a07b4ad31c85d35a520dc730b15532b71a53a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file doxa_lang-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for doxa_lang-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87a261c4f061510319910c2f4b0a7b4acaa2893aca0ed2712c0b507a4cfd6126
MD5 49a25af436d89ce97615e59d17929f56
BLAKE2b-256 4fdd6715e383fef6801692dac1ab6e8239be49c4f02efbdc78aacf1b5ef2986e

See more details on using hashes here.

Provenance

The following attestation bundles were made for doxa_lang-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci.yml on ManuelZierl/doxa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page