Logic Flashcards
(37 cards)
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 ^.
What is the SAT problem?
Deciding if a propositional formula has a truth assignment that causes it to be true (NP-complete)
What is the aim of SAT-solving?
To encode a problem X as a propositional formula φ, so that a solution to X corresponds to φ having a satisfying truth assignment
To employ algorithms to solve the SAT problem
What is the k-SAT problem?
The SAT problem but all the clauses contain k literals. k-SAT is polynomial time if k=2, but NP-complete for k >= 3
What is the (k,s)-SAT problem?
The SAT problem but every variable appears in at most s clauses
What is an argument form?
A sequence of formulae φ1, φ2, …, φn, ψ
It is valid if: whenever a truth assignment f makes φ1, φ2, … φn all evaluate to true, it also makes ψ evaluate to true
This can also be written as φ1, φ2, …, φn├ ψ (sequent)
The rules of inference corresponding to the argument form is φ1, φ2, …, φn => ψ
What is modus ponens?
A rule of inference which states that (p ^ (p=>q) => q
p, p=>q, ψ=q
What is modus tollens?
¬q, p=>q, ψ=¬p
If p implies q, and q is false, then p is false
What is hypothetical syllogism?
p=>q, q=>r, ψ= p=>r
If p implies q, and q implies r, then p implies r
What is resolution?
If p v q is true, and ¬p v r is true, then q v r is true