https://github.com/ncfavier/muri
A theorem prover for intuitionistic propositional logic
https://github.com/ncfavier/muri
curry-howard-isomorphism intuitionistic-logic theorem-prover
Last synced: about 2 months ago
JSON representation
A theorem prover for intuitionistic propositional logic
- Host: GitHub
- URL: https://github.com/ncfavier/muri
- Owner: ncfavier
- License: isc
- Created: 2020-10-04T11:59:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-22T18:58:02.000Z (4 months ago)
- Last Synced: 2025-03-24T23:18:06.331Z (2 months ago)
- Topics: curry-howard-isomorphism, intuitionistic-logic, theorem-prover
- Language: Haskell
- Homepage:
- Size: 30.3 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `muri :: Type -> Maybe Term`
muri takes a Haskell type, and generates a Haskell term with that type (or a more general one), if possible.
Equivalently, under the [propositions-as-types correspondence](https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence), muri is a theorem prover for intuitionistic propositional logic. It takes a proposition as input, and produces a proof of that proposition, if one exists.
Input types are restricted to type variables, the unit type `()`, product types `(a, b)`, the empty type `Void`, sum types `Either a b` and function types `a -> b`.
Output terms are built using lambda abstraction, function application, `let`, `absurd` and `case` expressions, the empty tuple `()`, pair construction and the `Left` and `Right` type constructors.
muri was inspired by Lennart Augustsson's [Djinn](https://github.com/augustss/djinn), and uses the LJT calculus from "Contraction-Free Sequent Calculi for Intuitionistic Logic" by Roy Dyckhoff to ensure termination.
## Usage
```sh
muri TYPE
```## Examples
```
$ muri 'a -> (b, c) -> (b, (a, c))'
\a -> \(b, c) -> (b, (a, c))
``````
$ muri '(a, b) -> Either a b'
\(a, b) -> Left a
``````
$ muri 'Either (a, c) (b, c) -> (Either a b, c)'
\a -> case a of { Left (b, c) -> (Left b, c); Right (b, c) -> (Right b, c) }
``````
$ muri '(Either (a -> f) a -> f) -> f'
\a -> a (Left (\c -> a (Right c)))
``````
$ muri '(a -> b) -> (Either (a -> f) b -> f) -> f'
\a -> \b -> b (Left (\c -> b (Right (a c))))
``````
$ muri '(Either (a -> f) (b -> f) -> f) -> ((a, b) -> f) -> f'
\a -> \b -> a (Left (\e -> a (Right (\f -> b (e, f)))))
``````
$ muri '((a -> b) -> c) -> ((a, b -> c) -> b) -> c'
\a -> \b -> a (\f -> b (f, \e -> a (\_ -> e)))
``````
$ muri '((((a -> Void) -> Void) -> a) -> a) -> (a -> Void) -> Void'
\a -> \b -> b (a (\d -> absurd (d b)))
``````
$ muri 'a -> b'
Impossible.
```