atp-0.1.0.0: Interface to automated theorem provers
Copyright(c) Evgenii Kotelnikov 2019-2021
LicenseGPL-3
Maintainerevgeny.kotelnikov@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

ATP.FOL

Description

Data structures that represent formulas and theorems in first-order logic, and smart constructors for them.

Synopsis

First-order logic

type Var = Integer Source #

The type of variables in first-order formulas.

data Term Source #

The term in first-order logic.

Constructors

Variable Var

A quantified variable.

Function FunctionSymbol [Term]

Application of a function symbol. The empty list of arguments represents a constant.

Instances

Instances details
Eq Term Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Term -> Term -> Bool #

(/=) :: Term -> Term -> Bool #

Ord Term Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

compare :: Term -> Term -> Ordering #

(<) :: Term -> Term -> Bool #

(<=) :: Term -> Term -> Bool #

(>) :: Term -> Term -> Bool #

(>=) :: Term -> Term -> Bool #

max :: Term -> Term -> Term #

min :: Term -> Term -> Term #

Show Term Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

showsPrec :: Int -> Term -> ShowS #

show :: Term -> String #

showList :: [Term] -> ShowS #

IsString Term Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fromString :: String -> Term #

Pretty Term Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Term -> Doc #

prettyList :: [Term] -> Doc #

FirstOrder Term Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Binder b => Binder (Term -> b) Source #

The recursive instance for polyvariadic bindings of quantified variables. This is a generalized version of https://emilaxelsson.github.io/documents/axelsson2013using.pdf.

Instance details

Defined in ATP.FirstOrder.Smart

Methods

quantified :: Quantifier -> (Term -> b) -> Formula Source #

data Literal Source #

The literal in first-order logic.

Constructors

Propositional Bool

A logical constant - tautology or falsum.

Predicate PredicateSymbol [Term]

Application of a predicate symbol. The empty list of arguments represents a boolean constant.

Equality Term Term

Equality between terms.

Instances

Instances details
Eq Literal Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Literal -> Literal -> Bool #

(/=) :: Literal -> Literal -> Bool #

Ord Literal Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show Literal Source # 
Instance details

Defined in ATP.FirstOrder.Core

IsString Literal Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fromString :: String -> Literal #

Pretty Literal Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Literal -> Doc #

prettyList :: [Literal] -> Doc #

FirstOrder Literal Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Pretty (Signed Literal) Source # 
Instance details

Defined in ATP.Pretty.FOL

data Sign Source #

The sign of a logical expression is either positive or negative.

Constructors

Positive 
Negative 

Instances

Instances details
Bounded Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Enum Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

succ :: Sign -> Sign #

pred :: Sign -> Sign #

toEnum :: Int -> Sign #

fromEnum :: Sign -> Int #

enumFrom :: Sign -> [Sign] #

enumFromThen :: Sign -> Sign -> [Sign] #

enumFromTo :: Sign -> Sign -> [Sign] #

enumFromThenTo :: Sign -> Sign -> Sign -> [Sign] #

Eq Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Sign -> Sign -> Bool #

(/=) :: Sign -> Sign -> Bool #

Ord Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

compare :: Sign -> Sign -> Ordering #

(<) :: Sign -> Sign -> Bool #

(<=) :: Sign -> Sign -> Bool #

(>) :: Sign -> Sign -> Bool #

(>=) :: Sign -> Sign -> Bool #

max :: Sign -> Sign -> Sign #

min :: Sign -> Sign -> Sign #

Show Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

showsPrec :: Int -> Sign -> ShowS #

show :: Sign -> String #

showList :: [Sign] -> ShowS #

Semigroup Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(<>) :: Sign -> Sign -> Sign #

sconcat :: NonEmpty Sign -> Sign #

stimes :: Integral b => b -> Sign -> Sign #

Monoid Sign Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

mempty :: Sign #

mappend :: Sign -> Sign -> Sign #

mconcat :: [Sign] -> Sign #

data Signed e Source #

A signed expression is that annotated with a Sign.

Constructors

Signed 

Fields

Instances

Instances details
Monad Signed Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(>>=) :: Signed a -> (a -> Signed b) -> Signed b #

(>>) :: Signed a -> Signed b -> Signed b #

return :: a -> Signed a #

Functor Signed Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fmap :: (a -> b) -> Signed a -> Signed b #

(<$) :: a -> Signed b -> Signed a #

Applicative Signed Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

pure :: a -> Signed a #

(<*>) :: Signed (a -> b) -> Signed a -> Signed b #

liftA2 :: (a -> b -> c) -> Signed a -> Signed b -> Signed c #

(*>) :: Signed a -> Signed b -> Signed b #

(<*) :: Signed a -> Signed b -> Signed a #

Foldable Signed Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fold :: Monoid m => Signed m -> m #

foldMap :: Monoid m => (a -> m) -> Signed a -> m #

foldMap' :: Monoid m => (a -> m) -> Signed a -> m #

foldr :: (a -> b -> b) -> b -> Signed a -> b #

foldr' :: (a -> b -> b) -> b -> Signed a -> b #

foldl :: (b -> a -> b) -> b -> Signed a -> b #

foldl' :: (b -> a -> b) -> b -> Signed a -> b #

foldr1 :: (a -> a -> a) -> Signed a -> a #

foldl1 :: (a -> a -> a) -> Signed a -> a #

toList :: Signed a -> [a] #

null :: Signed a -> Bool #

length :: Signed a -> Int #

elem :: Eq a => a -> Signed a -> Bool #

maximum :: Ord a => Signed a -> a #

minimum :: Ord a => Signed a -> a #

sum :: Num a => Signed a -> a #

product :: Num a => Signed a -> a #

Traversable Signed Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

traverse :: Applicative f => (a -> f b) -> Signed a -> f (Signed b) #

sequenceA :: Applicative f => Signed (f a) -> f (Signed a) #

mapM :: Monad m => (a -> m b) -> Signed a -> m (Signed b) #

sequence :: Monad m => Signed (m a) -> m (Signed a) #

Eq e => Eq (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Signed e -> Signed e -> Bool #

(/=) :: Signed e -> Signed e -> Bool #

Ord e => Ord (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

compare :: Signed e -> Signed e -> Ordering #

(<) :: Signed e -> Signed e -> Bool #

(<=) :: Signed e -> Signed e -> Bool #

(>) :: Signed e -> Signed e -> Bool #

(>=) :: Signed e -> Signed e -> Bool #

max :: Signed e -> Signed e -> Signed e #

min :: Signed e -> Signed e -> Signed e #

Show e => Show (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

showsPrec :: Int -> Signed e -> ShowS #

show :: Signed e -> String #

showList :: [Signed e] -> ShowS #

IsString e => IsString (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fromString :: String -> Signed e #

Pretty (Signed Literal) Source # 
Instance details

Defined in ATP.Pretty.FOL

FirstOrder e => FirstOrder (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Methods

vars :: Signed e -> Set Var Source #

free :: Signed e -> Set Var Source #

bound :: Signed e -> Set Var Source #

occursIn :: Var -> Signed e -> Bool Source #

freeIn :: Var -> Signed e -> Bool Source #

boundIn :: Var -> Signed e -> Bool Source #

ground :: Signed e -> Bool Source #

(~=) :: Signed e -> Signed e -> Bool Source #

(?=) :: Signed e -> Signed e -> Alpha Bool Source #

alpha :: forall (m :: Type -> Type). MonadAlpha m => Signed e -> AlphaT m (Signed e) Source #

sign :: Sign -> Signed e -> Signed e Source #

Juxtapose a given signed expression with a given sign.

newtype Clause Source #

The first-order clause - an implicitly universally-quantified disjunction of positive or negative literals, represented as a list of signed literals. The empty clause is logically equivalent to falsum.

Constructors

Literals 

Instances

Instances details
Eq Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Clause -> Clause -> Bool #

(/=) :: Clause -> Clause -> Bool #

Ord Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

IsString Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fromString :: String -> Clause #

Semigroup Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

Monoid Clause Source # 
Instance details

Defined in ATP.FirstOrder.Core

Pretty Clause Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Clause -> Doc #

prettyList :: [Clause] -> Doc #

FirstOrder Clause Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Simplify Clause Source #

Simplify the given clause by replacing the Literals constructor with the smart constructor clause. The effects of simplification are the following.

  • simplify c does not contain negative constant literals.
  • simplify c does not contain falsum literals.
  • simplify c does not contain redundant tautology literals.
>>> simplify (UnitClause (Signed Negative (Propositional True)))
Literals {getLiterals = []}
>>> simplify (Literals [FalsityLiteral, Signed Positive (Predicate "p" [])])
Literals {getLiterals = [Signed {signof = Positive, unsign = Predicate (PredicateSymbol "p") []}]}
>>> simplify (Literals [TautologyLiteral, Signed Positive (Predicate "p" [])])
Literals {getLiterals = [Signed {signof = Positive, unsign = Propositional True}]}
Instance details

Defined in ATP.FirstOrder.Simplification

newtype Clauses Source #

A clause set is zero or more first-order clauses. The empty clause set is logically equivalent to tautology.

Constructors

Clauses 

Fields

Instances

Instances details
Eq Clauses Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Clauses -> Clauses -> Bool #

(/=) :: Clauses -> Clauses -> Bool #

Ord Clauses Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show Clauses Source # 
Instance details

Defined in ATP.FirstOrder.Core

Semigroup Clauses Source # 
Instance details

Defined in ATP.FirstOrder.Core

Monoid Clauses Source # 
Instance details

Defined in ATP.FirstOrder.Core

Pretty Clauses Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Clauses -> Doc #

prettyList :: [Clauses] -> Doc #

Simplify Clauses Source #

Simplify the given clause set by replacing the Clauses constructor with the smart constructor clauses. The effects of simplification are the following.

  • simplify c does not contain negative constant literals.
  • simplify c does not contain falsum literals.
  • simplify c does not contain tautology literals.
  • simplify c does not contain redundant falsum literals.
>>> simplify (SingleClause (UnitClause (Signed Negative (Propositional True))))
Clauses {getClauses = [Literals {getLiterals = []}]}
>>> simplify (SingleClause (Literals [FalsityLiteral, Signed Positive (Predicate "p" [])]))
Clauses {getClauses = [Literals {getLiterals = [Signed {signof = Positive, unsign = Predicate (PredicateSymbol "p") []}]}]}
>>> simplify (SingleClause (Literals [TautologyLiteral, Signed Positive (Predicate "p" [])]))
Clauses {getClauses = []}
Instance details

Defined in ATP.FirstOrder.Simplification

data Connective Source #

The binary logical connective.

Constructors

And

Conjunction.

Or

Disjunction.

Implies

Implication.

Equivalent

Equivalence.

Xor

Exclusive or.

isAssociative :: Connective -> Bool Source #

Associativity of a given binary logical connective.

>>> isAssociative Implies
False
>>> isAssociative And
True

data Quantifier Source #

The quantifier in first-order logic.

Constructors

Forall

The universal quantifier.

Exists

The existential quantifier.

data Formula Source #

The formula in first-order logic.

Instances

Instances details
Eq Formula Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Formula -> Formula -> Bool #

(/=) :: Formula -> Formula -> Bool #

Ord Formula Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show Formula Source # 
Instance details

Defined in ATP.FirstOrder.Core

IsString Formula Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

fromString :: String -> Formula #

Pretty Formula Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Formula -> Doc #

prettyList :: [Formula] -> Doc #

FirstOrder Formula Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Binder Formula Source #

The degenerate instance - no variable is bound.

Instance details

Defined in ATP.FirstOrder.Smart

Simplify Formula Source #

Simplify the given formula by replacing each of its constructors with corresponding smart constructors. The effects of simplification are the following.

  • simplify f does not contain nested negations.
  • simplify f does not contain some of the constant atomic formulas from f.
  • All chained applications of any binary connective inside simplify f are right-associative.

Any formula built only using smart constructors is simplified by construction.

>>> simplify (Connected Or tautology (Atomic (Predicate "p" [])))
Atomic (Propositional True)
>>> simplify (Negate (Negate (Atomic (Predicate "p" []))))
Atomic (Predicate "p" [])
>>> simplify (Connected And (Connected And (Atomic (Predicate "p" [])) (Atomic (Predicate "q" []))) (Atomic (Predicate "r" [])))
Connected And (Atomic (Predicate "p" [])) (Connected And (Atomic (Predicate "q" [])) (Atomic (Predicate "r" [])))
Instance details

Defined in ATP.FirstOrder.Simplification

Binder (Var, Formula) Source #

The trivial instance - binder of the varible with the given name.

Instance details

Defined in ATP.FirstOrder.Smart

data LogicalExpression Source #

A logical expression is either a clause or a formula.

Constructors

Clause Clause 
Formula Formula 

Instances

Instances details
Eq LogicalExpression Source # 
Instance details

Defined in ATP.FirstOrder.Core

Ord LogicalExpression Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show LogicalExpression Source # 
Instance details

Defined in ATP.FirstOrder.Core

Pretty LogicalExpression Source # 
Instance details

Defined in ATP.Pretty.FOL

FirstOrder LogicalExpression Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Simplify LogicalExpression Source #

Simplify the given formula by replacing each of its constructors with corresponding smart constructors.

Instance details

Defined in ATP.FirstOrder.Simplification

data Theorem Source #

A theorem is zero or more axioms and a conjecture.

Constructors

Theorem 

Fields

Instances

Instances details
Eq Theorem Source # 
Instance details

Defined in ATP.FirstOrder.Core

Methods

(==) :: Theorem -> Theorem -> Bool #

(/=) :: Theorem -> Theorem -> Bool #

Ord Theorem Source # 
Instance details

Defined in ATP.FirstOrder.Core

Show Theorem Source # 
Instance details

Defined in ATP.FirstOrder.Core

Pretty Theorem Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Theorem -> Doc #

prettyList :: [Theorem] -> Doc #

Simplify Theorem Source #

Simplify the given theorem by flattening the conjunction of its premises and its conjecture.

Instance details

Defined in ATP.FirstOrder.Simplification

Syntactic sugar

Instances, type synonyms and pattern synonyms for syntactic convenience.

type Function = [Term] -> Term Source #

The type of a function symbol - a mapping from zero or more terms to a term.

type Constant = Term Source #

The type of a constant symbol.

type UnaryFunction = Term -> Term Source #

The type of a function symbol with one argument.

type BinaryFunction = Term -> Term -> Term Source #

The type of a function symbol with two arguments.

type TernaryFunction = Term -> Term -> Term -> Term Source #

The type of a function symbol with three arguments.

pattern Constant :: FunctionSymbol -> Constant Source #

Build a proposition from a predicate symbol.

pattern UnaryFunction :: FunctionSymbol -> UnaryFunction Source #

Build a unary function from a function symbol.

pattern BinaryFunction :: FunctionSymbol -> BinaryFunction Source #

Build a binary function from a function symbol.

pattern TernaryFunction :: FunctionSymbol -> TernaryFunction Source #

Build a ternary function from a function symbol.

type Predicate = [Term] -> Formula Source #

The type of a predicate symbol - a mapping from zero or more terms to a formula.

type Proposition = Formula Source #

The type of a proposition.

type UnaryPredicate = Term -> Formula Source #

The type of a predicate symbol with one argument.

type BinaryPredicate = Term -> Term -> Formula Source #

The type of a predicate symbol with two arguments.

type TernaryPredicate = Term -> Term -> Term -> Formula Source #

The type of a function symbol with three arguments.

pattern Proposition :: PredicateSymbol -> Proposition Source #

Build a proposition from a predicate symbol.

pattern UnaryPredicate :: PredicateSymbol -> UnaryPredicate Source #

Build a unary predicate from a predicate symbol.

pattern BinaryPredicate :: PredicateSymbol -> BinaryPredicate Source #

Build a binary predicate from a predicate symbol.

pattern TernaryPredicate :: PredicateSymbol -> TernaryPredicate Source #

Build a ternary predicate from a predicate symbol.

pattern TautologyLiteral :: Signed Literal Source #

The positive tautology literal.

pattern FalsityLiteral :: Signed Literal Source #

The positive falsity literal.

pattern EmptyClause :: Clause Source #

The empty clause. EmptyClause is semantically (but not syntactically) equivalent to Falsity.

pattern UnitClause :: Signed Literal -> Clause Source #

The unit clause.

pattern TautologyClause :: Clause Source #

A unit clause with a single positive tautology literal. TautologyClause is semantically (but not syntactically) equivalent to Tautology.

pattern NoClauses :: Clauses Source #

The set of clauses with a single clause in it.

pattern SingleClause :: Clause -> Clauses Source #

The set of clauses with a single clause in it.

pattern Tautology :: Formula Source #

The logical tautology.

pattern Falsity :: Formula Source #

The logical false. Falsity is semantically (but not syntactically) equivalent to EmptyClause.

pattern Claim :: Formula -> Theorem Source #

A logical claim is a conjecture entailed by the empty set of axioms.

data AlphaT m a Source #

The monad transformer that adds to the given monad m the ability to track a renaming of free and bound variables in a first-order expression.

Instances

Instances details
MonadTrans AlphaT Source # 
Instance details

Defined in ATP.FirstOrder.Alpha

Methods

lift :: Monad m => m a -> AlphaT m a #

Monad m => Monad (AlphaT m) Source # 
Instance details

Defined in ATP.FirstOrder.Alpha

Methods

(>>=) :: AlphaT m a -> (a -> AlphaT m b) -> AlphaT m b #

(>>) :: AlphaT m a -> AlphaT m b -> AlphaT m b #

return :: a -> AlphaT m a #

Functor m => Functor (AlphaT m) Source # 
Instance details

Defined in ATP.FirstOrder.Alpha

Methods

fmap :: (a -> b) -> AlphaT m a -> AlphaT m b #

(<$) :: a -> AlphaT m b -> AlphaT m a #

Monad m => Applicative (AlphaT m) Source # 
Instance details

Defined in ATP.FirstOrder.Alpha

Methods

pure :: a -> AlphaT m a #

(<*>) :: AlphaT m (a -> b) -> AlphaT m a -> AlphaT m b #

liftA2 :: (a -> b -> c) -> AlphaT m a -> AlphaT m b -> AlphaT m c #

(*>) :: AlphaT m a -> AlphaT m b -> AlphaT m b #

(<*) :: AlphaT m a -> AlphaT m b -> AlphaT m a #

evalAlphaT :: Monad m => AlphaT m a -> m a Source #

Evaluate an alpha computation and return the final value, discarding the global scope.

type Alpha a = AlphaT Identity a Source #

The alpha monad parametrized by the type a of the return value.

evalAlpha :: Alpha a -> a Source #

Evaluate an Alpha computation and return the final value, discarding the final variable renaming.

lookup :: Monad m => Var -> AlphaT m (Maybe Var) Source #

Lookup a variable, first in the stack of bound variables, then in the global scope.

scope :: Monad m => AlphaT m [Var] Source #

Read the set of free and bound variables of the given AlphaT computation.

enter :: Monad m => Var -> Var -> AlphaT m a -> AlphaT m a Source #

Run a computation inside AlphaT with the variable renaming.

share :: Monad m => Var -> Var -> AlphaT m () Source #

Update the global scope with a variable renaming.

class Monad m => MonadAlpha m where Source #

A helper monad for computations on free and bound occurrences of variables.

Methods

binding :: Var -> AlphaT m Var Source #

A monadic action to perform on a variable under a quantifier.

occurrence :: Var -> AlphaT m Var Source #

A monadic action to perform on a variable occurrence.

Smart constructors

signed :: Sign -> Literal -> Signed Literal Source #

A smart constructor for a signed literal.

unitClause :: Signed Literal -> Clause Source #

A smart constructor for a unit clause.

clause :: Foldable f => f (Signed Literal) -> Clause Source #

A smart contructor for a clause. clause eliminates negated boolean constants, falsums and redundant tautologies.

singleClause :: Clause -> Clauses Source #

A smart constructor for a set of clauses with a single clause in it.

clauses :: Foldable f => f Clause -> Clauses Source #

A smart constructor for the set of clauses. clauses eliminates negated boolean constants, falsums and redundant tautologies.

(===) :: Term -> Term -> Formula infix 8 Source #

A smart constructor for equality.

(=/=) :: Term -> Term -> Formula infix 8 Source #

A smart constructor for inequality.

neg :: Formula -> Formula Source #

A smart constructor for negation.

(\/) :: Formula -> Formula -> Formula infixl 6 Source #

A smart constructor for the Or connective. (\/) has the following properties.

Associativity

(f \/ g) \/ h == f \/ (g \/ h)

Left identity

Falsity \/ g == g

Right identity

f \/ Falsity == f

Left zero

Tautology \/ g == Tautology

Right zero

f \/ Tautology == Tautology

(/\) :: Formula -> Formula -> Formula infixl 7 Source #

A smart contructor for the And connective. (/\) has the following properties.

Associativity

(f /\ g) /\ h == f /\ (g /\ h)

Left identity

Tautology /\ g == g

Right identity

f /\ Tautology == f

Left zero

Falsity /\ g == Falsity

Right zero

f /\ Falsity == Falsity

(==>) :: Formula -> Formula -> Formula infix 5 Source #

A smart constructor for the Implies connective.

(<=>) :: Formula -> Formula -> Formula infixl 5 Source #

A smart constructor for the Equivalent connective. (<=>) has the following properties.

Associativity

(f <=> g) <=> h == f <=> (g <=> h)

Left identity

Tautology <=> g == g

Right identity

f <=> Tautology == f

(<~>) :: Formula -> Formula -> Formula infixl 5 Source #

A smart constructor for the Xor connective. (<~>) has the following properties.

Associativity

(f <~> g) <~> h == f <~> (g <~> h)

Left identity

Falsity <~> g == g

Right identity

f <~> Falsity == f

class Binder b where Source #

A class of binders for quantified variables.

This class and its instances provides machinery for using polyvariadic functions as higher-order abstract syntax for bindings of quantified variables.

eq = binaryPredicate "eq"
>>> quantified Forall $ \x -> x `eq` x
Quantified Forall 1 (Atomic (Predicate "eq" [Variable 1,Variable 1]))
>>> quantified Forall $ \x y -> x `eq` y ==> y `eq` x
Quantified Forall 2 (Quantified Forall 1 (Connected Implies (Atomic (Predicate "eq" [Variable 2,Variable 1])) (Atomic (Predicate "eq" [Variable 1,Variable 2]))))

Methods

quantified :: Quantifier -> b -> Formula Source #

A smart constructor for quantified formulas.

Instances

Instances details
Binder Formula Source #

The degenerate instance - no variable is bound.

Instance details

Defined in ATP.FirstOrder.Smart

Binder b => Binder (Term -> b) Source #

The recursive instance for polyvariadic bindings of quantified variables. This is a generalized version of https://emilaxelsson.github.io/documents/axelsson2013using.pdf.

Instance details

Defined in ATP.FirstOrder.Smart

Methods

quantified :: Quantifier -> (Term -> b) -> Formula Source #

Binder (Var, Formula) Source #

The trivial instance - binder of the varible with the given name.

Instance details

Defined in ATP.FirstOrder.Smart

forall :: Binder b => b -> Formula Source #

A smart constructor for universally quantified formulas. Provides a polyvariadic higher-order abstract syntax for the bindings of universally quantified variables.

exists :: Binder b => b -> Formula Source #

A smart constructor for existentially quantified formulas. Provides a polyvariadic higher-order abstract syntax for the bindings of existentially quantified variables.

(|-) :: Foldable f => f Formula -> Formula -> Theorem infix 2 Source #

A synonym for Theorem.

Monoids

conjunction :: Foldable f => f Formula -> Formula Source #

Build the conjunction of formulas in a list.

disjunction :: Foldable f => f Formula -> Formula Source #

Build the disjunction of formulas in a list.

equivalence :: Foldable f => f Formula -> Formula Source #

Build the equivalence of formulas in a list.

inequivalence :: Foldable f => f Formula -> Formula Source #

Build the inequivalence of formulas in a list.

Miscellaneous

flattenConjunction :: Foldable f => f Formula -> [Formula] Source #

Remove redundant boolean constants from a list of conjuncted formulas.

>>> flattenConjunction []
[]
>>> flattenConjunction [Tautology]
[]
>>> flattenConjunction [Falsity]
[Atomic (Propositional False)]
>>> flattenConjunction ["p", Tautology]
[Atomic (Predicate (PredicateSymbol "p") [])]
>>> flattenConjunction ["p", Falsity, "q"]
[Atomic (Propositional False)]

flattenDisjunction :: Foldable f => f Formula -> [Formula] Source #

Remove redundant boolean constants from a list of disjuncted formulas.

>>> flattenDisjunction []
[]
>>> flattenDisjunction [Tautology]
[Atomic (Propositional True)]
>>> flattenDisjunction [Falsity]
[]
>>> flattenDisjunction ["p", Tautology, "q"]
[Atomic (Propositional True)]
>>> flattenDisjunction ["p", Falsity]
[Atomic (Predicate (PredicateSymbol "p") [])]

Simplification

class Simplify a where Source #

A class of first-order expressions that simplify syntactically shrinks while preserving their evaluation.

Methods

simplify :: a -> a Source #

Instances

Instances details
Simplify Theorem Source #

Simplify the given theorem by flattening the conjunction of its premises and its conjecture.

Instance details

Defined in ATP.FirstOrder.Simplification

Simplify LogicalExpression Source #

Simplify the given formula by replacing each of its constructors with corresponding smart constructors.

Instance details

Defined in ATP.FirstOrder.Simplification

Simplify Formula Source #

Simplify the given formula by replacing each of its constructors with corresponding smart constructors. The effects of simplification are the following.

  • simplify f does not contain nested negations.
  • simplify f does not contain some of the constant atomic formulas from f.
  • All chained applications of any binary connective inside simplify f are right-associative.

Any formula built only using smart constructors is simplified by construction.

>>> simplify (Connected Or tautology (Atomic (Predicate "p" [])))
Atomic (Propositional True)
>>> simplify (Negate (Negate (Atomic (Predicate "p" []))))
Atomic (Predicate "p" [])
>>> simplify (Connected And (Connected And (Atomic (Predicate "p" [])) (Atomic (Predicate "q" []))) (Atomic (Predicate "r" [])))
Connected And (Atomic (Predicate "p" [])) (Connected And (Atomic (Predicate "q" [])) (Atomic (Predicate "r" [])))
Instance details

Defined in ATP.FirstOrder.Simplification

Simplify Clauses Source #

Simplify the given clause set by replacing the Clauses constructor with the smart constructor clauses. The effects of simplification are the following.

  • simplify c does not contain negative constant literals.
  • simplify c does not contain falsum literals.
  • simplify c does not contain tautology literals.
  • simplify c does not contain redundant falsum literals.
>>> simplify (SingleClause (UnitClause (Signed Negative (Propositional True))))
Clauses {getClauses = [Literals {getLiterals = []}]}
>>> simplify (SingleClause (Literals [FalsityLiteral, Signed Positive (Predicate "p" [])]))
Clauses {getClauses = [Literals {getLiterals = [Signed {signof = Positive, unsign = Predicate (PredicateSymbol "p") []}]}]}
>>> simplify (SingleClause (Literals [TautologyLiteral, Signed Positive (Predicate "p" [])]))
Clauses {getClauses = []}
Instance details

Defined in ATP.FirstOrder.Simplification

Simplify Clause Source #

Simplify the given clause by replacing the Literals constructor with the smart constructor clause. The effects of simplification are the following.

  • simplify c does not contain negative constant literals.
  • simplify c does not contain falsum literals.
  • simplify c does not contain redundant tautology literals.
>>> simplify (UnitClause (Signed Negative (Propositional True)))
Literals {getLiterals = []}
>>> simplify (Literals [FalsityLiteral, Signed Positive (Predicate "p" [])])
Literals {getLiterals = [Signed {signof = Positive, unsign = Predicate (PredicateSymbol "p") []}]}
>>> simplify (Literals [TautologyLiteral, Signed Positive (Predicate "p" [])])
Literals {getLiterals = [Signed {signof = Positive, unsign = Propositional True}]}
Instance details

Defined in ATP.FirstOrder.Simplification

Occurrence

class FirstOrder e where Source #

A class of first-order expressions, i.e. expressions that might contain variables. Formulas, Literals and Terms are first-order expressions.

A variable can occur both as free and bound, therefore free e and bound e are not necessarily disjoint and v freeIn e and v boundIn e are not necessarily musually exclusive.

vars, free and bound are connected by the following property.

free e <> bound e == vars e

occursIn, freeIn and boundIn are connected by the following property.

v `freeIn` e || v `boundIn` e == v `occursIn` e

Minimal complete definition

vars, free, bound, (?=), alpha

Methods

vars :: e -> Set Var Source #

The set of all variables that occur anywhere in the given expression.

free :: e -> Set Var Source #

The set of variables that occur freely in the given expression, i.e. are not bound by any quantifier inside the expression.

bound :: e -> Set Var Source #

The set of variables that occur bound in the given expression, i.e. are bound by a quantifier inside the expression.

occursIn :: Var -> e -> Bool Source #

Check whether the given variable occurs anywhere in the given expression.

freeIn :: Var -> e -> Bool Source #

Check whether the given variable occurs freely anywhere in the given expression.

boundIn :: Var -> e -> Bool Source #

Check whether the given variable occurs bound anywhere in the given expression.

ground :: e -> Bool Source #

Check whether the given expression is ground, i.e. does not contain any variables.

Note that ground formula is sometimes understood as formula that does not contain any free variables. In this library such formulas are called closed.

(~=) :: e -> e -> Bool infix 5 Source #

Check whether two given expressions are alpha-equivalent, that is equivalent up to renaming of variables.

(~=) is an equivalence relation.

Symmetry

e ~= e

Reflexivity

a ~= b == b ~= a

Transitivity

a ~= b && b ~= c ==> a ~= c

(?=) :: e -> e -> Alpha Bool Source #

A helper function calculating alpha-equivalence using the Alpha monad stack.

alpha :: MonadAlpha m => e -> AlphaT m e Source #

Instances

Instances details
FirstOrder LogicalExpression Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder Formula Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder Clause Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder Literal Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder Term Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder Var Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

FirstOrder e => FirstOrder [e] Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Methods

vars :: [e] -> Set Var Source #

free :: [e] -> Set Var Source #

bound :: [e] -> Set Var Source #

occursIn :: Var -> [e] -> Bool Source #

freeIn :: Var -> [e] -> Bool Source #

boundIn :: Var -> [e] -> Bool Source #

ground :: [e] -> Bool Source #

(~=) :: [e] -> [e] -> Bool Source #

(?=) :: [e] -> [e] -> Alpha Bool Source #

alpha :: forall (m :: Type -> Type). MonadAlpha m => [e] -> AlphaT m [e] Source #

FirstOrder e => FirstOrder (Signed e) Source # 
Instance details

Defined in ATP.FirstOrder.Occurrence

Methods

vars :: Signed e -> Set Var Source #

free :: Signed e -> Set Var Source #

bound :: Signed e -> Set Var Source #

occursIn :: Var -> Signed e -> Bool Source #

freeIn :: Var -> Signed e -> Bool Source #

boundIn :: Var -> Signed e -> Bool Source #

ground :: Signed e -> Bool Source #

(~=) :: Signed e -> Signed e -> Bool Source #

(?=) :: Signed e -> Signed e -> Alpha Bool Source #

alpha :: forall (m :: Type -> Type). MonadAlpha m => Signed e -> AlphaT m (Signed e) Source #

closed :: Formula -> Bool Source #

Check whether the given formula is closed, i.e. does not contain any free variables.

close :: Formula -> Formula Source #

Make any given formula closed by adding a top-level universal quantifier for each of its free variables.

close and unprefix are connected by the following property.

unprefix (close f) === f

unprefix :: Formula -> Formula Source #

Remove the top-level quantifiers.

>>> unprefix (Quantified Forall 1 (Quantified Exists 2 (Atomic (Equality (Variable 1) (Variable 2)))))
Atomic (Equality (Variable 1) (Variable 2))

Conversions

Formulas

liftSignedLiteral :: Signed Literal -> Formula Source #

Convert a signed literal to a (negated) atomic formula.

unliftSignedLiteral :: Formula -> Maybe (Signed Literal) Source #

Try to convert a first-order formula f to a signed literal. This function succeeds if f is a (negated) atomic formula.

liftClause :: Clause -> Formula Source #

Convert a clause to a full first-order formula.

unliftClause :: Formula -> Maybe Clause Source #

Try to convert a first-order formula f to a clause. This function succeeds if f is a tree of disjunctions of (negated) atomic formula.

Proofs

liftContradiction :: Contradiction f -> Inference f Source #

Convert a contradiction to an inference.

unliftContradiction :: Inference f -> Maybe (Contradiction f) Source #

Try to convert an inference to a contradiction.

liftRefutation :: Ord f => f -> Refutation f -> Derivation f Source #

Convert a refutation to a derivation.

unliftRefutation :: Derivation f -> Maybe (Refutation f) Source #

Try to convert a derivation to a refutation. This function succeds if the derivation has exactly one inference resulting in contradiction.

Proofs

data Rule f Source #

The inference rule.

Instances

Instances details
Functor Rule Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fmap :: (a -> b) -> Rule a -> Rule b #

(<$) :: a -> Rule b -> Rule a #

Foldable Rule Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fold :: Monoid m => Rule m -> m #

foldMap :: Monoid m => (a -> m) -> Rule a -> m #

foldMap' :: Monoid m => (a -> m) -> Rule a -> m #

foldr :: (a -> b -> b) -> b -> Rule a -> b #

foldr' :: (a -> b -> b) -> b -> Rule a -> b #

foldl :: (b -> a -> b) -> b -> Rule a -> b #

foldl' :: (b -> a -> b) -> b -> Rule a -> b #

foldr1 :: (a -> a -> a) -> Rule a -> a #

foldl1 :: (a -> a -> a) -> Rule a -> a #

toList :: Rule a -> [a] #

null :: Rule a -> Bool #

length :: Rule a -> Int #

elem :: Eq a => a -> Rule a -> Bool #

maximum :: Ord a => Rule a -> a #

minimum :: Ord a => Rule a -> a #

sum :: Num a => Rule a -> a #

product :: Num a => Rule a -> a #

Traversable Rule Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

traverse :: Applicative f => (a -> f b) -> Rule a -> f (Rule b) #

sequenceA :: Applicative f => Rule (f a) -> f (Rule a) #

mapM :: Monad m => (a -> m b) -> Rule a -> m (Rule b) #

sequence :: Monad m => Rule (m a) -> m (Rule a) #

Eq f => Eq (Rule f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

(==) :: Rule f -> Rule f -> Bool #

(/=) :: Rule f -> Rule f -> Bool #

Ord f => Ord (Rule f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

compare :: Rule f -> Rule f -> Ordering #

(<) :: Rule f -> Rule f -> Bool #

(<=) :: Rule f -> Rule f -> Bool #

(>) :: Rule f -> Rule f -> Bool #

(>=) :: Rule f -> Rule f -> Bool #

max :: Rule f -> Rule f -> Rule f #

min :: Rule f -> Rule f -> Rule f #

Show f => Show (Rule f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

showsPrec :: Int -> Rule f -> ShowS #

show :: Rule f -> String #

showList :: [Rule f] -> ShowS #

Pretty l => Pretty (Rule l) Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Rule l -> Doc #

prettyList :: [Rule l] -> Doc #

newtype RuleName Source #

The name of an inference rule.

Constructors

RuleName 

Fields

Instances

Instances details
Eq RuleName Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Ord RuleName Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show RuleName Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

IsString RuleName Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Pretty RuleName Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: RuleName -> Doc #

prettyList :: [RuleName] -> Doc #

ruleName :: Rule f -> RuleName Source #

The name of the given inference rule.

>>> unRuleName (ruleName AxiomOfChoice)
"axiom of choice"

data Inference f Source #

A logical inference is an expression of the form

A_1 ... A_n
----------- R,
    C

where each of A_1, ... A_n (called the antecedents), and C (called the consequent) are formulas and R is an inference Rule.

Instances

Instances details
Functor Inference Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fmap :: (a -> b) -> Inference a -> Inference b #

(<$) :: a -> Inference b -> Inference a #

Foldable Inference Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fold :: Monoid m => Inference m -> m #

foldMap :: Monoid m => (a -> m) -> Inference a -> m #

foldMap' :: Monoid m => (a -> m) -> Inference a -> m #

foldr :: (a -> b -> b) -> b -> Inference a -> b #

foldr' :: (a -> b -> b) -> b -> Inference a -> b #

foldl :: (b -> a -> b) -> b -> Inference a -> b #

foldl' :: (b -> a -> b) -> b -> Inference a -> b #

foldr1 :: (a -> a -> a) -> Inference a -> a #

foldl1 :: (a -> a -> a) -> Inference a -> a #

toList :: Inference a -> [a] #

null :: Inference a -> Bool #

length :: Inference a -> Int #

elem :: Eq a => a -> Inference a -> Bool #

maximum :: Ord a => Inference a -> a #

minimum :: Ord a => Inference a -> a #

sum :: Num a => Inference a -> a #

product :: Num a => Inference a -> a #

Traversable Inference Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

traverse :: Applicative f => (a -> f b) -> Inference a -> f (Inference b) #

sequenceA :: Applicative f => Inference (f a) -> f (Inference a) #

mapM :: Monad m => (a -> m b) -> Inference a -> m (Inference b) #

sequence :: Monad m => Inference (m a) -> m (Inference a) #

Eq f => Eq (Inference f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

(==) :: Inference f -> Inference f -> Bool #

(/=) :: Inference f -> Inference f -> Bool #

Ord f => Ord (Inference f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show f => Show (Inference f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Pretty l => Pretty (Inference l) Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Inference l -> Doc #

prettyList :: [Inference l] -> Doc #

antecedents :: Inference f -> [f] Source #

The antecedents of an inference.

newtype Contradiction f Source #

Contradiction is a special case of an inference that has the logical falsum as the consequent.

Constructors

Contradiction (Rule f) 

Instances

Instances details
Functor Contradiction Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fmap :: (a -> b) -> Contradiction a -> Contradiction b #

(<$) :: a -> Contradiction b -> Contradiction a #

Foldable Contradiction Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fold :: Monoid m => Contradiction m -> m #

foldMap :: Monoid m => (a -> m) -> Contradiction a -> m #

foldMap' :: Monoid m => (a -> m) -> Contradiction a -> m #

foldr :: (a -> b -> b) -> b -> Contradiction a -> b #

foldr' :: (a -> b -> b) -> b -> Contradiction a -> b #

foldl :: (b -> a -> b) -> b -> Contradiction a -> b #

foldl' :: (b -> a -> b) -> b -> Contradiction a -> b #

foldr1 :: (a -> a -> a) -> Contradiction a -> a #

foldl1 :: (a -> a -> a) -> Contradiction a -> a #

toList :: Contradiction a -> [a] #

null :: Contradiction a -> Bool #

length :: Contradiction a -> Int #

elem :: Eq a => a -> Contradiction a -> Bool #

maximum :: Ord a => Contradiction a -> a #

minimum :: Ord a => Contradiction a -> a #

sum :: Num a => Contradiction a -> a #

product :: Num a => Contradiction a -> a #

Traversable Contradiction Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

traverse :: Applicative f => (a -> f b) -> Contradiction a -> f (Contradiction b) #

sequenceA :: Applicative f => Contradiction (f a) -> f (Contradiction a) #

mapM :: Monad m => (a -> m b) -> Contradiction a -> m (Contradiction b) #

sequence :: Monad m => Contradiction (m a) -> m (Contradiction a) #

Eq f => Eq (Contradiction f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Ord f => Ord (Contradiction f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show f => Show (Contradiction f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

data Sequent f Source #

A sequent is a logical inference, annotated with a label. Linked sequents form derivations.

Constructors

Sequent f (Inference f) 

Instances

Instances details
Functor Sequent Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fmap :: (a -> b) -> Sequent a -> Sequent b #

(<$) :: a -> Sequent b -> Sequent a #

Foldable Sequent Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

fold :: Monoid m => Sequent m -> m #

foldMap :: Monoid m => (a -> m) -> Sequent a -> m #

foldMap' :: Monoid m => (a -> m) -> Sequent a -> m #

foldr :: (a -> b -> b) -> b -> Sequent a -> b #

foldr' :: (a -> b -> b) -> b -> Sequent a -> b #

foldl :: (b -> a -> b) -> b -> Sequent a -> b #

foldl' :: (b -> a -> b) -> b -> Sequent a -> b #

foldr1 :: (a -> a -> a) -> Sequent a -> a #

foldl1 :: (a -> a -> a) -> Sequent a -> a #

toList :: Sequent a -> [a] #

null :: Sequent a -> Bool #

length :: Sequent a -> Int #

elem :: Eq a => a -> Sequent a -> Bool #

maximum :: Ord a => Sequent a -> a #

minimum :: Ord a => Sequent a -> a #

sum :: Num a => Sequent a -> a #

product :: Num a => Sequent a -> a #

Traversable Sequent Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

traverse :: Applicative f => (a -> f b) -> Sequent a -> f (Sequent b) #

sequenceA :: Applicative f => Sequent (f a) -> f (Sequent a) #

mapM :: Monad m => (a -> m b) -> Sequent a -> m (Sequent b) #

sequence :: Monad m => Sequent (m a) -> m (Sequent a) #

Eq f => Eq (Sequent f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

(==) :: Sequent f -> Sequent f -> Bool #

(/=) :: Sequent f -> Sequent f -> Bool #

Ord f => Ord (Sequent f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

compare :: Sequent f -> Sequent f -> Ordering #

(<) :: Sequent f -> Sequent f -> Bool #

(<=) :: Sequent f -> Sequent f -> Bool #

(>) :: Sequent f -> Sequent f -> Bool #

(>=) :: Sequent f -> Sequent f -> Bool #

max :: Sequent f -> Sequent f -> Sequent f #

min :: Sequent f -> Sequent f -> Sequent f #

Show f => Show (Sequent f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

showsPrec :: Int -> Sequent f -> ShowS #

show :: Sequent f -> String #

showList :: [Sequent f] -> ShowS #

Pretty l => Pretty (Sequent l) Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Sequent l -> Doc #

prettyList :: [Sequent l] -> Doc #

newtype Derivation f Source #

A derivation is a directed asyclic graph of logical inferences. In this graph nodes are formulas and edges are inference rules. The type parameter f is used to label and index the nodes.

Constructors

Derivation (Map f (Inference f)) 

Instances

Instances details
Eq f => Eq (Derivation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

(==) :: Derivation f -> Derivation f -> Bool #

(/=) :: Derivation f -> Derivation f -> Bool #

Ord f => Ord (Derivation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show f => Show (Derivation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Ord f => Semigroup (Derivation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Ord f => Monoid (Derivation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

(Ord l, Pretty l) => Pretty (Derivation l) Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Derivation l -> Doc #

prettyList :: [Derivation l] -> Doc #

addSequent :: Ord f => Derivation f -> Sequent f -> Derivation f Source #

Attach a sequent to a derivation.

breadthFirst :: Ord f => Derivation f -> [Sequent f] Source #

Traverse the given derivation breadth-first and produce a list of sequents.

labeling :: Ord f => [Sequent f] -> Map f LogicalExpression Source #

Construct a mapping between inference labels and their correspondent formulas.

data Refutation f Source #

A refutation is a special case of a derivation that results in a contradiction. A successful proof produces by an automated theorem prover is a proof by refutation.

Constructors

Refutation (Derivation f) (Contradiction f) 

Instances

Instances details
Eq f => Eq (Refutation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Methods

(==) :: Refutation f -> Refutation f -> Bool #

(/=) :: Refutation f -> Refutation f -> Bool #

Ord f => Ord (Refutation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show f => Show (Refutation f) Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

(Ord l, Pretty l) => Pretty (Refutation l) Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Refutation l -> Doc #

prettyList :: [Refutation l] -> Doc #

data Solution Source #

The solution produced by an automated first-order theorem prover.

Constructors

Saturation (Derivation Integer)

A theorem can be disproven if the prover constructs a saturated set of first-order clauses.

Proof (Refutation Integer)

A theorem can be proven if the prover derives contradiction (the empty clause) from the set of axioms and the negated conjecture.

Instances

Instances details
Eq Solution Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Ord Solution Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Show Solution Source # 
Instance details

Defined in ATP.FirstOrder.Derivation

Pretty Solution Source # 
Instance details

Defined in ATP.Pretty.FOL

Methods

pretty :: Solution -> Doc #

prettyList :: [Solution] -> Doc #