Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Proof j = Node j [Proof j]
- pattern Proof :: j -> [Proof j] -> Proof j
- pattern Leaf :: j -> Proof j
- class Explain j where
- premises :: j -> [[j]]
- proofs :: Explain j => j -> [Proof j]
- prove :: Explain j => j -> Maybe (Proof j)
- prove' :: Explain j => j -> Proof j
- suppose :: Explain j => j -> Proof j
- conclusion :: Proof j -> j
- children :: Proof j -> [Proof j]
- hidePast :: Int -> Proof j -> Proof j
- hide :: Eq j => j -> Proof j -> Maybe (Proof j)
- countNodes :: Proof j -> Int
- getRow :: Int -> Proof j -> [j]
- toList :: Eq j => Proof j -> [j]
- toList' :: Proof a -> [a]
Proof Trees
The type of proof trees parameterized by the type of judgments j
.
Instances
Foldable Proof # | |
Defined in Logic.Proof fold :: Monoid m => Proof m -> m # foldMap :: Monoid m => (a -> m) -> Proof a -> m # foldMap' :: Monoid m => (a -> m) -> Proof a -> m # foldr :: (a -> b -> b) -> b -> Proof a -> b # foldr' :: (a -> b -> b) -> b -> Proof a -> b # foldl :: (b -> a -> b) -> b -> Proof a -> b # foldl' :: (b -> a -> b) -> b -> Proof a -> b # foldr1 :: (a -> a -> a) -> Proof a -> a # foldl1 :: (a -> a -> a) -> Proof a -> a # elem :: Eq a => a -> Proof a -> Bool # maximum :: Ord a => Proof a -> a # minimum :: Ord a => Proof a -> a # | |
Traversable Proof # | |
Applicative Proof # | |
Functor Proof # | |
Monad Proof # | |
Show j => Show (Proof j) # | |
Latex j => Latex (Proof j) # | |
Defined in Logic.Proof |
Proof Generation
Returns a list of all possible premises of a given judgment.
premises j = []
ifj
is decidably false.Apremises j = [[]]
ifj
is an axiom.premises j = [p1,p2,...,pn] : tail (premises j)
ifj
is provable from the conclusions ofp1, p2, ..., pn
.
prove :: Explain j => j -> Maybe (Proof j) #
Returns the first proof of a given judgment.
prove j = listToMaybe (proofs j)
prove' :: Explain j => j -> Proof j #
Returns a proof of a given judgment or fails if the judgment is not provable.
prove' j = fromJust (prove j)
suppose :: Explain j => j -> Proof j #
Gives the first proof of a given judgment and doesn't fail if the judgement is not provable.
Proof Tree Manipulation
conclusion :: Proof j -> j #
Extract the conclusion/root from a proof tree.
hidePast :: Int -> Proof j -> Proof j #
Get the proof tree with the premises hidden after the \(n\)th level.
hide :: Eq j => j -> Proof j -> Maybe (Proof j) #
Hide the subtrees of a proof tree that have the given judgment as their conclusion.
countNodes :: Proof j -> Int #
Count the number of judgemnets in a proof tree.