Logic Flashcards

1
Q

What does logic deal with?

A

Whether statements are true or false + chains of reasoning which enable us to decide this. Work with boolean + truth tables + de Morgan’s laws.

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

What are the symbols for and, or not?

A

and = ^. Or = v. Not = ¬.

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

What is the opposite of A^B?

A

¬A v ¬B. We find opposite by negating variable + swapping and/or symbols.

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

When is A ⇒ B false?

A

When A is true and B is false.

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

What is the contrapositive of A ⇒ B?

A

¬B ⇒ ¬A. They mean the same thing.

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

If you chain logical deductions together, how do you know when it’s always true?

A

If the truth table is true in every scenario.

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

What is forward chaining?

A

Search from initial conditions to goal. Start with what we know. Could end up with lots of intermediate deductions that aren’t needed for final answer.

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

What is backward chaining?

A

From goal back to initial conditions. Start with what we want to know. Can end up with lots of questions which we don’t need an answer to.

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

What is propositional logic?

A

Logic used when something must be proved/disproved (proposition)

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

What is predicate logic?

A

When we need to find out more about unknown variable before we can prove/disprove it. It tells you something about the subject and so is a Boolean function applied to 1 or more variables.

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

What happens when you add values to a predicate?

A

It becomes a proposition.

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

What is the domain/universe of discourse?

A

Set of values which can be assigned to predicate variable.

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

What are the quantifiers?

A

For all (∀) or there exists (∃) to indicate num of values for which predicate is true. For all shows all values are true. There exists shows at least one (possibly all) values are true for predicate. E.g. ∀x∈D .P(x) (for all possible values of x in domain D, P(x) is true.

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

What is a counterexample?

A

With for all, there must be at least 1case where p(x) is false so ¬( ∀x∈D.P(x)) = ∃x∈D.¬P(x) AND ¬( ∃x∈D .P(x) ) = ∀x∈D.¬P(x). You flip rule + negate predicate. Domain not affected.

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

How do you prove ‘there exists’?

A

You just need 1 example.

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

What is the lovers relationship?

A

Use 2 different quantifiers. Let L(a,b) be ‘a loves b’. Can use statements such as ∀x∈D. ∃y∈D.L(y,x) meaning everyone is loved by someone

17
Q

What is the difference between a finite and infinite sequence?

A

Finite sequences we know length and can specify each term’s index, we limit domain to num of terms in sequence. Strong parallel between ∀i + for loops for arrays. With infinite, we don’t know how many there are but if there’s a pattern we can make a conjecture about subsequent terms so can make a predicate rule for this.

18
Q

What is the difference between an ordered and a sorted sequence?

A

A sequence is already ordered but sorted means in asc/desc order.

19
Q

What is the Fibonacci sequence?

A

Addition of previous 2 numbers in sequence but have to declare first 2 values as don’t have 2 previous values.

20
Q

How do we concatenate sequences?

A

Tie symbol means concatenation, join 2 sequences together (⌢).

21
Q

How do we declare a subsequence in predicate logic?

A

Use subseq(S,T) to state if something is a subsequence, but not in VDMLab. To ref subsequence, use S(starti,…,endi)

22
Q

How can we use predicate logic for sequences of word?

A

Create predicate that detects repeated words e.g. ∃i∈{2,…,len(S)}.S(i)=S(i-1). If word spelt wrong, check if every word is in dictionary. E.g. ∀I ∈{1,…,len(S)}. ∃J ∈{1,…,len(D)}.S(i)=D(j).