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.6.0.tar.gz (21.1 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.6.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tinylean-0.6.0.tar.gz
Algorithm Hash digest
SHA256 14678d9832c91ab473336ac1e1bf67d96cc4e52e5c4e3fd9f8e2a984c9179419
MD5 ddd77130e8abcc328ebf36ad5ad3acdf
BLAKE2b-256 92ad46e308572eb65865129cde9007af63770d6c1b364e0aedc2b208c1670475

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tinylean-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 926cb7a72226417d14235283b90f7505194bd3059d273120ca79588b0752ab53
MD5 1ba58bac179e3dba3168744ac7523abe
BLAKE2b-256 8128fb92037393dead9a8ef30cb4bc8ac27936c1cc0253ba54bad71352a09221

See more details on using hashes here.

Provenance

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