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.0.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.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

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

Hashes for frege-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40a582f516c82ff4f11798afea71fad3530c98326767cdc181c2d05936526828
MD5 ed0d37dc308c136feedeee4409ff730b
BLAKE2b-256 94d9caa635925fedebaaa3c9a15e1699170ac6c0fdd01de16a2bbd5bc2cc4089

See more details on using hashes here.

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

Hashes for frege-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad0e661f45cb3ebc838285103954b08a84c050b0ec723589c3afaea3ef54926d
MD5 fd55ff29d6249a5f4d251d20f951a8df
BLAKE2b-256 3e3a98e75cf1d39143c45a42a051ac488b4937373e9d9582e316d9cca9c8df59

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