CS202_week1_lecture
CS202_week1_lecture
Date: 7th & 8th January 2025 Instructor & Scribe: Anamay Tengse
The first module: the basics of Logic and Sets, contains a fair bit of material that several of you
might have already encountered before. So, it might help to look at this module as more of an
agreement for the notation to be used for the rest of the course. Some pieces of notation may de-
viate from the ones in the textbook; we will point out when that happens.
We will use lowercase letters, e.g. p, q, . . ., to denote propositional variables; these are variables that
are placeholders for propositions. Note that every proposition is either true (⊤) or false (⊥), but
not both. The negation of a proposition p is denoted by ¬ p, and its truth value is the opposite of
that of p. Indeed, ¬(¬ p) is the same as saying p.
1
Connectives. Connectives are essentially operators for propositions. That is, the propositions
(or the sentences formed using connectives) will evaluate to either true or false, depending on the
propositions that they connect. There are two basic (and one not-so-basic) connectives.
• Conjunction: This is just the ‘and’ operator, and is denoted by ∧. The conjunction p ∧ q is true
only if both p and q are true.
Note that an empty conjunction is always true (sometimes called ‘vacuously true’). To un-
derstand this, think of always starting with an empty conjunction, and adding propositions
to it. Here is an example: “All the buses I own are red.” (Why is this a conjunction?)
• Disjunction: This is the ‘or’ operator, and is denoted by ∨. The disjunction p ∨ q ∨ r is true if at
least one of p, q or r is true. In the same spirit as above, an empty disjunction is always false
(also called ‘vacuously false’).
Conditionals. Technically, conditionals are a special type of connectives, but they deserve a spe-
cial category of their own, since they are extremely natural, and almost all spoken languages seem
to have invented them organically.
• Implication: This is the “if-then operator”, denoted by =⇒ . Textbook uses →, we won’t (we
reserve it for functions). In the language of connectives, p =⇒ q ≡ (¬ p ∨ q).
In an implication a =⇒ b, a is said to be the hypothesis (or assumption or premise), and b is
said to be the conclusion (or consequence).
Note that an implication is true if either the hypothesis is false, or if the conclusion is true,
sometimes regardless of what the other evaluates to. We covered some examples is class,
you can construct some of your own for fun.
• Bi-implication: This is the “if and only if operator”, denoted by ⇐⇒ . Textbook uses ↔;
we stay consistent with =⇒ . In other words, p ⇐⇒ q ≡ ( p =⇒ q) ∧ (q =⇒ p) ≡
(¬ p ∨ q) ∧ ( p ∨ ¬q).
Note that whenever a ≡ b, the proposition a ⇐⇒ b evaluates to true, and vice versa.
2
p q ¬p ∨ q p ∨ ¬q (¬ p ∨ q) ∧ ( p ∨ ¬q) p ⇐⇒ q
⊥ ⊥ ⊤ ⊤ ⊤ ⊤
⊥ ⊤ ⊤ ⊥ ⊥ ⊥
⊤ ⊥ ⊥ ⊤ ⊥ ⊥
⊤ ⊤ ⊤ ⊤ ⊤ ⊤
De Morgan’s Laws. Indeed, these connectives (and negations) can be combined to form more
complex expressions whose truth value depends on the underlying propositions. It is sometimes
useful to rewrite such expressions to simplify them and to decide whether they are true or false.
This can be done as follows. (We use the symbol ≡ to mean that two logical expressions are
equivalent, or that they have the same value.) There are called De Morgan’s laws.
Truth Tables. A good way to judge whether two propositions (as in expressions) are equivalent,
is to write their truth tables. For a proposition over k variables, the truth table has 2k rows that list
all the possible combinations of the truth values of the variables. There are at least k + 1 columns,
labelled by the k variables, and the proposition itself. Mostly, it is useful to break down a complex
proposition into smaller ones and have them as columns. See Figure 1 for an example.
Normal Forms. Now that we have seen how one can build complex propositions from simple
ones using different operators (or connectives), it makes sense to talk about simplifying a given
proposition. There are two forms of expressing propositions that can be intuitively understood
as “simple”. One is to write the proposition as a (massive) conjunction of “necessary conditions”,
each of which is written as a disjunction of variables of their negations. The other is the dual: writ-
ing it as a massive disjunction of “sufficient criteria”, each of which is a conjunction of variables
and their negations.
Inference. This is a process (NOT a type of proposition) of deriving new propositions from those
given or stated. Looking ahead, we will formalize this further via something called resolution, for
now let us return to Example 1.1.
3
• Let p denote the proposition that “NokiaG20 is a smartphone”, and q denote the predicate that
“NokiaG20 is a computer”.
• Now the first sentence tells us that p is true, second sentence tells us that p =⇒ q, and the
third sentence records (the product of) our inference that q is true.
Predicates. A predicate can be seen as a function (as in programming) that takes some inputs and
outputs true or false. Formally, a predicate is any logical expression that is defined with respect
to a variable; so a predicate “takes” some object as an input, and “outputs” a proposition about
that object. Just as with functions in programs (and propositions), we can define more complex
predicates using the ones we have already defined. And just as with functions in programs, it
helps if the predicates are named appropriately. When talking about a generic predicate, we will
use uppercase letters.
For the case of Example 1.1, let us introduce the following predicates.
Now, the first sentence in Example 1.1 tells us that ‘IsSmartphone( NokiaG20)’ is true, the second
one tells us that “if IsSmartphone( x ) is true, then IsComputer( x ) is true, for any x”, and the third
statement records the inference that IsComputer( NokiaG20) is also true. Formalizing the “for any
x” part is where we will need a quantifier.
2.1 Quantifiers
Observe that we commonly encounter two kinds of general statements: statements that apply to
every object (from a set we have in mind), and statements that talk about some object (from a set
that we have in mind). Some common examples are “everyone likes chocolate”, or “someone must
know how ChatGPT works”, or more mathematical statements like “all rational numbers are real”, or
“some rhombuses are not squares”. There are two quantifiers that capture these two behaviors.
• Universal quantifier: Denoted by ∀ (rotated A), this is used to make propositions that talk
about every object in some set. The expression ∀ x, P( x ) is read as “for all x, P( x )”, and it says
4
that “every x satisfies the predicate P”.
For instance, ∀ x, LikesChocolate( x ), or ∀ x, Rational( x ) =⇒ Real( x ).
• Existential quantifier: Denoted by ∃ (rotated E), this is used to claim that some object has a
certain property. So ∃ x : Q( x ) is read as “there exists (an) x such that Q( x )”, and it says that
“some x satisfies the predicate Q.”
For example, ∃ x : UnderstandsChatGPT( x ), or ∃y : Rhombus(y) ∧ ¬Square(y).
We can now formalize the statements made in Example 1.1 to a much better extent. (Note that
for any predicate P, the expression P( x ) is the proposition that “x satisfies P”.)
In the next week, we will formalize this even further, and see how the inference above can be
carried out almost mechanically. Before that, in the next lecture, we will look at how quantifiers
interact with each other and with other logical operations that we have seen.
Q. Can you write an expression for ∃y : Rhombus(y) ∧ ¬Square(y) using an implication? How
would that translate into English?