Copyright | (c) Artem Mavrin 2021 |
---|---|
License | BSD3 |
Maintainer | artemvmavrin@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Intuitionistic proofs in propositional logic.
Synopsis
- prove :: Ord a => Judgement a -> Maybe (Proof a)
- proveTautology :: Ord a => Formula a -> Maybe (Proof a)
- proveImp :: Ord a => Judgement a -> Maybe (Proof a)
- proveStatman :: Ord a => Judgement a -> Maybe (Proof a)
- isProvable :: Ord a => Judgement a -> Bool
- isTautology :: Ord a => Formula a -> Bool
- findCut :: Proof a -> Maybe (Proof a)
- hasCut :: Proof a -> Bool
- correct :: Ord a => Judgement a -> Proof a -> Bool
- valid :: Ord a => Proof a -> Bool
- debug :: Ord a => Proof a -> Either (Proof a) ()
Proof search for judgements and formulas
prove :: Ord a => Judgement a -> Maybe (Proof a) Source #
Find an intuitionistic proof of a judgement, if a proof exists.
proveTautology :: Ord a => Formula a -> Maybe (Proof a) Source #
Find an intuitionistic proof of a formula, if a proof exists.
Specific proof search algorithms
proveImp :: Ord a => Judgement a -> Maybe (Proof a) Source #
(
finds an intuitionistic proof
of a judgement \(g \vdash a\) in the implicational fragment of propositional
logic, if such a proof exists.proveImp
(g |-
a))
The algorithm is adapted from section 2.4 of
- Samuel Mimram (2020) PROGRAM = PROOF.
Examples
>>>
proveImp $ [Var 'a', Imp (Var 'a') (Var 'b')] |- Var 'b'
Just (ImpElim ([Var 'a',Imp (Var 'a') (Var 'b')] |- Var 'b') (Axiom ([Var 'a',Imp (Var 'a') (Var 'b')] |- Imp (Var 'a') (Var 'b'))) (Axiom ([Var 'a',Imp (Var 'a') (Var 'b')] |- Var 'a')))
>>>
proveImp $ [Imp (Var 'a') (Var 'b'), Imp (Var 'b') (Var 'a')] |- Var 'a'
Nothing
proveStatman :: Ord a => Judgement a -> Maybe (Proof a) Source #
Find an intuitionistic proof of a judgement, if one exists, using Statman's algorithm.
- Richard Statman (1979) "Intuitionistic propositional logic is polynomial-space complete." Theoretical Computer Science, Volume 9, Issue 1, pp. 67–72. DOI.
The judgement to be proved is converted to an implicational judgement as
described in toImp
and proved (if possible) using proveImp
. The resulting
proof is then converted into a proof of the original judgement.
Provability checking
isProvable :: Ord a => Judgement a -> Bool Source #
Determine whether a judgement is intuitionistically valid.
Examples
>>>
isProvable $ [Var "a", Var "b"] |- And (Var "a") (Var "b")
True
>>>
isProvable $ [] |- Or (Var "a") (Not (Var "a"))
False
isTautology :: Ord a => Formula a -> Bool Source #
Determine whether a formula is an intuitionistic tautology.
Examples
>>>
isTautology $ Imp (And (Var 'a') (Var 'b')) (Var 'a')
True
>>>
isTautology $ Or (Var 'a') (Not (Var 'a'))
False
>>>
isTautology $ Not (Not (Or (Var 'a') (Not (Var 'a'))))
True
Cuts
findCut :: Proof a -> Maybe (Proof a) Source #
Find the cut nearest the root of a proof, if any. This functions assumes the proof is valid.