100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Samenvatting

Applied Logic (2ITX0) Summary 2019

Beoordeling
5,0
(1)
Verkocht
1
Pagina's
11
Geüpload op
28-05-2020
Geschreven in
2019/2020

EN: This is a summary of the course Applied Logic (2ITX0) which is taught in the second quartile (Q2) at Eindhoven University of Technology. It is an elective that is mainly chosen by first-year Bachelor Computer Science and Engineering students. Applied Logic is the successor of Fundamentals of informatics (2IS80). In this course, a student learns how to apply logic to solve problems, how to prove the correctness of programs by invariants and what the basic principles of information theory are. ---- NL: Dit is een samenvatting van het vak Applied Logic (2ITX0) die wordt gegeven in het tweede kwartiel (K2) op de Technische Universiteit Eindhoven. Het is een keuzevak dat vooral wordt gekozen door eerstejaars Bachelor Technische Informatica studenten. Applied Logic is de opvolger van Fundamentals of informatics (2IS80). In dit vak leert een student hoe je logica kan toepassen om problemen op te lossen, hoe je de correctheid van programma's kan controleren met invariants en wat de basis principes van informatie theorie zijn.

Meer zien Lees minder









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Documentinformatie

Geüpload op
28 mei 2020
Aantal pagina's
11
Geschreven in
2019/2020
Type
Samenvatting

Onderwerpen

Voorbeeld van de inhoud

Applied Logic Summary 2019
Check the summary of Logic and Set Theory for the pre-knowledge of this subject.


Theme 1: SAT and SMT
A propositional formula is satisfiable (SAT) if you can give values to the variables such that the formula
yields true; SAT is composed from Boolean variables and corresponding operators. We will express several
problems as SAT problems and solve them using the corresponding tools. The basic method to know if a
propositional formula is SAT is to use truth tables but the amount of rows is exponential in the number of
variables. So the bad news is that SAT is NP-complete which means that certain classes of problems are
not solvable in realistic time. However, current SAT solvers are successful for several big formulas. SAT is
extended to SMT (Satisfiability Modulo Theories). In SAT and SMT we don’t think about how to solve it but
we only specify the problem. We use the tool Z3 to solve SMT problems. In Z3 you can do the following
operators:
(declare-const <name constant> <type of constant>) Declare a variable which has a value after running Z3
(e.g. (declare-const S2 Bool) )
(declare-fun <name function> (<type of input>) <type Declare a function which has a formula after running Z3
of output>) (e.g. (declare-fun M (Int) Int) )
(assert <program>) After “assert” is the program that Z3 will run using the
earlier declared variables and functions
(and <first argument> <second argument> … <last Does all operations mentioned between the brackets
argument>)
(or <first argument> <second argument> … <last Does one of the operations mentioned between the
argument>) brackets
( <operator> <arguments> ) Mathematical operations, such as >, <, >=, <=, =, +, *,
-, etc., are written in prefix notation (see on the left). +
may have any number of arguments.
(implies <first argument> <second argument>) For implication (→) in a propositional formula
(iff <first argument> <second argument>) For bi-implication (<->) in a propositional formula
(ite <condition> <result if true> <result if false>) The if-then-else operation first has the condition which
is Boolean, then the result in case the condition is true
and then the result in case the condition is false
(minimize <name constant>) Z3 tries to find the minimum or maximum value of a
OR (maximize <name constant>) variable. Put this outside “assert”.
(check-sat) Checks whether the described program is satisfiable
(get-model) Gets the values for which the described program is
satisfiable

An example of a SAT/SMT problem that has been discussed is the eight queens problem (in which we
looked at the rows, columns and diagonals of a chess board). A trick to find all solutions is by adding a
negation of a found solution to a formula and repeating this until the formula is unsatisfiable. There is also
the rectangle fitting problem (in which we looked at the width, height and coordinates of the rectangles).
For generating a formula in SMT syntax of a SAT formula with a lot of repetition, it is better to use a
program than edit it yourself. We can also solve a sudoku by SAT/SMT (we looked at every row, every
column and every fat 3 by 3 block) or generate one (start by a full sudoku and remove until the formula
extended by the negation of the known solution is satisfiable which means it has another solution).
Planning/scheduling can also be done by SAT/SMT (jobs have a certain running time, some jobs should
run before others, people are assigned to jobs, etc.). Finding the smallest value of a variable can be done
by using binary search (finding a value v for which it is satisfiable and for which v-1 is unsatisfiable) or by
using the built in feature minimize.




1
by Isabel Rutten

, Applied Logic Summary 2019
A conjunctive normal form (CNF) is a conjunction of clauses. A clause is a disjunction of
literals and is a property that we know to be true. A literal is either a variable or the
negation of a variable. The resolution rule states that if there are clauses of the Fig. 1: Formal notation
shape p v V and p v W, then the new clause V v W may be added (see fig. 1: above of resolution rule
the line: assumptions that hold. Underneath the line: conclusions. Alternatives to this
line: , , ). By using the Tseitin transformation (and thus also the resolution rule) we
can check the satisfiability of a CNF: from clauses new clauses can be derived, trying to
derive a contradiction: the empty clause . If this succeeds, we know that the CNF is
unsatisfiable. Unit resolution is the following: if a clause consists of a single literal l (a
unit clause) then the resolution rule allows to remove the literal l from a clause Fig. 2: Formal notation
containing l. A proof system is a set of proof rules of the shape seen in figures 1 of unit resolution
and 2 (so with the horizontal line). A proof system is sound if all its rules are valid and
from the empty clause we can conclude that the CNF is unsatisfiable. A proof system is complete if
every property in the corresponding format that holds, can be proved by only using the proof rules and if for
every unsatisfiable CNF, the empty clause can be derived. To prove that the CNF is a tautology,
prove that is unsatisfiable. To prove that implies , prove that and is unsatisfiable. To prove
that and are equivalent, prove that ( <-> ) so ( or ) and ( and ) is unsatisfiable.
Lewis Carroll made an example with the Tseitin transformation in which sentences can be rewritten to
clauses by defining variables.
DPLL is an algorithm to establish whether a CNF is satisfiable. The idea of DPLL is to first apply unit
resolution as long as possible (so as long as a clause occurs consisting of one literal, also unit-resol) and
then choose a variable p, introduce the cases p and p and for both cases go on recursively. If it is
satisfiable then all involved unit clauses yield a satisfying assignment. Otherwise, it is a big case analysis
yielding for all cases. DPLL always terminates and thus is a complete method to establish satisfiability.
For case analysis, all choices for a variable are correct but one choice may be more efficient than another.
DPLL transforms to resolution: if we have a DPLL proof that a CNF X is unsat, then it can be
transformed to a sequence of resolution steps starting in X and ending in the empty clause and thus the
resolution is complete.
Establishing the satisfiability of an arbitrary propositional formula that is not a CNF can be done by
transforming the formula to CNF while preserving satisfiability and then apply a DPLL based SAT solver on
this CNF. Finding this CNF is always possible but is however often unacceptably large. We can make a
corresponding clause for every 0 in the truth table of a formula and then use the conjunction of all those
clauses. This always works but there may be many clauses due to the exponential amount of rows in a
truth table. The solution to this is the Tseitin transformation: this is a linear transformation of an arbitrary
propositional formula to CNF while preserving satisfiability. The key idea is to
give a name to every subformula (except literals) and use this name as a fresh
variable. For every subformula there is a small CNF cnf( ). Transform the
big formula to the conjunction of all small cnfs of the subformulas. A subformula
stays the same if it consists of one literal but gets a name if not. The
subformula a with the name b is stated with a small CNF as follows: cnf(b <->
a). The whole formula also gets a name. Also the connections between the
subformulas get cnfs. Then we make a conjunction of these cnfs. See figure 3
for an example.
In order to get a real CNF we still need to compute the formulas cnf(b <-> a).
See: cnf(p <-> q) = (p or q) and ( p or q)
cnf(p <-> (q or r)) = ( p or q or r) and (p or q) and (p or r)
cnf(p <-> (q and r)) = (p or q or r) and ( p or q) and ( p or r)
cnf(p <-> (q <-> r)) = (p or q or r) and (p or q or r) and ( p or q or r) and
( p or q or r)
Fig. 3: Example of the
Tseitin transformation

2
by Isabel Rutten

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
5 jaar geleden

5,0

1 beoordelingen

5
1
4
0
3
0
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
IsabelRutten Technische Universiteit Eindhoven
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
97
Lid sinds
5 jaar
Aantal volgers
66
Documenten
21
Laatst verkocht
3 weken geleden
Summaries for Computer Science, Industrial Engineering, and ICT in Business

If you have any questions about the summaries or other study-related topics, you can always send me a message on this platform. For a cheaper price, you can also message me privately: I only receive 40% of the price you pay on this platform. I hope that these summaries help you advance your studies!

4,4

12 beoordelingen

5
9
4
1
3
1
2
0
1
1

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen