An open API service indexing awesome lists of open source software.

https://github.com/innovativeinventor/hack-python-types

Abusing Python’s type-checker (mypy) to construct a propositional, constructive logic proof checker via the Curry-Howard correspondence and the BHK interpretation of intuitionistic logic. (see blog post)
https://github.com/innovativeinventor/hack-python-types

Last synced: 12 months ago
JSON representation

Abusing Python’s type-checker (mypy) to construct a propositional, constructive logic proof checker via the Curry-Howard correspondence and the BHK interpretation of intuitionistic logic. (see blog post)

Awesome Lists containing this project

README

          

## hack-python-types
This repo contains the code and fully type-checkable proofs for various natural deduction inference rules in Python's type system.
It is intended to accompany [my blog post on the hacking Python's type system](https://max.fan/posts/hacking-python-types/).

You can see the corresponding proofs at [`/natural_deduction.py`](/natural_deduction.py).

To type-check the proofs yourself, run:
```
mypy .
```

See [https://max.fan/posts/hacking-python-types/](https://max.fan/posts/hacking-python-types/) for more.

## Contents
This repo proves the following natural deduction rules in Python's type system:
- modus ponens
- contrapositive
- modus tollens
- transitive implication (if A implies B and B implies C, then A implies C)
- conjunction introduction
- conjunction elimination
- disjunction introduction

Additionally, type definitions/stubs are given for:
- modus tollendo ponens (admitted as axiom -- not proven yet)
- constructive dilemma (admitted as axiom -- not proven yet)

Feedback is welcome.