atp-haskell 1.8 → 1.9
raw patch · 6 files changed
+71/−67 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Logic.ATP.Apply: instance (Data.Data.Data predicate, Data.Data.Data term) => Data.Data.Data (Data.Logic.ATP.Apply.FOLAP predicate term)
- Data.Logic.ATP.Apply: instance (GHC.Classes.Eq predicate, GHC.Classes.Eq term) => GHC.Classes.Eq (Data.Logic.ATP.Apply.FOLAP predicate term)
- Data.Logic.ATP.Apply: instance (GHC.Classes.Ord predicate, GHC.Classes.Ord term) => GHC.Classes.Ord (Data.Logic.ATP.Apply.FOLAP predicate term)
- Data.Logic.ATP.Apply: instance (GHC.Read.Read predicate, GHC.Read.Read term) => GHC.Read.Read (Data.Logic.ATP.Apply.FOLAP predicate term)
- Data.Logic.ATP.Equate: instance (Data.Data.Data predicate, Data.Data.Data term) => Data.Data.Data (Data.Logic.ATP.Equate.FOL predicate term)
- Data.Logic.ATP.Equate: instance (GHC.Classes.Eq predicate, GHC.Classes.Eq term) => GHC.Classes.Eq (Data.Logic.ATP.Equate.FOL predicate term)
- Data.Logic.ATP.Equate: instance (GHC.Classes.Ord predicate, GHC.Classes.Ord term) => GHC.Classes.Ord (Data.Logic.ATP.Equate.FOL predicate term)
- Data.Logic.ATP.Equate: instance (GHC.Read.Read predicate, GHC.Read.Read term) => GHC.Read.Read (Data.Logic.ATP.Equate.FOL predicate term)
- Data.Logic.ATP.Quantified: instance (Data.Data.Data v, Data.Data.Data atom) => Data.Data.Data (Data.Logic.ATP.Quantified.QFormula v atom)
- Data.Logic.ATP.Term: instance (Data.Data.Data function, Data.Data.Data v) => Data.Data.Data (Data.Logic.ATP.Term.Term function v)
- Data.Logic.ATP.Unif: instance Data.Logic.ATP.Unif.Unify Data.Logic.ATP.Skolem.SkAtom Data.Logic.ATP.Skolem.SkAtom
+ Data.Logic.ATP.Apply: instance (Data.Data.Data term, Data.Data.Data predicate) => Data.Data.Data (Data.Logic.ATP.Apply.FOLAP predicate term)
+ Data.Logic.ATP.Apply: instance (GHC.Classes.Eq term, GHC.Classes.Eq predicate) => GHC.Classes.Eq (Data.Logic.ATP.Apply.FOLAP predicate term)
+ Data.Logic.ATP.Apply: instance (GHC.Classes.Ord term, GHC.Classes.Ord predicate) => GHC.Classes.Ord (Data.Logic.ATP.Apply.FOLAP predicate term)
+ Data.Logic.ATP.Apply: instance (GHC.Read.Read term, GHC.Read.Read predicate) => GHC.Read.Read (Data.Logic.ATP.Apply.FOLAP predicate term)
+ Data.Logic.ATP.Apply: type family TermOf atom;
+ Data.Logic.ATP.Apply: }
+ Data.Logic.ATP.Equate: infix 6 .=.
+ Data.Logic.ATP.Equate: instance (Data.Data.Data term, Data.Data.Data predicate) => Data.Data.Data (Data.Logic.ATP.Equate.FOL predicate term)
+ Data.Logic.ATP.Equate: instance (GHC.Classes.Eq term, GHC.Classes.Eq predicate) => GHC.Classes.Eq (Data.Logic.ATP.Equate.FOL predicate term)
+ Data.Logic.ATP.Equate: instance (GHC.Classes.Ord term, GHC.Classes.Ord predicate) => GHC.Classes.Ord (Data.Logic.ATP.Equate.FOL predicate term)
+ Data.Logic.ATP.Equate: instance (GHC.Read.Read term, GHC.Read.Read predicate) => GHC.Read.Read (Data.Logic.ATP.Equate.FOL predicate term)
+ Data.Logic.ATP.Formulas: type family AtomOf formula;
+ Data.Logic.ATP.Formulas: }
+ Data.Logic.ATP.Lit: infix 6 ¬
+ Data.Logic.ATP.Pretty: infixr 6 <>
+ Data.Logic.ATP.Prop: infixl 2 <==>
+ Data.Logic.ATP.Prop: infixl 4 ∨
+ Data.Logic.ATP.Prop: infixl 5 `·`
+ Data.Logic.ATP.Prop: infixr 3 →
+ Data.Logic.ATP.Quantified: infixr 1 ∃
+ Data.Logic.ATP.Quantified: instance (Data.Data.Data atom, Data.Data.Data v) => Data.Data.Data (Data.Logic.ATP.Quantified.QFormula v atom)
+ Data.Logic.ATP.Quantified: type family VarOf formula;
+ Data.Logic.ATP.Quantified: }
+ Data.Logic.ATP.Skolem: type family SVarOf function;
+ Data.Logic.ATP.Skolem: }
+ Data.Logic.ATP.Term: instance (Data.Data.Data v, Data.Data.Data function) => Data.Data.Data (Data.Logic.ATP.Term.Term function v)
+ Data.Logic.ATP.Term: type family FunOf term;
+ Data.Logic.ATP.Term: }
+ Data.Logic.ATP.Unif: instance Data.Logic.ATP.Unif.Unify (Data.Logic.ATP.Skolem.SkAtom, Data.Logic.ATP.Skolem.SkAtom)
+ Data.Logic.ATP.Unif: type family UTermOf a;
+ Data.Logic.ATP.Unif: }
- Data.Logic.ATP.Apply: class (IsAtom atom, IsPredicate (PredOf atom), IsTerm (TermOf atom)) => HasApply atom where type family PredOf atom type family TermOf atom
+ Data.Logic.ATP.Apply: class (IsAtom atom, IsPredicate (PredOf atom), IsTerm (TermOf atom)) => HasApply atom where type PredOf atom type TermOf atom where {
- Data.Logic.ATP.DefCNF: defcnf1 :: (IsPropositional pf, JustPropositional pf, NumAtom (AtomOf pf), Ord pf) => pf -> pf
+ Data.Logic.ATP.DefCNF: defcnf1 :: forall pf. (IsPropositional pf, JustPropositional pf, NumAtom (AtomOf pf), Ord pf) => pf -> pf
- Data.Logic.ATP.DefCNF: defcnf3 :: (JustPropositional pf, Ord pf, NumAtom (AtomOf pf)) => pf -> pf
+ Data.Logic.ATP.DefCNF: defcnf3 :: forall pf. (JustPropositional pf, Ord pf, NumAtom (AtomOf pf)) => pf -> pf
- Data.Logic.ATP.Equal: equalitize :: (atom ~ AtomOf formula, term ~ TermOf atom, v ~ VarOf formula, v ~ TVarOf term, function ~ FunOf term, IsQuantified formula, HasEquate atom, IsTerm term, Ord formula, Ord atom) => formula -> formula
+ Data.Logic.ATP.Equal: equalitize :: forall formula atom term v function. (atom ~ AtomOf formula, term ~ TermOf atom, v ~ VarOf formula, v ~ TVarOf term, function ~ FunOf term, IsQuantified formula, HasEquate atom, IsTerm term, Ord formula, Ord atom) => formula -> formula
- Data.Logic.ATP.Equal: function_congruence :: (atom ~ AtomOf fof, term ~ TermOf atom, p ~ PredOf atom, v ~ VarOf fof, v ~ TVarOf term, function ~ FunOf term, IsQuantified fof, HasEquate atom, IsTerm term, Ord fof) => (function, Int) -> Set fof
+ Data.Logic.ATP.Equal: function_congruence :: forall fof atom term v p function. (atom ~ AtomOf fof, term ~ TermOf atom, p ~ PredOf atom, v ~ VarOf fof, v ~ TVarOf term, function ~ FunOf term, IsQuantified fof, HasEquate atom, IsTerm term, Ord fof) => (function, Int) -> Set fof
- Data.Logic.ATP.FOL: holdsQuantified :: (IsQuantified formula, FiniteInterpretation (AtomOf formula) function predicate (VarOf formula) dom, FiniteInterpretation formula function predicate (VarOf formula) dom) => Interp function predicate dom -> Map (VarOf formula) dom -> formula -> Bool
+ Data.Logic.ATP.FOL: holdsQuantified :: forall formula function predicate dom. (IsQuantified formula, FiniteInterpretation (AtomOf formula) function predicate (VarOf formula) dom, FiniteInterpretation formula function predicate (VarOf formula) dom) => Interp function predicate dom -> Map (VarOf formula) dom -> formula -> Bool
- Data.Logic.ATP.Formulas: class (Pretty formula, HasFixity formula, IsAtom (AtomOf formula)) => IsFormula formula where type family AtomOf formula
+ Data.Logic.ATP.Formulas: class (Pretty formula, HasFixity formula, IsAtom (AtomOf formula)) => IsFormula formula where type AtomOf formula where {
- Data.Logic.ATP.Herbrand: davisputnam :: (IsFirstOrder formula, Ord formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> Int
+ Data.Logic.ATP.Herbrand: davisputnam :: forall formula atom term v function. (IsFirstOrder formula, Ord formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> Int
- Data.Logic.ATP.Herbrand: davisputnam' :: (IsFirstOrder formula, Ord formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> formula -> formula -> Int
+ Data.Logic.ATP.Herbrand: davisputnam' :: forall formula atom term v function. (IsFirstOrder formula, Ord formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> formula -> formula -> Int
- Data.Logic.ATP.Herbrand: gilmore :: (IsFirstOrder fof, Ord fof, HasSkolem function, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> Int
+ Data.Logic.ATP.Herbrand: gilmore :: forall fof atom term v function. (IsFirstOrder fof, Ord fof, HasSkolem function, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> Int
- Data.Logic.ATP.Herbrand: herbloop :: (atom ~ AtomOf lit, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function, JustLiteral lit, HasApply atom, IsTerm term) => (Set (Set lit) -> (lit -> lit) -> Set (Set lit) -> Set (Set lit)) -> (Set (Set lit) -> Bool) -> Set (Set lit) -> Set term -> Set (function, Int) -> [TVarOf term] -> Int -> Set (Set lit) -> Set [term] -> Set [term] -> Set [term]
+ Data.Logic.ATP.Herbrand: herbloop :: forall lit atom function v term. (atom ~ AtomOf lit, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function, JustLiteral lit, HasApply atom, IsTerm term) => (Set (Set lit) -> (lit -> lit) -> Set (Set lit) -> Set (Set lit)) -> (Set (Set lit) -> Bool) -> Set (Set lit) -> Set term -> Set (function, Int) -> [TVarOf term] -> Int -> Set (Set lit) -> Set [term] -> Set [term] -> Set [term]
- Data.Logic.ATP.Lib: allnonemptysubsets :: Ord a => Set a -> Set (Set a)
+ Data.Logic.ATP.Lib: allnonemptysubsets :: forall a. Ord a => Set a -> Set (Set a)
- Data.Logic.ATP.Lib: allpairs :: (SetLike set, Ord c) => (a -> b -> c) -> set a -> set b -> set c
+ Data.Logic.ATP.Lib: allpairs :: forall a b c set. (SetLike set, Ord c) => (a -> b -> c) -> set a -> set b -> set c
- Data.Logic.ATP.Lib: allsets :: (Num a, Eq a, Ord b) => a -> Set b -> Set (Set b)
+ Data.Logic.ATP.Lib: allsets :: forall a b. (Num a, Eq a, Ord b) => a -> Set b -> Set (Set b)
- Data.Logic.ATP.Lib: allsubsets :: Ord a => Set a -> Set (Set a)
+ Data.Logic.ATP.Lib: allsubsets :: forall a. Ord a => Set a -> Set (Set a)
- Data.Logic.ATP.Lib: optimize :: (SetLike s, Foldable s) => (b -> b -> Ordering) -> (a -> b) -> s a -> Maybe a
+ Data.Logic.ATP.Lib: optimize :: forall s a b. (SetLike s, Foldable s) => (b -> b -> Ordering) -> (a -> b) -> s a -> Maybe a
- Data.Logic.ATP.Lib: slMap :: (SetLike c, Ord b) => (a -> b) -> c a -> c b
+ Data.Logic.ATP.Lib: slMap :: forall a b. (SetLike c, Ord b) => (a -> b) -> c a -> c b
- Data.Logic.ATP.Lib: slView :: SetLike c => c a -> Maybe (a, c a)
+ Data.Logic.ATP.Lib: slView :: forall a. SetLike c => c a -> Maybe (a, c a)
- Data.Logic.ATP.Lib: undefine :: Ord k => k -> Map k a -> Map k a
+ Data.Logic.ATP.Lib: undefine :: forall k a. Ord k => k -> Map k a -> Map k a
- Data.Logic.ATP.Meson: meson :: (IsFirstOrder fof, Unify atom atom, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
+ Data.Logic.ATP.Meson: meson :: (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
- Data.Logic.ATP.Meson: meson1 :: (IsFirstOrder fof, Unify atom atom, Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, predicate ~ PredOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
+ Data.Logic.ATP.Meson: meson1 :: forall m fof atom predicate term function v. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, predicate ~ PredOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
- Data.Logic.ATP.Meson: meson2 :: (IsFirstOrder fof, Unify atom atom, Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
+ Data.Logic.ATP.Meson: meson2 :: forall m fof atom term function v. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))
- Data.Logic.ATP.Parser: def :: Stream s m Char => GenLanguageDef s u m
+ Data.Logic.ATP.Parser: def :: forall s u m. Stream s m Char => GenLanguageDef s u m
- Data.Logic.ATP.Parser: existentialQuantifier :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: existentialQuantifier :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: folconstant :: (IsTerm term, Stream t t2 Char) => ParsecT t t1 t2 term
+ Data.Logic.ATP.Parser: folconstant :: forall term t t1 t2. (IsTerm term, Stream t t2 Char) => ParsecT t t1 t2 term
- Data.Logic.ATP.Parser: folconstant_numeric :: (IsTerm term, Stream t t2 Char) => ParsecT t t1 t2 term
+ Data.Logic.ATP.Parser: folconstant_numeric :: forall term t t1 t2. (IsTerm term, Stream t t2 Char) => ParsecT t t1 t2 term
- Data.Logic.ATP.Parser: folconstant_reserved :: (IsTerm term, Stream t t2 Char) => String -> ParsecT t t1 t2 term
+ Data.Logic.ATP.Parser: folconstant_reserved :: forall term t t1 t2. (IsTerm term, Stream t t2 Char) => String -> ParsecT t t1 t2 term
- Data.Logic.ATP.Parser: folfunction :: (IsTerm term, Stream s m Char) => ParsecT s u m term
+ Data.Logic.ATP.Parser: folfunction :: forall term s u m. (IsTerm term, Stream s m Char) => ParsecT s u m term
- Data.Logic.ATP.Parser: folfunction_infix :: (IsTerm term, Stream s m Char) => ParsecT s u m term
+ Data.Logic.ATP.Parser: folfunction_infix :: forall term s u m. (IsTerm term, Stream s m Char) => ParsecT s u m term
- Data.Logic.ATP.Parser: folparser :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: folparser :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: folpredicate :: (IsFormula formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: folpredicate :: forall formula s u m. (IsFormula formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: folpredicate_infix :: (IsFormula formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: folpredicate_infix :: forall formula s u m. (IsFormula formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: folsubterm :: (IsTerm term, Stream s m Char) => ParsecT s u m term
+ Data.Logic.ATP.Parser: folsubterm :: forall term s u m. (IsTerm term, Stream s m Char) => ParsecT s u m term
- Data.Logic.ATP.Parser: folsubterm_prefix :: (IsTerm term, Stream s m Char) => ParsecT s u m term
+ Data.Logic.ATP.Parser: folsubterm_prefix :: forall term s u m. (IsTerm term, Stream s m Char) => ParsecT s u m term
- Data.Logic.ATP.Parser: folterm :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: folterm :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: forallQuantifier :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: forallQuantifier :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: litexprparser :: (IsLiteral formula, Stream s m Char) => ParsecT s u m formula -> ParsecT s u m formula
+ Data.Logic.ATP.Parser: litexprparser :: forall formula s u m. (IsLiteral formula, Stream s m Char) => ParsecT s u m formula -> ParsecT s u m formula
- Data.Logic.ATP.Parser: litparser :: (JustLiteral formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: litparser :: forall formula s u m. (JustLiteral formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: litterm :: (JustLiteral formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: litterm :: forall formula s u m. (JustLiteral formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: m_angles :: Stream t t2 Char => forall a. ParsecT t t1 t2 a -> ParsecT t t1 t2 a
+ Data.Logic.ATP.Parser: m_angles :: forall t t1 t2. Stream t t2 Char => forall a. ParsecT t t1 t2 a -> ParsecT t t1 t2 a
- Data.Logic.ATP.Parser: m_identifier :: Stream t t2 Char => ParsecT t t1 t2 String
+ Data.Logic.ATP.Parser: m_identifier :: forall t t1 t2. Stream t t2 Char => ParsecT t t1 t2 String
- Data.Logic.ATP.Parser: m_integer :: Stream t t2 Char => ParsecT t t1 t2 Integer
+ Data.Logic.ATP.Parser: m_integer :: forall t t1 t2. Stream t t2 Char => ParsecT t t1 t2 Integer
- Data.Logic.ATP.Parser: m_parens :: Stream t t2 Char => forall a. ParsecT t t1 t2 a -> ParsecT t t1 t2 a
+ Data.Logic.ATP.Parser: m_parens :: forall t t1 t2. Stream t t2 Char => forall a. ParsecT t t1 t2 a -> ParsecT t t1 t2 a
- Data.Logic.ATP.Parser: m_reserved :: Stream t t2 Char => String -> ParsecT t t1 t2 ()
+ Data.Logic.ATP.Parser: m_reserved :: forall t t1 t2. Stream t t2 Char => String -> ParsecT t t1 t2 ()
- Data.Logic.ATP.Parser: m_reservedOp :: Stream t t2 Char => String -> ParsecT t t1 t2 ()
+ Data.Logic.ATP.Parser: m_reservedOp :: forall t t1 t2. Stream t t2 Char => String -> ParsecT t t1 t2 ()
- Data.Logic.ATP.Parser: m_symbol :: Stream t t2 Char => String -> ParsecT t t1 t2 String
+ Data.Logic.ATP.Parser: m_symbol :: forall t t1 t2. Stream t t2 Char => String -> ParsecT t t1 t2 String
- Data.Logic.ATP.Parser: m_whiteSpace :: Stream t t2 Char => ParsecT t t1 t2 ()
+ Data.Logic.ATP.Parser: m_whiteSpace :: forall t t1 t2. Stream t t2 Char => ParsecT t t1 t2 ()
- Data.Logic.ATP.Parser: propexprparser :: (IsPropositional formula, Stream s m Char) => ParsecT s u m formula -> ParsecT s u m formula
+ Data.Logic.ATP.Parser: propexprparser :: forall formula s u m. (IsPropositional formula, Stream s m Char) => ParsecT s u m formula -> ParsecT s u m formula
- Data.Logic.ATP.Parser: propparser :: (JustPropositional formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: propparser :: forall formula s u m. (JustPropositional formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: propterm :: (JustPropositional formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
+ Data.Logic.ATP.Parser: propterm :: forall formula s u m. (JustPropositional formula, HasEquate (AtomOf formula), Stream s m Char) => ParsecT s u m formula
- Data.Logic.ATP.Parser: quantifierId :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => String -> (String -> formula -> formula) -> ParsecT s u m formula
+ Data.Logic.ATP.Parser: quantifierId :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => String -> (String -> formula -> formula) -> ParsecT s u m formula
- Data.Logic.ATP.Parser: quantifierOp :: (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => String -> (String -> formula -> formula) -> ParsecT s u m formula
+ Data.Logic.ATP.Parser: quantifierOp :: forall formula s u m. (IsQuantified formula, HasEquate (AtomOf formula), Stream s m Char) => String -> (String -> formula -> formula) -> ParsecT s u m formula
- Data.Logic.ATP.Prolog: renamerule :: (IsLiteral lit, JustLiteral lit, Ord lit, HasApply atom, IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Int -> PrologRule lit -> (PrologRule lit, Int)
+ Data.Logic.ATP.Prolog: renamerule :: forall lit atom term v. (IsLiteral lit, JustLiteral lit, Ord lit, HasApply atom, IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Int -> PrologRule lit -> (PrologRule lit, Int)
- Data.Logic.ATP.Prop: cnf' :: (JustPropositional pf, Ord pf) => pf -> pf
+ Data.Logic.ATP.Prop: cnf' :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf
- Data.Logic.ATP.Prop: dnf :: (JustPropositional pf, Ord pf) => pf -> pf
+ Data.Logic.ATP.Prop: dnf :: forall pf. (JustPropositional pf, Ord pf) => pf -> pf
- Data.Logic.ATP.Prop: prettyPropositional :: JustPropositional pf => Side -> PrettyLevel -> Rational -> pf -> Doc
+ Data.Logic.ATP.Prop: prettyPropositional :: forall pf. JustPropositional pf => Side -> PrettyLevel -> Rational -> pf -> Doc
- Data.Logic.ATP.Quantified: associativityQuantified :: IsQuantified formula => formula -> Associativity
+ Data.Logic.ATP.Quantified: associativityQuantified :: forall formula. IsQuantified formula => formula -> Associativity
- Data.Logic.ATP.Quantified: class (IsPropositional formula, IsVariable (VarOf formula)) => IsQuantified formula where type family VarOf formula
+ Data.Logic.ATP.Quantified: class (IsPropositional formula, IsVariable (VarOf formula)) => IsQuantified formula where type VarOf formula where {
- Data.Logic.ATP.Quantified: convertQuantified :: (IsQuantified f1, IsQuantified f2) => (AtomOf f1 -> AtomOf f2) -> (VarOf f1 -> VarOf f2) -> f1 -> f2
+ Data.Logic.ATP.Quantified: convertQuantified :: forall f1 f2. (IsQuantified f1, IsQuantified f2) => (AtomOf f1 -> AtomOf f2) -> (VarOf f1 -> VarOf f2) -> f1 -> f2
- Data.Logic.ATP.Quantified: precedenceQuantified :: IsQuantified formula => formula -> Precedence
+ Data.Logic.ATP.Quantified: precedenceQuantified :: forall formula. IsQuantified formula => formula -> Precedence
- Data.Logic.ATP.Quantified: prettyQuantified :: (IsQuantified fof, v ~ VarOf fof) => Side -> PrettyLevel -> Rational -> fof -> Doc
+ Data.Logic.ATP.Quantified: prettyQuantified :: forall fof v. (IsQuantified fof, v ~ VarOf fof) => Side -> PrettyLevel -> Rational -> fof -> Doc
- Data.Logic.ATP.Resolution: presolution :: (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, Pretty fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
+ Data.Logic.ATP.Resolution: presolution :: forall fof atom term v function m. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, Pretty fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
- Data.Logic.ATP.Resolution: resolution1 :: (IsFirstOrder fof, Unify atom atom, Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
+ Data.Logic.ATP.Resolution: resolution1 :: forall m fof atom term v function. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
- Data.Logic.ATP.Resolution: resolution2 :: (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
+ Data.Logic.ATP.Resolution: resolution2 :: forall fof atom term v function m. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
- Data.Logic.ATP.Resolution: resolution3 :: (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
+ Data.Logic.ATP.Resolution: resolution3 :: forall fof atom term v function m. (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool))
- Data.Logic.ATP.Skolem: class (IsFunction function, IsVariable (SVarOf function)) => HasSkolem function where type family SVarOf function
+ Data.Logic.ATP.Skolem: class (IsFunction function, IsVariable (SVarOf function)) => HasSkolem function where type SVarOf function where {
- Data.Logic.ATP.Tableaux: prawitz :: (IsFirstOrder formula, Ord formula, Unify atom atom, HasSkolem function, Show formula, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> Int
+ Data.Logic.ATP.Tableaux: prawitz :: forall formula atom term function v. (IsFirstOrder formula, Ord formula, Unify (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
- Data.Logic.ATP.Tableaux: tab :: (IsFirstOrder formula, Unify 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)
+ Data.Logic.ATP.Tableaux: tab :: (IsFirstOrder formula, Unify (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)
- Data.Logic.ATP.Term: class (Eq term, Ord term, Pretty term, Show term, IsString term, HasFixity term, IsVariable (TVarOf term), IsFunction (FunOf term)) => IsTerm term where type family TVarOf term type family FunOf term
+ Data.Logic.ATP.Term: class (Eq term, Ord term, Pretty term, Show term, IsString term, HasFixity term, IsVariable (TVarOf term), IsFunction (FunOf term)) => IsTerm term where type TVarOf term type FunOf term where {
- Data.Logic.ATP.Unif: class TermOf a ~ TermOf b => Unify a b
+ Data.Logic.ATP.Unif: class (IsTerm (UTermOf a), IsVariable (TVarOf (UTermOf a))) => Unify a where type UTermOf a where {
- Data.Logic.ATP.Unif: unify :: Unify a b => a -> b -> StateT (Map (TVarOf (TermOf a)) (TermOf a)) Failing ()
+ Data.Logic.ATP.Unif: unify :: Unify a => a -> StateT (Map (TVarOf (UTermOf a)) (UTermOf a)) Failing ()
- Data.Logic.ATP.Unif: unify_literals :: (IsLiteral lit1, HasApply atom1, atom1 ~ AtomOf lit1, term ~ TermOf atom1, JustLiteral lit2, HasApply atom2, atom2 ~ AtomOf lit2, term ~ TermOf atom2, Unify atom1 atom2, v ~ TVarOf term) => lit1 -> lit2 -> StateT (Map v term) Failing ()
+ Data.Logic.ATP.Unif: unify_literals :: (IsLiteral lit1, HasApply atom1, atom1 ~ AtomOf lit1, term ~ TermOf atom1, JustLiteral lit2, HasApply atom2, atom2 ~ AtomOf lit2, term ~ TermOf atom2, Unify (atom1, atom2), term ~ UTermOf (atom1, atom2), v ~ TVarOf term) => lit1 -> lit2 -> StateT (Map v term) Failing ()
Files
- atp-haskell.cabal +1/−1
- src/Data/Logic/ATP/Meson.hs +10/−10
- src/Data/Logic/ATP/Pretty.hs +5/−2
- src/Data/Logic/ATP/Resolution.hs +17/−17
- src/Data/Logic/ATP/Tableaux.hs +15/−12
- src/Data/Logic/ATP/Unif.hs +23/−25
atp-haskell.cabal view
@@ -1,5 +1,5 @@ Name: atp-haskell-Version: 1.8+Version: 1.9 Synopsis: Translation from Ocaml to Haskell of John Harrison's ATP code Description: This package is a liberal translation from OCaml to Haskell of the automated theorem prover written in OCaml in
src/Data/Logic/ATP/Meson.hs view
@@ -33,7 +33,7 @@ import Data.Logic.ATP.Skolem (askolemize, Formula, HasSkolem(SVarOf), pnf, runSkolem, SkolemT, simpdnf', specialize, toSkolem) import Data.Logic.ATP.Tableaux (K(K), tab) import Data.Logic.ATP.Term (fApp, IsTerm(FunOf, TVarOf), vt)-import Data.Logic.ATP.Unif (Unify, unify_literals)+import Data.Logic.ATP.Unif (Unify(UTermOf), unify_literals) import Data.Map.Strict as Map import Data.Set as Set import Test.HUnit@@ -176,7 +176,7 @@ -- ------------------------------------------------------------------------- mexpand1 :: (JustLiteral lit, Ord lit,- HasApply atom, IsTerm term, Unify atom atom,+ HasApply atom, IsTerm term, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (PrologRule lit) -> Set lit@@ -206,7 +206,7 @@ -- ------------------------------------------------------------------------- puremeson1 :: forall fof atom term v function.- (IsFirstOrder fof, Unify atom atom, Ord fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ TVarOf term) => Maybe Depth -> fof -> Failing Depth@@ -219,7 +219,7 @@ (cls :: Set (Set (LFormula atom))) = simpcnf id (specialize id (pnf fm) :: PFormula atom) meson1 :: forall m fof atom predicate term function v.- (IsFirstOrder fof, Unify atom atom, Ord fof, HasSkolem function, Monad m,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, predicate ~ PredOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth)) meson1 maxdl fm =@@ -230,7 +230,7 @@ -- With repetition checking and divide-and-conquer search. -- ------------------------------------------------------------------------- -equal :: (JustLiteral lit, HasApply atom, Unify atom atom, IsTerm term,+equal :: (JustLiteral lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Map v term -> lit -> lit -> Bool equal env fm1 fm2 =@@ -257,7 +257,7 @@ (e1,n2+r1,k1)) (env,n1,k) -mexpand2 :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify atom atom,+mexpand2 :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (PrologRule lit) -> Set lit@@ -284,7 +284,7 @@ mexpand2' = mexpands rules (Set.insert g ancestors) asm cont (Prolog asm c, k') = renamerule k rule -mexpands :: (JustLiteral lit, Ord lit, HasApply atom, Unify atom atom, IsTerm term,+mexpands :: (JustLiteral lit, Ord lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (PrologRule lit) -> Set lit@@ -317,7 +317,7 @@ puremeson2 :: forall fof atom term v. (atom ~ AtomOf fof, term ~ TermOf atom, v ~ VarOf fof, v ~ TVarOf term, IsFirstOrder fof,- Unify atom atom, Ord fof+ Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof ) => Maybe Depth -> fof -> Failing Depth puremeson2 maxdl fm = snd <$> deepen f (Depth 0) maxdl@@ -328,7 +328,7 @@ (cls :: Set (Set (LFormula atom))) = simpcnf id (specialize id (pnf fm) :: PFormula atom) meson2 :: forall m fof atom term function v.- (IsFirstOrder fof, Unify atom atom, Ord fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth))@@ -336,7 +336,7 @@ askolemize ((.~.)(generalize fm)) >>= return . Set.map (puremeson2 maxdl . list_conj) . (simpdnf' :: fof -> Set (Set fof)) -meson :: (IsFirstOrder fof, Unify atom atom, HasSkolem function, Monad m, Ord fof,+meson :: (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => Maybe Depth -> fof -> SkolemT m function (Set (Failing Depth)) meson = meson2
src/Data/Logic/ATP/Pretty.hs view
@@ -9,7 +9,6 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-}-{-# OPTIONS_GHC -ddump-splices #-} module Data.Logic.ATP.Pretty ( (<>)@@ -105,7 +104,11 @@ pPrint = pPrint . Map.toList -- | Version of assertEqual that uses the pretty printer instead of show.-assertEqual' :: (?loc :: CallStack, Eq a, Pretty a) =>+assertEqual' :: (+#ifndef ghcjs_HOST_OS+ ?loc :: CallStack,+#endif+ Eq a, Pretty a) => String -- ^ The message prefix -> a -- ^ The expected value -> a -- ^ The actual value
src/Data/Logic/ATP/Resolution.hs view
@@ -40,7 +40,7 @@ import Data.Logic.ATP.Skolem (askolemize, Formula, Function(Skolem), HasSkolem(SVarOf), pnf, runSkolem, simpdnf', SkAtom, skolemize, SkolemT, specialize, SkTerm) import Data.Logic.ATP.Term (fApp, foldTerm, IsTerm(FunOf, TVarOf), prefix, V, vt)-import Data.Logic.ATP.Unif (solve, Unify, unify_literals)+import Data.Logic.ATP.Unif (solve, Unify(UTermOf), unify_literals) import Data.Map.Strict as Map import Data.Maybe (fromMaybe) import Data.Set as Set@@ -68,7 +68,7 @@ -- | MGU of a set of literals. mgu :: forall lit atom term v.- (JustLiteral lit, HasApply atom, Unify atom atom, IsTerm term,+ (JustLiteral lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set lit -> StateT (Map v term) Failing (Map v term) mgu l =@@ -79,7 +79,7 @@ _ -> solve <$> get _ -> solve <$> get -unifiable :: (JustLiteral lit, IsTerm term, HasApply atom, Unify atom atom,+unifiable :: (JustLiteral lit, IsTerm term, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => lit -> lit -> Bool unifiable p q = failing (const False) (const True) (execStateT (unify_literals p q) Map.empty)@@ -100,7 +100,7 @@ -- General resolution rule, incorporating factoring as in Robinson's paper. -- ------------------------------------------------------------------------- -resolvents :: (JustLiteral lit, Ord lit, HasApply atom, Unify atom atom, IsTerm term,+resolvents :: (JustLiteral lit, Ord lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set lit -> Set lit -> lit -> Set lit -> Set lit resolvents cl1 cl2 p acc =@@ -117,7 +117,7 @@ -- ps2 :: Set fof ps2 = Set.filter (unifiable ((.~.) p)) cl2 -resolve_clauses :: (JustLiteral lit, Ord lit, HasApply atom, Unify atom atom, IsTerm term,+resolve_clauses :: (JustLiteral lit, Ord lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), IsTerm term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set lit -> Set lit -> Set lit resolve_clauses cls1 cls2 =@@ -129,7 +129,7 @@ -- Basic "Argonne" loop. -- ------------------------------------------------------------------------- -resloop1 :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify atom atom,+resloop1 :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (Set lit) -> Set (Set lit) -> Failing Bool resloop1 used unused =@@ -145,13 +145,13 @@ pure_resolution1 :: forall fof atom term v. (atom ~ AtomOf fof, term ~ TermOf atom, v ~ TVarOf term, IsFirstOrder fof,- Unify atom atom,+ Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, Pretty fof ) => fof -> Failing Bool pure_resolution1 fm = resloop1 Set.empty (simpcnf id (specialize id (pnf fm) :: PFormula atom) :: Set (Set (LFormula atom))) resolution1 :: forall m fof atom term v function.- (IsFirstOrder fof, Unify atom atom, Ord fof, HasSkolem function, Monad m,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord fof, HasSkolem function, Monad m, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool)) resolution1 fm = askolemize ((.~.)(generalize fm)) >>= return . Set.map (pure_resolution1 . list_conj) . (simpdnf' :: fof -> Set (Set fof))@@ -220,7 +220,7 @@ -- | With deletion of tautologies and bi-subsumption with "unused". resolution2 :: forall fof atom term v function m.- (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool)) resolution2 fm = askolemize ((.~.) (generalize fm)) >>= return . Set.map (pure_resolution2 . list_conj) . (simpdnf' :: fof -> Set (Set fof))@@ -228,13 +228,13 @@ pure_resolution2 :: forall fof atom term v. (IsFirstOrder fof, Ord fof, Pretty fof, HasApply atom, IsTerm term,- Unify atom atom, Match (atom, atom) v term,+ Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, atom ~ AtomOf fof, term ~ TermOf atom, v ~ TVarOf term) => fof -> Failing Bool pure_resolution2 fm = resloop2 Set.empty (simpcnf id (specialize id (pnf fm) :: PFormula atom) :: Set (Set (LFormula atom))) resloop2 :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term,- Unify atom atom, Match (atom, atom) v term,+ Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (Set lit) -> Set (Set lit) -> Failing Bool resloop2 used unused =@@ -295,20 +295,20 @@ -- | Positive (P1) resolution. presolution :: forall fof atom term v function m.- (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, Pretty fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, Pretty fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool)) presolution fm = askolemize ((.~.) (generalize fm)) >>= return . Set.map (pure_presolution . list_conj) . (simpdnf' :: fof -> Set (Set fof)) pure_presolution :: forall fof atom term v.- (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, Ord fof, Pretty fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, Ord fof, Pretty fof, atom ~ AtomOf fof, term ~ TermOf atom, v ~ VarOf fof, v ~ TVarOf term) => fof -> Failing Bool pure_presolution fm = presloop Set.empty (simpcnf id (specialize id (pnf fm :: fof) :: PFormula atom) :: Set (Set (LFormula atom))) presloop :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term,- Match (atom, atom) v term, Unify atom atom,+ Match (atom, atom) v term, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (Set lit) -> Set (Set lit) -> Failing Bool presloop used unused =@@ -323,7 +323,7 @@ then Success True else presloop used' (Set.fold (incorporate cl) ros news) -presolve_clauses :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify atom atom,+presolve_clauses :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set lit -> Set lit -> Set lit presolve_clauses cls1 cls2 =@@ -333,7 +333,7 @@ -- | Introduce a set-of-support restriction. resolution3 :: forall fof atom term v function m.- (IsFirstOrder fof, Unify atom atom, Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof,+ (IsFirstOrder fof, Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, HasSkolem function, Monad m, Ord fof, atom ~ AtomOf fof, term ~ TermOf atom, function ~ FunOf term, v ~ VarOf fof, v ~ SVarOf function) => fof -> SkolemT m function (Set (Failing Bool)) resolution3 fm =@@ -342,7 +342,7 @@ pure_resolution3 :: forall fof atom term v. (atom ~ AtomOf fof, term ~ TermOf atom, v ~ VarOf fof, v ~ TVarOf term, IsFirstOrder fof,- Unify atom atom,+ Unify (atom, atom), term ~ UTermOf (atom, atom), Match (atom, atom) v term, Ord fof, Pretty fof) => fof -> Failing Bool pure_resolution3 fm =
src/Data/Logic/ATP/Tableaux.hs view
@@ -37,7 +37,7 @@ import Data.Logic.ATP.Quantified (exists, foldQuantified, for_all, Quant((:!:))) import Data.Logic.ATP.Skolem (askolemize, Formula, HasSkolem(SVarOf, toSkolem), runSkolem, simpdnf', skolemize, SkTerm) import Data.Logic.ATP.Term (fApp, IsTerm(TVarOf, FunOf), vt)-import Data.Logic.ATP.Unif (Unify, unify_literals)+import Data.Logic.ATP.Unif (Unify(UTermOf), unify_literals) import Data.Map.Strict as Map import Data.Set as Set import Data.String (IsString(..))@@ -45,14 +45,17 @@ import Test.HUnit hiding (State) -- | Unify complementary literals.-unify_complements :: (IsLiteral lit1, JustLiteral lit2, HasApply atom1, HasApply atom2, Unify atom1 atom2,- atom1 ~ AtomOf lit1, atom2 ~ AtomOf lit2, term ~ TermOf atom1, term ~ TermOf atom2, v ~ TVarOf term) =>+unify_complements :: (IsLiteral lit1, JustLiteral lit2, HasApply atom1, HasApply atom2,+ Unify (atom1, atom2), term ~ UTermOf (atom1, atom2), v ~ TVarOf term,+ atom1 ~ AtomOf lit1, term ~ TermOf atom1,+ atom2 ~ AtomOf lit2, term ~ TermOf atom2) => lit1 -> lit2 -> StateT (Map v term) Failing () unify_complements p q = unify_literals p ((.~.) q) -- | Unify and refute a set of disjuncts.-unify_refute :: (JustLiteral lit, Ord lit, HasApply atom, Unify atom atom, IsTerm term,- atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) =>+unify_refute :: (JustLiteral lit, Ord lit, HasApply atom, IsTerm term,+ Unify (atom, atom), term ~ UTermOf (atom, atom), v ~ TVarOf term,+ atom ~ AtomOf lit, term ~ TermOf atom) => Set (Set lit) -> Map v term -> Failing (Map v term) unify_refute djs env = case Set.minView djs of@@ -65,7 +68,7 @@ -- | Hence a Prawitz-like procedure (using unification on DNF). prawitz_loop :: forall lit atom v term.- (JustLiteral lit, Ord lit, HasApply atom, Unify atom atom,+ (JustLiteral lit, Ord lit, HasApply atom, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf lit, term ~ TermOf atom, v ~ TVarOf term) => Set (Set lit) -> [v] -> Set (Set lit) -> Int -> (Map v term, Int) prawitz_loop djs0 fvs djs n =@@ -78,7 +81,7 @@ newvar k = vt (fromString ("_" ++ show (n * length fvs + k))) prawitz :: forall formula atom term function v.- (IsFirstOrder formula, Ord formula, Unify atom atom, HasSkolem function, Show formula,+ (IsFirstOrder formula, Ord formula, Unify (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@@ -107,7 +110,7 @@ -- Comparison of number of ground instances. -- ------------------------------------------------------------------------- -compare :: (IsFirstOrder formula, Ord formula, Unify atom atom, HasSkolem function, Show formula,+compare :: (IsFirstOrder formula, Ord formula, Unify (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, Int)@@ -175,7 +178,7 @@ -- | More standard tableau procedure, effectively doing DNF incrementally. (p. 177) tableau :: forall formula atom term v function.- (IsFirstOrder formula, Unify atom atom,+ (IsFirstOrder formula, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term) => [formula] -> Depth -> RWS () () () (Failing (K, Map v term)) tableau fms n0 =@@ -211,14 +214,14 @@ tryLit :: JL formula -> JL formula -> RWS () () () (Failing (K, Map v term)) tryLit fm' l = failing (return . Failure) (\env' -> cont (k, env')) (execStateT (unify_complements fm' l) env) -tabrefute :: (IsFirstOrder formula, Unify atom atom,+tabrefute :: (IsFirstOrder formula, Unify (atom, atom), term ~ UTermOf (atom, atom), atom ~ AtomOf formula, term ~ TermOf atom, v ~ TVarOf term) => Maybe Depth -> [formula] -> Failing ((K, Map v term), Depth) tabrefute limit fms = let r = deepen (\n -> (,n) <$> evalRS (tableau fms n) () ()) (Depth 0) limit in failing Failure (Success . fst) r -tab :: (IsFirstOrder formula, Unify atom atom, Pretty formula, HasSkolem function,+tab :: (IsFirstOrder formula, Unify (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)@@ -285,7 +288,7 @@ -- Try to split up the initial formula first; often a big improvement. -- ------------------------------------------------------------------------- splittab :: forall formula atom term v function.- (IsFirstOrder formula, Unify atom atom, Ord formula, Pretty formula, HasSkolem function,+ (IsFirstOrder formula, Unify (atom, atom), term ~ UTermOf (atom, atom), Ord formula, Pretty formula, HasSkolem function, atom ~ AtomOf formula, term ~ TermOf atom, function ~ FunOf term, v ~ TVarOf term, v ~ SVarOf function) => formula -> [Failing ((K, Map v term), Depth)]
src/Data/Logic/ATP/Unif.hs view
@@ -3,6 +3,7 @@ -- Copyright (c) 2003-2007, John Harrison. (See "LICENSE.txt" for details.) {-# OPTIONS -Wall #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}@@ -10,7 +11,7 @@ {-# LANGUAGE TypeFamilies #-} module Data.Logic.ATP.Unif- ( Unify(unify)+ ( Unify(unify, UTermOf) , unify_terms , unify_literals , unify_atoms@@ -31,31 +32,27 @@ import Data.Logic.ATP.Lib (Failing(Success, Failure)) import Data.Logic.ATP.Lit (IsLiteral, JustLiteral, zipLiterals') import Data.Logic.ATP.Skolem (SkAtom, SkTerm)-import Data.Logic.ATP.Term (IsTerm(..))+import Data.Logic.ATP.Term (IsTerm(..), IsVariable) import Data.Map.Strict as Map import Data.Maybe (fromMaybe) -- import Data.Sequence (Seq, viewl, ViewL(EmptyL, (:<))) import Test.HUnit hiding (State) --- | Main unification procedure.-class TermOf a ~ TermOf b => Unify a b where- unify :: a -> b -> StateT (Map (TVarOf (TermOf a)) (TermOf a)) Failing ()- -- ^ Unify the two elements of a pair, collecting variable- -- assignments in the state.--{--instance Unify a b => Unify [a] [b] where- unify [] [] = return ()- unify (x : xs) (y : ys) = unify x y >> unify xs ys- unify _ _ = fail "unify - list length mismatch"--instance Unify a b => Unify (Seq a) (Seq b) where- unify xs ys =- case (viewl xs, viewl ys) of- (EmptyL, EmptyL) -> return ()- (x :< xs', y :< ys') -> unify x y >> unify xs' ys'- _ -> fail "unify - Seq list length mismatch"--}+-- | Main unification procedure. The result of unification is a+-- mapping of variables to terms, so although we can unify two+-- dissimilar types, they must at least have the same term type (which+-- means the variable type will also match.) The result of unifying+-- the two arguments is added to the state, while failure is signalled+-- in the Failing monad.+--+-- One might think that Unify should take two type parameters, the+-- types of two values to be unified, but there are instances where a+-- single type contains both - for example, in template-haskell we+-- want to unify a and b in a predicate such as this: @(AppT (AppT+-- EqualityT a) b)@.+class (IsTerm (UTermOf a), IsVariable (TVarOf (UTermOf a))) => Unify a where+ type UTermOf a+ unify :: a -> StateT (Map (TVarOf (UTermOf a)) (UTermOf a)) Failing () unify_terms :: (IsTerm term, v ~ TVarOf term) => [(term,term)] -> StateT (Map v term) Failing () unify_terms = mapM_ (uncurry unify_term_pair)@@ -111,7 +108,7 @@ -- who cares. unify_literals :: (IsLiteral lit1, HasApply atom1, atom1 ~ AtomOf lit1, term ~ TermOf atom1, JustLiteral lit2, HasApply atom2, atom2 ~ AtomOf lit2, term ~ TermOf atom2,- Unify atom1 atom2, v ~ TVarOf term) =>+ Unify (atom1, atom2), term ~ UTermOf (atom1, atom2), v ~ TVarOf term) => lit1 -> lit2 -> StateT (Map v term) Failing () unify_literals f1 f2 = fromMaybe (fail "Can't unify literals") (zipLiterals' ho ne tf at f1 f2)@@ -119,7 +116,7 @@ ho _ _ = Nothing ne p q = Just $ unify_literals p q tf p q = if p == q then Just (unify_terms []) else Nothing- at a1 a2 = Just (unify a1 a2)+ at a1 a2 = Just (unify (a1, a2)) unify_atoms :: (JustApply atom1, term ~ TermOf atom1, JustApply atom2, term ~ TermOf atom2,@@ -143,8 +140,9 @@ -- where -- app (t1, t2) = fullunify eqs >>= \i -> return $ (tsubst i t1, tsubst i t2) -instance Unify SkAtom SkAtom where- unify = unify_atoms_eq+instance Unify (SkAtom, SkAtom) where+ type UTermOf (SkAtom, SkAtom) = TermOf SkAtom+ unify = uncurry unify_atoms_eq test01, test02, test03, test04 :: Test test01 = TestCase (assertEqual "Unify test 1"