Skip to main content

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

  1. 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 ↔ C is 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.
  2. 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([...])).
  3. Parsing of latex/mathjax/typst logical expressions
  4. 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. The mode= dispatch and Symbol-driven tokenizer give a seam for a notation= axis.
  5. Generation of truth trees for viewing the structure of a logical formula or theory. a. https://en.wikipedia.org/wiki/Method_of_analytic_tableaux
  6. Syllogism class
  7. 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 a Term grammar (predicates P(x), functions f(g(x)), application) below the Formula grammar. This reshapes the type model: Element will sit alongside a Term type. 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-order Term grammar. g. Deviant (Intuitionistic, Multi-valued logics, Paraconsistent logics)
  8. Computational representations of Model Theory, Proof Theory, Set Theory and Computability Theory.
  9. Axiom listing and ability to add/modify/remove them.

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

frege-0.1.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

frege-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file frege-0.1.1.tar.gz.

File metadata

  • Download URL: frege-0.1.1.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

Hashes for frege-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0361bdcd33aa03644b0966034e66f7398b17c57b9cb0ec009850fb77f58e4ef4
MD5 e89b3eba72beca854c0148c24efdd10c
BLAKE2b-256 422eb142fdde9c9527e0a65a11972de5e673d3c4733b9ee93d88808f96c835cd

See more details on using hashes here.

File details

Details for the file frege-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: frege-0.1.1-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

Hashes for frege-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 363ab8f8cc03f7bb1cceafe1e30209b166164bc6157c10a1b9f1cf918b306359
MD5 b7889c0c704518becf324ce2e80c8120
BLAKE2b-256 a02a197f31213b9a15b6c7469f53209cd441115a5c58fbed294b1f683149e655

See more details on using hashes here.

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