Docsity

Propositional Logic and Truth Tables, Exams of Nursing

Partial preview of the text

Download Propositional Logic and Truth Tables and more Exams Nursing in PDF only on Docsity!

Typesetting math: 100%

MATH 120 Discrete Math - Chapter 2 Logic

Chapter 2 • Logic

Section 2.1 • Propositions and operators

Logic is the study of formal reasoning. A statement in a spoken language, such as in English, is often ambiguous in its meaning. By contrast, a statement in logic always has a well•defined meaning. Logic is important in mathematics for proving theorems. Logic is also used in computer science in areas such as artificial intelligence for automated reasoning and in designing digital circuits. Logic is useful in any field in which it is important to make precise statements. In law, logic can be used to define the implications of a particular law. In medicine, logic can be used to specify precisely the conditions under which a particular diagnosis would apply.

The most basic element in logic is a proposition. A proposition is a statement that is either true or false. The following statements are propositions:

There are an infinite number of prime numbers. (True.) The Declaration of Independence was signed on July 4, 1812. (False.)

Propositions are typically declarative sentences. For example, the following are not propositions:

What time is it? A question, not a proposition. A question is neither true nor false. Have a nice day. A command, not a proposition. A command is neither true nor false.

A proposition's truth value is a value indicating whether the proposition is actually true or false. A proposition is still a proposition whether its truth value is known to be true, known to be false, unknown, or a matter of opinion. The following are all propositions:

Two plus two is four. Truth value is true. Two plus two is five. Truth value is false. Monday will be cloudy. Truth value is unknown. The movie was funny. Truth value is a matter of opinion. The extinction of the dinosaurs was caused by a meteor. Truth value may be a matter of opinion.

Activity 2.1.1: Which statements are propositions?

# Question Your answer

10 is a prime number. Proposition

Not a proposition

Shut the door. Proposition

Not a proposition

All politicians are dishonest. Proposition

Not a proposition

Would you like some cake? Proposition

Not a proposition

Interest rates will rise this year. Proposition

Not a proposition

Propositional variables such as p, q and r can be used to denote arbitrary propositions, as in "p: January has 31 days".

Compound propositions are generated using logical operations. A logical operation combines propositions

using a particular composition rule. For example, the conjunction operator is denoted by ∧. The proposition p ∧ q is read "p and q" and is called the conjunction of p and q. p ∧ q is true if both p is true and q is true. p ∧ q is false if p is false, q is false or both are false.

Consider two specific propositions:

p: January has 31 days. q: February has 33 days.

Then p ∧ q is the proposition:

Activity 2.1.2: Truth table for the conjunction operator.

Activity 2.1.3: Truth table for the disjunction operator.

Proposition p's truth value is true •• January has 31 days. Proposition q's truth value is false •• February

does not have 33 days. The compound proposition p ∧ q is therefore false, because it is not the case that both propositions are true.

If a compound proposition is made up of the propositions p and q, the compound proposition's truth value will depend on the truth value for p and the truth value for q. This dependency can be expressed in a truth table. A truth table lists all possible truth value combinations for the individual propositions, one combination per row, along with the compound proposition's truth value. Below is the truth table for p ∧ q, where truth values in the table are represented using T for true and F for false.

The disjunction operator is denoted ∨. The proposition p ∨ q is read "p or q," and is true if either one of p or q is true, or if both are true. The proposition p ∨ q is false if neither p nor q is true. Using the same p and q from the example above, p ∨ q is the statement:

p ∨ q: January has 31 days or February has 33 days.

The proposition p ∨ q is true because January does have 31 days. The truth table for the ∨ operator is given below.

The exclusive or operation is usually denoted with the symbol ⊕. The proposition p ⊕ q is true if exactly one of the propositions p and q is true but not both. This question asks you to fill in the truth table for p ⊕ q.

Activity 2.1.4: Truth table for the exclusive or.

Note that the use of the "or" operator in logic may differ from what is commonly understood in everyday English. Often when the word "or" is used in English, the intended meaning is that one or the other of two things is true, but not both. One would normally understand the sentence "Lucy is going to the park or the movie" to mean that Lucy is either going to the park, or is going to the movie, but not both. Such an either/or meaning corresponds to the exclusive or operator in logic. In contrast, the ∨ operator in logic corresponds to an inclusive or , which is true when one or both of the propositions are true. For example, "Lucy opens the windows or doors when warm" means she opens windows, doors, or possibly both. Since the inclusive or is most common in logic, it is just called "or" for short.

p q (^) p ⊕ q

T T 1? T F 2? F T 3?

F F 4?

# Question Your answer

What is the truth value for the square labeled 1? True

False

What is the truth value for the square labeled 2? True

False

What is the truth value for the square labeled 3? True

False

What is the truth value for the square labeled 4? True

False

Activity 2.1.5: Truth table for the negation operator.

MATH 1 Act 2 ivit 0 y^ 2. D 1.6: is Ap c ply r in e g^ t lo e gical M op a era t tio h ns.^ - Chapter 2 Logic

Assume propositions p, q, and r have the following truth values:

p is true q is true r is false

What are the truth values for the following compound propositions?

# Question Your answer

p ∧ q 1

True

False

¬r

2

p ∧ r 3

p ∨ r 4

p ∨ q 5

True

False

True

False

True

False

True

False

Activity 2.2.1: Evaluating compound propositions.

False

( p ∨ r ) ∧ ¬p^ True

4

False

¬(p ∧ ¬r)^ True

3

False

¬r ∧ ( p ∨ ¬q )^ True

2

False

p ∨ ¬q^ True 1

# Question Your answer

MATH 1 Act 2 ivit 0 y^ 2. D 2.2: is Ev c alu r at e ing te com M plex a c t om h pou - nd C pro h po a siti p ons t.^ er 2 Logic

Assume the propositions p, q, r have the following truth values:

p is true q is true r is false

What are the truth values for the following compound propositions?

Complex expressions can be created with logical operators to conduct refined web searches. Suppose one is interested in studying jaguars (the animal from the cat family). Try searching (e.g., at google.com) for the term "jaguar" •• the results may include numerous hits related to the car "Jaguar". To avoid results involving cars, try a second search using the query "jaguar AND •car" •• the "•" symbol indicates negation. Notice that results are then mostly about the animal.

Example 2.2.1: Searching the web •• continued.

Table 2.2.1: Truth table with three variables.

Activity 2.2.3: Number of entries in a truth table.

p q r (^) ( p ∨ r ) ∧ ¬q

T T T F T T F F

T F T T T F F T F T T F

F T F F F F T T F F F F

Note that the T and F values for each row are unique, and that they are chosen methodically to create all possible combinations (e.g., the rightmost row alternates T F T F..., the next row T T F F ..... , etc.).

# Question Your answer

How many rows are in a truth table for a compound proposition with propositional variables p, q, and r?

How many rows are in a truth table for the proposition ( p ∧ q ) ∨ (¬r ∧ ¬q ) ∨ ¬( p ∧ t)?

When filling out a truth table for a complicated compound proposition, completing intermediate columns for smaller parts of the full compound proposition can be helpful:

Activity 2.2.4: Truth table with intermediate columns.

Example 2.2.2: Logic in electronic devices.

Most of the devices and appliances used in everyday life are controlled by electronic circuitry that works according to the laws of logic. A designer of an electronically•controlled device must first express the desired behavior in logic, and then test that the device behaves as desired under every set of circumstances.

Consider the following example:

An electronic fan automatically turns on and off depending on the humidity in a room. Since the humidity detector is not very accurate, the fan will stay on for 20 minutes once triggered in order to ensure that the room is cleared of moisture. There is also a manual off switch that can be used to override the automatic functioning of the control.

Define the following propositions:

M: The fan has been on for twenty minutes. H: The humidity level in the room is low. O: The manual "off" button has been pushed.

The fan will turn off if the following proposition evaluates to true:

(M ∧ H) ∨ O

A truth table can be useful in testing the device to make sure it works as intended under every set of circumstances. The following table might be used by a technician testing the electronic fan.

M H O Should be off? (T: yes) Your observation T T T T

T T F T T F T T T F F F

F T T T F T F F F F T T

F F F F

Section 2.3 • Conditional statements

Consider two propositions, p and q. The statement p → q is a conditional statement , which is itself a

proposition. p → q reads as "if p then q". The proposition is false if p is true and q is false; otherwise, the proposition is true. A conditional statement is also sometimes called an implication. In the conditional statement p → q, the proposition p is called the hypothesis and q is called the conclusion. The truth table

Each question has a proposition p that is an implication. Truth values are also given for the propositions contained in that implication. Indicate whether the implication p is true or false.

Activity 2.3.1: Understanding implications.

Table 2.3.2: English expressions of logical implication.

# Question Your answer

p: If it rains today, I will have my umbrella. It is raining today. I do not have my umbrella.

True

False

p: If Sally takes too long getting ready, she will miss the bus. Sally did not take too long getting ready. Sally missed the bus.

True

False

p: If it is sunny out, I ride my bike. It is not sunny out. I am not riding my bike.

True

False

There are many ways to express the conditional statement p → q in English:

If p, then q. If you mow Mr. Smith's lawn, then he will pay you. If p, q. If you mow Mr. Smith's lawn, he will pay you. q if p Mr. Smith will pay you if you mow his lawn.

p implies q. Mowing Mr. Smith's lawn implies that he will pay you. p only if q. You will mow Mr. Smith's lawn only if he pays you. p is sufficient for q. Mowing Mr. Smith's lawn is sufficient for him to pay you.

q is necessary for p. Mr. Smith's paying you is necessary for you to mow his lawn.

There is sometimes some confusion about the fact that the statement "p only if q" is the same as the implication p → q. Both statements imply that the only way for p to be true is if q is also true.

This question uses the following propositions: p: I will share my cookie with you. q: You will share your soda with me.

Select the conditional statement that has the same logical meaning as the English sentence given.

Activity 2.3.2: Implications from English sentences.

Converse : q → p Contrapositive : ¬q → ¬p Inverse : ¬p → ¬q

Figure 2.3.2: Conditional statements related to p → q:.

# Question Your answer

If you share your soda with me, then I will share my cookie with you.

q → p

p → q

My sharing my cookie with you is sufficient for you to share your soda with me.

q → p

p → q

I will share my cookie with you only if you share your soda with me.

q → p

p → q

There are three conditional statements related to the proposition p → q that occur so often in logic that they are given special names:

It will be shown later that the contrapositive is the only one of these three that has the same logical meaning as p → q. Consider the implication:

If it is raining today, the game will be cancelled.