Logic Flashcards
What is the purpose of logic?
To carry out precise and rigorous arguments about assertions and proofs, and to implement these assertions and proofs. We need a language whose structure (syntax) can be precisely described and whose meaning (semantics) can be unambiguously defined.
What are the three components of a system of logic?
Syntax: The definition of the formulae of the logic
Semantics: The association of meaning and truth to the formulae of the logic
Proof system: The manipulation of formulae according to a system of rules
All true should be provable (completeness), and all formulae that are provable should be true
What are formal methods?
The use of mathematically-based techniques to prove that programs have certain properties
What is model checking?
A branch of formal methods where a computer system is first modelled on some mathematical structure, and then a specific property that this system might have is expressed by a formula of some logic. Then we computationally verify whether the particular formula is satisfied by the mathematical model
Where is model checking used?
In microprocessor design, design of data communications protocol software, critical software, operating system device drivers
What is propositional logic?
A logic which consists of propositions: declarative sentences which are either true or false, and are represented with propositional variables (usually letters) which can take the value T or F
Propositional logic symbols
^ = and
v = or
¬ = not
=> = implies
<=> = if and only if
(p => q) is the same as (¬p v q)
P => Q truth table
T => T is true
T => F is false
F => T is true
F => F is true
P <=> Q truth table
T <=> T is true
T <=> F is false
F <=> T is false
F <=> F is true
What is a literal?
Either a propositional variable or its negation
What does it mean when a propositional formula φ(x1, x2, …, xn) evaluates to T under f (an assignment of true or false to x1, x2, …, xn)
The row of the truth table for φ corresponding to f evaluates to T. If φ evaluates to T for all f, it’s a tautology, if it evaluates to F for all f it’s a contradiction
Distributive Law of Disjunction over Conjunction
a v (b ^ c) = (a v b) ^ (a v c)
(and the same with opposite signs)
Generalised distributive law
X ^ (Y1 v Y2 v Y3 v … v Yn)
= (X ^ Y1) v (X ^ Y2) v (X ^ Y3) v … v (X ^ Yn)
What does it mean if a set C of logical connectives is functionally complete?
If any propositional formula is equivalent to one constructed using only the connectives from C
What does it mean if a propositional formula is in disjunctive normal form?
It consists of an OR of ANDs (e.g. (A ^ ¬B) v (C ^ ¬D) )
Every formula of propositional logic is equivalent to a formula in disjunctive normal form (a disjunction of conjunctions of literals)
You form this DNF formula by looking at which rows of the truth table evaluate to true, joining the literals with ^ and the rows with ^.