File size: 3,751 Bytes
814896a 8690667 814896a 3772fd4 8690667 8b4c279 8690667 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | ---
title: README
emoji: 📉
colorFrom: purple
colorTo: pink
sdk: static
pinned: false
license: apache-2.0
---
<h1 align="center">Nucleoid</h1>

<p align="center">
<b>Logic Language for LLMs</b>
</p>
Hallucinations are a major challenge in LLM reasoning because natural language is unstructured. By nature, LLMs are pattern engines that reason more effectively over structured entities and relationships, enabling more reliable, near-deterministic results.
Nucleoid is designed with a minimally tokenized syntax for logic representation and a declarative execution model, eliminating the need for LLMs to manually manage control flow, state propagation, and other imperative constructs. In addition, Nucleoid is a next-generation logic programming language built on structured objects and their relationships, extending the traditional Knowledge Graph.
- **Near-Deterministic:** Structured, reliable reasoning.
- **Logic Graph:** Executable knowledge graph.
- **Explainability:** Transparent, traceable decisions.
<div align="center">
<table>
<tr>
<th colspan="2">Nucleoid Runtime</th>
</tr>
<tr>
<th width="300">🦀 Rust-based</th>
<th width="300">⚡ LLM-based</th>
</tr>
<tr>
<td>
<b>Programming Language Runtime:</b> Implements the language specification by executing declarative statements.
</td>
<td>
<b>Fine-Tuned LLM:</b> Fine-tuned on synthesized datasets derived from the language specification.
</td>
</tr>
<tr>
<td align="center"><a href="https://github.com/NucleoidAI/Nucleoid">github.com/NucleoidAI/Nucleoid</a></td>
<td align="center"><a href="https://huggingface.co/nucleoid">huggingface.co/nucleoid</a></td>
</tr>
</table>
</div>
### Hello World
**Socrates is mortal without being told so**
```nuc
# There is a Human type with a name
class Human(name: str):
this.name = name
# Every human is mortal
$Human.mortal = true
# Socrates is a Human
socrates = Human("Socrates")
# Therefore, Socrates is mortal
assert(socrates.mortal, true)
```
---
## Language Reference
[**docs/reference.md**](https://github.com/NucleoidAI/Nucleoid/blob/rust/docs/reference.md) is the language reference: statements and state, variables and dependencies, expressions, types and instances, properties, class-level rules, blocks and scope, control flow, functions, transactions, built-in objects, error messages, and a syntax summary.
It is assembled from the NUC documents in [`/docs`](https://github.com/NucleoidAI/Nucleoid/blob/rust/docs/), indexed by [NUC 0](https://github.com/NucleoidAI/Nucleoid/blob/rust/docs/nuc-0000.md) with the conventions in [NUC 1](https://github.com/NucleoidAI/Nucleoid/blob/rust/docs/nuc-0001.md). `nucleoid.spec.md` is normative; where the two disagree, the specification wins.
[**docs/examples.md**](https://github.com/NucleoidAI/Nucleoid/blob/rust/docs/examples.md) covers the same ground as complete programs, each one runnable as written.
A Nucleoid program is a set of statements that remain true. An assignment is not an instruction that runs once and finishes, it is a relationship the runtime records and maintains.
**An assignment states a relationship, not a result**
```nuc
a = 1
b = a + 2
a = 3
assert(b, 5)
```
`b` is never stale. It is the sum of `a` and `2`, so changing `a` brings it up to date, and the same holds for properties, class-level rules and everything else the reference covers.
Every example in the reference is executable: `tests/reference.md` is its executable form and runs under `cargo test`, as do the snippets on this page. |