SAT Solver verification

Size: px
Start display at page:

Download "SAT Solver verification"

Transcription

1 SAT Solver verification By Filip Marić April 17, 2016 Abstract This document contains formall correctness proofs of modern SAT solvers. Two different approaches are used state-transition systems shallow embedding into HOL. Formalization based on state-transition systems follows [1, 3]. Several different SAT solver descriptions are given their partial correctness termination is proved. These include: 1. a solver based on classical DPLL procedure (based on backtracksearch with unit propagation), 2. a very general solver with backjumping learning (similiar to the description given in [3]), 3. a solver with a specific conflict analysis algorithm (similiar to the description given in [1]). Formalization based on shallow embedding into HOL defines a SAT solver as a set or recursive HOL functions. Solver supports most state-of-the art techniques including the two-watch literal propagation scheme. Within the SAT solver correctness proofs, a large number of lemmas about propositional logic CNF formulae are proved. This theory is self-contained could be used for further exploring of properties of CNF based SAT algorithms. Contents 1 MoreList last butlast - last element of list elements before it removeall - element removal uniq - no duplicate elements firstpos - first position of an element precedes - ordering relation induced by firstpos isprefix - prefixes of list list-diff - the set difference operation on two lists remdups - removing duplicates Levi s lemma Single element lists

2 2 CNF Syntax Basic datatypes Membership Variables Opposite literals Tautological clauses Semantics Valuations True/False literals True/False clauses True/False formulae Valuation viewed as a formula Consistency of valuations Totality of valuations Models satisfiability Tautological clauses Entailment Equivalency Remove false duplicate literals of a clause Resolution Unit clauses Reason clauses Last asserted literal of a list Trail datatype its properties Trail elements Marked trail elements Prefix before/upto a trail element Marked elements upto a given trail element Last marked element in a trail Level of a trail element Current trail level Prefix to a given trail level Number of literals of every trail level Prefix before last marked element Verification of DPLL based SAT solvers Literal Trail Invariants Auxiliary lemmas Transition rules preserve invariants Different characterizations of backjumping Termination Trail ordering Conflict clause ordering ConflictFlag ordering Formulae ordering Properties of well-founded relations

3 5 BasicDPLL Specification Invariants Soundness Termination Completeness Transition system of Nieuwenhuis, Oliveras Tinelli Specification Invariants Soundness Termination Completeness Transition system of Krstić Goel Specification Invariants Soundness Termination Completeness Functional implementation of a SAT solver with Two Watch literal propagation Specification Total correctness theorem MoreList theory MoreList imports Main /src/hol/library/multiset begin Theory contains some additional lemmas functions for the List datatype. Warning: some of these notions are obsolete because they already exist in List.thy in similiar form. 1.1 last butlast - last element of list elements before it lemma listequalsbutlastappendlast: list [] list = (butlast [last list] lemma lastlistinlist [simp]: list [] last list set list 3

4 lemma butlastissubset: set (butlast list) set list lemma setlistissetbutlastandlast: set list set (butlast list) {last list} lemma butlastappend: butlast list2 ) = (if list2 = [] then butlast list1 else butlast list2 )) 1.2 removeall - element removal lemma removeall-multiset: distinct a x set a mset a = {#x#} + mset (removeall x a) lemma removeall-map: x y. x y f x f y removeall (f x) (map f a) = map f (removeall x a) 1.3 uniq - no duplicate elements. uniq list holds iff there are no repeated elements in a list. Obsolete: same as distinct in List.thy. primrec uniq :: a list => bool uniq [] = True uniq (h#t) = (h / set t uniq t) lemma uniqdistinct: uniq l = distinct l lemma uniqappend: uniq l2 ) uniq l1 uniq l2 lemma uniqappendiff : uniq l2 ) = (uniq l1 uniq l2 set l1 set l2 = {}) (is?lhs =?rhs) lemma uniqappendelement: 4

5 uniq l e / set l = uniq [e]) lemma uniqimpliesnotlastmembutlast: uniq l last l / set (butlast l) lemma uniqbutlastnotuniqlistimplieslastmembutlast: uniq (butlast l) uniq l last l set (butlast l) lemma uniqremdups: uniq (remdups x) lemma uniqheadtailset: uniq l set (tl l) = (set l) {hd l} lemma uniqlengtheqcardset: uniq l length l = card (set l) lemma lengthgtonetwodistinctelements: uniq l length l > 1 l [] a1 a2. a1 set l a2 set l a1 a2 1.4 firstpos - first position of an element firstpos returns the zero-based index of the first occurrence of an element int a list, or the length of the list if the element does not occur. primrec firstpos :: a => a list => nat firstpos a [] = 0 firstpos a (h # t) = (if a = h then 0 else 1 + (firstpos a t)) lemma firstposequalzero: (firstpos a (m # M ) = 0 ) = (a = m) 5

6 lemma firstposlelength: a set l firstpos a l < length l lemma firstposappend: a set l firstpos a l = firstpos a l ) lemma firstposappendnonmemberfirstmembersecond: a / set l1 a set l2 firstpos a l2 ) = length l1 + firstpos a l2 lemma firstposdomainforelements: (0 firstpos a l firstpos a l < length l) = (a set l) (is?lhs =?rhs) lemma firstposequal: a set l b set l (firstpos a l = firstpos b l) = (a = b) (is?lhs =?rhs) lemma firstposlast: l [] uniq l (firstpos x l = length l 1 ) = (x = last l) 1.5 precedes - ordering relation induced by firstpos precedes :: a => a => a list => bool precedes a b l == (a set l b set l firstpos a l <= firstpos b l) lemma noelementsprecedesfirstelement: a b precedes a b (b # list) lemma lastprecedesnoelement: uniq l ( a. a last l precedes (last l) a l) lemma precedesappend: precedes a b l 6

7 precedes a b l ) lemma precedesmemberheadmembertail: a set l1 b / set l1 b set l2 precedes a b l2 ) lemma precedesreflexivity: a set l precedes a a l lemma precedestransitivity: precedes a b l precedes b c l precedes a c l lemma precedesantisymmetry: a set l b set l precedes a b l precedes b a l a = b lemma precedestotalorder: a set l b set l a=b precedes a b l precedes b a l lemma precedesmap: precedes a b list x y. x y f x f y precedes (f a) (f b) (map f list) lemma precedesfilter: precedes a b list f a f b precedes a b (filter f list) precedesorder list == {(a, b). precedes a b list a b} lemma transprecedesorder: trans (precedesorder list) 7

8 lemma wellfoundedprecedesorder: wf (precedesorder list) 1.6 isprefix - prefixes of list. Check if a list is a prefix of another list. Obsolete: similiar notion is defined in List prefixes.thy. isprefix :: a list => a list => bool isprefix p t = ( s. s = t) lemma prefixissubset: isprefix p l set p set l lemma uniqlistimpliesuniqprefix: isprefix p l uniq l uniq p lemma firstposprefixelement: isprefix p l a set p firstpos a p = firstpos a l lemma laterinprefixretainsprecedes: isprefix p l precedes a b l b set p precedes a b p 1.7 list-diff - the set difference operation on two lists. primrec list-diff :: a list a list a list list-diff x [] = x list-diff x (y#ys) = list-diff (removeall y x) ys lemma [simp]: list-diff [] y = [] 8

9 lemma [simp]: list-diff (x # xs) y = (if x set y then list-diff xs y else x # list-diff xs y) lemma listdiffiff : (x set a x / set b) = (x set (list-diff a b)) lemma listdiffdoubleremoveall: x set a list-diff b a = list-diff b (x # a) lemma removealllistdiff [simp]: removeall x (list-diff a b) = list-diff (removeall x a) b lemma listdiffremoveallnonmember: x / set a list-diff a b = list-diff a (removeall x b) lemma listdiffmap: x y. x y f x f y map f (list-diff a b) = list-diff (map f a) (map f b) 1.8 remdups - removing duplicates lemma remdupsremoveallcommute[simp]: remdups (removeall a list) = removeall a (remdups list) lemma remdupsappend: remdups b) = remdups (list-diff a remdups b lemma remdupsappendset: set (remdups b)) = set (remdups remdups (list-diff b a)) lemma remdupsappendmultiset: mset (remdups b)) = mset (remdups remdups (list-diff b a)) lemma remdupslistdiff : 9

10 remdups (list-diff a b) = list-diff (remdups a) (remdups b) multiset-le a b r == a = b (a, b) mult r lemma multisetemptylei : multiset-le {#} a r lemma multisetunionlessmono2 : trans r = (b1, b2 ) mult r = (a + b1, a + b2 ) mult r lemma multisetunionlessmono1 : trans r = (a1, a2 ) mult r = (a1 + b, a2 + b) mult r lemma multisetunionlemono2 : trans r multiset-le b1 b2 r multiset-le (a + b1 ) (a + b2 ) r lemma multisetunionlemono1 : trans r multiset-le a1 a2 r multiset-le (a1 + b) (a2 + b) r lemma multisetletrans: trans r multiset-le x y r multiset-le y z r 10

11 multiset-le x z r lemma multisetunionlemono: trans r multiset-le a1 a2 r multiset-le b1 b2 r multiset-le (a1 + b1 ) (a2 + b2 ) r lemma multisetlelistdiff : trans r multiset-le (mset (list-diff a b)) (mset a) r 1.9 Levi s lemma Obsolete: these two lemmas are already proved as append-eq-append-conv2 append-eq-cons-conv. lemma FullLevi: y = w) = (x = z y = w ( t. t = x y = w) ( t. t = z w = y)) (is?lhs =?rhs) lemma SimpleLevi: s = a # list) = ( p = [] s = a # list ( t. p = a # t s = list)) 1.10 Single element lists lemma lengthonecharacterisation: (length l = 1 ) = (l = [hd l]) lemma lengthoneimpliesonlyelement: length l = 1 a : set l a. a : set l a = a 11

12 end 2 CNF theory CNF imports MoreList begin Theory describing formulae in Conjunctive Normal Form. 2.1 Syntax Basic datatypes type-synonym Variable = nat datatype Literal = Pos Variable Neg Variable type-synonym Clause = Literal list type-synonym Formula = Clause list Notice that instead of set or multisets, lists are used in s of clauses formulae. This is done because SAT solver implementation usually use list-like data structures for representing these datatypes Membership Check if the literal is member of a clause, clause is a member of a formula or the literal is a member of a formula consts member :: a b bool (infixl el 55 ) overloading literalelclause member :: Literal Clause bool begin [simp]: ((literal::literal) el (clause::clause)) == literal set clause end overloading clauseelformula member :: Clause Formula bool begin [simp]: ((clause::clause) el (formula::formula)) == clause set formula end overloading el-literal op el :: Literal Formula bool begin primrec el-literal (literal::literal) el ([]::Formula) = False 12

13 ((literal::literal) el ((clause # formula)::formula)) = ((literal el clause) (literal el formula)) end lemma literalelformulacharacterization: fixes literal :: Literal formula :: Formula (literal el formula) = ( (clause::clause). clause el formula literal el clause) Variables The variable of a given literal primrec var :: Literal Variable var (Pos v) = v var (Neg v) = v Set of variables of a given clause, formula or valuation primrec varsclause :: (Literal list) (Variable set) varsclause [] = {} varsclause (literal # list) = {var literal} (varsclause list) primrec varsformula :: Formula (Variable set) varsformula [] = {} varsformula (clause # formula) = (varsclause clause) (varsformula formula) consts vars :: a Variable set overloading vars-clause vars :: Clause Variable set begin [simp]: vars (clause::clause) == varsclause clause end overloading vars-formula vars :: Formula Variable set begin [simp]: vars (formula::formula) == varsformula formula end overloading vars-set vars :: Literal set Variable set begin 13

14 [simp]: vars (s::literal set) == {vbl. l. l s var l = vbl} end lemma clausecontainsitsliteralsvariable: fixes literal :: Literal clause :: Clause literal el clause var literal vars clause lemma formulacontainsitsliteralsvariable: fixes literal :: Literal formula::formula literal el formula var literal vars formula lemma formulacontainsitsclausesvariables: fixes clause :: Clause formula :: Formula clause el formula vars clause vars formula lemma varsappendformulae: fixes formula1 :: Formula formula2 :: Formula vars formula2 ) = vars formula1 vars formula2 lemma varsappendclauses: fixes clause1 :: Clause clause2 :: Clause vars clause2 ) = vars clause1 vars clause2 lemma varsremoveliteral: fixes literal :: Literal clause :: Clause vars (removeall literal clause) vars clause lemma varsremoveliteralsuperset: fixes literal :: Literal clause :: Clause vars clause {var literal} vars (removeall literal clause) lemma varsremoveallclause: fixes clause :: Clause formula :: Formula vars (removeall clause formula) vars formula lemma varsremoveallclausesuperset: fixes clause :: Clause formula :: Formula 14

15 vars formula vars clause vars (removeall clause formula) lemma varinclausevars: fixes variable :: Variable clause :: Clause variable vars clause = ( literal. literal el clause var literal = variable) lemma varinformulavars: fixes variable :: Variable formula :: Formula variable vars formula = ( literal. literal el formula var literal = variable) (is?lhs formula =?rhs formula) lemma varssubsetformula: fixes F :: Formula F :: Formula c::clause. c el F c el F vars F vars F lemma varsclausevarsset: fixes clause :: Clause vars clause = vars (set clause) Opposite literals primrec opposite :: Literal Literal opposite (Pos v) = (Neg v) opposite (Neg v) = (Pos v) lemma oppositeidempotency [simp]: fixes literal::literal opposite (opposite literal) = literal lemma oppositesymmetry [simp]: fixes literal1 ::Literal literal2 ::Literal (opposite literal1 = literal2 ) = (opposite literal2 = literal1 ) lemma oppositeuniqueness [simp]: fixes literal1 ::Literal literal2 ::Literal (opposite literal1 = opposite literal2 ) = (literal1 = literal2 ) 15

16 lemma oppositeisdifferentfromliteral [simp]: fixes literal::literal opposite literal literal lemma oppositeliteralshavesamevariable [simp]: fixes literal::literal var (opposite literal) = var literal lemma literalswithsamevariableareequaloropposite: fixes literal1 ::Literal literal2 ::Literal (var literal1 = var literal2 ) = (literal1 = literal2 opposite literal1 = literal2 ) (is?lhs =?rhs) The list of literals obtained by negating all literals of a literal list (clause, valuation). Notice that this is not a negation of a clause, because the negation of a clause is a conjunction not a disjunction. oppositeliterallist :: Literal list Literal list oppositeliterallist clause == map opposite clause lemma literalellistiffoppositeliteraleloppositeliterallist: fixes literal :: Literal literallist :: Literal list literal el literallist = (opposite literal) el (oppositeliterallist literallist) lemma oppositeliterallistidempotency [simp]: fixes literallist :: Literal list oppositeliterallist (oppositeliterallist literallist) = literallist lemma oppositeliterallistremove: fixes literal :: Literal literallist :: Literal list oppositeliterallist (removeall literal literallist) = removeall (opposite literal) (oppositeliterallist literallist) lemma oppositeliterallistnonempty: fixes literallist :: Literal list (literallist []) = ((oppositeliterallist literallist) []) 16

17 lemma varsoppositeliterallist: vars (oppositeliterallist clause) = vars clause Tautological clauses Check if the clause contains both a literal its opposite primrec clausetautology :: Clause bool clausetautology [] = False clausetautology (literal # clause) = (opposite literal el clause clausetautology clause) lemma clausetautologycharacterization: fixes clause :: Clause clausetautology clause = ( literal. literal el clause (opposite literal) el clause) 2.2 Semantics Valuations type-synonym Valuation = Literal list lemma valuationcontainsitsliteralsvariable: fixes literal :: Literal valuation :: Valuation literal el valuation var literal vars valuation lemma varssubsetvaluation: fixes valuation1 :: Valuation valuation2 :: Valuation set valuation1 set valuation2 vars valuation1 vars valuation2 lemma varsappendvaluation: fixes valuation1 :: Valuation valuation2 :: Valuation vars valuation2 ) = vars valuation1 vars valuation2 lemma varsprefixvaluation: fixes valuation1 :: Valuation valuation2 :: Valuation isprefix valuation1 valuation2 vars valuation1 vars valuation2 17

18 2.2.2 True/False literals Check if the literal is contained in the given valuation literaltrue :: Literal Valuation bool literaltrue-def [simp]: literaltrue literal valuation == literal el valuation Check if the opposite literal is contained in the given valuation literalfalse :: Literal Valuation bool literalfalse-def [simp]: literalfalse literal valuation == opposite literal el valuation lemma variabledefinedimpliesliteraldefined: fixes literal :: Literal valuation :: Valuation var literal vars valuation = (literaltrue literal valuation literalfalse literal valuation) (is (?lhs valuation) = (?rhs valuation)) True/False clauses Check if there is a literal from the clause which is true in the given valuation primrec clausetrue :: Clause Valuation bool clausetrue [] valuation = False clausetrue (literal # clause) valuation = (literaltrue literal valuation clausetrue clause valuation) Check if all the literals from the clause are false in the given valuation primrec clausefalse :: Clause Valuation bool clausefalse [] valuation = True clausefalse (literal # clause) valuation = (literalfalse literal valuation clausefalse clause valuation) lemma clausetrueiffcontainstrueliteral: fixes clause :: Clause valuation :: Valuation clausetrue clause valuation = ( literal. literal el clause literaltrue literal valuation) 18

19 lemma clausefalseiffallliteralsarefalse: fixes clause :: Clause valuation :: Valuation clausefalse clause valuation = ( literal. literal el clause literalfalse literal valuation) lemma clausefalseremove: clausefalse clause valuation clausefalse (removeall literal clause) valuation lemma clausefalseappendvaluation: fixes clause :: Clause valuation :: Valuation valuation :: Valuation clausefalse clause valuation clausefalse clause valuation ) lemma clausetrueappendvaluation: fixes clause :: Clause valuation :: Valuation valuation :: Valuation clausetrue clause valuation clausetrue clause valuation ) lemma emptyclauseisfalse: fixes valuation :: Valuation clausefalse [] valuation lemma emptyvaluationfalsifiesonlyemptyclause: fixes clause :: Clause clause [] clausefalse clause [] lemma valuationcontainsitsfalseclausesvariables: fixes clause::clause valuation::valuation clausefalse clause valuation vars clause vars valuation True/False formulae Check if all the clauses from the formula are false in the given valuation primrec 19

20 formulatrue :: Formula Valuation bool formulatrue [] valuation = True formulatrue (clause # formula) valuation = (clausetrue clause valuation formulatrue formula valuation) Check if there is a clause from the formula which is false in the given valuation primrec formulafalse :: Formula Valuation bool formulafalse [] valuation = False formulafalse (clause # formula) valuation = (clausefalse clause valuation formulafalse formula valuation) lemma formulatrueiffallclausesaretrue: fixes formula :: Formula valuation :: Valuation formulatrue formula valuation = ( clause. clause el formula clausetrue clause valuation) lemma formulafalseiffcontainsfalseclause: fixes formula :: Formula valuation :: Valuation formulafalse formula valuation = ( clause. clause el formula clausefalse clause valuation) lemma formulatrueassociativity: fixes f1 :: Formula f2 :: Formula f3 :: Formula valuation :: Valuation formulatrue f2 f3 ) valuation = formulatrue f3 )) valuation lemma formulatruecommutativity: fixes f1 :: Formula f2 :: Formula valuation :: Valuation formulatrue f2 ) valuation = formulatrue f1 ) valuation lemma formulatruesubset: fixes formula :: Formula formula :: Formula valuation :: Valuation formulatrue: formulatrue formula valuation subset: (clause::clause). clause el formula clause el formula formulatrue formula valuation 20

21 lemma formulatrueappend: fixes formula1 :: Formula formula2 :: Formula valuation :: Valuation formulatrue formula2 ) valuation = (formulatrue formula1 valuation formulatrue formula2 valuation) lemma formulatrueremoveall: fixes formula :: Formula clause :: Clause valuation :: Valuation formulatrue formula valuation formulatrue (removeall clause formula) valuation lemma formulafalseappend: fixes formula :: Formula formula :: Formula valuation :: Valuation formulafalse formula valuation formulafalse formula ) valuation lemma formulatrueappendvaluation: fixes formula :: Formula valuation :: Valuation valuation :: Valuation formulatrue formula valuation formulatrue formula valuation ) lemma formulafalseappendvaluation: fixes formula :: Formula valuation :: Valuation valuation :: Valuation formulafalse formula valuation formulafalse formula valuation ) lemma trueformulawithsingleliteralclause: fixes formula :: Formula literal :: Literal valuation :: Valuation formulatrue (removeall [literal] formula) [literal]) formulatrue formula [literal]) Valuation viewed as a formula Converts a valuation (the list of literals) into formula (list of single member lists of literals) primrec 21

22 val2form :: Valuation Formula val2form [] = [] val2form (literal # valuation) = [literal] # val2form valuation lemma val2formel: fixes literal :: Literal valuation :: Valuation literal el valuation = [literal] el val2form valuation lemma val2formaresingleliteralclauses: fixes clause :: Clause valuation :: Valuation clause el val2form valuation ( literal. clause = [literal] literal el valuation) lemma val2formofsingleliteralvaluation: length v = 1 val2form v = [[hd v]] lemma val2formremoveall: fixes literal :: Literal valuation :: Valuation removeall [literal] (val2form valuation) = val2form (removeall literal valuation) lemma val2formappend: fixes valuation1 :: Valuation valuation2 :: Valuation val2form valuation2 ) = (val2form val2form valuation2 ) lemma val2formformulatrue: fixes valuation1 :: Valuation valuation2 :: Valuation formulatrue (val2form valuation1 ) valuation2 = ( (literal :: Literal). literal el valuation1 literal el valuation2 ) Consistency of valuations Valuation is inconsistent if it contains both a literal its opposite. primrec inconsistent :: Valuation bool inconsistent [] = False inconsistent (literal # valuation) = (opposite literal el valuation inconsistent valuation) 22

23 [simp]: consistent valuation == inconsistent valuation lemma inconsistentcharacterization: fixes valuation :: Valuation inconsistent valuation = ( literal. literaltrue literal valuation literalfalse literal valuation) lemma clausetrueandclausefalseimpliesinconsistent: fixes clause :: Clause valuation :: Valuation clausetrue clause valuation clausefalse clause valuation inconsistent valuation lemma formulatrueandformulafalseimpliesinconsistent: fixes formula :: Formula valuation :: Valuation formulatrue formula valuation formulafalse formula valuation inconsistent valuation lemma inconsistentappend: fixes valuation1 :: Valuation valuation2 :: Valuation inconsistent valuation2 ) inconsistent valuation1 inconsistent valuation2 ( literal. literaltrue literal valuation1 literalfalse literal valuation2 ) lemma consistentappendelement: consistent v literalfalse l v consistent [l]) lemma inconsistentremoveall: fixes literal :: Literal valuation :: Valuation inconsistent (removeall literal valuation) inconsistent valuation lemma inconsistentprefix: isprefix valuation1 valuation2 inconsistent valuation1 inconsistent valuation2 lemma consistentprefix: isprefix valuation1 valuation2 consistent valuation2 consistent valuation1 23

24 2.2.7 Totality of valuations Checks if the valuation contains all the variables from the given set of variables total [simp]: total valuation variables == variables vars valuation lemma totalsubset: fixes A :: Variable set B :: Variable set valuation :: Valuation A B total valuation B total valuation A lemma totalformulaimpliestotalclause: fixes clause :: Clause formula :: Formula valuation :: Valuation clauseel: clause el formula totalformula: total valuation (vars formula) totalclause: total valuation (vars clause) lemma totalvaluationforclausedefinesallitsliterals: fixes clause :: Clause valuation :: Valuation literal :: Literal totalclause: total valuation (vars clause) literalel: literal el clause trueorfalse: literaltrue literal valuation literalfalse literal valuation lemma totalvaluationforclausedefinesitsvalue: fixes clause :: Clause valuation :: Valuation totalclause: total valuation (vars clause) clausetrue clause valuation clausefalse clause valuation lemma totalvaluationforformuladefinesallitsliterals: fixes formula::formula valuation::valuation totalformula: total valuation (vars formula) literalelformula: literal el formula literaltrue literal valuation literalfalse literal valuation lemma totalvaluationforformuladefinesallitsclauses: fixes formula :: Formula valuation :: Valuation clause :: Clause totalformula: total valuation (vars formula) clauseelformula: clause el formula 24

25 clausetrue clause valuation clausefalse clause valuation lemma totalvaluationforformuladefinesitsvalue: totalformula: total valuation (vars formula) formulatrue formula valuation formulafalse formula valuation lemma totalremoveallsingleliteralclause: fixes literal :: Literal valuation :: Valuation formula :: Formula varliteral: var literal vars valuation totalremoveall: total valuation (vars (removeall [literal] formula)) total valuation (vars formula) Models satisfiability Model of a formula is a consistent valuation under which formula/clause is true consts model :: Valuation a bool overloading modelformula model :: Valuation Formula bool begin [simp]: model valuation (formula::formula) == consistent valuation (formulatrue formula valuation) end overloading modelclause model :: Valuation Clause bool begin [simp]: model valuation (clause::clause) == consistent valuation (clausetrue clause valuation) end Checks if a formula has a model satisfiable :: Formula bool satisfiable formula == valuation. model valuation formula lemma formulawithemptyclauseisunsatisfiable: fixes formula :: Formula ([]::Clause) el formula satisfiable formula lemma satisfiablesubset: fixes formula0 :: Formula formula :: Formula subset: (clause::clause). clause el formula0 clause el formula 25

26 satisfiable formula satisfiable formula0 lemma satisfiableappend: fixes formula1 :: Formula formula2 :: Formula satisfiable formula2 ) satisfiable formula1 satisfiable formula2 lemma modelexp: fixes formula :: Formula literal :: Literal valuation :: Valuation model valuation formula var literal / vars valuation model [literal]) formula Tautological clauses lemma tautologynotfalse: fixes clause :: Clause valuation :: Valuation clausetautology clause consistent valuation clausefalse clause valuation lemma tautologyintotalvaluation: clausetautology clause vars clause vars valuation clausetrue clause valuation lemma modelappendtautology: model valuation F clausetautology c vars valuation vars F vars c model valuation [c]) lemma satisfiableappendtautology: satisfiable F clausetautology c satisfiable [c]) lemma modelappendtautologicalformula: 26

27 fixes F :: Formula F :: Formula model valuation F c. c el F clausetautology c vars valuation vars F vars F model valuation F ) lemma satisfiableappendtautologicalformula: satisfiable F c. c el F clausetautology c satisfiable F ) lemma satisfiablefiltertautologies: satisfiable F = satisfiable (filter (% c. clausetautology c) F ) lemma modelfiltertautologies: model valuation (filter (% c. clausetautology c) F ) vars F vars valuation model valuation F Entailment Formula entails literal if it is true in all its models formulaentailsliteral :: Formula Literal bool formulaentailsliteral formula literal == (valuation::valuation). model valuation formula literaltrue literal valuation Clause implies literal if it is true in all its models clauseentailsliteral :: Clause Literal bool clauseentailsliteral clause literal == (valuation::valuation). model valuation clause literaltrue literal valuation Formula entails clause if it is true in all its models formulaentailsclause :: Formula Clause bool formulaentailsclause formula clause == 27

28 (valuation::valuation). model valuation formula model valuation clause Formula entails valuation if it entails its every literal formulaentailsvaluation :: Formula Valuation bool formulaentailsvaluation formula valuation == literal. literal el valuation formulaentailsliteral formula literal Formula entails formula if it is true in all its models formulaentailsformula :: Formula Formula bool formulaentailsformula-def : formulaentailsformula formula formula == (valuation::valuation). model valuation formula model valuation formula lemma singleliteralclausesentailitsliteral: fixes clause :: Clause literal :: Literal length clause = 1 literal el clause clauseentailsliteral clause literal lemma clauseentailsliteralthenformulaentailsliteral: fixes clause :: Clause formula :: Formula literal :: Literal clause el formula clauseentailsliteral clause literal formulaentailsliteral formula literal lemma formulaentailsliteralappend: fixes formula :: Formula formula :: Formula literal :: Literal formulaentailsliteral formula literal formulaentailsliteral formula ) literal lemma formulaentailsliteralsubset: fixes formula :: Formula formula :: Formula literal :: Literal formulaentailsliteral formula literal (c::clause). c el formula c el formula formulaentailsliteral formula literal lemma formulaentailsliteralremoveall: fixes formula :: Formula clause :: Clause literal :: Literal formulaentailsliteral (removeall clause formula) literal 28

29 formulaentailsliteral formula literal lemma formulaentailsliteralremoveallappend: fixes formula1 :: Formula formula2 :: Formula clause :: Clause valuation :: Valuation formulaentailsliteral ((removeall clause formula1 formula2 ) literal formulaentailsliteral formula2 ) literal lemma formulaentailsitsclauses: fixes clause :: Clause formula :: Formula clause el formula formulaentailsclause formula clause lemma formulaentailsclauseappend: fixes clause :: Clause formula :: Formula formula :: Formula formulaentailsclause formula clause formulaentailsclause formula ) clause lemma formulaunsatiffimpliesemptyclause: fixes formula :: Formula formulaentailsclause formula [] = ( satisfiable formula) lemma formulatrueextendwithentailedclauses: fixes formula :: Formula formula0 :: Formula valuation :: Valuation formulaentailed: (clause::clause). clause el formula formulaentailsclause formula0 clause consistent valuation formulatrue formula0 valuation formulatrue formula valuation lemma formulaentailsformulaiffentailsallitsclauses: fixes formula :: Formula formula :: Formula formulaentailsformula formula formula = ( clause::clause. clause el formula formulaentailsclause formula clause) (is?lhs =?rhs) lemma formulaentailsformulathatentailsclause: fixes formula1 :: Formula formula2 :: Formula clause :: Clause 29

30 formulaentailsformula formula1 formula2 formulaentailsclause formula2 clause formulaentailsclause formula1 clause lemma fixes formula1 :: Formula formula2 :: Formula formula1 :: Formula literal :: Literal formulaentailsliteral formula2 ) literal formulaentailsformula formula1 formula1 formulaentailsliteral formula2 ) literal lemma formulafalseinentailedvaluationisunsatisfiable: fixes formula :: Formula valuation :: Valuation formulafalse formula valuation formulaentailsvaluation formula valuation satisfiable formula lemma formulafalseinentailedorpurevaluationisunsatisfiable: fixes formula :: Formula valuation :: Valuation formulafalse formula valuation literal. literal el valuation formulaentailsliteral formula literal opposite literal el formula satisfiable formula lemma unsatisfiableformulawithsingleliteralclause: fixes formula :: Formula literal :: Literal satisfiable formula [literal] el formula formulaentailsliteral (removeall [literal] formula) (opposite literal) lemma unsatisfiableformulawithsingleliteralclauses: fixes F ::Formula c::clause satisfiable val2form (oppositeliterallist c)) clausetautology c formulaentailsclause F c lemma satisfiableentailedformula: fixes formula0 :: Formula formula :: Formula formulaentailsformula formula0 formula satisfiable formula0 satisfiable formula 30

31 lemma val2formisentailed: formulaentailsvaluation val2form F ) valuation Equivalency Formulas are equivalent if they have same models. equivalentformulae :: Formula Formula bool equivalentformulae formula1 formula2 == (valuation::valuation). model valuation formula1 = model valuation formula2 lemma equivalentformulaeiffentaileachother: fixes formula1 :: Formula formula2 :: Formula equivalentformulae formula1 formula2 = (formulaentailsformula formula1 formula2 formulaentailsformula formula2 formula1 ) lemma equivalentformulaereflexivity: fixes formula :: Formula equivalentformulae formula formula lemma equivalentformulaesymmetry: fixes formula1 :: Formula formula2 :: Formula equivalentformulae formula1 formula2 = equivalentformulae formula2 formula1 lemma equivalentformulaetransitivity: fixes formula1 :: Formula formula2 :: Formula formula3 :: Formula equivalentformulae formula1 formula2 equivalentformulae formula2 formula3 equivalentformulae formula1 formula3 lemma equivalentformulaeappend: fixes formula1 :: Formula formula1 :: Formula formula2 :: Formula equivalentformulae formula1 formula1 equivalentformulae formula2 ) formula2 ) lemma satisfiableequivalent: 31

32 fixes formula1 :: Formula formula2 :: Formula equivalentformulae formula1 formula2 satisfiable formula1 = satisfiable formula2 lemma satisfiableequivalentappend: fixes formula1 :: Formula formula1 :: Formula formula2 :: Formula equivalentformulae formula1 formula1 satisfiable formula2 ) satisfiable formula2 ) lemma replaceequivalentbyequivalent: fixes formula :: Formula formula :: Formula formula1 :: Formula formula2 :: Formula equivalentformulae formula formula equivalentformulae formula2 ) formula2 ) lemma clauseorderirrelevant: equivalentformulae F2 ) F2 ) lemma extendequivalentformulawithentailedclause: fixes formula1 :: Formula formula2 :: Formula clause :: Clause equivalentformulae formula1 formula2 formulaentailsclause formula2 clause equivalentformulae formula1 [clause]) lemma entailsliteralrelpacepartwithequivalent: equivalentformulae F F formulaentailsliteral F2 ) l formulaentailsliteral F2 ) l Remove false duplicate literals of a clause removefalseliterals :: Clause Valuation Clause removefalseliterals clause valuation = filter (λ l. literalfalse l valuation) clause 32

33 lemma clausetrueremovefalseliterals: consistent v clausetrue c v = clausetrue (removefalseliterals c v) v lemma clausetrueremoveduplicateliterals: clausetrue c v = clausetrue (remdups c) v lemma removeduplicateliteralsequivalentclause: equivalentformulae [remdups clause] [clause] lemma falseliteralscanberemoved: fixes F ::Formula F ::Formula v::valuation equivalentformulae val2form F2 ) F equivalentformulae val2form [removefalseliterals c F2 ) [c]) (is equivalentformulae?lhs?rhs) lemma falseandduplicateliteralscanberemoved: equivalentformulae val2form F2 ) F equivalentformulae val2form [remdups (removefalseliterals c F2 ) [c]) (is equivalentformulae?lhs?rhs) lemma satisfiedclausecanberemoved: equivalentformulae val2form v) F clausetrue c v equivalentformulae val2form v) [c]) lemma formulaentailsclauseremoveentailedliteralopposites: formulaentailsclause F clause formulaentailsvaluation F valuation formulaentailsclause F (list-diff clause (oppositeliterallist valuation)) Resolution 33

34 resolve clause1 clause2 literal == removeall literal removeall (opposite literal) clause2 lemma resolventisentailed: fixes clause1 :: Clause clause2 :: Clause literal :: Literal formulaentailsclause [clause1, clause2 ] (resolve clause1 clause2 literal) lemma formulaentailsresolvent: fixes formula :: Formula clause1 :: Clause clause2 :: Clause formulaentailsclause formula clause1 formulaentailsclause formula clause2 formulaentailsclause formula (resolve clause1 clause2 literal) lemma resolvefalseclauses: fixes literal :: Literal clause1 :: Clause clause2 :: Clause valuation :: Valuation clausefalse (removeall literal clause1 ) valuation clausefalse (removeall (opposite literal) clause2 ) valuation clausefalse (resolve clause1 clause2 literal) valuation Unit clauses Clause is unit in a valuation if all its literals but one are false, that one is undefined. isunitclause :: Clause Literal Valuation bool isunitclause uclause uliteral valuation == uliteral el uclause (literaltrue uliteral valuation) (literalfalse uliteral valuation) ( literal. literal el uclause literal uliteral literalfalse literal valuation) lemma unitliteralisentailed: fixes uclause :: Clause uliteral :: Literal formula :: Formula valuation :: Valuation isunitclause uclause uliteral valuation formulaentailsclause formula uclause formulaentailsliteral val2form valuation) uliteral lemma isunitclauseremoveallunitliteralisfalse: fixes uclause :: Clause uliteral :: Literal valuation :: 34

35 Valuation isunitclause uclause uliteral valuation clausefalse (removeall uliteral uclause) valuation lemma isunitclauseappendvaluation: isunitclause uclause uliteral valuation l uliteral l opposite uliteral isunitclause uclause uliteral [l]) lemma containstruenotunit: l el c literaltrue l v consistent v ( ul. isunitclause c ul v) lemma unitbecomesfalse: isunitclause uclause uliteral valuation clausefalse uclause [opposite uliteral]) Reason clauses A clause is reason for unit propagation of a given literal if it was a unit clause before it is asserted, became true when it is asserted. isreason::clause Literal Valuation bool (isreason clause literal valuation) == (literal el clause) (clausefalse (removeall literal clause) valuation) ( literal. literal el (removeall literal clause) precedes (opposite literal ) literal valuation opposite literal literal) lemma isreasonappend: fixes clause :: Clause literal :: Literal valuation :: Valuation valuation :: Valuation isreason clause literal valuation isreason clause literal valuation ) lemma isunitclauseisreason: 35

36 fixes uclause :: Clause uliteral :: Literal valuation :: Valuation isunitclause uclause uliteral valuation uliteral el valuation isreason uclause uliteral valuation ) lemma isreasonholdsinprefix: fixes prefix :: Valuation valuation :: Valuation clause :: Clause literal :: Literal literal el prefix isprefix prefix valuation isreason clause literal valuation isreason clause literal prefix Last asserted literal of a list lastassertedliteral from a list is the last literal from a clause that is asserted in a valuation. islastassertedliteral::literal Literal list Valuation bool islastassertedliteral literal clause valuation == literal el clause literaltrue literal valuation ( literal. literal el clause literal literal precedes literal literal valuation) Function that gets the last asserted literal of a list - specified only by its postcondition. getlastassertedliteral :: Literal list Valuation Literal getlastassertedliteral clause valuation == last (filter (λ l::literal. l el clause) valuation) lemma getlastassertedliteralcharacterization: clausefalse clause valuation clause [] uniq valuation islastassertedliteral (getlastassertedliteral (oppositeliterallist clause) valuation) (oppositeliterallist clause) valuation 36

37 lemma lastassertedliteralisuniq: fixes literal :: Literal literal :: Literal literallist :: Literal list valuation :: Valuation lastl: islastassertedliteral literal literallist valuation lastl : islastassertedliteral literal literallist valuation literal = literal lemma islastassertedcharacterization: fixes literal :: Literal literallist :: Literal list v :: Valuation islastassertedliteral literal (oppositeliterallist literallist) valuation opposite literal el literallist literaltrue literal valuation lemma islastassertedliteralsubset: islastassertedliteral l c M set c set c l el c islastassertedliteral l c M lemma lastassertedlastinvaluation: fixes literal :: Literal literallist :: Literal list valuation :: Valuation literal el literallist literaltrue literal valuation islastassertedliteral literal literallist [literal]) end 3 Trail datatype its properties theory Trail imports MoreList begin Trail is a list in which some elements can be marked. type-synonym a Trail = ( a bool) list abbreviation element :: ( a bool) a element x == fst x 37

38 abbreviation marked :: ( a bool) bool marked x == snd x 3.1 Trail elements Elements of the trail with marks removed primrec elements :: a Trail a list elements [] = [] elements (h#t) = (element h) # (elements t) lemma elements t = map fst t lemma eithermarkedornotmarkedelement: a = (element a, True) a = (element a, False) lemma eithermarkedornotmarked: e set (elements M ) (e, True) set M (e, False) set M lemma elementmemelements [simp]: x set M element x set (elements M ) lemma elementsappend [simp]: elements b) = elements elements b lemma elementsemptyifftrailempty [simp]: (elements list = []) = (list = []) lemma elementsbutlasttrailisbutlastelementstrail [simp]: elements (butlast M ) = butlast (elements M ) lemma elementlasttrailislastelementstrail [simp]: M [] element (last M ) = last (elements M ) 38

39 lemma isprefixelements: isprefix a b isprefix (elements a) (elements b) lemma prefixelementsaretrailelements: isprefix p M set (elements p) set (elements M ) lemma uniqelementstrailimpliesuniqelementsprefix: isprefix p M uniq (elements M ) uniq (elements p) lemma [simp]: (e, d) set M e set (elements M ) lemma uniqimpliesexclusivetrueorfalse: (e, d) set M uniq (elements M ) (e, d) set M 3.2 Marked trail elements primrec markedelements :: a Trail a list markedelements [] = [] markedelements (h#t) = (if (marked h) then (element h) # (markedelements t) else (markedelements t)) lemma markedelements t = (elements (filter snd t)) lemma markedelementismarkedtrue: (m set (markedelements M )) = ((m, True) set M ) lemma markedelementsappend: 39

40 markedelements M2 ) = markedelements markedelements M2 lemma markedelementsareelements: m set (markedelements M ) m set (elements M ) lemma markedandmemberimpliesismarkedelement: marked m m set M (element m) set (markedelements M ) lemma markedelementsprefixaremarkedelementstrail: isprefix p M m set (markedelements p) m set (markedelements M ) lemma markedelementstrailmemprefixaremarkedelementsprefix: uniq (elements M ) isprefix p M m set (elements p) m set (markedelements M ) m set (markedelements p) 3.3 Prefix before/upto a trail element Elements of the trail before the first occurrence of a given element - not incuding it primrec prefixbeforeelement :: a a Trail a Trail prefixbeforeelement e [] = [] prefixbeforeelement e (h#t) = (if (element h) = e then [] else (h # (prefixbeforeelement e t)) ) lemma prefixbeforeelement e t = takewhile (λ e. element e e) t lemma prefixbeforeelement e t = take (firstpos e (elements t)) t 40

41 Elements of the trail before the first occurrence of a given element - incuding it primrec prefixtoelement :: a a Trail a Trail prefixtoelement e [] = [] prefixtoelement e (h#t) = (if (element h) = e then [h] else (h # (prefixtoelement e t)) ) lemma prefixtoelement e t = take ((firstpos e (elements t)) + 1 ) t lemma isprefixprefixtoelement: isprefix (prefixtoelement e t) t lemma isprefixprefixbeforeelement: isprefix (prefixbeforeelement e t) t lemma prefixtoelementcontainstrailelement: e set (elements M ) e set (elements (prefixtoelement e M )) lemma prefixbeforeelementdoesnotcontaintrailelement: e set (elements M ) e / set (elements (prefixbeforeelement e M )) lemma prefixtoelementappend: prefixtoelement e M2 ) = (if e set (elements M1 ) then prefixtoelement e M1 else prefixtoelement e M2 ) lemma prefixtoelementtoprefixelement: isprefix p M e set (elements p) 41

42 prefixtoelement e M = prefixtoelement e p 3.4 Marked elements upto a given trail element Marked elements of the trail upto the given element (which is also included if it is marked) markedelementsto :: a a Trail a list markedelementsto e t = markedelements (prefixtoelement e t) lemma markedelementstoareprefixofmarkedelements: isprefix (markedelementsto e M ) (markedelements M ) lemma markedelementstoaremarkedelements: m set (markedelementsto e M ) m set (markedelements M ) lemma markedelementstononmemberareallmarkedelements: e / set (elements M ) markedelementsto e M = markedelements M lemma markedelementstoappend: markedelementsto e M2 ) = (if e set (elements M1 ) then markedelementsto e M1 else markedelements markedelementsto e M2 ) lemma markedelementsemptyimpliesmarkedelementstoempty: markedelements M = [] markedelementsto e M = [] lemma markedelementismemberofitsmarkedelementsto: uniq (elements M ) marked e e set M element e set (markedelementsto (element e) M ) lemma markedelementstoprefixelement: isprefix p M e set (elements p) 42

43 markedelementsto e M = markedelementsto e p 3.5 Last marked element in a trail lastmarked :: a Trail a lastmarked t = last (markedelements t) lemma lastmarkedismarkedelement: markedelements M [] lastmarked M set (markedelements M ) lemma removelastmarkedfrommarkedelementstolastmarkedareall- MarkedElementsInPrefixLastMarked: markedelements M [] removeall (lastmarked M ) (markedelementsto (lastmarked M ) M ) = markedelements (prefixbeforeelement (lastmarked M ) M ) lemma markedelementstolastmarkedareallmarkedelements: uniq (elements M ) markedelements M [] markedelementsto (lastmarked M ) M = markedelements M lemma lasttrailelementmarkedimpliesmarkedelementstolastelementare- AllMarkedElements: marked (last M ) last (elements M ) / set (butlast (elements M )) markedelementsto (last (elements M )) M = markedelements M lemma lastmarkedismemberofitsmarkedelementsto: uniq (elements M ) markedelements M [] lastmarked M set (markedelementsto (lastmarked M ) M ) lemma lasttrailelementnotmarkedimpliesmarkedelementstolaremarkedelementstolinbutlasttrail: 43

44 marked (last M ) markedelementsto e M = markedelementsto e (butlast M ) 3.6 Level of a trail element Level of an element is the number of marked elements that precede it elementlevel :: a a Trail nat elementlevel e t = length (markedelementsto e t) lemma elementlevelmarkedgeq1 : uniq (elements M ) e set (markedelements M ) elementlevel e M >= 1 lemma elementlevelappend: a set (elements M ) elementlevel a M = elementlevel a M ) lemma elementlevelprecedesleq: precedes a b (elements M ) elementlevel a M elementlevel b M lemma elementlevelprecedesmarkedelementlt: uniq (elements M ) e d d set (markedelements M ) precedes e d (elements M ) elementlevel e M < elementlevel d M lemma differentmarkedelementshavedifferentlevels: uniq (elements M ) a set (markedelements M ) b set (markedelements M ) 44

45 a b elementlevel a M elementlevel b M 3.7 Current trail level Current level is the number of marked elements in the trail currentlevel :: a Trail nat currentlevel t = length (markedelements t) lemma currentlevelnonmarked: currentlevel M = currentlevel [(l, False)]) lemma currentlevelprefix: isprefix a b currentlevel a <= currentlevel b lemma elementlevelleqcurrentlevel: elementlevel a M currentlevel M lemma elementoncurrentlevel: a / set (elements M ) elementlevel a [(a, d)]) = currentlevel d)]) [(a, 3.8 Prefix to a given trail level Prefix is made or elements of the trail up to a given element level primrec prefixtolevel-aux :: a Trail nat nat a Trail (prefixtolevel-aux [] l cl) = [] (prefixtolevel-aux (h#t) l cl) = (if (marked h) then (if (cl >= l) then [] else (h # (prefixtolevel-aux t l (cl+1 )))) else (h # (prefixtolevel-aux t l cl)) ) prefixtolevel :: nat a Trail a Trail 45

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel April 17, 2016 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Propositional Logic: Models and Proofs

Propositional Logic: Models and Proofs Propositional Logic: Models and Proofs C. R. Ramakrishnan CSE 505 1 Syntax 2 Model Theory 3 Proof Theory and Resolution Compiled at 11:51 on 2016/11/02 Computing with Logic Propositional Logic CSE 505

More information

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw Applied Logic Lecture 1 - Propositional logic Marcin Szczuka Institute of Informatics, The University of Warsaw Monographic lecture, Spring semester 2017/2018 Marcin Szczuka (MIMUW) Applied Logic 2018

More information

Propositional Logic Language

Propositional Logic Language Propositional Logic Language A logic consists of: an alphabet A, a language L, i.e., a set of formulas, and a binary relation = between a set of formulas and a formula. An alphabet A consists of a finite

More information

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant M a s t e r r e s e a rc h I n t e r n s h i p Master Thesis Formalisation of Ground Inference Systems in a Proof Assistant Domain: Data Structures and Algorithms - Logic in Computer Science Author: Mathias

More information

Landau Symbols. Manuel Eberl. November 28, 2018

Landau Symbols. Manuel Eberl. November 28, 2018 Landau Symbols Manuel Eberl November 28, 2018 Contents 1 Sorting and grouping factors 1 2 Decision procedure for real functions 4 2.1 Eventual non-negativity/non-zeroness............. 4 2.2 Rewriting Landau

More information

Lecture 2 Propositional Logic & SAT

Lecture 2 Propositional Logic & SAT CS 5110/6110 Rigorous System Design Spring 2017 Jan-17 Lecture 2 Propositional Logic & SAT Zvonimir Rakamarić University of Utah Announcements Homework 1 will be posted soon Propositional logic: Chapter

More information

Solving SAT Modulo Theories

Solving SAT Modulo Theories Solving SAT Modulo Theories R. Nieuwenhuis, A. Oliveras, and C.Tinelli. Solving SAT and SAT Modulo Theories: from an Abstract Davis-Putnam-Logemann-Loveland Procedure to DPLL(T) Mooly Sagiv Motivation

More information

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010 Introduction to Artificial Intelligence Propositional Logic & SAT Solving UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010 Today Representation in Propositional Logic Semantics & Deduction

More information

Constraint Solving for Finite Model Finding in SMT Solvers

Constraint Solving for Finite Model Finding in SMT Solvers myjournal manuscript No. (will be inserted by the editor) Constraint Solving for Finite Model Finding in SMT Solvers Andrew Reynolds Cesare Tinelli Clark Barrett Received: date / Accepted: date Abstract

More information

Satisfiability Modulo Theories

Satisfiability Modulo Theories Satisfiability Modulo Theories Bruno Dutertre SRI International Leonardo de Moura Microsoft Research Satisfiability a > b + 2, a = 2c + 10, c + b 1000 SAT a = 0, b = 3, c = 5 Model 0 > 3 + 2, 0 = 2 5 +

More information

Classical Propositional Logic

Classical Propositional Logic Classical Propositional Logic Peter Baumgartner http://users.cecs.anu.edu.au/~baumgart/ Ph: 02 6218 3717 Data61/CSIRO and ANU July 2017 1 / 71 Classical Logic and Reasoning Problems A 1 : Socrates is a

More information

Propositional Reasoning

Propositional Reasoning Propositional Reasoning CS 440 / ECE 448 Introduction to Artificial Intelligence Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri Spring 2010 Intro to AI (CS

More information

Normal Forms of Propositional Logic

Normal Forms of Propositional Logic Normal Forms of Propositional Logic Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 12, 2017 Bow-Yaw Wang (Academia Sinica) Normal Forms of Propositional Logic September

More information

Warm-Up Problem. Is the following true or false? 1/35

Warm-Up Problem. Is the following true or false? 1/35 Warm-Up Problem Is the following true or false? 1/35 Propositional Logic: Resolution Carmen Bruni Lecture 6 Based on work by J Buss, A Gao, L Kari, A Lubiw, B Bonakdarpour, D Maftuleac, C Roberts, R Trefler,

More information

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30) Computational Logic Davide Martinenghi Free University of Bozen-Bolzano Spring 2010 Computational Logic Davide Martinenghi (1/30) Propositional Logic - sequent calculus To overcome the problems of natural

More information

Comp487/587 - Boolean Formulas

Comp487/587 - Boolean Formulas Comp487/587 - Boolean Formulas 1 Logic and SAT 1.1 What is a Boolean Formula Logic is a way through which we can analyze and reason about simple or complicated events. In particular, we are interested

More information

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel Propositional Logic Methods & Tools for Software Engineering (MTSE) Fall 2017 Prof. Arie Gurfinkel References Chpater 1 of Logic for Computer Scientists http://www.springerlink.com/content/978-0-8176-4762-9/

More information

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system): Logic Knowledge-based agents Inference engine Knowledge base Domain-independent algorithms Domain-specific content Knowledge base (KB) = set of sentences in a formal language Declarative approach to building

More information

Introduction to Solving Combinatorial Problems with SAT

Introduction to Solving Combinatorial Problems with SAT Introduction to Solving Combinatorial Problems with SAT Javier Larrosa December 19, 2014 Overview of the session Review of Propositional Logic The Conjunctive Normal Form (CNF) Modeling and solving combinatorial

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Reasoning with Quantified Boolean Formulas

Reasoning with Quantified Boolean Formulas Reasoning with Quantified Boolean Formulas Martina Seidl Institute for Formal Models and Verification Johannes Kepler University Linz 1 What are QBF? Quantified Boolean formulas (QBF) are formulas of propositional

More information

LOGIC PROPOSITIONAL REASONING

LOGIC PROPOSITIONAL REASONING LOGIC PROPOSITIONAL REASONING WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität Linz Version 2018.1

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

Computation and Logic Definitions

Computation and Logic Definitions Computation and Logic Definitions True and False Also called Boolean truth values, True and False represent the two values or states an atom can assume. We can use any two distinct objects to represent

More information

A brief introduction to Logic. (slides from

A brief introduction to Logic. (slides from A brief introduction to Logic (slides from http://www.decision-procedures.org/) 1 A Brief Introduction to Logic - Outline Propositional Logic :Syntax Propositional Logic :Semantics Satisfiability and validity

More information

Tutorial 1: Modern SMT Solvers and Verification

Tutorial 1: Modern SMT Solvers and Verification University of Illinois at Urbana-Champaign Tutorial 1: Modern SMT Solvers and Verification Sayan Mitra Electrical & Computer Engineering Coordinated Science Laboratory University of Illinois at Urbana

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson SAT Solving 1 / 36 Review: Propositional

More information

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT The Wumpus Game Stench Stench Gold Stench Start 1 The Wumpus Game Stench in the square containing the wumpus and in the directly adjacent squares in the squares directly adjacent to a pit Glitter in the

More information

Propositional and First Order Reasoning

Propositional and First Order Reasoning Propositional and First Order Reasoning Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p p Clause: disjunction of literals q \/ p \/ r given by

More information

Propositional Logic Resolution (6A) Young W. Lim 12/31/16

Propositional Logic Resolution (6A) Young W. Lim 12/31/16 Propositional Logic Resolution (6A) Young W. Lim Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,

More information

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna The Calculus of Computation: Decision Procedures with Applications to Verification Part I: FOUNDATIONS by Aaron Bradley Zohar Manna 1. Propositional Logic(PL) Springer 2007 1-1 1-2 Propositional Logic(PL)

More information

Satisfiability Modulo Theories

Satisfiability Modulo Theories Satisfiability Modulo Theories Summer School on Formal Methods Menlo College, 2011 Bruno Dutertre and Leonardo de Moura bruno@csl.sri.com, leonardo@microsoft.com SRI International, Microsoft Research SAT/SMT

More information

Propositional Logic: Evaluating the Formulas

Propositional Logic: Evaluating the Formulas Institute for Formal Models and Verification Johannes Kepler University Linz VL Logik (LVA-Nr. 342208) Winter Semester 2015/2016 Propositional Logic: Evaluating the Formulas Version 2015.2 Armin Biere

More information

Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas

Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas Journal of Artificial Intelligence Research 1 (1993) 1-15 Submitted 6/91; published 9/91 Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas Enrico Giunchiglia Massimo

More information

Free Groups. Joachim Breitner. April 17, 2016

Free Groups. Joachim Breitner. April 17, 2016 Free Groups Joachim Breitner April 17, 2016 Abstract Free Groups are, in a sense, the most generic kind of group. They are defined over a set of generators with no additional relations in between them.

More information

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel Propositional Logic Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel References Chpater 1 of Logic for Computer Scientists http://www.springerlink.com/content/978-0-8176-4762-9/

More information

Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality. Benjamin Porter

Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality. Benjamin Porter Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality Benjamin Porter March 12, 2013 Contents 1 Cauchy s Mean Theorem 3 1.1 Abstract.............................. 3 1.2 Formal proof...........................

More information

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask Set 6: Knowledge Representation: The Propositional Calculus Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask Outline Representing knowledge using logic Agent that reason logically A knowledge based agent Representing

More information

Propositional and Predicate Logic - V

Propositional and Predicate Logic - V Propositional and Predicate Logic - V Petr Gregor KTIML MFF UK WS 2016/2017 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - V WS 2016/2017 1 / 21 Formal proof systems Hilbert s calculus

More information

Combined Satisfiability Modulo Parametric Theories

Combined Satisfiability Modulo Parametric Theories Intel 07 p.1/39 Combined Satisfiability Modulo Parametric Theories Sava Krstić*, Amit Goel*, Jim Grundy*, and Cesare Tinelli** *Strategic CAD Labs, Intel **The University of Iowa Intel 07 p.2/39 This Talk

More information

First-order resolution for CTL

First-order resolution for CTL First-order resolution for Lan Zhang, Ullrich Hustadt and Clare Dixon Department of Computer Science, University of Liverpool Liverpool, L69 3BX, UK {Lan.Zhang, U.Hustadt, CLDixon}@liverpool.ac.uk Abstract

More information

Propositional Logic Resolution (6A) Young W. Lim 12/12/16

Propositional Logic Resolution (6A) Young W. Lim 12/12/16 Propositional Logic Resolution (6A) Young W. Lim Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,

More information

A General Method for the Proof of Theorems on Tail-recursive Functions

A General Method for the Proof of Theorems on Tail-recursive Functions A General Method for the Proof of Theorems on Tail-recursive Functions Pasquale Noce Security Certification Specialist at Arjo Systems - Gep S.p.A. pasquale dot noce dot lavoro at gmail dot com pasquale

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel October 11, 2017 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

ECE473 Lecture 15: Propositional Logic

ECE473 Lecture 15: Propositional Logic ECE473 Lecture 15: Propositional Logic Jeffrey Mark Siskind School of Electrical and Computer Engineering Spring 2018 Siskind (Purdue ECE) ECE473 Lecture 15: Propositional Logic Spring 2018 1 / 23 What

More information

Propositional logic. Programming and Modal Logic

Propositional logic. Programming and Modal Logic Propositional logic Programming and Modal Logic 2006-2007 4 Contents Syntax of propositional logic Semantics of propositional logic Semantic entailment Natural deduction proof system Soundness and completeness

More information

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning COMP9414, Monday 26 March, 2012 Propositional Logic 2 COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning Overview Proof systems (including soundness and completeness) Normal Forms

More information

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning COMP219: Artificial Intelligence Lecture 20: Propositional Reasoning 1 Overview Last time Logic for KR in general; Propositional Logic; Natural Deduction Today Entailment, satisfiability and validity Normal

More information

Examples for program extraction in Higher-Order Logic

Examples for program extraction in Higher-Order Logic Examples for program extraction in Higher-Order Logic Stefan Berghofer October 10, 2011 Contents 1 Auxiliary lemmas used in program extraction examples 1 2 Quotient and remainder 2 3 Greatest common divisor

More information

Truth-Functional Logic

Truth-Functional Logic Truth-Functional Logic Syntax Every atomic sentence (A, B, C, ) is a sentence and are sentences With ϕ a sentence, the negation ϕ is a sentence With ϕ and ψ sentences, the conjunction ϕ ψ is a sentence

More information

Abstract Answer Set Solvers with Backjumping and Learning

Abstract Answer Set Solvers with Backjumping and Learning Under consideration for publication in Theory and Practice of Logic Programming 1 Abstract Answer Set Solvers with Backjumping and Learning YULIYA LIERLER Department of Computer Science University of Texas

More information

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19 PROPOSITIONAL LOGIC VL Logik: WS 2018/19 (Version 2018.2) Martina Seidl (martina.seidl@jku.at), Armin Biere (biere@jku.at) Institut für Formale Modelle und Verifikation BOX Game: Rules 1. The game board

More information

Decision Procedures for Satisfiability and Validity in Propositional Logic

Decision Procedures for Satisfiability and Validity in Propositional Logic Decision Procedures for Satisfiability and Validity in Propositional Logic Meghdad Ghari Institute for Research in Fundamental Sciences (IPM) School of Mathematics-Isfahan Branch Logic Group http://math.ipm.ac.ir/isfahan/logic-group.htm

More information

Lattices and Orders in Isabelle/HOL

Lattices and Orders in Isabelle/HOL Lattices and Orders in Isabelle/HOL Markus Wenzel TU München October 8, 2017 Abstract We consider abstract structures of orders and lattices. Many fundamental concepts of lattice theory are developed,

More information

Write your own Theorem Prover

Write your own Theorem Prover Write your own Theorem Prover Phil Scott 27 October 2016 Phil Scott Write your own Theorem Prover 27 October 2016 1 / 31 Introduction We ll work through a toy LCF style theorem prover for classical propositional

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson Propositional Logic 1 / 33 Propositional

More information

Language of Propositional Logic

Language of Propositional Logic Logic A logic has: 1. An alphabet that contains all the symbols of the language of the logic. 2. A syntax giving the rules that define the well formed expressions of the language of the logic (often called

More information

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber 15-414 Aug 31, 2011 Why study SAT solvers? Many problems reduce to SAT. Formal verification CAD, VLSI Optimization AI, planning, automated

More information

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) B.Y. Choueiry 1 Instructor s notes #12 Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) Introduction to Artificial Intelligence CSCE 476-876, Fall 2018 URL: www.cse.unl.edu/ choueiry/f18-476-876

More information

Advanced Topics in LP and FP

Advanced Topics in LP and FP Lecture 1: Prolog and Summary of this lecture 1 Introduction to Prolog 2 3 Truth value evaluation 4 Prolog Logic programming language Introduction to Prolog Introduced in the 1970s Program = collection

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter 7.1-7.4 (previous lecture, Part I) Chapter 7.5 (this lecture, Part II) (optional: 7.6-7.8)

More information

Propositional Logic: Methods of Proof. Chapter 7, Part II

Propositional Logic: Methods of Proof. Chapter 7, Part II Propositional Logic: Methods of Proof Chapter 7, Part II Inference in Formal Symbol Systems: Ontology, Representation, ti Inference Formal Symbol Systems Symbols correspond to things/ideas in the world

More information

CS:4420 Artificial Intelligence

CS:4420 Artificial Intelligence CS:4420 Artificial Intelligence Spring 2018 Propositional Logic Cesare Tinelli The University of Iowa Copyright 2004 18, Cesare Tinelli and Stuart Russell a a These notes were originally developed by Stuart

More information

Propositional logic. Programming and Modal Logic

Propositional logic. Programming and Modal Logic Propositional logic Programming and Modal Logic 2006-2007 4 Contents Syntax of propositional logic Semantics of propositional logic Semantic entailment Natural deduction proof system Soundness and completeness

More information

02 Propositional Logic

02 Propositional Logic SE 2F03 Fall 2005 02 Propositional Logic Instructor: W. M. Farmer Revised: 25 September 2005 1 What is Propositional Logic? Propositional logic is the study of the truth or falsehood of propositions or

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 31. Propositional Logic: DPLL Algorithm Malte Helmert and Gabriele Röger University of Basel April 24, 2017 Propositional Logic: Overview Chapter overview: propositional

More information

Inference in Propositional Logic

Inference in Propositional Logic Inference in Propositional Logic Deepak Kumar November 2017 Propositional Logic A language for symbolic reasoning Proposition a statement that is either True or False. E.g. Bryn Mawr College is located

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

Lecture Notes on SAT Solvers & DPLL

Lecture Notes on SAT Solvers & DPLL 15-414: Bug Catching: Automated Program Verification Lecture Notes on SAT Solvers & DPLL Matt Fredrikson André Platzer Carnegie Mellon University Lecture 10 1 Introduction In this lecture we will switch

More information

Functional Data Structures

Functional Data Structures Functional Data Structures with Isabelle/HOL Tobias Nipkow Fakultät für Informatik Technische Universität München 2017-2-3 1 Part II Functional Data Structures 2 Chapter 1 Binary Trees 3 1 Binary Trees

More information

Code Generation for a Simple First-Order Prover

Code Generation for a Simple First-Order Prover Code Generation for a Simple First-Order Prover Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, Technical University of Denmark, 2800 Kongens Lyngby, Denmark Abstract. We

More information

Propositional Calculus

Propositional Calculus Propositional Calculus Dr. Neil T. Dantam CSCI-498/598 RPM, Colorado School of Mines Spring 2018 Dantam (Mines CSCI, RPM) Propositional Calculus Spring 2018 1 / 64 Calculus? Definition: Calculus A well

More information

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5 rtificial Intelligence Topic 12 Logical Inference Reading: Russell and Norvig, Chapter 7, Section 5 c Cara MacNish. Includes material c S. Russell & P. Norvig 1995,2003 with permission. CITS4211 Logical

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) You will be expected to know Basic definitions Inference, derive, sound, complete Conjunctive Normal Form (CNF) Convert a Boolean formula to CNF Do a short

More information

Logic: Propositional Logic (Part I)

Logic: Propositional Logic (Part I) Logic: Propositional Logic (Part I) Alessandro Artale Free University of Bozen-Bolzano Faculty of Computer Science http://www.inf.unibz.it/ artale Descrete Mathematics and Logic BSc course Thanks to Prof.

More information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

CS156: The Calculus of Computation Zohar Manna Autumn 2008 Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)

More information

Abstract DPLL and Abstract DPLL Modulo Theories

Abstract DPLL and Abstract DPLL Modulo Theories Abstract DPLL and Abstract DPLL Modulo Theories Robert Nieuwenhuis, Albert Oliveras, and Cesare Tinelli Abstract. We introduce Abstract DPLL, a general and simple abstract rule-based formulation of the

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Propositional logic. First order logic. Alexander Clark. Autumn 2014 Propositional logic First order logic Alexander Clark Autumn 2014 Formal Logic Logical arguments are valid because of their form. Formal languages are devised to express exactly that relevant form and

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

Tecniche di Verifica. Introduction to Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic Tecniche di Verifica Introduction to Propositional Logic 1 Logic A formal logic is defined by its syntax and semantics. Syntax An alphabet is a set of symbols. A finite sequence of these symbols is called

More information

Boolean Expression Checkers

Boolean Expression Checkers Boolean Expression Checkers Tobias Nipkow May 27, 2015 Abstract This entry provides executable checkers for the following properties of boolean expressions: satisfiability, tautology and equivalence. Internally,

More information

Cardinality Networks: a Theoretical and Empirical Study

Cardinality Networks: a Theoretical and Empirical Study Constraints manuscript No. (will be inserted by the editor) Cardinality Networks: a Theoretical and Empirical Study Roberto Asín, Robert Nieuwenhuis, Albert Oliveras, Enric Rodríguez-Carbonell Received:

More information

Chapter 4: Classical Propositional Semantics

Chapter 4: Classical Propositional Semantics Chapter 4: Classical Propositional Semantics Language : L {,,, }. Classical Semantics assumptions: TWO VALUES: there are only two logical values: truth (T) and false (F), and EXTENSIONALITY: the logical

More information

From SAT To SMT: Part 1. Vijay Ganesh MIT

From SAT To SMT: Part 1. Vijay Ganesh MIT From SAT To SMT: Part 1 Vijay Ganesh MIT Software Engineering & SMT Solvers An Indispensable Tactic for Any Strategy Formal Methods Program Analysis SE Goal: Reliable/Secure Software Automatic Testing

More information

Propositional and Predicate Logic. jean/gbooks/logic.html

Propositional and Predicate Logic.   jean/gbooks/logic.html CMSC 630 February 10, 2009 1 Propositional and Predicate Logic Sources J. Gallier. Logic for Computer Science, John Wiley and Sons, Hoboken NJ, 1986. 2003 revised edition available on line at http://www.cis.upenn.edu/

More information

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World Agenda Artificial Intelligence 10. Propositional Reasoning, Part I: Principles How to Think About What is True or False 1 Introduction Álvaro Torralba Wolfgang Wahlster 2 Propositional Logic 3 Resolution

More information

Notes. Corneliu Popeea. May 3, 2013

Notes. Corneliu Popeea. May 3, 2013 Notes Corneliu Popeea May 3, 2013 1 Propositional logic Syntax We rely on a set of atomic propositions, AP, containing atoms like p, q. A propositional logic formula φ Formula is then defined by the following

More information

Integrating a SAT Solver with an LCF-style Theorem Prover

Integrating a SAT Solver with an LCF-style Theorem Prover Integrating a SAT Solver with an LCF-style Theorem Prover A Fast Decision Procedure for Propositional Logic for the System Tjark Weber webertj@in.tum.de PDPAR 05, July 12, 2005 Integrating a SAT Solver

More information

Propositional Dynamic Logic

Propositional Dynamic Logic Propositional Dynamic Logic Contents 1 Introduction 1 2 Syntax and Semantics 2 2.1 Syntax................................. 2 2.2 Semantics............................... 2 3 Hilbert-style axiom system

More information

An Introduction to SAT Solving

An Introduction to SAT Solving An Introduction to SAT Solving Applied Logic for Computer Science UWO December 3, 2017 Applied Logic for Computer Science An Introduction to SAT Solving UWO December 3, 2017 1 / 46 Plan 1 The Boolean satisfiability

More information

Miscellaneous Isabelle/Isar examples

Miscellaneous Isabelle/Isar examples Miscellaneous Isabelle/Isar examples Makarius Wenzel With contributions by Gertrud Bauer and Tobias Nipkow October 8, 2017 Abstract Isar offers a high-level (and theory) language for Isabelle. We give

More information

Polynomial Factorization

Polynomial Factorization Polynomial Factorization René Thiemann and Akihisa Yamada October 11, 2017 Abstract Based on existing libraries for polynomial interpolation and matrices, we formalized several factorization algorithms

More information

Equivalences. Proposition 2.8: The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ. Idempotency Idempotency Commutativity

Equivalences. Proposition 2.8: The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ. Idempotency Idempotency Commutativity Substitution Theorem Proposition 2.7: Let φ 1 and φ 2 be equivalent formulas, and ψ[φ 1 ] p be a formula in which φ 1 occurs as a subformula at position p. Then ψ[φ 1 ] p is equivalent to ψ[φ 2 ] p. 84

More information

Foundations of Lazy SMT and DPLL(T)

Foundations of Lazy SMT and DPLL(T) Foundations of Lazy SMT and DPLL(T) Cesare Tinelli The University of Iowa Foundations of Lazy SMT and DPLL(T) p.1/86 Acknowledgments: Many thanks to Albert Oliveras for contributing some of the material

More information

Solving SAT and SAT Modulo Theories: From an Abstract Davis Putnam Logemann Loveland Procedure to DPLL(T)

Solving SAT and SAT Modulo Theories: From an Abstract Davis Putnam Logemann Loveland Procedure to DPLL(T) Solving SAT and SAT Modulo Theories: From an Abstract Davis Putnam Logemann Loveland Procedure to DPLL(T) ROBERT NIEUWENHUIS AND ALBERT OLIVERAS Technical University of Catalonia, Barcelona, Spain AND

More information