Copyright | (c) Artem Mavrin 2021 |
---|---|
License | BSD3 |
Maintainer | artemvmavrin@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Defines the Formula
type, its constructors, and its instances.
Synopsis
- data Formula a where
- prettyFormula :: PrettyPrintable a => Formula a -> String
Formula type
Formulas of propositional logic are built inductively from atomic propositions
- truth \(\top\),
- falsity \(\bot\), and
- propositional variables \(a, b, c, \ldots\)
using the unary connective
- negation \(\lnot\)
and the binary connectives
- implication \(\rightarrow\),
- disjunction \(\lor\),
- conjunction \(\land\), and
- equivalence \(\leftrightarrow\).
pattern Lit :: Bool -> Formula a | Propositional literal/constant. |
pattern Var :: a -> Formula a | Propositional variable. |
pattern Not :: Formula a -> Formula a | Negation. |
pattern Imp :: Formula a -> Formula a -> Formula a | Implication. |
pattern Or :: Formula a -> Formula a -> Formula a | Disjunction. |
pattern And :: Formula a -> Formula a -> Formula a | Conjunction. |
pattern Iff :: Formula a -> Formula a -> Formula a | Equivalence. |
Instances
Eq a => Eq (Formula a) Source # | Syntactic equality. |
Ord a => Ord (Formula a) Source # | First compare heights, then compare sizes, then resolve using the
convention |
Defined in AutoProof.Internal.Formula.Types | |
Read a => Read (Formula a) Source # | |
Show a => Show (Formula a) Source # | |
AST (Formula a) Source # | |
PrettyPrintable a => PrettyPrintable (Formula a) Source # | |
type Root (Formula a) Source # | |
Defined in AutoProof.Internal.Formula.Types |
Pretty-printing
prettyFormula :: PrettyPrintable a => Formula a -> String Source #
Get a pretty-printed representation of a propositional formula.
Examples
>>>
prettyFormula $ Imp (Var "a") (Or (Var "b") (Lit False))
"a → (b ∨ ⊥)"