Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- module Data.Logic.ATP.Lib
- module Data.Logic.ATP.Pretty
- module Data.Logic.ATP.Formulas
- data Lit = L {}
- class IsFormula lit => IsLiteral lit where
- naiveNegate :: lit -> lit
- foldNegation :: (lit -> r) -> (lit -> r) -> lit -> r
- foldLiteral' :: (lit -> r) -> (lit -> r) -> (Bool -> r) -> (AtomOf lit -> r) -> lit -> r
- class IsLiteral formula => JustLiteral formula
- data LFormula atom
- negate :: IsLiteral formula => formula -> formula
- negative :: IsLiteral formula => formula -> Bool
- (.~.) :: IsLiteral formula => formula -> formula
- (¬) :: IsLiteral formula => formula -> formula
- negated :: IsLiteral formula => formula -> Bool
- positive :: IsLiteral formula => formula -> Bool
- foldLiteral :: JustLiteral lit => (lit -> r) -> (Bool -> r) -> (AtomOf lit -> r) -> lit -> r
- onatomsLiteral :: JustLiteral lit => (AtomOf lit -> AtomOf lit) -> lit -> lit
- overatomsLiteral :: JustLiteral lit => (AtomOf lit -> r -> r) -> lit -> r -> r
- zipLiterals' :: (IsLiteral lit1, IsLiteral lit2) => (lit1 -> lit2 -> Maybe r) -> (lit1 -> lit2 -> Maybe r) -> (Bool -> Bool -> Maybe r) -> (AtomOf lit1 -> AtomOf lit2 -> Maybe r) -> lit1 -> lit2 -> Maybe r
- zipLiterals :: (JustLiteral lit1, JustLiteral lit2) => (lit1 -> lit2 -> Maybe r) -> (Bool -> Bool -> Maybe r) -> (AtomOf lit1 -> AtomOf lit2 -> Maybe r) -> lit1 -> lit2 -> Maybe r
- convertLiteral :: (JustLiteral lit1, IsLiteral lit2) => (AtomOf lit1 -> AtomOf lit2) -> lit1 -> lit2
- convertToLiteral :: (IsLiteral formula, JustLiteral lit) => (formula -> lit) -> (AtomOf formula -> AtomOf lit) -> formula -> lit
- precedenceLiteral :: JustLiteral lit => lit -> Precedence
- associativityLiteral :: JustLiteral lit => lit -> Associativity
- prettyLiteral :: JustLiteral lit => PrettyLevel -> Rational -> lit -> Doc
- showLiteral :: JustLiteral lit => lit -> String
- data Prop = P {}
- class IsLiteral formula => IsPropositional formula where
- (.|.) :: formula -> formula -> formula
- (.&.) :: formula -> formula -> formula
- (.<=>.) :: formula -> formula -> formula
- (.=>.) :: formula -> formula -> formula
- foldPropositional' :: (formula -> r) -> (formula -> BinOp -> formula -> r) -> (formula -> r) -> (Bool -> r) -> (AtomOf formula -> r) -> formula -> r
- foldCombination :: (formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> formula -> r
- data BinOp
- class IsPropositional formula => JustPropositional formula
- data TruthTable a = TruthTable [a] [TruthTableRow]
- data PFormula atom
- (==>) :: IsPropositional formula => formula -> formula -> formula
- (⇒) :: IsPropositional formula => formula -> formula -> formula
- (→) :: IsPropositional formula => formula -> formula -> formula
- binop :: IsPropositional formula => formula -> BinOp -> formula -> formula
- (⊃) :: IsPropositional formula => formula -> formula -> formula
- (⇔) :: IsPropositional formula => formula -> formula -> formula
- (<=>) :: IsPropositional formula => formula -> formula -> formula
- (↔) :: IsPropositional formula => formula -> formula -> formula
- (<==>) :: IsPropositional formula => formula -> formula -> formula
- (∧) :: IsPropositional formula => formula -> formula -> formula
- (·) :: IsPropositional formula => formula -> formula -> formula
- (∨) :: IsPropositional formula => formula -> formula -> formula
- foldPropositional :: JustPropositional pf => (pf -> BinOp -> pf -> r) -> (pf -> r) -> (Bool -> r) -> (AtomOf pf -> r) -> pf -> r
- zipPropositional :: (JustPropositional pf1, JustPropositional pf2) => (pf1 -> BinOp -> pf1 -> pf2 -> BinOp -> pf2 -> Maybe r) -> (pf1 -> pf2 -> Maybe r) -> (Bool -> Bool -> Maybe r) -> (AtomOf pf1 -> AtomOf pf2 -> Maybe r) -> pf1 -> pf2 -> Maybe r
- convertPropositional :: (JustPropositional pf1, IsPropositional pf2) => (AtomOf pf1 -> AtomOf pf2) -> pf1 -> pf2
- convertToPropositional :: (IsPropositional formula, JustPropositional pf) => (formula -> pf) -> (AtomOf formula -> AtomOf pf) -> formula -> pf
- precedencePropositional :: JustPropositional pf => pf -> Precedence
- associativityPropositional :: JustPropositional pf => pf -> Associativity
- prettyPropositional :: forall pf. JustPropositional pf => Side -> PrettyLevel -> Rational -> pf -> Doc
- showPropositional :: JustPropositional pf => Side -> Int -> pf -> ShowS
- onatomsPropositional :: JustPropositional pf => (AtomOf pf -> AtomOf pf) -> pf -> pf
- overatomsPropositional :: JustPropositional pf => (AtomOf pf -> r -> r) -> pf -> r -> r
- eval :: JustPropositional pf => pf -> (AtomOf pf -> Bool) -> Bool
- atoms :: IsFormula formula => formula -> Set (AtomOf formula)
- onallvaluations :: Ord atom => (r -> r -> r) -> ((atom -> Bool) -> r) -> (atom -> Bool) -> Set atom -> r
- truthTable :: JustPropositional pf => pf -> TruthTable (AtomOf pf)
- tautology :: JustPropositional pf => pf -> Bool
- unsatisfiable :: JustPropositional pf => pf -> Bool
- satisfiable :: JustPropositional pf => pf -> Bool
- psubst :: JustPropositional formula => Map (AtomOf formula) formula -> formula -> formula
- dual :: JustPropositional pf => pf -> pf
- psimplify :: IsPropositional formula => formula -> formula
- psimplify1 :: IsPropositional formula => formula -> formula
- nenf :: IsPropositional formula => formula -> formula
- list_conj :: (Foldable t, IsFormula formula, IsPropositional formula) => t formula -> formula
- list_disj :: (Foldable t, IsFormula formula, IsPropositional formula) => t formula -> formula
- mk_lits :: (JustPropositional pf, Ord pf) => Set pf -> (AtomOf pf -> Bool) -> pf
- allsatvaluations :: Ord atom => ((atom -> Bool) -> Bool) -> (atom -> Bool) -> Set atom -> [atom -> Bool]
- dnfSet :: (JustPropositional pf, Ord pf) => pf -> pf
- purednf :: (JustPropositional pf, IsLiteral lit, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit)
- simpdnf :: (JustPropositional pf, IsLiteral lit, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit)
- rawdnf :: IsPropositional formula => formula -> formula
- dnf :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf
- purecnf :: (JustPropositional pf, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit)
- simpcnf :: (JustPropositional pf, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit)
- cnf' :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf
- cnf_ :: (IsPropositional pf, Ord pf, JustLiteral lit) => (AtomOf lit -> AtomOf pf) -> Set (Set lit) -> pf
- trivial :: (Ord lit, IsLiteral lit) => Set lit -> Bool
- testProp :: Test
- data Knows a
- mk_knows :: (IsPropositional formula, AtomOf formula ~ Knows a) => String -> a -> formula
- mk_knows2 :: (IsPropositional formula, AtomOf formula ~ Knows a) => String -> a -> a -> formula
- prime :: (IsPropositional formula, Ord formula, AtomOf formula ~ Knows Integer) => Integer -> formula
- ramsey :: (IsPropositional pf, AtomOf pf ~ Knows Integer, Ord pf) => Integer -> Integer -> Integer -> pf
- testPropExamples :: Test
- module Data.Logic.ATP.DefCNF
- module Data.Logic.ATP.DP
- module Data.Logic.ATP.Term
- module Data.Logic.ATP.Apply
- module Data.Logic.ATP.Equate
- module Data.Logic.ATP.Quantified
- module Data.Logic.ATP.Parser
- module Data.Logic.ATP.FOL
- module Data.Logic.ATP.Skolem
- module Data.Logic.ATP.Herbrand
- module Data.Logic.ATP.Unif
- tab :: (IsFirstOrder formula, Unify Failing (atom, atom), term ~ UTermOf (atom, atom), Pretty formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => Maybe Depth -> formula -> Failing ((K, Map v term), Depth)
- prawitz :: forall formula atom term function v. (IsFirstOrder formula, Ord formula, Unify Failing (atom, atom), term ~ UTermOf (atom, atom), HasSkolem function, Show formula, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> Int
- testTableaux :: Test
- module Data.Logic.ATP.Resolution
- module Data.Logic.ATP.Prolog
- module Data.Logic.ATP.Meson
- module Data.Logic.ATP.Equal
- data Mode
- data Style = Style {
- mode :: Mode
- lineLength :: Int
- ribbonsPerLine :: Float
- data TextDetails
- data Doc
- class Pretty a where
- pPrintPrec :: PrettyLevel -> Rational -> a -> Doc
- pPrint :: a -> Doc
- pPrintList :: PrettyLevel -> [a] -> Doc
- newtype PrettyLevel = PrettyLevel Int
- text :: String -> Doc
- first :: Doc -> Doc -> Doc
- empty :: Doc
- char :: Char -> Doc
- parens :: Doc -> Doc
- (<+>) :: Doc -> Doc -> Doc
- isEmpty :: Doc -> Bool
- space :: Doc
- integer :: Integer -> Doc
- float :: Float -> Doc
- braces :: Doc -> Doc
- brackets :: Doc -> Doc
- semi :: Doc
- comma :: Doc
- colon :: Doc
- ptext :: String -> Doc
- sizedText :: Int -> String -> Doc
- zeroWidthText :: String -> Doc
- equals :: Doc
- lparen :: Doc
- rparen :: Doc
- lbrack :: Doc
- rbrack :: Doc
- lbrace :: Doc
- rbrace :: Doc
- int :: Int -> Doc
- double :: Double -> Doc
- rational :: Rational -> Doc
- quotes :: Doc -> Doc
- doubleQuotes :: Doc -> Doc
- maybeParens :: Bool -> Doc -> Doc
- maybeBrackets :: Bool -> Doc -> Doc
- maybeBraces :: Bool -> Doc -> Doc
- maybeQuotes :: Bool -> Doc -> Doc
- maybeDoubleQuotes :: Bool -> Doc -> Doc
- reduceDoc :: Doc -> RDoc
- hcat :: [Doc] -> Doc
- hsep :: [Doc] -> Doc
- vcat :: [Doc] -> Doc
- nest :: Int -> Doc -> Doc
- hang :: Doc -> Int -> Doc -> Doc
- punctuate :: Doc -> [Doc] -> [Doc]
- ($$) :: Doc -> Doc -> Doc
- ($+$) :: Doc -> Doc -> Doc
- sep :: [Doc] -> Doc
- cat :: [Doc] -> Doc
- fcat :: [Doc] -> Doc
- fsep :: [Doc] -> Doc
- style :: Style
- render :: Doc -> String
- renderStyle :: Style -> Doc -> String
- fullRender :: Mode -> Int -> Float -> (TextDetails -> a -> a) -> a -> Doc -> a
- prettyNormal :: PrettyLevel
- prettyShow :: Pretty a => a -> String
- prettyParen :: Bool -> Doc -> Doc
- module Test.HUnit
Documentation
module Data.Logic.ATP.Lib
module Data.Logic.ATP.Pretty
module Data.Logic.ATP.Formulas
class IsFormula lit => IsLiteral lit where Source #
The class of formulas that can be negated. Literals are the building blocks of the clause and implicative normal forms. They support negation and must include true and false elements.
naiveNegate :: lit -> lit Source #
Negate a formula in a naive fashion, the operators below prevent double negation.
:: (lit -> r) | called for normal formulas |
-> (lit -> r) | called for negated formulas |
-> lit | |
-> r |
Test whether a lit is negated or normal
:: (lit -> r) | Called for higher order formulas (non-literal) |
-> (lit -> r) | Called for negated formulas |
-> (Bool -> r) | Called for true and false formulas |
-> (AtomOf lit -> r) | Called for atomic formulas |
-> lit | |
-> r |
This is the internal fold for literals, foldLiteral
below should
normally be used, but its argument must be an instance of JustLiteral
.
Instances
(IsFormula (LFormula atom), Eq atom, Ord atom) => IsLiteral (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit | |
(IsFormula (JL a), IsLiteral a) => IsLiteral (JL a) Source # | |
IsAtom atom => IsLiteral (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop | |
(HasApply atom, v ~ TVarOf (TermOf atom)) => IsLiteral (QFormula v atom) Source # | |
Defined in Data.Logic.ATP.Quantified naiveNegate :: QFormula v atom -> QFormula v atom Source # foldNegation :: (QFormula v atom -> r) -> (QFormula v atom -> r) -> QFormula v atom -> r Source # foldLiteral' :: (QFormula v atom -> r) -> (QFormula v atom -> r) -> (Bool -> r) -> (AtomOf (QFormula v atom) -> r) -> QFormula v atom -> r Source # |
class IsLiteral formula => JustLiteral formula Source #
Class that indicates that a formula type *only* contains IsLiteral
features - no combinations or quantifiers.
Instances
IsAtom atom => JustLiteral (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit | |
(IsFormula (JL a), IsLiteral a) => JustLiteral (JL a) Source # | |
Defined in Data.Logic.ATP.LitWrapper |
Example of a JustLiteral
type.
Instances
IsAtom atom => IsFormula (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit true :: LFormula atom Source # false :: LFormula atom Source # asBool :: LFormula atom -> Maybe Bool Source # atomic :: AtomOf (LFormula atom) -> LFormula atom Source # overatoms :: (AtomOf (LFormula atom) -> r -> r) -> LFormula atom -> r -> r Source # onatoms :: (AtomOf (LFormula atom) -> AtomOf (LFormula atom)) -> LFormula atom -> LFormula atom Source # | |
(IsFormula (LFormula atom), Eq atom, Ord atom) => IsLiteral (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit | |
IsAtom atom => JustLiteral (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit | |
IsAtom atom => HasFixity (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit precedence :: LFormula atom -> Precedence Source # associativity :: LFormula atom -> Associativity Source # | |
Data atom => Data (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LFormula atom -> c (LFormula atom) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LFormula atom) # toConstr :: LFormula atom -> Constr # dataTypeOf :: LFormula atom -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (LFormula atom)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LFormula atom)) # gmapT :: (forall b. Data b => b -> b) -> LFormula atom -> LFormula atom # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LFormula atom -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LFormula atom -> r # gmapQ :: (forall d. Data d => d -> u) -> LFormula atom -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LFormula atom -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LFormula atom -> m (LFormula atom) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LFormula atom -> m (LFormula atom) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LFormula atom -> m (LFormula atom) # | |
Read atom => Read (LFormula atom) Source # | |
Show atom => Show (LFormula atom) Source # | |
Eq atom => Eq (LFormula atom) Source # | |
Ord atom => Ord (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit compare :: LFormula atom -> LFormula atom -> Ordering # (<) :: LFormula atom -> LFormula atom -> Bool # (<=) :: LFormula atom -> LFormula atom -> Bool # (>) :: LFormula atom -> LFormula atom -> Bool # (>=) :: LFormula atom -> LFormula atom -> Bool # | |
IsAtom atom => Pretty (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit pPrintPrec :: PrettyLevel -> Rational -> LFormula atom -> Doc # pPrint :: LFormula atom -> Doc # pPrintList :: PrettyLevel -> [LFormula atom] -> Doc # | |
type AtomOf (LFormula atom) Source # | |
Defined in Data.Logic.ATP.Lit |
negate :: IsLiteral formula => formula -> formula Source #
Negate the formula, avoiding double negation
(.~.) :: IsLiteral formula => formula -> formula infix 6 Source #
Negate the formula, avoiding double negation
(¬) :: IsLiteral formula => formula -> formula infix 6 Source #
Negate the formula, avoiding double negation
foldLiteral :: JustLiteral lit => (lit -> r) -> (Bool -> r) -> (AtomOf lit -> r) -> lit -> r Source #
onatomsLiteral :: JustLiteral lit => (AtomOf lit -> AtomOf lit) -> lit -> lit Source #
Implementation of onatoms
for JustLiteral
types.
overatomsLiteral :: JustLiteral lit => (AtomOf lit -> r -> r) -> lit -> r -> r Source #
implementation of overatoms
for JustLiteral
types.
zipLiterals' :: (IsLiteral lit1, IsLiteral lit2) => (lit1 -> lit2 -> Maybe r) -> (lit1 -> lit2 -> Maybe r) -> (Bool -> Bool -> Maybe r) -> (AtomOf lit1 -> AtomOf lit2 -> Maybe r) -> lit1 -> lit2 -> Maybe r Source #
Combine two literals (internal version).
zipLiterals :: (JustLiteral lit1, JustLiteral lit2) => (lit1 -> lit2 -> Maybe r) -> (Bool -> Bool -> Maybe r) -> (AtomOf lit1 -> AtomOf lit2 -> Maybe r) -> lit1 -> lit2 -> Maybe r Source #
Combine two literals.
convertLiteral :: (JustLiteral lit1, IsLiteral lit2) => (AtomOf lit1 -> AtomOf lit2) -> lit1 -> lit2 Source #
Convert a JustLiteral
instance to any IsLiteral
instance.
convertToLiteral :: (IsLiteral formula, JustLiteral lit) => (formula -> lit) -> (AtomOf formula -> AtomOf lit) -> formula -> lit Source #
Convert any formula to a literal, passing non-IsLiteral structures to the first argument (typically a call to error.)
precedenceLiteral :: JustLiteral lit => lit -> Precedence Source #
associativityLiteral :: JustLiteral lit => lit -> Associativity Source #
prettyLiteral :: JustLiteral lit => PrettyLevel -> Rational -> lit -> Doc Source #
Implementation of pPrint
for -- JustLiteral
types.
showLiteral :: JustLiteral lit => lit -> String Source #
An instance of IsPredicate.
Instances
IsAtom Prop Source # | |
Defined in Data.Logic.ATP.Prop | |
HasFixity Prop Source # | |
Defined in Data.Logic.ATP.Prop precedence :: Prop -> Precedence Source # associativity :: Prop -> Associativity Source # | |
IsString Prop Source # | |
Defined in Data.Logic.ATP.Prop fromString :: String -> Prop # | |
Show Prop Source # | |
Eq Prop Source # | |
Ord Prop Source # | |
Pretty Prop Source # | |
Defined in Data.Logic.ATP.Prop pPrintPrec :: PrettyLevel -> Rational -> Prop -> Doc # pPrintList :: PrettyLevel -> [Prop] -> Doc # |
class IsLiteral formula => IsPropositional formula where Source #
A type class for propositional logic. If the type we are writing an instance for is a zero-order (aka propositional) logic type there will generally by a type or a type parameter corresponding to atom. For first order or predicate logic types, it is generally easiest to just use the formula type itself as the atom type, and raise errors in the implementation if a non-atomic formula somehow appears where an atomic formula is expected (i.e. as an argument to atomic or to the third argument of foldPropositional.)
(.|.) :: formula -> formula -> formula infixl 4 Source #
Disjunction/OR
(.&.) :: formula -> formula -> formula infixl 5 Source #
Conjunction/AND. x .&. y = (.~.) ((.~.) x .|. (.~.) y)
(.<=>.) :: formula -> formula -> formula infixl 2 Source #
Equivalence. x .=. y = (x .=>. y) .&. (y .=>. x)
(.=>.) :: formula -> formula -> formula infixr 3 Source #
Implication. x .=>. y = ((.~.) x .|. y)
:: (formula -> r) | fold on some higher order formula |
-> (formula -> BinOp -> formula -> r) | fold on a binary operation formula. Functions
of this type can be constructed using |
-> (formula -> r) | fold on a negated formula |
-> (Bool -> r) | fold on a boolean formula |
-> (AtomOf formula -> r) | fold on an atomic formula |
-> formula | |
-> r |
A fold function that distributes different sorts of formula to its parameter functions, one to handle binary operators, one for negations, and one for atomic formulas. See examples of its use to implement the polymorphic functions below.
foldCombination :: (formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> (formula -> formula -> r) -> formula -> r Source #
An alternative fold function for binary combinations of formulas
Instances
IsAtom atom => IsPropositional (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop (.|.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.&.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.<=>.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.=>.) :: PFormula atom -> PFormula atom -> PFormula atom Source # foldPropositional' :: (PFormula atom -> r) -> (PFormula atom -> BinOp -> PFormula atom -> r) -> (PFormula atom -> r) -> (Bool -> r) -> (AtomOf (PFormula atom) -> r) -> PFormula atom -> r Source # foldCombination :: (PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> PFormula atom -> r Source # | |
(IsFormula (QFormula v atom), HasApply atom, v ~ TVarOf (TermOf atom)) => IsPropositional (QFormula v atom) Source # | |
Defined in Data.Logic.ATP.Quantified (.|.) :: QFormula v atom -> QFormula v atom -> QFormula v atom Source # (.&.) :: QFormula v atom -> QFormula v atom -> QFormula v atom Source # (.<=>.) :: QFormula v atom -> QFormula v atom -> QFormula v atom Source # (.=>.) :: QFormula v atom -> QFormula v atom -> QFormula v atom Source # foldPropositional' :: (QFormula v atom -> r) -> (QFormula v atom -> BinOp -> QFormula v atom -> r) -> (QFormula v atom -> r) -> (Bool -> r) -> (AtomOf (QFormula v atom) -> r) -> QFormula v atom -> r Source # foldCombination :: (QFormula v atom -> r) -> (QFormula v atom -> QFormula v atom -> r) -> (QFormula v atom -> QFormula v atom -> r) -> (QFormula v atom -> QFormula v atom -> r) -> (QFormula v atom -> QFormula v atom -> r) -> QFormula v atom -> r Source # |
This type is used to construct the first argument of foldPropositional
.
Instances
Data BinOp Source # | |
Defined in Data.Logic.ATP.Prop gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BinOp -> c BinOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BinOp # dataTypeOf :: BinOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BinOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BinOp) # gmapT :: (forall b. Data b => b -> b) -> BinOp -> BinOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r # gmapQ :: (forall d. Data d => d -> u) -> BinOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BinOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BinOp -> m BinOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BinOp -> m BinOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BinOp -> m BinOp # | |
Bounded BinOp Source # | |
Enum BinOp Source # | |
Show BinOp Source # | |
Eq BinOp Source # | |
Ord BinOp Source # | |
class IsPropositional formula => JustPropositional formula Source #
Class that indicates a formula type *only* supports Propositional features - it has no way to represent quantifiers.
Instances
IsAtom atom => JustPropositional (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop |
data TruthTable a Source #
TruthTable [a] [TruthTableRow] |
Instances
Show a => Show (TruthTable a) Source # | |
Defined in Data.Logic.ATP.Prop showsPrec :: Int -> TruthTable a -> ShowS # show :: TruthTable a -> String # showList :: [TruthTable a] -> ShowS # | |
Eq a => Eq (TruthTable a) Source # | |
Defined in Data.Logic.ATP.Prop (==) :: TruthTable a -> TruthTable a -> Bool # (/=) :: TruthTable a -> TruthTable a -> Bool # | |
Pretty atom => Pretty (TruthTable atom) Source # | |
Defined in Data.Logic.ATP.Prop pPrintPrec :: PrettyLevel -> Rational -> TruthTable atom -> Doc # pPrint :: TruthTable atom -> Doc # pPrintList :: PrettyLevel -> [TruthTable atom] -> Doc # |
An instance of IsPropositional.
Instances
IsAtom atom => IsFormula (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop true :: PFormula atom Source # false :: PFormula atom Source # asBool :: PFormula atom -> Maybe Bool Source # atomic :: AtomOf (PFormula atom) -> PFormula atom Source # overatoms :: (AtomOf (PFormula atom) -> r -> r) -> PFormula atom -> r -> r Source # onatoms :: (AtomOf (PFormula atom) -> AtomOf (PFormula atom)) -> PFormula atom -> PFormula atom Source # | |
IsAtom atom => IsLiteral (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop | |
IsAtom atom => HasFixity (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop precedence :: PFormula atom -> Precedence Source # associativity :: PFormula atom -> Associativity Source # | |
IsAtom atom => IsPropositional (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop (.|.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.&.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.<=>.) :: PFormula atom -> PFormula atom -> PFormula atom Source # (.=>.) :: PFormula atom -> PFormula atom -> PFormula atom Source # foldPropositional' :: (PFormula atom -> r) -> (PFormula atom -> BinOp -> PFormula atom -> r) -> (PFormula atom -> r) -> (Bool -> r) -> (AtomOf (PFormula atom) -> r) -> PFormula atom -> r Source # foldCombination :: (PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> (PFormula atom -> PFormula atom -> r) -> PFormula atom -> r Source # | |
IsAtom atom => JustPropositional (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop | |
Data atom => Data (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PFormula atom -> c (PFormula atom) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PFormula atom) # toConstr :: PFormula atom -> Constr # dataTypeOf :: PFormula atom -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PFormula atom)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PFormula atom)) # gmapT :: (forall b. Data b => b -> b) -> PFormula atom -> PFormula atom # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PFormula atom -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PFormula atom -> r # gmapQ :: (forall d. Data d => d -> u) -> PFormula atom -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PFormula atom -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PFormula atom -> m (PFormula atom) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PFormula atom -> m (PFormula atom) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PFormula atom -> m (PFormula atom) # | |
Read atom => Read (PFormula atom) Source # | |
(IsPropositional (PFormula atom), Show atom) => Show (PFormula atom) Source # | |
Eq atom => Eq (PFormula atom) Source # | |
Ord atom => Ord (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop compare :: PFormula atom -> PFormula atom -> Ordering # (<) :: PFormula atom -> PFormula atom -> Bool # (<=) :: PFormula atom -> PFormula atom -> Bool # (>) :: PFormula atom -> PFormula atom -> Bool # (>=) :: PFormula atom -> PFormula atom -> Bool # | |
IsAtom atom => Pretty (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop pPrintPrec :: PrettyLevel -> Rational -> PFormula atom -> Doc # pPrint :: PFormula atom -> Doc # pPrintList :: PrettyLevel -> [PFormula atom] -> Doc # | |
type AtomOf (PFormula atom) Source # | |
Defined in Data.Logic.ATP.Prop |
(==>) :: IsPropositional formula => formula -> formula -> formula infixr 3 Source #
Implication synonyms. Note that if the -XUnicodeSyntax option is turned on the operator ⇒ can not be declared/used as a function - it becomes a reserved special character used in type signatures.
(⇒) :: IsPropositional formula => formula -> formula -> formula infixr 3 Source #
Implication synonyms. Note that if the -XUnicodeSyntax option is turned on the operator ⇒ can not be declared/used as a function - it becomes a reserved special character used in type signatures.
(→) :: IsPropositional formula => formula -> formula -> formula infixr 3 Source #
Implication synonyms. Note that if the -XUnicodeSyntax option is turned on the operator ⇒ can not be declared/used as a function - it becomes a reserved special character used in type signatures.
binop :: IsPropositional formula => formula -> BinOp -> formula -> formula Source #
Combine formulas with a BinOp
, for use building the first
argument of foldPropositional
.
(⊃) :: IsPropositional formula => formula -> formula -> formula infixr 3 Source #
Implication synonyms. Note that if the -XUnicodeSyntax option is turned on the operator ⇒ can not be declared/used as a function - it becomes a reserved special character used in type signatures.
(⇔) :: IsPropositional formula => formula -> formula -> formula infixl 2 Source #
If-and-only-if synonyms
(<=>) :: IsPropositional formula => formula -> formula -> formula infixl 2 Source #
If-and-only-if synonyms
(↔) :: IsPropositional formula => formula -> formula -> formula infixl 2 Source #
If-and-only-if synonyms
(<==>) :: IsPropositional formula => formula -> formula -> formula infixl 2 Source #
If-and-only-if synonyms
(∧) :: IsPropositional formula => formula -> formula -> formula infixl 5 Source #
And/conjunction synonyms
(·) :: IsPropositional formula => formula -> formula -> formula infixl 5 Source #
And/conjunction synonyms
(∨) :: IsPropositional formula => formula -> formula -> formula infixl 4 Source #
Or/disjunction synonyms
:: JustPropositional pf | |
=> (pf -> BinOp -> pf -> r) | fold on a binary operation formula |
-> (pf -> r) | fold on a negated formula |
-> (Bool -> r) | fold on a boolean formula |
-> (AtomOf pf -> r) | fold on an atomic formula |
-> pf | |
-> r |
Deconstruct a JustPropositional
formula.
:: (JustPropositional pf1, JustPropositional pf2) | |
=> (pf1 -> BinOp -> pf1 -> pf2 -> BinOp -> pf2 -> Maybe r) | Combine two binary operation formulas |
-> (pf1 -> pf2 -> Maybe r) | Combine two negated formulas |
-> (Bool -> Bool -> Maybe r) | Combine two boolean formulas |
-> (AtomOf pf1 -> AtomOf pf2 -> Maybe r) | Combine two atomic formulas |
-> pf1 | |
-> pf2 | |
-> Maybe r | Result is Nothing if the formulas don't unify |
Combine two JustPropositional
formulas if they are similar.
:: (JustPropositional pf1, IsPropositional pf2) | |
=> (AtomOf pf1 -> AtomOf pf2) | Convert an atomic formula |
-> pf1 | |
-> pf2 |
Convert any instance of JustPropositional
to any IsPropositional
formula.
convertToPropositional Source #
:: (IsPropositional formula, JustPropositional pf) | |
=> (formula -> pf) | Convert a higher order formula |
-> (AtomOf formula -> AtomOf pf) | Convert an atomic formula |
-> formula | |
-> pf |
Convert any instance of IsPropositional
to a JustPropositional
formula. Typically the
ho (higher order) argument calls error if it encounters something it can't handle.
precedencePropositional :: JustPropositional pf => pf -> Precedence Source #
Implementation of precedence
for any JustPropostional
type.
associativityPropositional :: JustPropositional pf => pf -> Associativity Source #
prettyPropositional :: forall pf. JustPropositional pf => Side -> PrettyLevel -> Rational -> pf -> Doc Source #
Implementation of pPrint
for any JustPropostional
type.
showPropositional :: JustPropositional pf => Side -> Int -> pf -> ShowS Source #
Implementation of show
for any JustPropositional
type. For clarity, show methods fully parenthesize
onatomsPropositional :: JustPropositional pf => (AtomOf pf -> AtomOf pf) -> pf -> pf Source #
Implementation of onatoms
for any JustPropositional
type.
overatomsPropositional :: JustPropositional pf => (AtomOf pf -> r -> r) -> pf -> r -> r Source #
Implementation of overatoms
for any JustPropositional
type.
eval :: JustPropositional pf => pf -> (AtomOf pf -> Bool) -> Bool Source #
Interpretation of formulas.
atoms :: IsFormula formula => formula -> Set (AtomOf formula) Source #
Return the set of propositional variables in a formula.
onallvaluations :: Ord atom => (r -> r -> r) -> ((atom -> Bool) -> r) -> (atom -> Bool) -> Set atom -> r Source #
truthTable :: JustPropositional pf => pf -> TruthTable (AtomOf pf) Source #
Code to print out truth tables.
tautology :: JustPropositional pf => pf -> Bool Source #
Recognizing tautologies.
unsatisfiable :: JustPropositional pf => pf -> Bool Source #
Related concepts.
satisfiable :: JustPropositional pf => pf -> Bool Source #
psubst :: JustPropositional formula => Map (AtomOf formula) formula -> formula -> formula Source #
Substitution operation.
dual :: JustPropositional pf => pf -> pf Source #
Dualization.
psimplify :: IsPropositional formula => formula -> formula Source #
Routine simplification.
psimplify1 :: IsPropositional formula => formula -> formula Source #
nenf :: IsPropositional formula => formula -> formula Source #
list_conj :: (Foldable t, IsFormula formula, IsPropositional formula) => t formula -> formula Source #
Disjunctive normal form (DNF) via truth tables.
list_disj :: (Foldable t, IsFormula formula, IsPropositional formula) => t formula -> formula Source #
allsatvaluations :: Ord atom => ((atom -> Bool) -> Bool) -> (atom -> Bool) -> Set atom -> [atom -> Bool] Source #
dnfSet :: (JustPropositional pf, Ord pf) => pf -> pf Source #
purednf :: (JustPropositional pf, IsLiteral lit, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit) Source #
simpdnf :: (JustPropositional pf, IsLiteral lit, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit) Source #
With subsumption checking, done very naively (quadratic).
rawdnf :: IsPropositional formula => formula -> formula Source #
dnf :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf Source #
Mapping back to a formula.
purecnf :: (JustPropositional pf, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit) Source #
Conjunctive normal form (CNF) by essentially the same code. (p. 60)
simpcnf :: (JustPropositional pf, JustLiteral lit, Ord lit) => (AtomOf pf -> AtomOf lit) -> pf -> Set (Set lit) Source #
cnf' :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf Source #
cnf_ :: (IsPropositional pf, Ord pf, JustLiteral lit) => (AtomOf lit -> AtomOf pf) -> Set (Set lit) -> pf Source #
trivial :: (Ord lit, IsLiteral lit) => Set lit -> Bool Source #
Filtering out trivial disjuncts (in this guise, contradictory).
Instances
NumAtom (Knows Integer) Source # | |
IsAtom (Knows Integer) Source # | |
Defined in Data.Logic.ATP.PropExamples | |
Num a => HasFixity (Knows a) Source # | |
Defined in Data.Logic.ATP.PropExamples precedence :: Knows a -> Precedence Source # associativity :: Knows a -> Associativity Source # | |
Show a => Show (Knows a) Source # | |
Eq a => Eq (Knows a) Source # | |
Ord a => Ord (Knows a) Source # | |
Defined in Data.Logic.ATP.PropExamples | |
(Num a, Show a) => Pretty (Knows a) Source # | |
Defined in Data.Logic.ATP.PropExamples pPrintPrec :: PrettyLevel -> Rational -> Knows a -> Doc # pPrintList :: PrettyLevel -> [Knows a] -> Doc # |
mk_knows2 :: (IsPropositional formula, AtomOf formula ~ Knows a) => String -> a -> a -> formula Source #
prime :: (IsPropositional formula, Ord formula, AtomOf formula ~ Knows Integer) => Integer -> formula Source #
ramsey :: (IsPropositional pf, AtomOf pf ~ Knows Integer, Ord pf) => Integer -> Integer -> Integer -> pf Source #
Generate assertion equivalent to R(s,t) <= n for the Ramsey number R(s,t)
module Data.Logic.ATP.DefCNF
module Data.Logic.ATP.DP
module Data.Logic.ATP.Term
module Data.Logic.ATP.Apply
module Data.Logic.ATP.Equate
module Data.Logic.ATP.Quantified
module Data.Logic.ATP.Parser
module Data.Logic.ATP.FOL
module Data.Logic.ATP.Skolem
module Data.Logic.ATP.Herbrand
module Data.Logic.ATP.Unif
tab :: (IsFirstOrder formula, Unify Failing (atom, atom), term ~ UTermOf (atom, atom), Pretty formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => Maybe Depth -> formula -> Failing ((K, Map v term), Depth) Source #
prawitz :: forall formula atom term function v. (IsFirstOrder formula, Ord formula, Unify Failing (atom, atom), term ~ UTermOf (atom, atom), HasSkolem function, Show formula, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> Int Source #
testTableaux :: Test Source #
module Data.Logic.ATP.Resolution
module Data.Logic.ATP.Prolog
module Data.Logic.ATP.Meson
module Data.Logic.ATP.Equal
Rendering mode.
PageMode | Normal rendering ( |
ZigZagMode | With zig-zag cuts. |
LeftMode | No indentation, infinitely long lines ( |
OneLineMode | All on one line, |
Instances
Generic Mode | |
Show Mode | |
Eq Mode | |
type Rep Mode | |
Defined in Text.PrettyPrint.Annotated.HughesPJ type Rep Mode = D1 ('MetaData "Mode" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6" 'False) ((C1 ('MetaCons "PageMode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ZigZagMode" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "LeftMode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OneLineMode" 'PrefixI 'False) (U1 :: Type -> Type))) |
A rendering style. Allows us to specify constraints to choose among the many different rendering options.
Style | |
|
Instances
Generic Style | |
Show Style | |
Eq Style | |
type Rep Style | |
Defined in Text.PrettyPrint.Annotated.HughesPJ type Rep Style = D1 ('MetaData "Style" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6" 'False) (C1 ('MetaCons "Style" 'PrefixI 'True) (S1 ('MetaSel ('Just "mode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mode) :*: (S1 ('MetaSel ('Just "lineLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "ribbonsPerLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)))) |
data TextDetails #
A TextDetails represents a fragment of text that will be output at some
point in a Doc
.
Chr !Char | A single Char fragment |
Str String | A whole String fragment |
PStr String | Used to represent a Fast String fragment but now deprecated and identical to the Str constructor. |
Instances
The abstract type of documents. A Doc represents a set of layouts. A Doc with no occurrences of Union or NoDoc represents just one layout.
Pretty printing class. The precedence level is used in a similar way as in
the Show
class. Minimal complete definition is either pPrintPrec
or
pPrint
.
pPrintPrec :: PrettyLevel -> Rational -> a -> Doc #
pPrintList :: PrettyLevel -> [a] -> Doc #
Instances
newtype PrettyLevel #
Level of detail in the pretty printed output. Level 0 is the least detail.
Instances
Show PrettyLevel | |
Defined in Text.PrettyPrint.HughesPJClass showsPrec :: Int -> PrettyLevel -> ShowS # show :: PrettyLevel -> String # showList :: [PrettyLevel] -> ShowS # | |
Eq PrettyLevel | |
Defined in Text.PrettyPrint.HughesPJClass (==) :: PrettyLevel -> PrettyLevel -> Bool # (/=) :: PrettyLevel -> PrettyLevel -> Bool # | |
Ord PrettyLevel | |
Defined in Text.PrettyPrint.HughesPJClass compare :: PrettyLevel -> PrettyLevel -> Ordering # (<) :: PrettyLevel -> PrettyLevel -> Bool # (<=) :: PrettyLevel -> PrettyLevel -> Bool # (>) :: PrettyLevel -> PrettyLevel -> Bool # (>=) :: PrettyLevel -> PrettyLevel -> Bool # max :: PrettyLevel -> PrettyLevel -> PrettyLevel # min :: PrettyLevel -> PrettyLevel -> PrettyLevel # |
first
returns its first argument if it is non-empty, otherwise its second.
zeroWidthText :: String -> Doc #
Some text, but without any width. Use for non-printing text such as a HTML or Latex tags
maybeDoubleQuotes :: Bool -> Doc -> Doc #
Apply doubleQuotes
to Doc
if boolean is true.
Nest (or indent) a document by a given number of positions
(which may also be negative). nest
satisfies the laws:
nest
0 x = xnest
k (nest
k' x) =nest
(k+k') xnest
k (x<>
y) =nest
k x<>
nest
k ynest
k (x$$
y) =nest
k x$$
nest
k ynest
kempty
=empty
x
, if<>
nest
k y = x<>
yx
non-empty
The side condition on the last law is needed because
empty
is a left identity for <>
.
punctuate :: Doc -> [Doc] -> [Doc] #
punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn]
($$) :: Doc -> Doc -> Doc infixl 5 #
Above, except that if the last line of the first argument stops at least one position before the first line of the second begins, these two lines are overlapped. For example:
text "hi" $$ nest 5 (text "there")
lays out as
hi there
rather than
hi there
renderStyle :: Style -> Doc -> String #
Render the Doc
to a String using the given Style
.
:: Mode | Rendering mode. |
-> Int | Line length. |
-> Float | Ribbons per line. |
-> (TextDetails -> a -> a) | What to do with text. |
-> a | What to do at the end. |
-> Doc | The document. |
-> a | Result. |
The general rendering interface. Please refer to the Style
and Mode
types for a description of rendering mode, line length and ribbons.
The "normal" (Level 0) of detail.
prettyShow :: Pretty a => a -> String #
Pretty print a value with the prettyNormal
level.
prettyParen :: Bool -> Doc -> Doc #
Parenthesize an value if the boolean is true.
module Test.HUnit