Gaia Lang — Python DSL for knowledge authoring, compilation, and inference
Project description
Gaia Lang
A Python DSL for authoring machine-readable scientific knowledge. Gaia Lang lets researchers declare propositions, logical constraints, and reasoning strategies as Python objects, then compiles them into a canonical intermediate representation (Gaia IR) for inference via belief propagation.
Quick Example
from gaia.lang import claim, setting, contradiction, deduction
# Declare knowledge
aristotle = setting("Aristotle's doctrine: heavier objects fall faster.")
heavy_faster = claim("Observations show heavier stones fall faster in air.")
composite_slower = claim("A tied composite should fall slower (light part drags heavy).")
composite_faster = claim("A tied composite should fall faster (greater total mass).")
# Logical constraint
paradox = contradiction(composite_slower, composite_faster,
reason="Same premise yields opposite predictions")
# Reasoning
vacuum_law = claim("In vacuum all bodies fall at the same rate.",
given=[paradox, heavy_faster])
Install
pip install gaia-lang
For development:
git clone https://github.com/SiliconEinstein/Gaia.git
cd Gaia && uv sync
CLI Workflow
gaia compile → gaia check → gaia infer → gaia register
(DSL → IR) (validate) (BP preview) (registry PR)
| Command | Purpose |
|---|---|
gaia compile [path] |
Compile Python DSL to Gaia IR (.gaia/ir.json) |
gaia check [path] |
Validate package structure and IR consistency |
gaia infer [path] |
Run belief propagation with a review sidecar |
gaia register [path] |
Submit package to the Gaia Official Registry |
Create a Knowledge Package
1. Initialize
uv init --lib galileo-falling-bodies-gaia
cd galileo-falling-bodies-gaia
uv add gaia-lang
mv src/galileo_falling_bodies_gaia src/galileo_falling_bodies
2. Configure pyproject.toml
[project]
name = "galileo-falling-bodies-gaia"
version = "1.0.0"
[tool.gaia]
type = "knowledge-package"
uuid = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
- Package name must end with
-gaia typemust be"knowledge-package"uuidis required for registry submission
3. Write DSL declarations in src/galileo_falling_bodies/__init__.py
from gaia.lang import claim, setting, contradiction
aristotle = setting("Aristotle: heavier objects fall faster.")
heavy_faster = claim("Heavy stones fall faster in air.")
composite_slower = claim("Tied composite should be slower.")
composite_faster = claim("Tied composite should be faster.")
paradox = contradiction(composite_slower, composite_faster,
reason="Same premise yields opposite conclusions")
vacuum_law = claim("In vacuum all bodies fall at the same rate.",
given=[paradox, heavy_faster])
__all__ = ["aristotle", "heavy_faster", "composite_slower",
"composite_faster", "paradox", "vacuum_law"]
4. Compile and validate
gaia compile .
gaia check .
5. Publish
git tag v1.0.0 && git push origin main --tags
gaia register . --registry-dir ../gaia-registry --create-pr
DSL Surface
Knowledge
| Function | Description |
|---|---|
claim(content, *, given, background, parameters, provenance) |
Scientific assertion — the only type carrying probability |
setting(content) |
Background context — no probability, no BP participation |
question(content) |
Open research inquiry |
Operators (deterministic constraints)
| Function | Semantics |
|---|---|
contradiction(a, b) |
A and B cannot both be true |
equivalence(a, b) |
A and B share the same truth value |
complement(a, b) |
A and B have opposite truth values |
disjunction(*claims) |
At least one must be true |
Strategies (reasoning declarations)
| Function | Description |
|---|---|
noisy_and(premises, conclusion) |
All premises jointly support conclusion |
infer(premises, conclusion) |
General conditional probability table |
deduction(premises, conclusion) |
Deductive reasoning (conjunction → implication) |
abduction(observation, hypothesis) |
Inference to best explanation |
analogy(source, target, bridge) |
Analogical transfer |
extrapolation(source, target, continuity) |
Continuity-based prediction |
elimination(exhaustiveness, excluded, survivor) |
Process of elimination |
case_analysis(exhaustiveness, cases, conclusion) |
Case-by-case reasoning |
mathematical_induction(base, step, conclusion) |
Inductive proof |
composite(premises, conclusion, sub_strategies) |
Hierarchical composition |
Architecture
gaia/
├── lang/ DSL runtime, declarations, and compiler
├── ir/ Gaia IR schema, validation, formalization
├── bp/ Belief propagation engine (4 backends)
├── cli/ CLI commands (compile, check, infer, register)
└── review/ Review sidecar model
Documentation
- DSL Reference
- Package Model
- Knowledge & Reasoning Semantics
- CLI Workflow
- Gaia IR Specification
- Registry Design
Testing
pytest
ruff check .
ruff format --check .
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gaia_lang-0.1.0.tar.gz.
File metadata
- Download URL: gaia_lang-0.1.0.tar.gz
- Upload date:
- Size: 69.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c190dc4beeae88540268d9cf567e47f2418be91ac6cb7ad60fda2fa31bf402c
|
|
| MD5 |
f228386e88ccbbe81e8d726ed0674afe
|
|
| BLAKE2b-256 |
5abaaf7e85f2ff43e08b0bd4e993b9557a607d4d5ae475a886f47149f3f6794f
|
Provenance
The following attestation bundles were made for gaia_lang-0.1.0.tar.gz:
Publisher:
publish.yml on SiliconEinstein/Gaia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gaia_lang-0.1.0.tar.gz -
Subject digest:
5c190dc4beeae88540268d9cf567e47f2418be91ac6cb7ad60fda2fa31bf402c - Sigstore transparency entry: 1224342173
- Sigstore integration time:
-
Permalink:
SiliconEinstein/Gaia@418d45cea24917b910405ad009916cc0a2ee9a29 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SiliconEinstein
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@418d45cea24917b910405ad009916cc0a2ee9a29 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gaia_lang-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gaia_lang-0.1.0-py3-none-any.whl
- Upload date:
- Size: 77.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c48af60369133ce9aa73d1deb1cda68408e1e6ccc610c6080b22f38e0eb8de5
|
|
| MD5 |
1a9f822bf7937d319792ac50b3735369
|
|
| BLAKE2b-256 |
8123c0847e79e649158395b00a9585b8021948f563e79f52f0781c920f30d2ef
|
Provenance
The following attestation bundles were made for gaia_lang-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on SiliconEinstein/Gaia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gaia_lang-0.1.0-py3-none-any.whl -
Subject digest:
3c48af60369133ce9aa73d1deb1cda68408e1e6ccc610c6080b22f38e0eb8de5 - Sigstore transparency entry: 1224342175
- Sigstore integration time:
-
Permalink:
SiliconEinstein/Gaia@418d45cea24917b910405ad009916cc0a2ee9a29 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SiliconEinstein
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@418d45cea24917b910405ad009916cc0a2ee9a29 -
Trigger Event:
push
-
Statement type: