Logic Flashcards

1
Q

What is the purpose of logic?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three components of a system of logic?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are formal methods?

A

The use of mathematically-based techniques to prove that programs have certain properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is model checking?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is model checking used?

A

In microprocessor design, design of data communications protocol software, critical software, operating system device drivers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is propositional logic?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Propositional logic symbols

A

^ = and
v = or
¬ = not
=> = implies
<=> = if and only if

(p => q) is the same as (¬p v q)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

P => Q truth table

A

T => T is true
T => F is false
F => T is true
F => F is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

P <=> Q truth table

A

T <=> T is true
T <=> F is false
F <=> T is false
F <=> F is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a literal?

A

Either a propositional variable or its negation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Distributive Law of Disjunction over Conjunction

A

a v (b ^ c) = (a v b) ^ (a v c)
(and the same with opposite signs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Generalised distributive law

A

X ^ (Y1 v Y2 v Y3 v … v Yn)
= (X ^ Y1) v (X ^ Y2) v (X ^ Y3) v … v (X ^ Yn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does it mean if a set C of logical connectives is functionally complete?

A

If any propositional formula is equivalent to one constructed using only the connectives from C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does it mean if a propositional formula is in disjunctive normal form?

A

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 ^.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the SAT problem?

A

Deciding if a propositional formula has a truth assignment that causes it to be true (NP-complete)

17
Q

What is the aim of SAT-solving?

A

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

18
Q

What is the k-SAT problem?

A

The SAT problem but all the clauses contain k literals. k-SAT is polynomial time if k=2, but NP-complete for k >= 3

19
Q

What is the (k,s)-SAT problem?

A

The SAT problem but every variable appears in at most s clauses

20
Q

What is an argument form?

A

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 => ψ

21
Q

What is modus ponens?

A

A rule of inference which states that (p ^ (p=>q) => q
p, p=>q, ψ=q

22
Q

What is modus tollens?

A

¬q, p=>q, ψ=¬p
If p implies q, and q is false, then p is false

23
Q

What is hypothetical syllogism?

A

p=>q, q=>r, ψ= p=>r
If p implies q, and q implies r, then p implies r

24
Q

What is resolution?

A

If p v q is true, and ¬p v r is true, then q v r is true

25
Q

Rules for conjunction

A

^-i (^-introduction)
φ1 φ2
φ1 ^ φ2

^-e1 and ^-e2 (^-elimination)
φ1 ^ φ2
φ1

φ1 ^ φ2
φ2

26
Q

Rules for double negation

A

¬¬i (¬¬-introduction)
φ
¬¬φ

¬¬e (¬¬-elimination)
¬¬φ
φ

27
Q

Prove the sequent:
p, ¬¬(q^r) ├ ¬¬p^r

A
  1. p (premise)
  2. ¬¬(q^r) (premise)
  3. ¬¬p (¬¬i 1)
  4. q^r (¬¬e 2)
  5. r (^e2 4)
  6. ¬¬p ^ r (^i 3 5)
28
Q

Rules for implication

A

=>e (eliminating implication)
φ1 φ1 => φ2
φ2

=>i (introducing implication)

<open>
φ1
<continue>
φ2
<close>
φ1 => φ2

Once the box has been closed, the formulae inside can no longer be used
</close></continue></open>

29
Q

What is a truth assignment?

A

An assignment of values (true or false) to variables in a formula
A truth assignment satisfies a formula if it makes it evaluate to true
A formula is satisfying if a truth assignment satisfies it

30
Q

What does it mean if a formula B is a logical consequence of a formula A?

A

Every truth assignment that satisfies A also satisfies B
We can also say that A entails B, or A |= B

We have A |= B if and only if A and not(B) is unsatisfiable

A1, A2, …, An |= B if and only if A1 and A2 … and An and not(B) is unsatisfiable

Checking for entailment/consequence is the same as checking for (un)satisfiability

31
Q

What are literals and clauses?

A

Literals are variables (x, y, z) and their negations (!x, !y, !z)
Clauses are formulae of the form L1 or L2 or L3 where each L is a literal. They can be thought of as a set.

32
Q

What does it mean if a propositional formula is in conjunctive normal form?

A

It consists of an AND of ORs (e.g. (A v ¬B v C) ^ (D ^ ¬E) )
Every formula of propositional logic is equivalent to a formula in conjunctive normal form (a conjunction of clauses)
Each CNF is a clause-set

33
Q

DIMACS format

A

Text format for representing clause sets
Variables are indicated as positive integers, negated variables are represented by negative integers
Any line starting with a c is a comment
At the top of the file is a line of form “p cnf N M” where N is the number of the largest variable, and M is the total number of clauses in the clause set
Clauses are separated by a zero

34
Q

How would the clause set F = {{u, ¬v, ¬y}, {¬u, z}, {¬v, ¬w}, {w, ¬x}, {x, y, ¬z}} be represented?

A

c VGE
c BBC
c HRT
c 5 because there are 5 clauses, 6 because there are 6 unique variables u, v, w, x, y, z
p cnf 6 5
1 -2 -5 0
-1 6 0
-2 -3 0
3 -4 0
-4 5 -6 0

35
Q

Procedure for converting a formula to CNF?

A

Express all connectives using ^, v and ¬
Push ¬ inside
Use De Morgan’s Laws to convert to CNF

36
Q

Tseitin’s algorithm for converting a propositional formula to CNF

A

Input: a propositional formula A. Let F = ∅

While A has a subformula LM where * is any binary logical connective and L and M are literals:
- Replace this subformula with a new variable x(L
M)
- Append “V F(x(L*M))” to the end of F (see the flashcard “defining clause-sets”)

Now A is a single literal B. Add “V B” to F and halt. Output clause set F.

37
Q

Defining clause sets

A