5.8 KiB
| dg-publish |
|---|
| true |
18 Setembro 2023 - #MFES
Conteúdo
1. Intro
Formal modeling - formally represent the system and its properties in the syntactic conventions that the tool understands and can process.
Formal Logic = logical language (logical symbols + non-logical symbols) + semantics +proof system
1.1 SAT
The Boolean satisfiability (SAT) problem:
Find an assignment to the propositional variables of the formula such that the formula evaluates to TRUE, or prove that no such assignment exists.
- SAT is an NP-complete decision problem.
- SAT was the first problem to be shown NP-complete.
- There are no known polynomial time algorithms for SAT.
Usually SAT solvers deal with formulas in conjunctive normal form (CNF)
- literal: propositional variable or its negation A, ¬A, B, ¬B, C, ¬C
- clause: disjuntion of literals. (A _ ¬B _ C)
- conjunctive normal form: conjuction of clauses. (A _ ¬B _ C) ^ (B _ ¬A) ^ ¬C
[!info]+ Cook's theorem(1971) SAT is NP-complete
1.2 Proposicional Logic (PL)
[!note] Nota Esta secção basicamente só contém revisão de conceitos. Aconselha-se a ver a coisa rapidamente, porque é só a formalidade de lógica escrita por extenso.
Let A be an assignment and let F be a formula. If A(F) = 1, then we say F holds under assignment, or A models F.
We write A \models F iff A(F)=1, and A \not \models F iff A(F) = 0.
An assignment is a function A : V_{prop} \implies {0,1} , that assigns to every
propositional variable a truth value. An assignment A naturally extends to all formulas, A : Form \implies {0,1}. The truth value of a formula is computed using truth tables:
| F | A |
B |
\neg A |
A \land B |
A \lor B |
A \implies B |
A \iff B |
\bot |
\top |
|---|---|---|---|---|---|---|---|---|---|
A_1 (F) |
0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
A_2 (F) |
0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
A_3 (F) |
1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
A_4 (F) |
1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
A formula F is:
- valid iff it holds under every assignment. We write
\models F. A valid formula is called a tautology. - satisfiable iff it folds (true) under some assignment.
- unsatisfiable iff it holds under no assignment. An unsatisfiable formula is called a contradiction.
- refutable iff it is not valid.
[!tip]+ Proposition
Fis valid iff\neg Fis unsatisfiable.
-
F \models Giff for every assignmentA, ifA \models FthenA \models G. We sayGis a consequence ofF. -
F \equiv GiffF \models GandG \models F. We sayFandGare equivalent. -
Let
\Gamma = { F_1, F_2, F_3,... }be a set of formulas.A \models \GammaiffA \models F_ifor each formulaF_iin\Gamma. We sayAmodels\Gamma.\Gamma \models GiffA \models \GammaimpliesA \models Gfor every assignmentA. We sayGis a consequence of\Gamma.
[!tip]+ Proposition
F \models Giff\models F \implies G.\Gamma \models Gand\Gammafinite iff\models \land \Gamma \implies G.
\Gammais consistent or satisfiable iff there is an assignment that models\Gamma.- We say that
\Gammais inconsistent or unsatisfiable iff there is not consistent and denote this by\Gamma \models \bot.
[!tip]+ Proposition
- {$F, \neg F$}
\models \bot - If
\Gamma \models \botand\Gamma \subseteq \Gamma ', then\Gamma ' \models \bot \Gamma \models Fiff\Gamma, \neg F \models \bot
-
Formula
Gis a subformula of formula F if it occurs syntactically within F -
Formula G is a strict subformula of F if G is a subformula of
FandG \neg = F
Basic Equivalences:
\neg \neg A \equiv AA \lor A \equiv AA \land A \equiv AA \land \neg A \equiv \botA \lor \neg A \equiv \topA \lor B \equiv B \lor AA \land B \equiv B \land AA \land \top \equiv AA \lor \top \equiv \topA \land \bot \equiv \botA \lor \bot \equiv AA \land (B \lor A) \equiv AA \land (B \lor C) \equiv (A \land B) \lor (A \land C)A \lor (B \land C) \equiv (A \lor B) \land (A \lor C)\neg (A \lor B) \equiv \neg A \land \neg B\neg (A \land B) \equiv \neg A \lor \neg BA \implies B \equiv \neg A \lor BA \iff B \equiv (A \implies B) \land (B \implies A)
2. SAT Solvers
-
There are several techniques and algorithms for SAT solving.
-
Usually SAT solvers receive as input a formula in a specific syntatical format.
-
SAT solvers deal with formulas in conjunctive normal form (CNF).
-
Most current state-of-the-art SAT solvers are based on the Davis-Putnam-Logemann-Loveland (DPLL) framework.
2.1 DPLL Framework
The idea is to incrementally construct an assignment compatible with a CNF, propagating the implications of the decisions made that are easy to detect and simplifying the clauses.
A CNF is satisfied by an assignment if all its clauses are satisfied. And a clause is satisfied if at least one of its literals is satisfied.