Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views9 pages

Lec 4

The document discusses Well-Formed Formulas (WFF) in logic, defining their structure, types, and rules for validity. It explains functionally complete sets of connectives, emphasizing the use of AND, OR, and NOT to express logical formulas without conditionals or biconditionals. Additionally, it covers Normal Forms, Principal Forms, and methods for converting logical expressions into Disjunctive Normal Form (DNF) and Conjunctive Normal Form (CNF), providing examples and key takeaways.

Uploaded by

pochinkisu075
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)
18 views9 pages

Lec 4

The document discusses Well-Formed Formulas (WFF) in logic, defining their structure, types, and rules for validity. It explains functionally complete sets of connectives, emphasizing the use of AND, OR, and NOT to express logical formulas without conditionals or biconditionals. Additionally, it covers Normal Forms, Principal Forms, and methods for converting logical expressions into Disjunctive Normal Form (DNF) and Conjunctive Normal Form (CNF), providing examples and key takeaways.

Uploaded by

pochinkisu075
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/ 9

DISCRETE STRUCTURES AND THEORY OF LOGIC (BCS 303)

Lecture -4
Well-Formed Formulas (WFF)
A Well-Formed Formula (WFF) is a logical expression that follows specific rules. These expressions use variables
(like capital letters) and connective symbols (like AND, OR, NOT, etc.). WFFs are important because they help
structure logical statements correctly.
Connective Symbols:
• ¬ (Negation): "NOT"
• ∧ (Conjunction): "AND"
• ∨ (Disjunction): "OR"
• ⇒ (Rightwards Arrow): "IMPLIES"
• ⇔ (Left-Right Arrow): "IF AND ONLY IF"
Types of Statements:
1. Atomic Statements: Simple statements with no connective symbols. These are the most basic building
blocks and are automatically WFFs.

• Example: P, Q, R (each one is a WFF by itself).


2. Molecular/Composite Statements: These are made by combining simple statements using connective
symbols.

• Example: If P and Q are two simple statements, valid combinations (WFFs) could be:
▪ ¬P (NOT P)
▪ (P ∨ Q) (P OR Q)
▪ (P ∧ Q) (P AND Q)
▪ (P ⇒ Q) (P IMPLIES Q)
▪ (P ⇔ Q) (P IF AND ONLY IF Q)
Rules for WFF:
• Any statement variable by itself is a WFF. For example, P, ¬P, Q, etc.
• If P is a WFF, then ¬P (NOT P) is also a WFF.
• If P and Q are WFFs, you can combine them with symbols like ∨, ∧, ⇒, ⇔ to form a new WFF.
Examples of Well-Formed Formulas:
1. ¬¬P: Since P is a WFF, ¬P is also a WFF. Taking NOT again (¬¬P) is still valid.
2. (P ⇒ Q) ⇒ Q: The statement (P ⇒ Q) is valid, and combining it with Q using ⇒ is a valid WFF.
3. (¬Q ∧ P): ¬Q and P are both WFFs, so connecting them with ∧ (AND) is valid.
4. (¬P ∨ Q) ∧ ¬¬Q: Both (¬P ∨ Q) and ¬¬Q are valid WFFs, and combining them with ∧ makes another valid
WFF.
5. ¬((¬P ∨ Q) ∧ ¬¬Q): Taking the negation of a valid WFF using ¬ is still a valid WFF.

Invalid Examples (Not WFFs):


1. (P): Although P alone is a WFF, wrapping it in unnecessary parentheses makes it invalid.
2. ¬P ∧ Q: This expression is ambiguous without parentheses. It could mean (¬P ∧ Q) or ¬(P ∧ Q).
Parentheses are needed to remove the ambiguity.
3. ((P ⇒ Q)): The inner part (P ⇒ Q) is valid, but the extra outer parentheses make it invalid.
4. (P ⇒⇒ Q): You can't have two connective symbols (⇒⇒) in a row; this is not valid.
5. ((P ∧ Q) ∧) Q): The parentheses are misplaced, making it invalid.
6. ((P ∧ Q) ∧ PQ): You can't use variables together like PQ without a connective symbol.
7. (P ∨ Q) ⇒ (∧ Q): Inside the parentheses (∧ Q), you need two variables to form a valid operation, but only
one (Q) is present.
In simple terms, WFFs are like properly structured sentences in a language. They follow specific rules, and any
violation of these rules leads to an invalid or incorrect formula.

What is a Functionally Complete Set of Connectives?


A functionally complete set of connectives is a set of logical operators (like ∧, ∨, ¬, etc.) that can be used to
express any logical formula. If a set contains connectives that allow you to express any formula, it’s called a
functionally complete set. The minimal such set cannot have a connective that can be expressed in terms of
others in the same set.
However, the goal here is to eliminate certain connectives (like ⇒ and ⇔) and express formulas using only three
basic connectives: ∧, ∨, and ¬.
Step 1: Eliminate the Conditional (⇒)
The conditional p ⇒ q (if p, then q) can be replaced by an equivalent expression that doesn't use the conditional
operator:
• p ⇒ q ≡ ¬p ∨ q
This is a key equivalence you can use whenever you see p ⇒ q.
Step 2: Express the Biconditional (⇔)
There are two ways to express the biconditional p ⇔ q:
1. p ⇔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)
▪ This says that p ⇔ q is true if both p and q are true, or both are false.
2. p ⇔ q ≡ (p ⇒ q) ∧ (q ⇒ p)
▪ This expresses the biconditional as two implications: p implies q and q implies p.
Step 3: Using the Equivalences
Using the elimination of ⇒, we can rewrite the biconditional as:
• p ⇔ q ≡ (¬p ∨ q) ∧ (¬q ∨ p)
This means we can eliminate both the biconditional ⇔ and conditional ⇒ using only ∧, ∨, and ¬.
Step 4: De Morgan's Law
De Morgan’s law helps simplify logical expressions. It states:
• p ∧ q ≡ ¬(¬p ∨ ¬q)
• p ∨ q ≡ ¬(¬p ∧ ¬q)
These allow you to replace conjunctions (AND) and disjunctions (OR) with negations and vice versa.
Example: Simplifying a Complex Expression
(p ⇒ q ∧ r) ∨ (r ⇔ s)
The goal is to express this without using biconditional (⇔) or conditional (⇒) connectives.
Step-by-step simplification:
1. Replace the biconditional r ⇔ s using the equivalent formula:
➢ r ⇔ s ≡ (¬r ∨ s) ∧ (¬s ∨ r)
2. Replace the conditional p ⇒ q ∧ r using the equivalent formula:
➢ p ⇒ q ∧ r ≡ ¬p ∨ (q ∧ r)
Thus, the expression becomes:
• (¬p ∨ (q ∧ r)) ∨ ((¬r ∨ s) ∧ (¬s ∨ r))
This expression is now written using only ∧, ∨, and ¬ and does not contain the biconditional or the conditional
anymore.
Conclusion:
By using these logical equivalences, you can replace more complex connectives like ⇒ and ⇔ with simpler ones
(AND, OR, NOT) and thus express any formula using a minimal functionally complete set of connectives: ∧, ∨,
and ¬.

Normal and Principal Forms


In logic, Normal Forms and Principal Forms are standardized ways to write logical expressions so that they follow
specific patterns. This makes it easier to work with, simplify, and analyze these logical formulas, especially in
things like computer programming, circuit design, and automated problem solving.
What Are Normal Forms?
Normal Forms are specific ways of organizing logical expressions. They break down formulas into combinations
of basic components (called literals), connected by logical operators like AND, OR, and NOT. These forms make
logical statements easier to manage.
Key Concepts:
1. Literal: A basic variable (like A, B, or C) or its negation (like ¬A). Example: A, ¬B
2. Clause: A combination of literals connected by OR (∨). Example: A ∨ ¬B
3. Normal Form: A logical formula that follows a specific structure, like CNF (Conjunctive Normal Form) or
DNF (Disjunctive Normal Form).
4. Elementary product: A group of literals connected by AND (e.g., p^ ¬q ^ r).
5. Elementary sum: A group of literals connected by OR (e.g., p v ¬q).
Types of Normal Forms:
1. Disjunctive Normal Form (DNF):
o Structure: A formula written as a disjunction (OR) of multiple conjunctions (AND) of literals.
o Example:
▪ (P ∧ ¬Q) ∨ (Q ∧ R) ∨ (¬P ∧ Q ∧ ¬R)
o In DNF, the formula is a sum (OR) of products (ANDs). Each part is a combination of variables
connected by AND, and all these parts are joined by OR.
2. Conjunctive Normal Form (CNF):
o Structure: A formula written as a conjunction (AND) of disjunctions (OR) of literals.
o Example:
▪ (¬P ∨ Q) ∧ (Q ∨ R) ∧ (¬P ∨ Q ∨ ¬R)
o In CNF, the formula is a product (AND) of sums (ORs). Each part is a combination of variables
connected by OR, and all these parts are joined by AND.

Principal Forms:
Principal Forms are special kinds of normal forms where the formulas are broken down to their most basic
components, known as minterms (for DNF) and maxterms (for CNF). These forms provide unique ways to
represent logical expressions.
1. Principal Disjunctive Normal Form (PDNF):
o This is a DNF where each conjunction contains every variable in the expression, either as itself or
its negation.
o Example:
▪ (P ∧ ¬Q ∧ R) ∨ (¬P ∧ Q ∧ ¬R)
o This form ensures that each conjunction (AND) has all the variables, which makes it a more
detailed version of DNF.
2. Principal Conjunctive Normal Form (PCNF):
o This is a CNF where each disjunction contains every variable, either as itself or its negation.
o Example:
▪ (¬P ∨ Q ∨ R) ∧ (P ∨ ¬Q ∨ ¬R)
o Similar to PDNF, each disjunction (OR) in PCNF includes all the variables.
Procedure to Convert to DNF:
There are three main steps to transform a logical expression into DNF:
1. Remove → and ↔ by expressing them using AND, OR, and NOT.
2. Eliminate NOTs by applying De Morgan’s laws and removing double negations.
3. Distribute OR over AND using distributive laws to get a sum of elementary products.

Example:
(a) Convert p ∧ ( p → q ) to DNF:
1. Step 1: Remove the implication (→):
➢ P → q is the same as ¬p ∨ q
So, p ∧ ( p → q ) becomes p ∧ ( ¬ p ∨ q )
2. Step 2: Apply the distributive law:
➢ Distribute p over ¬p ∨ q:
(p∧¬p)∨(p∧q)
Here, p∧¬p is false, so this simplifies to:
p∧q
This is the required DNF form: p ∧ q

(b) Convert p v (¬p → ( q v (q → ¬r ))) to DNF:


(c) Convert p → ((p → q ) ^ ¬ (¬q v ¬p)) to DNF:

NOTE: DNF is not unique: There may be multiple ways to write the same expression in DNF form, but they will
all be logically equivalent.

Conjunctive Normal Form (CNF)


• CNF is a standard way of expressing a logical formula where the formula is made up of ANDs of several
ORs.
• In CNF, you have clauses (which are ORs of literals), and the whole expression is an AND of those clauses.

Example: Obtain the Conjunctive Normal Form of the following:


(a) p ^ (p → q)
(b) [ q v ( p ^ r )] ^ ~ [ (p v r ) ^ q ]
Principal Disjunctive Normal Form (PDNF)
• PDNF is a special form of Disjunctive Normal Form (DNF). It's also called the sum of products canonical
form.
• It’s an expression made of ORs of minterms. A minterm is an AND of all variables (either in positive or
negated form).
Truth Table Explanation
The image shows a truth table for two variables, p and q, and their combinations with various expressions:

p q p∧q p∧¬q ¬p∧q ¬p∧¬q

T T T F F F

T F F T F F

F T F F T F

F F F F F T

• Each row of the truth table corresponds to a minterm.


• The truth table lists all the possible combinations of truth values for p and q, and shows the resulting
truth values for different minterms.

How to Convert to PDNF


There are two methods for obtaining PDNF:
1. By Using a Truth Table:
▪ Construct the truth table for the given logical expression.
▪ Identify the rows where the result is true (T).
▪ For each row where the result is true, create a minterm by writing ANDs of the variables (write
the variable if it’s true in that row, or its negation if it’s false).
▪ Combine all these minterms using OR to get the PDNF.
2. Without Using a Truth Table:
▪ First, obtain a DNF for the expression.
▪ Eliminate any terms that are contradictions (like p∧¬p).
▪ For each missing variable in a product, use distributive laws to add the variable (as either the
variable or its negation).
▪ Repeat until all elementary products become minterms.

Key Takeaways:
• CNF is made up of ANDs of ORs.
• PDNF is made up of ORs of minterms (where each minterm is an AND of all variables or their negations).
• The truth table helps in identifying which minterms to include in the PDNF.
• The PDNF of a formula is unique. This means there is only one way to write it in PDNF form, unlike regular
DNF which might have different forms.

Example: Finding the Principal Disjunctive Normal Form


(a) p ⟹ q
➢ The truth table for p ⟹ q (which means "if p then q") is shown in the image:

p q p⟹q

T T T

T F F

F T T

F F T

➢ The column for p ⟹ q has true (T) in the 1st, 3rd, and 4th rows.
➢ The corresponding minterms (rows where the result is true) are:
▪ Row 1: p ∧ q
▪ Row 3: ¬p ∧ q
▪ Row 4: ¬p ∧ ¬q
➢ So, the PDNF of p ⟹ q is: ( p ∧ q ) ∨ ( ¬ p ∧ q ) ∨ ( ¬ p∧ ¬ q )

But if we asked to determine the DNF then, the given expression can be simplified

( p ∧ q ) ∨ ( ¬ p ∧ q ) ∨ ( ¬ p∧ ¬ q )
q ^ ( p ^ ~p ) v ( ~p ^ ~q )
q ^ T v ( ~p ^ ~q )
q v ( ~p ^ ~q ) ------------------- DNF
Simplified expression

(b) q ∨ ( ¬p ∧ ( p ⟹ q ))
➢ The truth table for this expression is also given:

p q ¬p p⟹q ¬p ∧ (p ⟹ q) q v ( ¬p ∧ ( p ⟹ q))

T T F T F T

T F F F F F

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

➢ The column for q ∨ ( ¬p ∧ (p ⟹ q)) shows that the result is true for all rows except the 2nd.
➢ The corresponding minterms are:
▪ Row 1: p ∧ q
▪ Row 3: ¬p ∧ q
▪ Row 4: ¬p ∧ ¬q
➢ So, the PDNF of this expression is: ( p ∧ q ) ∨ ( ¬p ∧ q ) ∨ ( ¬p ∧ ¬q )
Note: The result shows that this expression is equivalent to p ⟹ q because they both have the same PDNF.

(c) q v (p v ~q)
(d) ( p ^ ~q ^ ~r) v (q ^ r)

Principal Conjunctive Normal Form (PCNF)


• PCNF is the dual of PDNF. Instead of using minterms, PCNF uses maxterms. A maxterm is the OR of
variables (either the variable itself or its negation).
• The process for obtaining PCNF is similar to PDNF, except you focus on rows of the truth table where the
result is false (F).
• It is also called the product of sums canonical form because it involves taking a product (AND, ∧) of sums
(OR, ∨).
For example, for two variables p and q:
• Maxterms are: p v q, p v ¬q, ¬p v q, ¬p v ¬q
For three variables p, q, r:
• Maxterms are: p v q v r, p v q v ¬r, ¬p v q v r, and so on.
Each maxterm gives a false result for one unique combination of truth values of the variables.
Steps to Obtain PCNF:
1. By Truth Table:
▪ Construct the truth table.
▪ Identify the rows where the truth value is false (F).
▪ For each of these rows, construct the corresponding maxterm.
▪ The PCNF is the AND of all these maxterms.
2. Without Truth Table:
▪ Obtain the disjunctive normal form (DNF).
▪ Apply negation to the entire DNF formula to get the PCNF. This can also be done using De
Morgan’s laws.
Example: Obtain the PCNF
(a) p ^ q using the truth table:
• Truth table:

p q p^q

T T T

T F F

F T F

F F F

• The result is false (F) for the 2nd, 3rd, and 4th rows. So, we create maxterms for these rows:
▪ 2nd row: ¬p v q
▪ 3rd row: p v ¬q
▪ 4th row: ¬p v ¬q
• The PCNF is the AND of these maxterms: ( ¬p ∨ q ) ∧ ( p ∨ ¬ q ) ∧ ( ¬p ∨ ¬q )

(c) ( ~p → r ) ^ (q ↔ p)

Key Points:
1. PCNF uses maxterms, which are formed from rows where the truth table has false (F) results.
2. The process for constructing PCNF is similar to PDNF, but focuses on false results instead of true.
3. The truth table method is useful for obtaining maxterms directly.
4. Every formula has a unique PCNF, and if a formula is a contradiction, the PCNF includes all possible
maxterms.

Summary of Important Points:


1. PDNF uses ORs of minterms, which are formed from rows where the truth table has true (T) results.
2. PCNF uses ANDs of maxterms, which are formed from rows where the truth table has false (F) results.
3. The truth table helps in identifying the necessary minterms or maxterms for building the PDNF or PCNF.
4. The PDNF of an expression is unique. Two expressions are equivalent if they have the same PDNF.
5. A tautology always has a special form, like p v ¬p, in PDNF.

You might also like