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.7.0.tar.gz (21.4 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.7.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tinylean-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3dd660e625158a927645803cee77c15c3d7ec916f50ce2cec073cf5a58e3299f
MD5 171ffa61643032e76e917ce988d8662e
BLAKE2b-256 b7d26bbe44460a0d9043a863495e1394da4b3787680fd5fa7756d7835c43a1a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinylean-0.7.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.7.0-py3-none-any.whl.

File metadata

  • Download URL: tinylean-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92b60fa7c9775257423be75865ec3ff95cc2b302852c8256283a2dfdaef0a00f
MD5 e1ab706c002bff717090491bb05a9870
BLAKE2b-256 d3c52f4f815c83be359c0f43a17d821c162733b454896fdf5023627f72c7b94e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinylean-0.7.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