autoproof-0.0.0.0: Propositional logic library
Copyright(c) Artem Mavrin 2021
LicenseBSD3
Maintainerartemvmavrin@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

AutoProof.Internal.Classical.SAT.TruthAssignment

Description

Defines the TruthAssignment class.

Synopsis

Documentation

class TruthAssignment t a where Source #

Class representing truth assignments for evalutating propositional logic formulas.

Minimal complete definition

evalVar

Methods

evalVar :: t -> a -> Bool Source #

Evaluate the truth value of a variable under a given truth assignment.

evalFormula :: t -> Formula a -> Bool Source #

Evaluate the truth value of a formula under a given truth assignment.

Instances

Instances details
TruthAssignment () a Source #

Assigns all propositional variables the truth value False. Can be used to evaluate closed formulas.

Examples

Expand
>>> () |= (Var "a")
False
>>> () |= (Or (Lit True) (Lit False))
True
Instance details

Defined in AutoProof.Internal.Classical.SAT.TruthAssignment

Methods

evalVar :: () -> a -> Bool Source #

evalFormula :: () -> Formula a -> Bool Source #

Ord a => TruthAssignment (Map a Bool) a Source #

Truth assignments where a missing key in the map is interpreted as False.

Examples

Expand
>>> t = Map.fromList $ [("a", True), ("b", False)]
>>> t |= And (Var "a") (Not (Var "b"))
True
>>> t = Map.fromList $ [("a", True)]
>>> t |= Imp (Var "a") (Var "b")
False
Instance details

Defined in AutoProof.Internal.Classical.SAT.TruthAssignment

Methods

evalVar :: Map a Bool -> a -> Bool Source #

evalFormula :: Map a Bool -> Formula a -> Bool Source #

(|=) :: TruthAssignment t a => t -> Formula a -> Bool infix 5 Source #

Semantic entailment relation. This is an infix alias of evalFormula.

Examples

Expand
>>> t = Map.fromList $ [("a", True), ("b", False)]
>>> t |= And (Var "a") (Not (Var "b"))
True