0% found this document useful (0 votes)
65 views135 pages

Discrete Structures

The document outlines a course on Discrete Structures I, focusing on propositional and predicate logic, proofs, and their applications in mathematical reasoning. It covers the language of propositions, logical connectives, and the construction of logical arguments, emphasizing the importance of logical clarity in mathematics and computer science. Exercises are included to reinforce understanding of the concepts presented.

Uploaded by

Fridah W
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views135 pages

Discrete Structures

The document outlines a course on Discrete Structures I, focusing on propositional and predicate logic, proofs, and their applications in mathematical reasoning. It covers the language of propositions, logical connectives, and the construction of logical arguments, emphasizing the importance of logical clarity in mathematics and computer science. Exercises are included to reinforce understanding of the concepts presented.

Uploaded by

Fridah W
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Discrete Structures I

Mwangi H. (Ph.D.)

Year 2.1
Department of Computing
J.K.U.A.T.
1 Propositional Logic
The Language of Propositions
Construction Propositions
Connectives
Applications
Logical Equivalences
Exercises
2 Predicate Logic
Predicates and Variables
Quantifiers
Nested Quantifiers
Possible Pitfalls
Exercises
3 Proofs
Theorems
Direct Proofs
Indirect Proofs
Strategies to Help with Proofs
More Types of Proofs
Exercises

[Link]@[Link] (SCIT) Computer Science 2 / 126


Logic and Proofs

This chapter will set the foundations of mathematical reasoning and


thinking to be used in this course and in all your subsequent math
and computer science courses.
Fundamental to all mathematics and computer science is logical
arguments and proofs.
In this first chapter we will explore different logic systems, namely
propositional logic and predicate logic. Within these systems we will
see how to form formulas, logical arguments, inferences, and how to
prove with certainty if some mathematical statement is correct or not.
The reason we need to study logic more formally is that English, and
many natural languages, are very ambiguous.

[Link]@[Link] (SCIT) Computer Science 3 / 126


Propositional Logic

Logic and Proofs

Propositional Logic is the logical system built around propositions.


From such propositions one can build logical arguments and
implications.
In this section we will explore the language of propositions, their
applications, and deriving logical equivalences.

[Link]@[Link] (SCIT) Computer Science 4 / 126


Propositional Logic The Language of Propositions

Logic and Proofs

Propositions are all about truth. Is a statement true or false? Is a


statement correct or incorrect?
A proposition is a declarative sentence or statement has a truth value.
It is a statement which is either true or false. Each proposition has a
”truth value”: either true or false.
Examples of propositions
Socrates was a human.
Socrates was a pigeon.
It is raining today.
The logo of Starbucks is a green mermaid.
1+1=2
1+1=4

[Link]@[Link] (SCIT) Computer Science 5 / 126


Propositional Logic The Language of Propositions

Logic and Proofs

Notice that propositions need not be a true statement. Propositions


only need to be declarative. Their truth value may be true or false.
However, all propositions must have a particular truth value. The
statement cannot be both true and false. The statement must be
able to be interpreted as true or false.
From the previous definition and examples, propositions are therefore
not questions, general statements, demands, or hypotheses.
Propositions do not have any variables, quantifiers, or parameters
(e.g. the words “some” or “any” typically do not appear). Consider
now a few non-examples.

[Link]@[Link] (SCIT) Computer Science 6 / 126


Propositional Logic The Language of Propositions

Logic and Proofs

Examples of statements that are not propositions


Do you have a dog?
Let’s go!
Some coffee mug with a mermaid on it.
x +2=3
y = x2 − 1
Are each of these propositions?
I am a Quail.
Jupiter is the 5th planet from the sun.
On Thursdays, van Gogh painted landscapes.
11+56∗3−8
19 =9

[Link]@[Link] (SCIT) Computer Science 7 / 126


Propositional Logic Construction Propositions

Logic and Proofs

An entire proposition is often denoted by a single propositional


variable.
Propositional variables are typically among p, q, r , s, t . . .
Using propositional variables
p := The sky is blue
q := The sun rises from the west
Denote truth values in particular ways. ”True” may be denoted by T
”False” may be denoted by F

[Link]@[Link] (SCIT) Computer Science 8 / 126


Propositional Logic Connectives

Logic and Proofs

Propositions (and propositional variables) can be combined into


compound propositions or propositional formulas. Similar to
compound sentences and other logical connectives in natural
language.
Propositional Logic has 5 main connectives. Each connective has a
corresponding meaning in natural language
1 Negation: ¬
2 Conjuction: ∧
3 Disjunction: ∨
4 Implication: =⇒
5 Biconditional ⇐⇒
Logical connectives are like arithmetic operators +, −, ×, ÷

[Link]@[Link] (SCIT) Computer Science 9 / 126


Propositional Logic Connectives

Negation

The negation of a proposition results in a proposition with the


opposite truth value
Given a proposition p its negation is ¬p and has the following truth
values.

p ¬p
T F
F T
Let p = “the sky is blue”. What is ¬p?
Let q = 2 + 2 = 5. What is ¬q?

[Link]@[Link] (SCIT) Computer Science 10 / 126


Propositional Logic Connectives

Conjunction

The conjunction of two propositions is the logical ”and” of the two


propositions.
The conjunction of two proposition is only true if both the
propositions are individually true, otherwise the conjunction is false.
Given proposition p and q their conjunction is denoted p ∧ q and has
the following truth values.
p q p∧q
F T F
F F F
T T T
T F F

[Link]@[Link] (SCIT) Computer Science 11 / 126


Propositional Logic Connectives

Disjunction

The disjunction of two propositions is the ”or” of the two


propositions.
The disjunction is true if at least one of the propositions is
individually true, otherwise the disjunction is false.
Given proposition p and q their conjunction is denoted p ∨ q and has
the following truth values.
p q p∨q
F T T
F F F
T T T
T F T

[Link]@[Link] (SCIT) Computer Science 12 / 126


Propositional Logic Connectives

Implication

Implication is one of the most challenging connectives to understand.


Yet it is arguably the most important for creating logical arguments
An implication is a conditional statement. For two propositions p and
q, p =⇒ q is an implication which is read ”if p, then q”. You can
also say ”p implies q”.
Let p be ”it is raining” and q be ”the ground is wet”, what is
p =⇒ q?
Let t be ”I score an A in KCSE” and s be ”I will graduate with a
First”, what is t =⇒ s?
In an implication p =⇒ q, the first proposition p is known as the
hypothesis, antecedent, or premise. The second proposition q is
known as the conclusion or consequence.

[Link]@[Link] (SCIT) Computer Science 13 / 126


Propositional Logic Connectives

Implication

Since an implication is a conditional, the truth value of the implication


as a whole changes depending on the truth value of the premise.
The following truth table summarizes the truth values of an
implication.
p q p =⇒ q
F F T
F T T
T F F
T T T
An implication can be viewed as an obligation, a contract, or a
commitment.
The implication p =⇒ q is false (the contract is broken; the
obligation is unmet) only when p is true and q is false.

[Link]@[Link] (SCIT) Computer Science 14 / 126


Propositional Logic Connectives

Implication

If p is true, then p =⇒ q is always true.


If p is true and the implication correct (the obligation is upheld), then
q can never be false.
”Falsity can imply anything.” If the hypothesis is false, then the
implication is always true, regardless of the whether or not the
conclusion is true.

[Link]@[Link] (SCIT) Computer Science 15 / 126


Propositional Logic Connectives

Implication

There are many equivalent ways to think about the implication


p =⇒ q

if p, then q q whenever p
p =⇒ q q follows p
q when p p is sufficient for q
q, if p q is necessary for p

[Link]@[Link] (SCIT) Computer Science 16 / 126


Propositional Logic Connectives

Necessity and Sufficiency

An implication connects propositions by a necessary or sufficient


condition. From p =⇒ q we get two relations:
1 p is sufficient for q
2 q is necessary for p
That is, ”if sufficient condition, then necessary condition”.

[Link]@[Link] (SCIT) Computer Science 17 / 126


Propositional Logic Connectives

Necessity and Sufficiency

Necessary

Sufficient
Sufficient

Figure: Being in the inner circle is sufficient for being in the outer circle. Being in
the outer circle is necessary for being in the inner circle.

[Link]@[Link] (SCIT) Computer Science 18 / 126


Propositional Logic Connectives

Biconditional

For two propositions p and q, they can be connected by a


biconditional as p ⇐⇒ q.
A biconditional is an double implication. A biconditional is true if
both propositions have the same truth value. p ⇐⇒ q can be read
as ”if and only if”. A biconditional has the following truth table.
p q p ⇐⇒ q
F F T
F T F
T F F
T T T

[Link]@[Link] (SCIT) Computer Science 19 / 126


Propositional Logic Connectives

Biconditional

”p if and only if q”
”if p then q, and if q then p”
”p is necessary and sufficient for q”
”p iff q”
What is the truth value of these compound propositions?
“The Earth is flat” =⇒ “Pigeons are robots”
“Bats have wings” =⇒ “Bats are birds”
“A square is a rectangle” ⇐⇒ “A square had four 90°interior angles”
“Spinach is green” ⇐⇒ “Penguins can fly”

[Link]@[Link] (SCIT) Computer Science 20 / 126


Propositional Logic Connectives

Propositional Formulas

Much like arithmetic formulas using addition, multiplication, division,


etc., propositional formulas may use several connectives
simultaneously.
Logical connectives have a similar order of precedence to BEDMAS.
1 Parenthesis: always perform operations on expressions inside
parentheses first.
2 Negation: apply negation to a proposition before binary connectives.
3 Conjunction: conjunction before disjunction
4 Disjunction: disjunction after conjunction, but before implication
5 Implication: =⇒ after ∧, ∨,
6 Biconditional: ⇐⇒ after ∧, ∨and =⇒ .
Propositional variables need not be associated with a particular
proposition or truth value.
Replacing the variables in a propositional formula with a truth value is
called a truth assignment.

[Link]@[Link] (SCIT) Computer Science 21 / 126


Propositional Logic Connectives

Propositional Formulas

Definition 1.1: Truth Assignment

A truth assignment is the assignment of a truth value (true or false) to a propo-


sitional variable. Equally, it is the replacement of a propositional variable with a
truth value.

Propositional formulas result in different truth values depending on the particular


truth assignment on its constituent propositional variables.
When at least one truth assignment exists so that a formula is true, that formula is
said to be satisfiable.

Definition 1.2: Satisfiable

A propositional formula is satisfiable if its truth value can be true under some
truth assignment. If every possible truth assignment makes the formula have
false as its truth value, that formula is said to be unsatisfiable.

[Link]@[Link] (SCIT) Computer Science 22 / 126


Propositional Logic Connectives

Truth Tables

Truth tables are tools for determining the truth values of propositional
formulas
Table is separated into two sets of columns
1 The first set of columns represent each proposition (or propositional
variable) in a formula
2 The second set of columns represents the sub-formulas and formulas
whose truth value are to be determined
There must be one row in the table for every possible combination of
truth values of the propositional variables.

[Link]@[Link] (SCIT) Computer Science 23 / 126


Propositional Logic Connectives

Truth Tables - 3 Variable Truth Table

Let p, q, r be propositional variables. A truth table for the formula


(p ∧ q) ∨ r is
p q r p ∧ q (p ∧ q) ∨ r
F F F F F
F F T F T
F T F F F
F T T F T
T F F F F
T F T F T
T T F T T
T T T T T
p, q, r have every possible combination of truth values

[Link]@[Link] (SCIT) Computer Science 24 / 126


Propositional Logic Connectives

Truth Tables

Begin Truth table construction by filling out the columns


corresponding to each propositional variable.
These columns represent every possible combination of truth values
on these variables.
Then add columns for each sub-formula, one at a time, building up to
the final formula
Consider the formula p ∧ q ∧ r ∨ ¬q ∨ r =⇒ p. Then by order of
precedence this equation becomes ((p ∧ q ∧ r ) ∨ ((¬q) ∧ r )) =⇒ p.
This contains several sub-formulas which we can parse as follows
i ¬q
ii ¬q ∧ r
iii p∧q
iv (p ∧ q) ∧ r
v (p ∧ q ∧ r ) ∨ (¬q ∧ r )
vi ((p ∧ q ∧ r ) ∨ (¬q ∨ r )) =⇒ p

[Link]@[Link] (SCIT) Computer Science 25 / 126


Propositional Logic Connectives

Truth Tables

To be explicit as possible, create a truth table with 3 + 6 = 9 columns


(3 variables, 6 sub-formulas).
A truth table for the propositional formula p ∧ q ∧ r ∨ ¬q ∧ r =⇒ p
p q r p ∧ q ∧ r ¬q ∧ r (p ∧ q ∧ r ) ∨ (¬q ∧ r )
F F F F F F
F F T F T T
F T F F F F
F T T F F F
T F F F F F
T F T F T T
T T F F F F
T T T T F T

[Link]@[Link] (SCIT) Computer Science 26 / 126


Propositional Logic Connectives

Implication, inverse, converse and contrapositive

Consider the propositional formula p =⇒ q


1 Converse: q =⇒ p
2 Inverse: ¬p =⇒ ¬q
3 Contrapositive: ¬q =⇒ ¬p

Definition 1.3: A conditional and its inverse

The proposition ”if it is raining, then I wear a jacket” is a condi-


tional statement. Its inverse is ”if it is not raining I do not wear
a jacket”

Note An implication and its inverse are not exactly the same.

[Link]@[Link] (SCIT) Computer Science 27 / 126


Propositional Logic Applications

Applications of Propositional Logic

Generally propositional logic is applied in Logic, Computer


Architecture, Theoretical computer science among others
More formally, PL is used in:
a Translating English to Logic
b Boolean Searches
c Formal specifications of software and computer systems
d Solving puzzles

[Link]@[Link] (SCIT) Computer Science 28 / 126


Propositional Logic Applications

Translating English to Logic

Translating English sentence to propositional formula is a 2-Step


activity
1 Find the atomic propositions - The smallest clauses of the sentence
which do not contain connectives and represent them using a unique
variable
2 Determine the appropriate logical connectives for those propositions

Example 1.1

”If it is raining and I am going outside, I bring an Umbrella”.


Let p be ”it is raining”, q, ”I am going outside”, r ”I bring an
umbrella”. Choosing the connectives right converts the above
sentence to p ∧ q =⇒ r

Do the same for ”The Dog is big and friendly or small and tough”

[Link]@[Link] (SCIT) Computer Science 29 / 126


Propositional Logic Applications

Boolean Searches
Boolean refers to a special kind of mathematics that deal with truth
values: true and false.
Boolean algebra is a set of rules for manipulating formulas containing
variables and truth values.
Very similar to but distinct from propositional logic.
Boolean Searches is about using logical connectives to help search
through datasets and filter pieces of data. Useful in databases and
internet search engines.

Example 1.2

Consider keywords Data and Science. AND search for records


containing both Data and Science. OR Searches for records
containing Data or Science, NOT Searches records that excludes
both keywords.
Web searches is an extension of the same concept

[Link]@[Link] (SCIT) Computer Science 30 / 126


Propositional Logic Applications

Formal Specifications
In software, computer and electrical engineering, the requirements of
a system software or device must meet precise specifications
Naturally natural language are often ambiguous and for system
requirement to avoid contradiction, those requirements must be
translated into precise logical statements.

Example 1.3: Logical Specification

Mute all notifications during business hours when the user’s sta-
tus is not available. Let p be ”It is during business hours”, q
be ”the user’s status is set to be available” and r be ”mute all
notifications”. A propositional formula for this specification is:
p ∧ ¬q =⇒ r

Propositional Logic can be used to determine if the collection of all


requirements for a system is consistent
[Link]@[Link] (SCIT) Computer Science 31 / 126
Propositional Logic Applications

Formal Specifications
Definition 1.4: Consistent

A set of propositional formulas is consistent if there exists at least one


truth assignment so that every proposition is simultaneously true.

Consistency is not the same as saying every formula in a set is being


satisfiable.
In this case formulas must be simultaneously satisfied by the same
truth assignment.
To determine consistency, we move as follows. Given a collection of
propostions p1 , p2 , · · · pn , then the propositions are consistent if their
conjunction is satisfiable.
The following formula has at least one truth assignment that makes it
true p1 ∧ p2 ∧ p3 ∧ · · · ∧ pn
To determine the consistency of a requirement set, we must first build
propositional formulas for each requirement.
[Link]@[Link] (SCIT) Computer Science 32 / 126
Propositional Logic Applications

Formal Specifications
If the same clause exists in multiple requirements, the same
propositional variable is used.
Next we assign the same true or false value to each variable so that
every formula is simultaneously true.
Where no assignment exists, the set of requirements are said to be
inconsistent.
Example 1.4

Consider an electronic messaging network requiring that all sent mes-


sages are certain to be received. This specification behaviour might
be modelled as the follows:
1 Messages remain in the outbound message queue until they
have been received by the recipient
2 An unreceived message is either a draft or is in the outbound
message queue
3 Received messages cannot be drafts
[Link]@[Link] (SCIT) Computer Science 33 / 126
Propositional Logic Applications

Formal Specifications
Let p be ”messages is in outbound message queue”,q be ”Message is
received” and r be ”message is a draft”. Then we have
1 p =⇒ ¬q
2 ¬q =⇒ (p ∨ r )
3 q =⇒ ¬r
p q r p =⇒ ¬q ¬q =⇒ (p ∨ r ) q =⇒ ¬r
F F F T F F
F F T T T F
F T F T T T
F T T T T F
T F F T T F
T F T T T F
T T F F T T
T T T F T F

Since at least one truth assignment simultaneously satisfies all


equations, namely p := F , q := T , r := F , this set of requirements
is consistent.
In the language of this problem, that means the message is received
and is not a draft and is not in the outbound queue

[Link]@[Link] (SCIT) Computer Science 34 / 126


Propositional Logic Applications

Solving Logic Puzzles


Many puzzles are based around logical arguments and reasoning.
For solution to such puzzles, propositional logic is a very useful tool.
The idea is to model the elements of the puzzle as propositional
formulae and use those formulas to determine if they are satisfiable,
consistent etc, depending on the puzzle.

Example 1.5: Knights and Knaves

Suppose you are on an island with two kinds of people


1 Knights, who always tell the truth; and
2 Knaves, who always lie
You meet two people A and B. A says ”B is a knight.” B says
”the two of us are different kind of people”. What kind of
people are A and B

[Link]@[Link] (SCIT) Computer Science 35 / 126


Propositional Logic Applications

Knights and Knaves

A and B are both Knaves


Let p ”A is a knight”, and q be ”B is a knight”.
The statement ”the two of us are different kind of people” can be
̸ q) ∨ (¬p ∧ q)
represented as (p∧ =
a Assume A is a knight and therefore p is true. Then, the statement ”B
is a knight” must be true and therefore q is true. If B is a knight, then
the formula (p ∧ ¬q) ∨ (¬p ∧ q) should be true. However, this formula
is false if both p and q are true
b Assume A is a knave (i.e. ¬p is true). Then, the statement ”B is a
knight” must be false (i.e. ¬q is true). Therefore, B is a knave and the
statement should be a lie. Both p and q being false makes
(p∧ = ̸ q) ∨ (¬p ∧ q) false, which is consistent

[Link]@[Link] (SCIT) Computer Science 36 / 126


Propositional Logic Logical Equivalences

Logical Equivalences
Propositional logic is the foundation of more complex logical systems and formal
mathematical proofs.
Of particular importance is the equivalence proof that proves one thing is equivalent to
another through a sequence of equivalences.

Definition 1.5: Tautology

A propositional formula that is always true, for every possible truth assignment

A proposition that is not a tautology is either a contradiction or contingency

Definition 1.6: Contradiction

A proposition formula that is always false, for every possible truth assignment, is
a contradiction

Definition 1.7: Contingency

A proposition formula that is neither a contradiction nor a tautology is a contin-


gency

[Link]@[Link] (SCIT) Computer Science 37 / 126


Propositional Logic Logical Equivalences

Logically Equivalent

Two propositions formulas say p and q, are logically equivalent if


p ⇐⇒ q is a tautology. If this is the case, we may write p ⇐⇒ q
or p ≡ q
An explicit way to determine if two expressions are logically equivalent
is if their two columns in a truth table are identical
Logically equivalent truth table
p q ¬p p =⇒ q ¬p ∧ q
F F T T T
F T T T T
T F F F F
T T F T T

[Link]@[Link] (SCIT) Computer Science 38 / 126


Propositional Logic Logical Equivalences

Logically Equivalent

Following are logical equivalences which should be memorized. They


are similar to many laws of arithmetic
Law ∧ ∨
Identity p∧T ≡p p∨F ≡p
Annihilation p∧F ≡F p∨T ≡T
Idempotent p∧p ≡p p∨p ≡p
Complementation p ∧ ¬p ≡ F p ∨ ¬p ≡ T
Double Negation ¬(¬p) ≡ p

[Link]@[Link] (SCIT) Computer Science 39 / 126


Propositional Logic Logical Equivalences

Logically Equivalent

Other interesting properties of logical connectives between two or


more propositional variables
Law ∧ connective ∨ connective
Commutativity p∧q ≡q∧p p∨q ≡q∨p
Associativity p ∧ (q ∧ r ) ≡ (q ∧ p) ∧ r p ∨ (q ∨ r ) ≡ (q ∨ p) ∨ r
Distributivity p ∧ (q ∧ r ) ≡ (p ∧ q) ∨ (p ∧ r ) p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )
Absorption p ∧ (p ∨ q) ≡ p p ∨ (p ∧ q) ≡ p
De Morgan’s Laws ¬(p ∧ q) ≡ ¬p ∨ ¬q ¬(p ∨ q) ≡ ¬p ∧ ¬q

Demo Morgan’s Laws are very important as they explain how


negation distributes over conjuction and disjunction. It turns
disjunction into conjunctions and vice versa

[Link]@[Link] (SCIT) Computer Science 40 / 126


Propositional Logic Logical Equivalences

Logical Equivalences
In these laws, we can replace any propositional variable with an entire
propositional formula WLOG
Let p := (¬a ∧ b) ∨ c
(¬a ∧ b) ∨ c ∨ T ≡ ((¬a ∧ b) ∨ c) ∨ T
≡p∨T
≡T
These laws and properties are used as building blocks to prove that
certain expressions are logically equivalent. More logical equivalences
(p =⇒ q) ≡ ¬p ∨ q
(p =⇒ q) ∧ (p =⇒ r ) ≡ p =⇒ (q ∧ r )
(p =⇒ r ) ∧ (q =⇒ r ) ≡ (p ∨ q) =⇒ r
p ⇐⇒ q ≡ (p =⇒ q) ∧ (q =⇒ p)
p ⇐⇒ q ≡ ¬p ⇐⇒ ¬q
p ⇐⇒ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)

Draw truth table for the above propositions to prove that they are
logically equivalent
[Link]@[Link] (SCIT) Computer Science 41 / 126
Propositional Logic Logical Equivalences

Equivalence Proof

To show two expressions say A and B, are logically equivalent we


construct a sequence of logically equivalent statements Ei beginning
with A and ending with B

A ≡ E1
E1 ≡ E2
E2 ≡ E3
.
.
.
En ≡ B

[Link]@[Link] (SCIT) Computer Science 42 / 126


Propositional Logic Logical Equivalences

Equivalence Proof - Example 1

Prove that p ∧ (¬p ∨ q) ≡ p ∧ q

p ∧ (¬p ∨ q) ≡ p ∧ ¬p ∨ p ∧ q distributivity
≡F ∨p∧q complementation
≡p∧q Identity

Prove that p ∨ (p ∧ q) ∨ (¬p ∧ r ) ≡ (p ∧ q) ∨ p ∨ r

p ∨ (p ∧ q) ∨ (¬p ∧ r ) ≡ (p ∧ q) ∨ p ∨ (¬p ∧ r ) commutativity


≡ (p ∧ q) ∨ (p ∨ ¬p) ∧ (p ∨ r ) distributivity
≡ (p ∧ q) ∨ (T ∧ (p ∨ r )) Complementation
≡ (p ∧ q) ∨ (p ∨ r ) Identity

[Link]@[Link] (SCIT) Computer Science 43 / 126


Propositional Logic Exercises

Exercises

Classify each of the following statements as True or False



1 4 = 2 + 2 and 7 <√ 50
2 4 = 2 + 2 → 7 < √50
3 4 ̸= 2 + 2 → 7 < √50
4 4 = 2 + 2 → 7 ≥ 50
Give the negation of each of the following compound statements.
1 a2 > 0 or a is not a real number
2 x = ±1
3 x is a real number and x 2 + 1 = 0
Give the converse, inverse, and contrapositive of each of the following
implications
1 If ba and bc are integers, then a
c is an integer
2 ab = 0 → a = 0

[Link]@[Link] (SCIT) Computer Science 44 / 126


Propositional Logic Exercises

Exercises

For each of the following propositional formulas, determine which are


satisfiable. If they are satisfiable, give a truth assignment which
satisfies the formula.
1 p ∧ (¬q ∨ ¬r ) ∧ (q ∨ ¬p)
2 p ∧ (q ∨ ¬p) ∧ (¬q ∨ ¬p) ∧ r
3 (p ∧ q ∧ ¬r ) ∨ (p ∧ ¬q ∧ ¬r )

[Link]@[Link] (SCIT) Computer Science 45 / 126


Propositional Logic Exercises

Application Exercise

Define the basic clauses of each of the following statements as


propositional variables. Then, express each of the following compound
statements as propositional formulas. Finally, is this set of propositions
consistent? If so, give a truth assignment which shows they are consistent.

1 The campus server does not work if the internet is off.


2 Students can skype during the test when the Prof is distracted.
3 If the classroom phone does not ring then the Prof is not distracted.
4 Students cannot skype during the test unless the internet is on.
5 If the classroom phone rings then the campus server works.

[Link]@[Link] (SCIT) Computer Science 46 / 126


Predicate Logic

Predicate Logic

Propositional Logic is insufficient to represent more complex logical


expressions. For example, the following cannot be represented.
p := ”All men are mortal” and q := ”Socrates is a man”. Is socrates
mortal? The answer is yes.

[Link]@[Link] (SCIT) Computer Science 47 / 126


Predicate Logic Predicates and Variables

Predicates and Variables

Predicate logic augments propositional logic with variables,


predicates, and quantifiers.
Variables are simple. They are some symbol, for example x, y , or z
that stands in for some mathematical object.

Definition 2.1: Predicate

A Symbol which represents a property or relation.

Predicates are typically capital letters P, Q, R, S . . ..


Predicates stand for something. They are more general in that they
need not have a truth value. Whereas propositions need to be
declarative statement(i.e. an independent clause in a sentence),
predicates can be an incomplete clause

[Link]@[Link] (SCIT) Computer Science 48 / 126


Predicate Logic Predicates and Variables

Predicates and Variables


The following are all predicates
D :=”is a Dog”
R :=”is rowing his boat”
P :=”is a positive number”
E :=”is an even integer”
As can be observed in the above examples, predicates lack subjects. When
Combined with variables, predicates allow us to form propositional
functions

Definition 2.2: Propositional Functions

A function formed by a predicate and one or more variables.


A proposition is obtained by applying particular values to the vari-
able(s) or by binding the variables with logical quantifiers.

Propositional functions become propositions when their variables are


replaced by a value in the domain of discourse or domain.
[Link]@[Link] (SCIT) Computer Science 49 / 126
Predicate Logic Predicates and Variables

Propositional Function
The domain specifies what are the possible values for the variable. a
Domain is represented by U
If there is no domain, propositional function has little meaning.
Suppose P(x) stands for ”x passed ICS 2204”, this only makes sense
if the domain x is the ”people who have taken ICS 2204”
Let P be ”is greater than 0”. Then P(x) is a propositional function
denoting x is greater than 0. If we let the domain be the integers, x
may take the value of any integer
1 P(−3) is false
2 P(0) is false
3 P(2) is true
4 P(3.14159) is invalid
Replace a particular value from the domain of discourse for a variable
in a proportional function, we say that the variable is bound - also
called bound variable
A variable that is not bound is called a free variable
[Link]@[Link] (SCIT) Computer Science 50 / 126
Predicate Logic Predicates and Variables

Propositional Function - Example

Let R(x, y , z) := x + y = z. Let Q(x, y , z) := x − y = z. Let U be


the integers x, y , and z. What are the values of the following?
1 R(x, 3, z)
2 R(2, −1, 5)
3 R(3, 4, 7)
4 Q(2, −1, 3)
5 Q(3, 4, 7)
6 Q(x,3,z)
For compound expressions, logical connectives of propositional logic
also apply to predicate logic. Examples
Let P(x) := x can fly. Let Q(x) := x are blue. Let the domain of x
be all species of animals
1 P(penguins) ∨ P(geese) is true
2 P(blue jays) ∧ Q(blue jays) is true
3 P(penguins) → Q(tigers)

[Link]@[Link] (SCIT) Computer Science 51 / 126


Predicate Logic Predicates and Variables

Propositional Function - Example

Let P, Q be predicates. Let x, y be variables


1 P(2) ∨ Q(5) is a proposition since all variables are bound
2 P(3) ∧ P(x) is a propositional function with one variable
3 P(x) → P(y ) is a propositinal function with two variables
4 P(y ) ∨ Q(x) is a propositional function with two varialbes

[Link]@[Link] (SCIT) Computer Science 52 / 126


Predicate Logic Quantifiers

Quantifiers

Quantifiers are used as modifiers to variables - gives rise to the logical


formalization of the English words ”all”, ”some”, ”any”, ”every”, etc.

Example 2.1

1 all men are mortal


2 some birds cannot fly

These cannot be expressed in propositional logic but can be


represented in predicate logic using quantifiers.
The two main quantifiers are the universal quantifier and the
existential quantifier

[Link]@[Link] (SCIT) Computer Science 53 / 126


Predicate Logic Quantifiers

Quantifiers

Definition 2.3: Universal Quantifier

”For all”, ”For Any”, ”Given any”. A Universal quantifier asserts that
a predicate is true for any and every value in the domain. Denoted
by ∀

Definition 2.4: Existential Quantifier

”There exists”, ”For some”, ”There is a”, ”There is at least one”.


An existential quantifier asserts that a predicate is true for at least
one value in the domain - Denoted ∃

A quantifier binds a variable to a value just like substituting a variable to a


value from a domain.

[Link]@[Link] (SCIT) Computer Science 54 / 126


Predicate Logic Quantifiers

Universal Quantifier

Let P be a predicate and U be the domain.


1 ∀xP(x) says that P(x) is true for every choice of x from the domain
2 ∃xP(x) says that P(x) is true for some x in the domain
∀ x P(x) can be read as ”For all x, P(x)”

Example 2.2

a Let P(x) := x > 0. If U is all integers, ∀xP(x) is false


b Let P(x) := 2x is even. If U is all integers, ∀xP(x) is true
c Let P(x) := x has feathers. If U is all animals, ∀xP(x) is false
d Let P(x) := x > 0. If U is all integers, ∀xP(x) is false

[Link]@[Link] (SCIT) Computer Science 55 / 126


Predicate Logic Quantifiers

Existential Quantifier

∃ x P(x) can be read as ”There exists and x such that P(x)”

Example 2.3

a Let P(x) := x > 0. If U is all integers, ∃xP(x) is true


b Let P(x) := 2x is odd. If U is all integers, ∃xP(x) is false
c Let P(x) := x has feathers. If U is all animals, ∃xP(x) is true
d Let P(x) := x has feathers. If U is all birds, ∃xP(x) is true

Note that the truth value of a propositional function whose variable is


bound by a quantifier depend on the particular domain of discours

[Link]@[Link] (SCIT) Computer Science 56 / 126


Predicate Logic Quantifiers

Exercise

Let P(x) := x < 2

Example 2.4

i If U is positive integers, what is the truth value of ∀ x P(x)?


What is the value of ∃ x P(x)
ii If U is negative intgers, what the truth value of ∀ x P(x)?
What is the truth value of ∃ x P(x)?
iii If U is the numbers 3, 4, 5 what is the truth value of ∀ x P(x)?
What is the truth value of ∃ x P(x)

[Link]@[Link] (SCIT) Computer Science 57 / 126


Predicate Logic Quantifiers

Let P(x) be a propositional function with a universe U


1 If ∀ x P(x) is true, then ∃ x P(x) must be true.
2 If ∃ x P(x) is false, then ∀ x P(x) must be false.
That is ∀ x P(x) → ∃ x P(x) and ¬(∃ x P(x)) → ¬(∀ x P(x))

[Link]@[Link] (SCIT) Computer Science 58 / 126


Predicate Logic Quantifiers

Precedence of Quantifiers

Quantifiers have a higher precedence that all other logical connectives


∃ x P(x) ∨ Q(x) ≡ ( ∃ x P(x) ) ∨ Q(x)
∃ x P(x) ∧ Q(x) ≡ ( ∃ x P(x) ) ∧ Q(x)
∀ x P(x) → Q(x) ≡ ( ∀ x P(x) ) → Q(x)
P(x) → ∃ x Q(x) ≡ P(x) → ( ∃ x Q(x) )

[Link]@[Link] (SCIT) Computer Science 59 / 126


Predicate Logic Quantifiers

Quantified Compounds

Let P(x) := ”x is a son”


Let Q(x) := ”x is a parent”
Let U be all people
∀ x P(x) → Q(x) translates to ”if every person has a son, then x is a
parent” i.e we have not bound the variable in the predicate Q(x)
∀ x (P(x) → Q(x)) translates to ”For all people, if a person has a son
then that person is a prent”

[Link]@[Link] (SCIT) Computer Science 60 / 126


Predicate Logic Quantifiers

Negating Quantifiers

This must be done carefully to avoid losing the meaning of a sentence

Example 2.5: Negating English

1 ”Every student in this class knows Python”


a ”It is not the case that every student in this class knows
Python” or
b ”Not every student in this class knows Python” or
c ”At least one student in this class does not know Python”
2 ”Someone thinks football is the best sport”
1 ”It is not the case that someone thinks football is the best
sport” or
2 ”No one this football is the best sport” or
3 ”Everyone thinks football is not the best sport”

[Link]@[Link] (SCIT) Computer Science 61 / 126


Predicate Logic Quantifiers

As above, quantifiers can be negated in two ways


Negate the quantifier itself
negate the Inner predicate
This is similar to Demorgan’s law for propositional logic. Negating a universal or existential
quantifier ”flips” it become the other one

Example 2.6: Illustration

¬(∀ x P(x)) ≡ ∃ x ¬P(x)


¬(∃ x P(x)) ≡ ∀ x ¬P(x)

Example 2.7

Let P :=”Knows Python” with U being all students in this class

¬(∀ x P(x)) ≡ ∃ x ¬P(x)

There exists a student in this class who does not know Python
Let S := ”Thinks football is the best sport” with U being all people

¬(∃ x S(x)) ≡ ∀ x ¬S(x)

Every one does not this football is the best sport

[Link]@[Link] (SCIT) Computer Science 62 / 126


Predicate Logic Quantifiers

Truth and Fallacy of Quantifiers


Quantified Equivalent When True? When False?
Expression Expression
∀ x P(x) When P(x) is true for every When P(x) is false for at
possible x least one possible x
∃ x P(x) When P(x) is true for at When P(x) is false for every
least one possible x possible x
¬∀ x P(x) ∃ x ¬P(x) When P(x) is false for at When P(x) is true for every
least one possible x possible x
¬∃ x P(x) ∀ x ¬P(x) When P(x) is false for every When P(x) is true for at
possible x least one possible x

Try to internalize the subtle differences in each case. They are important
throughout the course and in the future.

[Link]@[Link] (SCIT) Computer Science 63 / 126


Predicate Logic Quantifiers

Exercises

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern the truth value from the resulting
expressions?
1 ”Some student in this class has visited Mecca”
2 ”Every Student in this class has visited Us or Mecca”
3 ”An Animal that can fly is an animal with wings”

[Link]@[Link] (SCIT) Computer Science 64 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

Let M: = ”Has visited Mecca”;

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

Let M: = ”Has visited Mecca”;Let S: = ”Has visited US”;

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

Let M: = ”Has visited Mecca”;Let S: = ”Has visited US”; Let W: = ”Has


wings”;

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

Let M: = ”Has visited Mecca”;Let S: = ”Has visited US”; Let W: = ”Has


wings”; Let Y: = ”Can fly”;

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

Translate the following sentences to predicate logic, using quantifiers as


appropriate. Can you discern a truth value from the resulting expression?

Let M: = ”Has visited Mecca”;Let S: = ”Has visited US”; Let W: = ”Has


wings”; Let Y: = ”Can fly”;
1 ”Some student in this class has visited Mecca”

If U is students in this class, then: ∃ x M(x)


If U is all people, let T: =”is a student in this class”. Then we have
∃ x T (x) → M(x)
I personally do not know the truth value of this. However, if you are
reading this and you have been to Mecca, then your existence in this
class provides an “existence proof” that the statement is true.

[Link]@[Link] (SCIT) Computer Science 65 / 126


Predicate Logic Quantifiers

Exercise - Solution

2 ”Every Student in this class has visited Us or Mecca”


If U is student in this class: ∀ x (M(x) ∨ S(x))
If U is all people: ∀ x [ T (x) → (M(x) ∨ S(x)) ]
The truth value of this statement is true. You are all attending school
in US, and have been to campus in London, Ontario. The statement is
true without even knowing the truth value of M(x)

[Link]@[Link] (SCIT) Computer Science 66 / 126


Predicate Logic Quantifiers

Exercise - Solution

3 ”An Animal that can fly is an animal with wings”


Let U be all animals ∀ x (W (x) → Y (x))
Notice that this English statement does not explicitly use “every” or
“for all”. However, it is still a statement which is stating a universality.
It is stating that any animal that can fly must have wings. Therefore
we use the universal quantifier.
The truth value of this statement is true. All animals which fly are
animals which have wings. Notice that the converse is not true
(penguins have wings but cannot fly). Can you prove me wrong? Do
you know of an animal that can fly but doesn’t have wings? If you can
identify such an animal, that would be a “proof by counterexample”.

[Link]@[Link] (SCIT) Computer Science 67 / 126


Predicate Logic Nested Quantifiers

Nested Quantifiers

Nesting quantifiers are necessary for natural language with several clauses
and variables. It has natural extension to math and computer science

Example 2.8: Nested Quantifier

”Every real number has a multiplicative inverse”


Let U be the set of real numbers

∀ x ∃ y (x × y = 1)

Nested Quantifiers can be thought of as Propositional functions.

From the above example, let P(x, y ) := (x × y = 1) and


Q(x) := ∃ y P(x, y ) can be interpreted that x and y are multiplicative
inverses, meanwhile Q(x) mean x has a multiplicative inverse.

[Link]@[Link] (SCIT) Computer Science 68 / 126


Predicate Logic Nested Quantifiers

Nested Quantifiers

Then, ”every real number has a multiplicative inverse” can be written as:

∀ x Q(x) ≡ ∀ x (∃ y P(x, y ))
≡ ∀ x (∃ y (x × y = 1))
≡ ∀ x ∃ y (x × y = 1)

The best way to think about nested quantifiers is that variables are
bound or ”fixed” left to right. In ∃x ∀y P(x, y ), x is bound first,
regardless of what happens to y . Then y is bound
Another way to think about nested quantifiers is nested loops.

[Link]@[Link] (SCIT) Computer Science 69 / 126


Predicate Logic Nested Quantifiers

Consider the following loop and subsequent expressions


f o r i in range (n) :
f o r j i n r a n g e (m) :
P( i , j )
Expression When is it true?
∀i ∀j P(i, j) Only true if all iterations of both loops are true.
∀i ∃j P(i, j) True when, for every iteration of the outer loop, at
least one iteration of the inner loop is true.
∃i ∀j P(i, j) Is true when, for at least one iteration of the outer
loop, every iteration of the inner loop is true.
∃i ∃j P(i, j) Is true if at least one iteration of the inner loop is
true, for any iteration of the outer loop.

[Link]@[Link] (SCIT) Computer Science 70 / 126


Predicate Logic Nested Quantifiers

Quantifiers to English

Example 2.9

Let C (x) := x has a computer,


Predicate Logic Nested Quantifiers

Quantifiers to English

Example 2.10

Let C (x) := x has a computer,F (x, y ) := x and y are Friends, where


U is all students at Western
1 ∀x (C (x) ∨ ∃y (C (y ) ∧ F (x, y )))

In English, this means ”Every student at Western has a


computer or Has a friend with a computer”
2 ∃x ∀y ∀z ( (F (x, y ) ∧ F (x, z) ∧ (y ̸= z)) → ¬F (y , z) )

“There exists a student with two different friends who are not
friends with each other.

[Link]@[Link] (SCIT) Computer Science 71 / 126


Predicate Logic Nested Quantifiers

A large part of being able to understand, and translate, mathematical


statements comes with practice. But, there is a general methodology we
can use to convert mathematical statements to logic.
1 Write the stamement to be more verbose. Replace phrases like ”q
whenever p” with ”if p then q” to bring the statement closer to direct
translation.
2 Explicitly introduce variables. Replace phrases like ”a number greater
than two” with ”a number x such that x > 2”
3 Finally, translate the sentence to a logical expression using quantifiers,
predicates, and logical connectives.

[Link]@[Link] (SCIT) Computer Science 72 / 126


Predicate Logic Nested Quantifiers

Example 2.11

Write ”the sum of two positive integers is always positive” as a logical


expression.
1 Make the sentence be more verbose: ”for any two integers, if
they are both positive, then their sum is positive”
2 Use variables: ”for any two integers x and y , if x and y are
both positive, then their sum is positive”
3 Translate to a logical expression

∀x ∀y ( (x > 0) ∧ (y > 0) → (x + y > 0) ),

where U is all integers

[Link]@[Link] (SCIT) Computer Science 73 / 126


Predicate Logic Nested Quantifiers

Revisiting System Specifications

Predicate Logic is exceptionally useful for system specifications. This application


requires special care with nested quantifiers and precedence between quantifiers and
logical connectives.

Example 2.12: System Specification with Predicates

Consider a mail-server with limited bandwidth. The designer specifies three re-
quirements
1 “Every message larger than 1 megabyte must be compressed.”
2 “Messages larger than 10 megabytes cannot be sent.”
The domain is left implicit since it is obvious Let L(m, y ) := ”message m is larger
than x megabytes”
Predicate Logic Nested Quantifiers

Revisiting System Specifications

Predicate Logic is exceptionally useful for system specifications. This application


requires special care with nested quantifiers and precedence between quantifiers and
logical connectives.

Example 2.13: System Specification with Predicates

Consider a mail-server with limited bandwidth. The designer specifies three re-
quirements
1 “Every message larger than 1 megabyte must be compressed.”
2 “Messages larger than 10 megabytes cannot be sent.”
The domain is left implicit since it is obvious Let L(m, y ) := ”message m is larger
than x megabytes” Let C (m) := ”message m is compressed”
Predicate Logic Nested Quantifiers

Revisiting System Specifications

Predicate Logic is exceptionally useful for system specifications. This application


requires special care with nested quantifiers and precedence between quantifiers and
logical connectives.

Example 2.14: System Specification with Predicates

Consider a mail-server with limited bandwidth. The designer specifies three re-
quirements
1 “Every message larger than 1 megabyte must be compressed.”
2 “Messages larger than 10 megabytes cannot be sent.”
The domain is left implicit since it is obvious Let L(m, y ) := ”message m is larger
than x megabytes” Let C (m) := ”message m is compressed” Let S(u, m) :=
”user u can send message m”
1 ∀ m (L(m, 1) → C (m))
2 ∀ m (L(m, 10) → ∀u¬S(u, m)) ≡ ∀ m (L(m, 10) → ¬∃uS(u, m))

[Link]@[Link] (SCIT) Computer Science 74 / 126


Predicate Logic Possible Pitfalls

Possible Pitfalls

Predicates, quantifiers, and logical connectives have a strict order of


precedence that can drastically change their interpretation. When in
doubt, use parentheses!

We know from Negating Quantifiers that negation “flips” a universal


quantifier or existential quantifier to become the other. But what happens
when we have nested quantifiers? Simply use parentheses and proceed one
at a time.

¬∀x ∃y ∀z P(x, y , z) ≡ ¬ (∀x (∃y (∀z P(x, y , z))))


≡ (∃x ¬ (∃y (∀z P(x, y , z))))
≡ (∃x (∀y ¬ (∀z P(x, y , z))))
≡ (∃x (∀y (∃z ¬P(x, y , z))))

[Link]@[Link] (SCIT) Computer Science 75 / 126


Predicate Logic Possible Pitfalls

Quantifiers and Connectives


Quantifiers have a higher precedence than logical connectives.
Parenthesis are used to apply a quantifier to a compound expression.

Is it possible to “distribute” a quantifier into a compound expression as we


did with negation? The answer is sometimes. The following is valid
∀x (P(x) ∧ Q(x)) ≡ ∀x P(x) ∧ ∀x Q(x)

∃x (P(x) ∨ Q(x)) ≡ ∃x P(x) ∨ ∃x Q(x)


Example 2.15

To see why the above is: let the domain of x be a, b, c

∀x (P(x) ∧ Q(x)) ≡ (P(a) ∧ Q(a)) ∧ (P(b) ∧ Q(b)) ∧ (P(c) ∧ Q(c))


≡ P(a) ∧ P(b) ∧ P(c) ∧ Q(a) ∧ Q(b) ∧ Q(c)
≡ ∀x P(x) ∧ ∀x Q(x)
[Link]@[Link] (SCIT) Computer Science 76 / 126
Predicate Logic Possible Pitfalls

Quantifiers and Connectives

Example 2.16

To see why the above is: let the domain of x be a, b, c

∃x (P(x) ∨ Q(x)) ≡ P(a) ∨ P(b) ∨ P(c) ∨ Q(a) ∨ Q(b) ∨ Q(c)


≡ P(a) ∨ P(b) ∨ P(c) ∨ Q(a) ∨ Q(b) ∨ Q(c)
≡ ∃x P(x) ∨ ∃x Q(x)

However, in more cases, quantifiers do not distribute. Here are some counterexamples.

Example 2.17

∃x (P(x) ∧ Q(x)) ̸≡ ∃x P(x) ∧ ∃x Q(x)

∀x (P(x) ∨ Q(x)) ̸≡ ∀x P(x) ∨ ∀x Q(x)

∃x (P(x) → Q(x)) ̸≡ ∃x P(x) → ∃x Q(x)

∀x (P(x) → Q(x)) ̸≡ ∀x P(x) → ∀x Q(x)

[Link]@[Link] (SCIT) Computer Science 77 / 126


Predicate Logic Possible Pitfalls

Quantifiers and Connectives

The major reason why existential quantifiers do not distribute is because


the two quantifiers bind the avariables in different ways.

∃x P(x) ∧ ∃x Q(x) means ”There exists some x such that P(x) AND
there exists some x such that Q(x)”

The x in the first clause is not the same x in the second clause. x was
quantified twice in different contexts.

The above statement is very different from ∃x(P(x) ∧ Q(x)) which means
”There exists some x such that P(x) and Q(x) are true”.
In this case, the same object is being applied simultaneously to P and Q

[Link]@[Link] (SCIT) Computer Science 78 / 126


Predicate Logic Exercises

Predicates and Variables

1 Use the appropriate quantifiers ”for all” and ”there exists” to write
the following sentences
a “Not all continuous functions are differentiable.”
b There is no largest real number.”
c “Every positive integer is the product of some collection of primes.”
2 Use the appropriate quantifiers ”for all” and ”there exists” to write
the following sentences. ou don’t have to translate to predicate logic,
just re-write in English being more verbose and including the phrases
“for all” and “there exists” as appropriate.
a A polynomial with integer coefficients may have integer roots.
b A polygon may not be both convex and concave.
c Trigonometric functions are periodic.

[Link]@[Link] (SCIT) Computer Science 79 / 126


Predicate Logic Exercises

Quantifiers

Let F (x) := x is fish

Let H(x) := x is whale

Let W (x) := x inhabits the water

Let S(x) := x has scales

If the domain of x is all animals, what is the truth value of the following?
i ∀x (F (x) → W (x))
ii ∃x (S(x) → ¬W (x))
iii ∃x (F (x) ∧ ¬S(x) ∧ W (x))
iv ∀x S(x) → ∀x W (x)

[Link]@[Link] (SCIT) Computer Science 80 / 126


Predicate Logic Exercises

Let B(x) :=” x is a bird”


Let E (x) :=” x lays eggs”
Let M(x) :=” x is a mammal”
Let P(x) :=” x is a plant”
Let W (x) :=” x inhabits the water”
If the domain of x is all plant and animals, translate each of these
quatified statements to a natural language statement. What is the truth
value of each of them
1 ∀x (B(x) → E (x))
2 ∀x (E (x) → B(x))
3 ∃x (W (x) ∧ P(x))
4 ∃x (W (x) ∧ E (x))
5 ∀x (P(x) ∨ M(x) ∨ B(x))
6 ∀x (W (x) → ¬M(x))
[Link]@[Link] (SCIT) Computer Science 81 / 126
Predicate Logic Exercises

Quantifier Solutions

1 True. All birds lay eggs.


2 False. Not all eye-layers are birds. Reptiles, for example.
3 True. There are water plants. For example, seaweed.
4 True Egg-laying water dwellers? Puffins, Penguins, for example.
5 False. There are organisms which are neither plants, mammals or
birds. Reptiles, amphibians, etc.
6 False. There are water-inhabiting organisms which are mammals.
Whales!

[Link]@[Link] (SCIT) Computer Science 82 / 126


Predicate Logic Exercises

Quantifiers - Exercises Cont’d

Let U be the set of imaginary creatures consisting drackles, klabs and


grebbits
D(x) := x is a drackle
K (x) := x is a klab
G (x) := x is a grebbit
Translate the following into predicate logic statements
1 Everything is a drackle.
2 Nothing is a klab.
3 All drackles are klabs.
4 Some drackles are grebbits.
5 No klab is a grebbit.

[Link]@[Link] (SCIT) Computer Science 83 / 126


Predicate Logic Exercises

Quantifier Solutions

1 ∀ x D(x)
2 ¬∃ x K (x) ≡ ∀ x ¬K (x)
3 ∀ x (D(x) → K (x))
4 ∃ x (D(x) ∧ G (x))
5 ¬∃ x (K (x) ∧ G (x)) ≡ ∀ x (¬K (x) ∨ ¬G (x))

[Link]@[Link] (SCIT) Computer Science 84 / 126


Predicate Logic Exercises

Application Exercises
Consider the following requirements:
a “If a user is active, then they are connected to the server”
b “Only users connected to the server can receive messages”
c “A user that requests encryption must receive encrypted messages”
Let the domain of u be all users of the system and the domain of e be
”encrypted” or ”unencrypted”.
Let
Predicate Description
A(u) := u is an active user C (u) := u is an connected to the
server
R(u, e) := u can receive messages E (u) := u has requested encryp-
of type e tion
Translate these requirements to quantified predicates. Is that set of
propositions consistent? If so, give a satisfying truth assignment. If not,
what can you add to one of these requirements (using the already supplied
predicates) to make the requirements consistent?
[Link]@[Link] (SCIT) Computer Science 85 / 126
Predicate Logic Exercises

Application Solution

a ∀ u ( A(u) → C (u) )
b ∀ u ∃ e ( C (u) ↔ R(u, e) )
c ∀ u (E (u) → R(u, encrypted) ∧ ¬R(u, unencrypted)))
These are not consistent. If A(u), C (u) are false and E (u) is true, then the
third requirement implies that u can receive messages, contradicting (b)
Modify the third requirement:

∃ u (E (u) ∧ C (u) → R(u, encrypted) ∧ ¬R(u, unencrypted))

[Link]@[Link] (SCIT) Computer Science 86 / 126


Predicate Logic Exercises

Quantifier Exercises
Let T (x, y ) be the predicate ”x is taking y ” where the domain of x is all
students and the domain of y is all courses
Translate the following English statements into quantified predicate
statements
1 “Every course is being taken by at least one student”
2 “Some student is taking every course”
3 “No student is taking all courses”
4 “There is a course that all students are taking”
5 “Every student is taking at least one course”
6 “There is a course that no students are taking”
7 “Some students are taking no courses”
8 “No course is being taken by all students”
9 “Some courses are being taken by no students”
10 “No student is taking any course”
[Link]@[Link] (SCIT) Computer Science 87 / 126
Predicate Logic Exercises

Quantifier Solutions

1 ∀C ∃S T (S, C )
2 ∃S ∀C T (S, C )
3 ∀S ∃C ¬T (S, C )
4 ∃C ∀S T (S, C )
5 ∀S ∃C T (S, C )
6 ∃C ∀S ¬T (S, C )
7 ∃S ∀C ¬T (S, C )
8 ∀C ∃S ¬T (S, C )
9 ∃C ∀S ¬T (S, C )
10 ∀S ∀C ¬T (S, C )

[Link]@[Link] (SCIT) Computer Science 88 / 126


Proofs

Having solid understanding of propositional and predicate logic, the


section seeks to put them into practice. We will examine a methods of
proofs and strategies to formally prove something.

Recall equivalence proofs as one kind of proof. ”Proof by truth table” is a


valid option for proving equivalence.

This section examines prove of general statements that cannot be easily be


proved by a truth table.

[Link]@[Link] (SCIT) Computer Science 89 / 126


Proofs Theorems

Definition 3.1: Proof

A proof is a precise, formal, and valid argument which establishes the


truth of a statement

Just like how Satisfiability and Consistency have a direct applications to


computer science, so too do mathematical proofs

Example 3.1: Uses of Proof

1 Computer and Software System Verification


2 Cybersecurity and Cryptography
3 Artificial Intelligence; and
4 Guaranteeing algorithm Correctness

[Link]@[Link] (SCIT) Computer Science 90 / 126


Proofs Theorems

Provable Things

Theorem 3.1

A theorem is a formal statement that be shown to be true. It establishes a truth


from which other theorems can be proved, or algorithm constructed

Lemma 3.1

A lemma is a formal statement that can be shown to be true, and is used to


proof another theorem. It is a helper ”theorem”

Proposition 3.1

A proposition is a formal statement that can be shown to be true, but the


importance of this fact is less than that of a theorem

[Link]@[Link] (SCIT) Computer Science 91 / 126


Proofs Theorems

Provable Things
Corollary 3.1

A corollary is a special case of a theorem, lemma, or proposition. It


follows directly from a theorem and is not typically proved explicitly.
Corollaries are stated to show an “important result” or “important
implication” of of a theorem.

Conjecture 3.1: Conjecture

A Conjecture is a formal statement that is likely to be true, but


has not yet been proved to be true. Once proven to be true, it may
become a formal theorem or lemma.

Whether its a theorem, a lemma or a proposition, the way they are stated
and the way they are proved remains the same. For consistencys’ sake, a
theorem will be used.
[Link]@[Link] (SCIT) Computer Science 92 / 126
Proofs Theorems

Theorem Statements

Theorems are typically stated as inferences or byconditionals. ”If P then


Q” or ”P if and only if Q. The structure of using ”let x be · · · ” is an
implicit universal quantifier.

For all x which satisfy this property, the inference (theorem) holds.

With a little practice, we can extract the implication from such statements.

[Link]@[Link] (SCIT) Computer Science 93 / 126


Proofs Theorems

Theorem Statements
Example 3.2: Implicit Implications

Consider the following theorem statements

Theorem 3.2

Let x, y be positive real numbers such that x > y . Then, x 2 > y 2

This also means

Theorem 3.3

If x > y , where x and y are positive numbers, then x 2 > y 2

Which also mean

Theorem 3.4

”For all positive real numbers x and y , if x > y then x 2 > y 2 ”

[Link]@[Link] (SCIT) Computer Science 94 / 126


Proofs Theorems

In the example 3.2, the closest to being a direct translation is the last
statement.
Let P(x, y ) := x > y
Let Q(x, y ) := x 2 > y 2
If we let the domain of x and y be all positive real numbers, then the
previous example states
∀x∀y (P(x, y ) → Q(x, y ))

[Link]@[Link] (SCIT) Computer Science 95 / 126


Proofs Theorems

Trivial Proof

Proposition 3.2

If it is raining then 1 = 1

Proof.
This implication is trivivally true since 1 = 1 is known to be true. The
truth value of the premise does not matter

Proof for implications p → q relies on p being false. Recall ”Falsity


implies” anything. If we know p to be false, then the implication p → q is
always true. A vacuous proof is thus a simple statement that shows p to
be obviously false

[Link]@[Link] (SCIT) Computer Science 96 / 126


Proofs Direct Proofs

Direct Proofs

One of the most straight forward types of proofs.


If we wish to prove the statement p → q, we assume p is true and use
laws and axioms and logical equivalence to show that q must also be
true
Also direct proof can be defined as follows: if we prove a statement
A → B, we assume A is true and the prove a sequence of implications:
A → A1 → A2 → · · · → B for some statements A1 , A2 , . . .

Definition 3.2: Even and Odd Integers

An integer m is even if it satisfies the formula m = 2k for some


integer k. An integer n is odd if it satisfies the formula n = 2k + 1
for some integer k

[Link]@[Link] (SCIT) Computer Science 97 / 126


Proofs Direct Proofs

Definition 3.3: Rational Number


p
A number n is rational if there exists integer p and q such that n = q
and q ̸= 0

Using definitions 3.2 and 3.3 we used direct proof to prove the following proposition

Proposition 3.3

If n is an odd integer, then n2 is odd

Proof.
Let P(n) := ”n is odd”, Let Q(n) :=”n2 is odd”. Let the domain of n be all integers.
We look to proof ∀n (P(n) → Q(n))
Assume P(n) is true. ∴ there exists some integer k such that n = 2k + 1.
Then, n2 = (2k + 1)2 = (4k 2 + 4k + 1) = 2(2k 2 + 2k) + 1.
Letting k ′ = 2k 2 + 2k, we have that k ′ is an integer and n2 = 2k ′ + 1.
∴ n2 is odd

[Link]@[Link] (SCIT) Computer Science 98 / 126


Proofs Direct Proofs

Example 3.3

Proposition 3.4

The sum of two rational numbers is rational

Proof.
Let P(x) :=”x is a rational number, where the domain of x is all real numbers.
Proove that is needed: ∀x ∀y (P(x) ∧ P(y ) → P(x + y )
Assume that x and y are rational numbers.
Then, there exists integers a, b, c, d such that x = ba , y = dc , b ̸= 0, and d ̸= 0.
We have,
a c ad+bc
x +y = b
+ d
= bd
= gf ,
Where f = ad + bc and g = bd ̸= 0 are integers.
∴ x + y is rational

[Link]@[Link] (SCIT) Computer Science 99 / 126


Proofs Direct Proofs

Proving Biconditionals

A theorem can also be stated as a biconditional. i.e. p ↔ q


In this case the prove contains two parts. Recall
p ↔ q ≡ (p → q) ∧ (q → p)
Hence, we must prove two implications.
In this kind of proof, proving p → q is called ”proving the sufficient
condition”; and proving q → p is called ”proving the necessary condition”

[Link]@[Link] (SCIT) Computer Science 100 / 126


Proofs Direct Proofs

Proving Biconditionals

Prove the following statement using a direct proof

Example 3.4: Biconditional Prove - direct

Proposition 3.5

”A non-vero number q is rational if and only if there exists a


non-zero integer n such that qn” is an integer.”

[Link]@[Link] (SCIT) Computer Science 101 / 126


Proofs Direct Proofs

Solution to the proposition 3.5


Proof.
In this case the proof is biconditional, an ”if and only if”
1 ”If q is a non-zero rational number then there exists a non-zero
integer n such that qn is an integer”, and
2 ”If qn is an integer for some number q and some non-zero integer n,
then q is rational”
Proof of 1:
Assume q is rational. ∴, q = ba for some integers a, b with b ̸= 0. Take
n = b. Then nq = n ba = a. Since a is an integer, so is qn
Proof of 2:
Assume n is a non-zero integer and qn is an integer.
This means, there exists an integer r such that qn = r
Since n is non-zero, we can divide both sides by n resulting to q = nr .
As both r and n are integers, q is a rational number
[Link]@[Link] (SCIT) Computer Science 102 / 126
Proofs Indirect Proofs

For this kind proofs, we prove a statement like A → B without following a


sequence of implications A → A1 → · · · → B. Instead we proceed in an
unexpected way.
There are two main types of indirect proofs
1 Proof by Contrapositive
2 Proof by Contradiction

[Link]@[Link] (SCIT) Computer Science 103 / 126


Proofs Indirect Proofs

Proof by Contrapositive

Prooving a statement p → q requires that that we prove its contrapositive.


Thus the statement ¬q → ¬p which is its contrapositive equivalent.
Recall an implication and its contrapositive are equivalent, that is
p → q ≡ ¬q → ¬p.
Proving the Contrapositive can be done using any other proof method.
Typicall this is done by direct method.
However, this is not always true

[Link]@[Link] (SCIT) Computer Science 104 / 126


Proofs Indirect Proofs

Proof by Contrapositive
Example 3.5: Proof by Contrapositive

Proposition 3.6

If n is an integer such that 3n + 2 is odd, then n is odd

Proof.
Proceed the proof by contrapositive.
Assume n is not odd.
Then we prove that 3n + 2 is not odd.
Since n is not odd, then it is even, therefore n = 2k for some integer k
Substituting:
3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1)
Let k ′ = 3k + 1, then 3n + 2 = 2k ′
Hence, it is even.

[Link]@[Link] (SCIT) Computer Science 105 / 126


Proofs Indirect Proofs

Proof by Contradiction

For this method of proof, we look to assume some fact and then find a
contradiction.
Recall that a contradiction is a statement that is always false
Suppose we want to prove the statement p.
By contradiction, we assume ¬p is true, and derive a contradiction.
That is, we show that ¬p → A1 → A2 → · · · → F for some statement
A1 , A2 , . . .
By contrapositive, if ¬p → F holds then T → p holds.
∴ p must be true.

[Link]@[Link] (SCIT) Computer Science 106 / 126


Proofs Indirect Proofs

Example 3.6: Proof by Contradiction

Theorem 3.5

There is no largest integer

Proof.
Proceed the prove by contradiction
Assume that there does exist some largest integer called n.
But n + 1 is also an integer and n + 1 is strictly larger than n.
∴ our assumption that a largest integer exist is false.
That is, there is no largest integer is true.

[Link]@[Link] (SCIT) Computer Science 107 / 126


Proofs Strategies to Help with Proofs

Strategies to Help with Proofs

This section guides in helping writing and deciphering proofs. These


strategies can be incorporated into various different proof methods
1 Finding errors in proofs
2 Proof by cases
3 Without loss of generality
4 Disproof by counterexample

[Link]@[Link] (SCIT) Computer Science 108 / 126


Proofs Strategies to Help with Proofs

Finding errors in proofs


Recall, a proof is a logical and sequential argument.
A Proof only holds if every step along the way is correct.
A single ”misstep” makes the proof invalid and thus not proving anything.

Find errors in the following proposition

Proposition 3.7

1=2

Proof.
1. a=b Premise
2. a2 = ab Multiple both sides by a
3. a2 − b 2 = ab − b 2 Subract b 2 from both sides
4. (a − b)(a + b) = b(a − b) Factor both sides
5. a+b =b Divide both sides by a − b
6. 2b = b Since a = b, a + b = 2b
7. 2=1 Divide both sides by b

[Link]@[Link] (SCIT) Computer Science 109 / 126


Proofs Strategies to Help with Proofs

Proof by Cases

Whare a theorem premise is composed of a compound statement, it is


recommended that you prove all the possible cases. e.g. Let n be an
integer. In this case, n could be negative, zero or positive.
There are two steps in a proof by cases:
1 Extract from the theorem statement the possible cases; and
2 Prove each case indpendeptly
The validity of proof by cases come from the following logical equivalence
(p1 ∨ p2 ∨ · · · ∨ pn ) → q ≡ (p1 → q) ∧ (p2 → q) ∧ · · · ∧ (pn → q)
Each of the ”or” conditions in the premise is a separate case that must be
proven.

[Link]@[Link] (SCIT) Computer Science 110 / 126


Proofs Strategies to Help with Proofs

Proof by Cases

Example 3.7: Proof by Cases

Proposition 3.8

Let x and y be real numbers. If x ̸= 0 or y ̸= 0 then x 2 + y 2 ̸= 0

Proof by Cases.

First, Consider x ̸= 0. Then, x 2 ̸= 0 and x 2 > 0. We also know y 2 ≥ 0 without


any further assumptions. ∴ x 2 + y 2 is strictly greater than 0
Second, consider y ̸= 0. Again, y 2 ̸= 0 and y 2 > 0. ∴ since x 2 ≥ 0, x 2 + y 2 is
strictly greater that 0

Notice in the proof for proposition 3.8 each of the case is identical

[Link]@[Link] (SCIT) Computer Science 111 / 126


Proofs Strategies to Help with Proofs

Without loss of generality - W.L.O.G.

This a way for provers to be lazy. When two cases are sufficiently similar,
one only needs to give a proof to one of the cases.
What constitutes ”sufficiently similar”?
Typically, it will be an arbitrary choice made througout the proof for which
the other choice would be equally as valid.
Such an arbitrary choice should be symmetric.

[Link]@[Link] (SCIT) Computer Science 112 / 126


Proofs Strategies to Help with Proofs

W.L.O.G.
Example 3.8: W.L.O.G.

Proposition 3.9

For two integers x and y if xy and x + y are both even, then both x and y are
even

Proof.
Prove by contrapositive: Suppose it is not the case that x and y are even. We look to
prove xy and x + y are both not even. We prove this by cases
WLOG, assume x is odd. Thus x = 2k + 1 for some integer k
Case 1: y is even and y = 2ℓ for some ℓ
x + y = (2k + 1) + 2ℓ = 2(k + ℓ) + 1
∴ x + y is odd
Case 2: y is odd and y = 2ℓ + 1 for some integer ℓ
xy = (2k + 1)(2ℓ + 1) = 4kℓ + 2k + 2ℓ + 1 = 2(2kℓ + k + ℓ) + 1
∴ xy is odd
In either case at least one of x + y or xy is odd. This proves the contrapositive and
thus the proposition

[Link]@[Link] (SCIT) Computer Science 113 / 126


Proofs Strategies to Help with Proofs

W.L.O.G.

In 3.8 we used w.l.o.g. to state that we made an arbitrary choice. We


chose that x is odd.

We could have equally made the choice that y is odd and then proved the
two cases.

Since either choice would follow the same proof, they are ”sufficiently
similar” hence need to only prove one of the choices.

[Link]@[Link] (SCIT) Computer Science 114 / 126


Proofs Strategies to Help with Proofs

Disproof by Counterexample

We have observed that many theorems are stated in the form ∀x P(x).

Therefore, rather that proove such a statement, the statement can be


disproved. In other words, one can prove that ∀x P(x) is false.

From Predicate logic, we know that if ∀x P(x) is false, then ¬∀x P(x)

Moreover

¬∀x P(x) ≡ ∃x ¬P(x)

A proof by example is a proof ∃x Q(x) by finding a particular example for


which Q(x) is true.

Letting Q(x) be ¬P(x) we can thus disprove our original statement


∀x P(x)

[Link]@[Link] (SCIT) Computer Science 115 / 126


Proofs Strategies to Help with Proofs

Disproof by Counterexample
Example 3.9: Disproof by Counterexample

Conjecture 3.2

For a real numberx if x < 1, then x 2 < 1

Proof.
Let P(x) := x < 1. Let Q(x) := x 2 < 1

We look to disprove ∀x (P(x) → Q(x))

That is, we should prove ∃x ¬(P(x) → Q(x))

This implication is false if P(x) is true and Q(x) is false.

x = −2 is such a counterexample. P(−2) is true since −2 < 1

However, Q(−2) is false since (−2)2 = 4 ̸< 1

∴ the conjecture is false

[Link]@[Link] (SCIT) Computer Science 116 / 126


Proofs More Types of Proofs

Other than the above proves: Direct Proof and Indirect Proofs, we now
explore other proof concepts:
1 Existence of Proof
2 Uniqueness Proofs

[Link]@[Link] (SCIT) Computer Science 117 / 126


Proofs More Types of Proofs

Existence of Proof

This look to prove theorems of the form ∃x P(x). This is very similar to
using counterexamples to disprove a statement.

There are two kinds of existence proofs for ∃x P(x):


1 A Constructive Proof finds a witness a such that P(a) is true.
Proving that the statement with the existential quantifier is true.
Constructive proofs may provide the witness itself or provide a
method for ”constructing” a witness.
2 A Nonconstructive Proof proves that a witness must exist (usually in
some indirect way) without providing a particular witness.

[Link]@[Link] (SCIT) Computer Science 118 / 126


Proofs More Types of Proofs

Constructive Proof

Example 3.10: Constructive Proof

Theorem 3.6

There is a positive integer that is equal to two different sums


of cubes of positive integers

Proof.
1729 = 103 + 93 = 123 + 13

The Challenge with existence theorems is that of finding a witness.


Moreover, it is often equally as difficult to disprove an existence
theorem.

[Link]@[Link] (SCIT) Computer Science 119 / 126


Proofs More Types of Proofs

Open Problems
Problems that have not yet been proven to be true, but also not yet
proved to be false, are open problems.
Open problems often have a conjecture associated with them. It is
often the case that research continues in certain directions with the
assumption that a conjecture is true.
If a conjecture is later found to be false, then all of that work which
assumed the opposite is immediately invalidated. Such open problems
are therefore very “high stakes”.
The biggest, and arguably most consequential, open problem is
?
P = N P. This question says, can any problem which is easily verified
be easily solved?
Once we have a witness, it is very easy to verify if that witness
satisfies the theorem. But, is it always easy to find a witness? That is
the open question of whether or not P = N P
Most of computer science has been developed under the assumption
that P = ̸ N P. For example, everything related to cryptography and
cybersecurity relies on P ≠ NP
[Link]@[Link] (SCIT) Computer Science 120 / 126
Proofs More Types of Proofs

Nonconstructive Proof
Example 3.11: Nonconstructive Proof

Theorem 3.7

There exists irrational numbers x and y such that x y is rational.

Proof.
√ √
We know 2 is irrational. Let x = y = 2
√ √2
We have two cases: 2 is rational or irrational. In this case, the theorem is
obviously true and we are done.
√ √2 √
Consider the second case. Let x = 2 . Let y = 2. By assumption x is
irrational and we know y is irrational and we know:
√ √2.√2 √ √2√2 √ 2
xy = 2 = 2 = 2 =2
Surely 2 is rational, and we have proved the statement in both cases.

[Link]@[Link] (SCIT) Computer Science 121 / 126


Proofs More Types of Proofs

Uniqueness proofs

These are a form of existence proofs where we want to prove a statement


of the form “there exists a unique x such that P(x)”

This kind of theorem statement can be written using special notation:


∃!x P(x). ∃! means that there exists exactly one element from the domain
of discourse that satisfies the predicate.

Proving uniqueness can be very tricky. Indeed, proving ∃!x P(x) is the
same as proving a more complicated statement:

∃x (P(x) ∧ ∀y (y ̸= x → ¬P(y )))

or equivalently

∃x (P(x) ∧ ∀y (P(y ) → y = x))

[Link]@[Link] (SCIT) Computer Science 122 / 126


Proofs More Types of Proofs

Uniqueness proofs

In this case, there are two parts of a uniqueness proof.


1 Existence we must show that an x exists such that P(x) is true
2 Uniqueness we must show if y ̸= x then P(y ) is false or we must
show that if P(y ) is true then y = x (they are contrapositives).

[Link]@[Link] (SCIT) Computer Science 123 / 126


Proofs More Types of Proofs

Example 3.12: Uniqueness proofs

Theorem 3.8

If a and b are real numbers such that a ̸= 0, then there is a unique real
number r such that ar + b = 0

Proof.
−b
Existence: Since a ̸= 0 we have ar + b = 0 =⇒ r = a

Uniqueness: Proceed by contradiction.


Suppose s is a real number such that s ̸= r and as + b = 0 Since this and the
previous equation both equal 0 we have:

ar + b = as + b
ar = as
r =s

Since we chose s arbitrarily and arrived at the fact the r = s we know that r is
unique.
[Link]@[Link] (SCIT) Computer Science 124 / 126
Proofs Exercises

Sixth Slide

[Link]@[Link] (SCIT) Computer Science 125 / 126


Proofs Exercises

Sixth Slide

[Link]@[Link] (SCIT) Computer Science 126 / 126


Proofs Exercises

Sixth Slide

[Link]@[Link] (SCIT) Computer Science 127 / 126

You might also like