Skip to main content

Tiny theorem prover with syntax like Lean 4

Project description

TinyLean

Supported Python versions Lines of Python Test codecov

Tiny theorem prover in Python, with syntax like Lean 4.

Tour

An identity function in TinyLean:

def id {T: Type} (a: T): T := a

example := id Type

Inductive data types:

inductive Maybe (A: Type) where
| Nothing
| Just (a: A)
open Maybe

inductive N where
| Z
| S (n: N)
open N

inductive Vec (A: Type) (n: N) where
| Nil (n := Z)
| Cons {m: N} (a: A) (v: Vec A m) (n := S m)
open Vec

The typechecker knows if any case is impossible (i.e. dependent pattern matching):

def v0: Vec N Z := Nil

example :=
  match v0 with
  | Nil => Z
  /- Cons is impossible, leaving it here yields errors. -/

So a bottom type eliminator is trivial via DPM:

inductive Weird (n: N) where
| MkWeird (n := Z)
open Weird

/- Impossible to construct a term for type `Weird (S Z)`. -/
example {A: Type} (x: Weird (S Z)): A := nomatch x

License

MIT

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

tinylean-0.5.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

tinylean-0.5.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file tinylean-0.5.0.tar.gz.

File metadata

  • Download URL: tinylean-0.5.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tinylean-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2aad4f529a52d08b320589682b4e925ea2a7fad20d97a303b24b9c0625677b18
MD5 05dda8efcc952a9199c2ccbf2e2f9f37
BLAKE2b-256 c08dedd6ce58a5737b933d91b7048fbdf25428556e1cace53d3b3b4a5596b8e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinylean-0.5.0.tar.gz:

Publisher: release.yml on anqurvanillapy/TinyLean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tinylean-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: tinylean-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tinylean-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3db0d7993cbcd69fedd342fe40f27b6b3adc34cf325e706abcb9e36b2b3d096
MD5 951a0cf0eb42709387423efd4dd46303
BLAKE2b-256 71b7597d415f83c67d76970c3ed099c76fb7d4191162ecdc758ebcc0b59acbc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinylean-0.5.0-py3-none-any.whl:

Publisher: release.yml on anqurvanillapy/TinyLean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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