A small library for propositional logic and formal systems.
Project description
frege
A small, typed library for various systems of logic.
Install
uv add frege
Quickstart
# TODO
Run the bundled example:
# TODO
uv run python examples/TODO.py
Development
All tasks run through plain uv commands:
uv sync # install the project + dev dependencies
uv run pytest # run tests with coverage
uv run ruff check . # lint
uv run ruff format . # format (use --check in CI)
uv run ty check # type check
uv run python examples/propositional_logic.py
Goals
- Parsing of logical expressions from 'standard' syntax into a typed representation.
- Have:
¬(prefix),∧(left-assoc),→(right-assoc). - Still need
∨(left-assoc, slots between∧and→) to complete propositional syntax. ↔and⊕are non-associative:A ↔ B ↔ Cis ambiguous, so chaining should be rejected (parse exactly two operands). This is a new associativity case the current precedence-climbing parser does not yet handle.
- Have:
- Generation of truth tables from Formulae/Theories
- For normalization (CNF/DNF) the nested-binary tree for the associative
∧/∨becomes awkward; consider flattening to n-ary nodes (And([...])).
- For normalization (CNF/DNF) the nested-binary tree for the associative
- Parsing of latex/mathjax/typst logical expressions
- Support for various notation forms.
- Polish/prefix (
Cpq,Kpq) and postfix/RPN have no associativity or precedence; they are a separate parse mode, not a new operator level. Themode=dispatch andSymbol-driven tokenizer give a seam for anotation=axis.
- Polish/prefix (
- Generation of truth trees for viewing the structure of a logical formula or theory. a. https://en.wikipedia.org/wiki/Method_of_analytic_tableaux
Syllogismclass- Support for Systems of Logic
a. Aristotelian (see Syllogism impl as prerequisite)
b. Classical
c. Propositional
d. First-Order
- Quantifiers
∀x. φ,∃x. φare binders, not binary operators: they bind a variable and grab maximal scope to the right. Forces aTermgrammar (predicatesP(x), functionsf(g(x)), application) below theFormulagrammar. This reshapes the type model:Elementwill sit alongside aTermtype. e. Modal -□/◇are prefix unary, stackable like¬; cheap to add as a new method at the same precedence level. f. Higher order - Addsλbinders and left-associative application; builds on the first-orderTermgrammar. g. Deviant (Intuitionistic, Multi-valued logics, Paraconsistent logics) - Computational representations of Model Theory, Proof Theory, Set Theory and Computability Theory.
- Axiom listing and ability to add/modify/remove them.
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
frege-0.1.0.tar.gz
(9.0 kB
view details)
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
frege-0.1.0-py3-none-any.whl
(11.2 kB
view details)
File details
Details for the file frege-0.1.0.tar.gz.
File metadata
- Download URL: frege-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a582f516c82ff4f11798afea71fad3530c98326767cdc181c2d05936526828
|
|
| MD5 |
ed0d37dc308c136feedeee4409ff730b
|
|
| BLAKE2b-256 |
94d9caa635925fedebaaa3c9a15e1699170ac6c0fdd01de16a2bbd5bc2cc4089
|
File details
Details for the file frege-0.1.0-py3-none-any.whl.
File metadata
- Download URL: frege-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad0e661f45cb3ebc838285103954b08a84c050b0ec723589c3afaea3ef54926d
|
|
| MD5 |
fd55ff29d6249a5f4d251d20f951a8df
|
|
| BLAKE2b-256 |
3e3a98e75cf1d39143c45a42a051ac488b4937373e9d9582e316d9cca9c8df59
|