Flashcards in Logic Deck (22)
What does logic deal with?
Whether statements are true or false + chains of reasoning which enable us to decide this. Work with boolean + truth tables + de Morgan's laws.
What are the symbols for and, or not?
and = ^. Or = v. Not = ¬.
What is the opposite of A^B?
¬A v ¬B. We find opposite by negating variable + swapping and/or symbols.
When is A ⇒ B false?
When A is true and B is false.
What is the contrapositive of A ⇒ B?
¬B ⇒ ¬A. They mean the same thing.
If you chain logical deductions together, how do you know when it's always true?
If the truth table is true in every scenario.
What is forward chaining?
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.
What is backward chaining?
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.
What is propositional logic?
Logic used when something must be proved/disproved (proposition)
What is predicate logic?
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.
What happens when you add values to a predicate?
It becomes a proposition.
What is the domain/universe of discourse?
Set of values which can be assigned to predicate variable.
What are the quantifiers?
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.
What is a counterexample?
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 do you prove 'there exists'?
You just need 1 example.
What is the lovers relationship?
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
What is the difference between a finite and infinite sequence?
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.
What is the difference between an ordered and a sorted sequence?
A sequence is already ordered but sorted means in asc/desc order.
What is the Fibonacci sequence?
Addition of previous 2 numbers in sequence but have to declare first 2 values as don’t have 2 previous values.
How do we concatenate sequences?
Tie symbol means concatenation, join 2 sequences together (⌢).
How do we declare a subsequence in predicate logic?
Use subseq(S,T) to state if something is a subsequence, but not in VDMLab. To ref subsequence, use S(starti,…,endi)