0% found this document useful (0 votes)
127 views4 pages

Translating English Sentences: Discrete Structures CMSC 2123 1.2 Applications of Propositional Logic

This document discusses translating English sentences to logical expressions and applications of propositional logic. It provides examples of translating sentences to logical expressions and using logic gates to represent digital circuits. Logic circuits can be constructed from basic logic gates like AND, OR, and NOT gates and used to model hardware. Propositional logic can represent specifications by defining logical propositions and connecting them with logical operators.

Uploaded by

Tamim Islam
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)
127 views4 pages

Translating English Sentences: Discrete Structures CMSC 2123 1.2 Applications of Propositional Logic

This document discusses translating English sentences to logical expressions and applications of propositional logic. It provides examples of translating sentences to logical expressions and using logic gates to represent digital circuits. Logic circuits can be constructed from basic logic gates like AND, OR, and NOT gates and used to model hardware. Propositional logic can represent specifications by defining logical propositions and connecting them with logical operators.

Uploaded by

Tamim Islam
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
You are on page 1/ 4

Discrete Structures Lecture 2

CMSC 2123 1.2 Applications of Propositional Logic

Translating English Sentences


EXAMPLE 1 How can this English sentence be translated into a logical expression?

“You can access the Internet from campus only if you are a computer
science major or you are not a freshman.”

Solution: Define the following propositions:


Proposition English statement
𝑎𝑎 “You can access the Internet from campus.”
𝑐𝑐 “You are a computer science major.”
𝑓𝑓 “You are a freshman”
“only if” maps to →
𝑎𝑎 → (𝑐𝑐 ∨ ¬𝑓𝑓)

EXAMPLE 2 Translate the following sentence into a logical expression.

“You cannot ride the roller coaster if you are under 4 feet tall unless you
are older than 16 years old.”

Solution: Define the following propositions:


Proposition English statement
𝑞𝑞 “You can ride the roller coaster.”
𝑟𝑟 “You are under 4 feet tall.”
s “You are older than 16 years old.”
(𝑟𝑟 ∧ ¬𝑠𝑠) → ¬𝑞𝑞

System Specification
Translating sentences in natural language (such as English) into logical expressions is an essential
part of specifying both hardware and software systems.

EXAMPLE 3 Express the specification “The automated reply cannot be sent when the file
system is full” using logical connectives.

Solution: Define the following propositions:


Proposition English statement
𝑝𝑝 “The automated reply can be sent.”
¬𝑝𝑝 “It is not the case that the automated reply can be sent.”
¬𝑝𝑝 “The automated reply cannot be sent.”
𝑞𝑞 “The file system in full.”
𝑞𝑞 → ¬𝑝𝑝

1
Discrete Structures Lecture 2
CMSC 2123 1.2 Applications of Propositional Logic

Logic Circuits
Propositional logic can be applied to the design of computer hardware.

A logic circuit (or digital circuit) receives input signals 𝑝𝑝1 , 𝑝𝑝2 , ⋯ , 𝑝𝑝𝑛𝑛 , each a bit [either 0 (off) or 1
(on)], and produces output signals 𝑠𝑠, 𝑠𝑠2 , ⋯ , 𝑠𝑠𝑚𝑚 , each a bit.

p p
p ¬p p ∨q p∧ q
q q
Inverter OR gate AND gate
FIGURE 1 Basic logic gates

Complicated digital circuits can be constructed from three basic circuits, called gates, shown in
Figure 1. The inverter, or NOT gate, takes an input bit 𝑝𝑝, and produces an output ¬𝑝𝑝. The OR
gate takes two input signals 𝑝𝑝 and 𝑞𝑞, each a bit, and produces an as output the signal 𝑝𝑝 ∨ 𝑞𝑞.
Finally, the AND gate takes two input signals 𝑝𝑝 and 𝑞𝑞, each a bit, and produces an as output the
signal 𝑝𝑝 ∧ 𝑞𝑞.

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

r
¬r
FIGURE 2 A combinatorial circuit

EXAMPLE 9 Determine the output for the combinatorial circuit in Figure 2.


Solution: In Figure 2 we display the output of each logic gate in the circuit.
We see that the AND gate takes input of 𝑝𝑝 and ¬𝑞𝑞, the output of the inverter
with input 𝑞𝑞, and produces 𝑝𝑝 ∧ ¬𝑞𝑞. Next, we note that the OR gate takes
input 𝑝𝑝 ∧ ¬𝑞𝑞 and ¬𝑟𝑟, the output of the inverter with input 𝑟𝑟, and produces
the final output (𝑝𝑝 ∧ ¬𝑞𝑞) ∨ ¬𝑟𝑟.

2
Discrete Structures Lecture 2
CMSC 2123 1.2 Applications of Propositional Logic

EXAMPLE 10 Build a digital circuit that produces the output (𝑝𝑝 ∨ ¬𝑟𝑟) ∧ (¬𝑝𝑝 ∨ (𝑞𝑞 ∨ ¬𝑟𝑟))
Solution: Construct as shown in the steps below.
Step 1 (p ∨¬r) (p∨¬ r)∧(¬p ∨(q∨¬ r))

(¬p ∨(q ∨¬r))


Step 2
p
r
¬r (p ∨¬r) (p∨¬r) ∧(¬p∨ (q∨¬r))

(¬p ∨(q∨¬ r))

Step 3
p
r
¬r (p ∨¬r) (p∨¬r) ∧(¬p∨ (q∨¬ r))

¬p (¬p ∨(q ∨¬r))


p
(q∨¬ r)

Step 4
p
r
¬r (p ∨¬r) (p∨¬ r)∧(¬p ∨(q∨¬ r))

¬p (¬p ∨(q ∨¬r))


p

q (q∨¬r)
r
¬r

3
Discrete Structures Lecture 2
CMSC 2123 1.2 Applications of Propositional Logic

Logic and Bit Operations

Truth Value Bit


T 1
F 0

REMARK A bit is the contraction of binary digit, a zero (0) or a one (1).

DEFINITION 7 A bit string is a sequence of zero or more bits. The length of the string is the
number of bits in the string.

EXAMPLE 12 101010011 is a bit string of length nine.

EXAMPLE 13 Find the bitwise OR, bitwise AND, and bitwise XOR, of the bit strings 01
1011 0110 and 11 0001 1101.
Solution:

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
OR 1 1 1 0 1 1 1 1 1 1

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
AND 0 1 0 0 0 1 0 1 0 0

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
XOR 1 0 1 0 1 0 1 0 1 1

You might also like