Skip to content

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)

Notifications You must be signed in to change notification settings

InnovativeInventor/hack-python-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

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.

You can see the corresponding proofs at /natural_deduction.py.

To type-check the proofs yourself, run:

mypy .

See 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.

About

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)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages