______ __ __ __
/ \ / | / | / |
/$$$$$$ |_______ $$ |_ ______ $$ | ______ ______ $$/ _______
$$ | $$ |/ \$$ / \$$ | / \ / \ / | / |
$$ | $$ |$$$$$$ |$$ |$$$$$$ |$$ |/$$$$$$ /$$$$$$ |$$ |/$$$$$$/
$$ | $$ |$$ | $$ |$$ |$$ | $$ |$$ |$$ | $$ |$$ | $$ |$$ |$$ |
$$ \__$$ |$$ | $$ |$$ |$$ \__$$ |$$ |$$ \__$$ |$$ \__$$ |$$ |$$ \_____
$$ $$/ $$ | $$ |$$ |$$ $$/ $$ |$$ $$/ $$ $$ |$$ |$$ |
$$$$$$/ $$/ $$/ $$/ $$$$$$/ $$/ $$$$$$/ $$$$$$$ |$$/ $$$$$$$/
/ \__$$ |
$$ $$/
$$$$$$/
Logic-as-Code compiler, ontology transpiler and SMT solver engine.
OntoLogic is a first-order logic (FOL) domain-specific language, multi-target compiler, theorem-prover bridge and REPL written in Haskell. Write a formal ontology once, check it for consistency with Z3, CVC5 or Vampire, and compile it into code, API contracts, database schemas, knowledge-graph formats and diagrams.
Project site: https://bsommers.github.io/OntoLogic/ | Rationale: docs/purpose.md
stack build # 1. build
stack exec ontologic-exe -- -i examples/smart_factory.logic -t lint # 2. lint
stack exec ontologic-exe -- -i examples/smart_factory.logic -t solve # 3. check consistency (SMT)
stack exec ontologic-exe -- -i examples/smart_factory.logic -t ts -o ./generated/ts # 4. emit TypeScript/Zod
stack exec ontologic-exe -- --repl # 5. interactive REPLFull walkthrough: docs/user-guide/quickstart.md. Install options: docs/user-guide/installation.md.
- FOL DSL with typed properties, binary relations, quantifiers and inheritance.
- Modular namespaces:
import,namespace, cycle detection and a standard library lookup path. - Semantic linter: symbol resolution, circular inheritance, duplicates and axiom contradictions.
- Multi-prover solver: consistency, subsumption proofs, unsatisfiable-concept detection and counterexamples (Z3, CVC5, Vampire or auto).
- Language server and VS Code extension (
ontologic-lsp,editors/vscode). - Interactive REPL with
:load,:solve,:prove,:unsat,:emit <target>. - Many emitters from one shared intermediate representation (
ModelIR).
Select with -t <target>; see --help for the full list and docs/user-guide/targets-and-emitters.md for details.
| Category | Targets |
|---|---|
| Application code | ts (Zod), java, python (Pydantic v2), rust, go, cpp |
| API and data contracts | openapi, graphql, jsonschema, protobuf, sql |
| Knowledge graphs | owl, shacl, neo4j |
| Provers | smt (SMT-LIB2), tptp, solve |
| Diagrams | mermaid, d2 (add --render for images); see docs/user-guide/visualization.md |
| Tooling | lint, repl, lsp |
- Documentation index
- User guide: quickstart, installation, language reference, CLI reference, targets and emitters, visualization
- Architecture and purpose
- Using OntoLogic
- Developer guide
- Changelog
The bundled libraries live in ontologic-lib/; see docs/standard-library.md. Worked examples across many domains: docs/domains/README.md.
stack build --ghc-options="-Wall -Werror"
stack testApache License 2.0. See LICENSE.