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

LOGIC PROGRAMMING

The document discusses propositional logic, including various logical operators and their outputs based on truth values. It explains the significance of well-defined formulas in logic and outlines rules of inference such as Modus Ponens, Hypothetical Syllogism, and Disjunctive Syllogism with corresponding truth tables. Additionally, it provides examples and explanations for each logical operation and inference rule.

Uploaded by

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

LOGIC PROGRAMMING

The document discusses propositional logic, including various logical operators and their outputs based on truth values. It explains the significance of well-defined formulas in logic and outlines rules of inference such as Modus Ponens, Hypothetical Syllogism, and Disjunctive Syllogism with corresponding truth tables. Additionally, it provides examples and explanations for each logical operation and inference rule.

Uploaded by

arnoldwood196
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

NAME: DAISY MWANDIHI

REG NO: DCS/2022/36138


UNIT NAME: LOGIC PROGRAMMING

1. Below are propositional statements in propositional logic


r = Mary got married last year.
s = Mary got pregnant.

p Q P⨁q (p ↓ q) (p ⨁ q) ∨ (p ↓ q) p↑q
T T F T T F
T F T T T F
F T T F T F
F F F F F T
Required:
a) Find the output of the above propositional operators [5 Marks]
b) Explain each output above with propositions [5 Marks]
Exclusive OR (XOR): p ⊕ q - Output: F (False)
Proposition: Mary got married last year (True) OR Mary got pregnant (False).
Here, XOR is only true if exactly one statement is true. Since both p and q have opposite truth
values, it doesn't fit the XOR criteria, making the output false.
Imagine a light switch: XOR is like the switch. If only one light (statement) is on (true), the total
(XOR) is like turning one light on. But both lights being on/off (both true/false) makes XOR like
turning both off.
Material conditional (IF...THEN): p → q - Output: T (True)
Proposition: If Mary got married last year (True), then Mary got pregnant (False).
This might seem counterintuitive, but the implication is true because the rule doesn't claim anything
about what happens when the first part (p) is false. It only focuses on the specific scenario where p
is true.
Material disjunction (OR): (p ∨ q) - Output: T (True)
Proposition: Mary got married last year (True) OR Mary got pregnant (False). (True - at least one
statement is true)
This is like saying "either p or q or maybe both." Since p is already true, the entire statement
becomes true regardless of q.
(Exclusive OR) ∨ (Material conditional): (p ⊕ q) ∨ (p → q) - Output: T (True)
We already know p ⊕ q is false and p → q is true. Now, we see if either outcome makes the entire
expression true using OR:
Proposition: (Mary got married last year OR Mary got pregnant) OR (If Mary got married last year,
then Mary got pregnant).
Since even one part is true (p → q), the entire statement is true.
Sheffer stroke (NAND): p ↑ q - Output: F (False)
Proposition: It is not true that both Mary got married last year (True) AND Mary got pregnant
(False). (True - contradicts the condition where both statements need to be false for NAND to be
true)
This less common operator (NAND) acts like a gate that only allows the output if both inputs are
false. Since p is true, the output is false.
2. Using a truth table Prove that X ⨁ Y ≅ (X ∧∼Y)∨(∼X∧Y). [4 Marks]

X Y X⨁Y X ∧ ∼Y ∼X ∧ Y (X ∧ ∼Y) ∨
(∼X ∧ Y)
T T F F F F
T F T F T T
F T T T F T
F F F T T T

3. Well defined formulas are building blocks of Logic, explain [4 Marks]


Logic is a formal system for reasoning about statements and propositions. It provides a structured
way to analyze the relationships between them and arrive at valid conclusions.
This system relies on a set of clearly defined rules and symbols.
The Role of Well-Defined Formulas:
Well-defined formulas act as the atoms of this system. They are like the bricks that make up the
logical structure.
These formulas are created using: Variables: Represent unknown values or statements.
Connectives: Symbols that represent logical operations like AND, OR, NOT, etc. Constants: Symbols
that represent fixed values like True or False.
By combining these elements according to specific rules, we construct well-defined formulas that
express clear and unambiguous propositions.
4. Rules of Inference are Mathematical logic often used for logical proofs which are valid arguments
that determine the truth values of mathematical statements. For each state the rule, the formula
and use a truth table to illustrate the following types of Inference rules:
A. Modus Ponens: [4 Marks]

Formula:P ⟹ Q (P implies Q)
If P implies Q, and P is true, then Q is true.

P (P is true)
Truth Table:
P Q P⟹Q P ∧ (P ⟹ Q) Conclusion

from P ⟹ Q and
T T T T Q is true (follows

P being true)

T F F F Not applicable
(the rule only

⟹ Q is true)
applies when P

F T T T Not applicable
(the rule only
applies when P is
true)

F F T T Not applicable
(the rule only

⟹ Q and P are
applies when P

true

B. Hypothetical Syllogism: [4 Marks]


If P implies Q, and Q implies R, then P implies R.

Formula:

P ⟹ Q (P implies Q)
Q ⟹ R (Q implies R)
Truth Table:

P⟹Q Q⟹R (P ⟹ Q) ∧ P⟹R


(Q ⟹ R)
P Q R

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

C. Disjunctive Syllogism: [4 Marks]

If P or Q is true, and P is false, then Q is true.

Formula:
P ∨ Q (P or Q is true)
¬P (P is false)
Truth Table:

P Q P∨Q ¬P Conclusion
T T T F Not applicable

applies when P ∨
(the rule only

Q is true and P is
false)
T F T F Q is true
F T T T Q is true
F F F T Not applicable

applies when P ∨
(the rule only

Q is true)

You might also like