Volume 1
Discrete Mathematics: Mathematical Logic
Study Notes
Concept reference & formula sheet for this chapter
Syllabus: Propositional and first order logic.
Mark Distribution in Previous GATE
Welcome to the "Discrete Mathematics: Mathematical Logic" chapter of your GATE Computer Science exam preparation. This section is designed to provide a comprehensive, exam-focused overview of the fundamental concepts, formulas, and problem-solving techniques you'll need to master. Mathematical Logic is the bedrock of computer science, providing the formal tools to reason about computation, verify program correctness, design circuits, and understand artificial intelligence. For the GATE CS exam, this subject typically carries a weightage of 5-8 marks. Questions often involve determining the validity of arguments, checking logical equivalence, translating natural language statements into logical expressions, and identifying tautologies or contradictions. A strong grasp of these concepts is indispensable not just for direct questions but also for understanding the logical underpinnings of other topics like set theory, relations, and algorithms.
Topic-wise Key Concepts
Propositional Logic
Propositional Logic, also known as propositional calculus, is the study of propositions (declarative sentences that are either true or false, but not both) and their combinations using logical connectives. It forms the most basic level of logical reasoning, focusing on the truth values of simple statements and how they combine to determine the truth values of complex statements.
- Definition and Core Idea: A proposition is a statement that is unequivocally true or false. Propositional logic uses symbols to represent propositions and logical connectives to form compound propositions, allowing us to analyze their truth values systematically.
Important Formulas, Theorems, and Results:
1. Logical Connectives:
-
▪ Negation (NOT): (read as "not p")
-
▪ Conjunction (AND): (read as "p and q")
-
▪ Disjunction (OR): (read as "p or q")
-
▪ Implication (IF...THEN): (read as "if p then q" or "p implies q")
-
▪ Biconditional (IF AND ONLY IF): (read as "p if and only if q")
-
▪ Exclusive OR (XOR): (read as "p xor q")
-
▪ NAND:
-
▪ NOR:
-
- Truth Tables: Essential for defining connectives and evaluating compound propositions.
-
▪ : T if p is F, F if p is T.
-
▪ : T if both p and q are T, else F.
-
▪ : T if p is T or q is T (or both), else F.
-
▪ : F only if p is T and q is F, else T.
-
▪ : T if p and q have the same truth value, else F.
-
▪ : T if p and q have different truth values, else F.
3. Tautology, Contradiction, Contingency:
-
▪ Tautology: A compound proposition that is always true, regardless of the truth values of its atomic propositions. Example: .
-
▪ Contradiction (or Absurdity): A compound proposition that is always false. Example: .
-
▪ Contingency: A compound proposition that is neither a tautology nor a contradiction (i.e., its truth value depends on the truth values of its atomic propositions).
-
- Logical Equivalence (): Two propositions and are logically equivalent if is a tautology. This means they always have the same truth value.
5. Laws of Logic (Logical Equivalences):
▪ Identity Laws:
-
▪
-
▪
▪ Domination Laws:
-
▪
-
▪
▪ Idempotent Laws:
-
▪
-
▪
-
▪ Double Negation Law:
▪ Commutative Laws:
-
▪
-
▪
▪ Associative Laws:
-
▪
-
▪
▪ Distributive Laws:
-
▪
-
▪
▪ De Morgan's Laws:
-
▪
-
▪
▪ Absorption Laws:
-
▪
-
▪
▪ Inverse Laws (Complement Laws):
-
▪
-
▪
▪ Implication Equivalences:
-
▪
-
▪ (Contrapositive)
-
▪
▪ Biconditional Equivalences:
-
▪
-
▪
-
▪
-
▪
6. Conjunctive Normal Form (CNF) and Disjunctive Normal Form (DNF)
-
▪ Literal: A propositional variable or its negation (e.g., , ).
-
▪ Clause: A disjunction of literals (e.g., ).
-
▪ CNF: A conjunction of clauses (e.g., ).
-
▪ Minterm: A conjunction of literals where each variable appears exactly once (e.g., ).
-
▪ Maxterm: A disjunction of literals where each variable appears exactly once (e.g., ).
-
▪ DNF: A disjunction of minterms (e.g., ).
-
▪ Any propositional formula can be converted into an equivalent CNF or DNF.
-
Key Properties and Identities: All the laws of logic listed above are crucial identities for simplification and proving equivalence. Understanding the truth conditions for each connective is fundamental.
Common Pitfalls or Tricky Points:
-
Confusing implication () with causation or "if and only if". Remember is false only when is true and is false.
-
Incorrectly applying De Morgan's Laws, especially with more complex expressions.
-
Misinterpreting the biconditional; it implies mutual implication.
-
Errors in constructing truth tables, particularly for propositions with many variables.
-
Assuming logical equivalence based on partial truth values.
Standard Problem-Solving Techniques or Shortcuts:
-
Truth Tables: The most direct method for small propositions to check tautology, contradiction, or equivalence.
-
Logical Equivalences: Use the laws of logic to simplify expressions or prove equivalence without truth tables. This is often faster for complex expressions.
-
Substitution: Replace sub-expressions with their known equivalents.
-
Proof by Contradiction: To show is a tautology, assume is true and derive a contradiction. To show , assume is true and derive a contradiction.
-
Conversion to CNF/DNF: Useful for standardization and for certain proof methods like resolution.
First Order Logic (Predicate Logic)
First Order Logic (FOL), also known as Predicate Logic, extends propositional logic by allowing us to express more complex statements about objects, their properties, and relationships. It introduces predicates, variables, and quantifiers, enabling reasoning about "all" or "some" elements within a domain.
-
Definition and Core Idea: FOL allows us to break down propositions into predicates (properties or relations) and arguments (variables or constants). It introduces quantifiers ( for "for all" and exists$ for "there exists") to make statements about collections of objects, providing a richer expressive power than propositional logic.
-
Important Formulas, Theorems, and Results:
-
- Components of FOL:
-
▪ Predicates: Represent properties or relations (e.g., for "x is prime", for "x loves y").
-
▪ Variables: Placeholders for objects (e.g., ).
-
▪ Constants: Specific objects (e.g., "Socrates", "5").
-
▪ Functions: Map objects to other objects (e.g., for "father of x").
-
▪ Quantifiers:
-
▪ Universal Quantifier (): "For all", "for every", "for each". means is true for every in the domain.
-
▪ Existential Quantifier (): "There exists", "for some", "for at least one". means there is at least one in the domain for which is true.
-
- Scope of Quantifiers, Free and Bound Variables:
-
▪ The scope of a quantifier is the part of the formula to which it applies.
-
▪ A variable is bound if it is within the scope of a quantifier using that variable.
-
▪ A variable is free if it is not bound by any quantifier.
-
▪ A formula with no free variables is called a sentence or closed formula and has a definite truth value.
-
- Quantifier Equivalences (Negation Rules):
-
▪ (It is not true that all x have property P if and only if there exists an x that does not have property P).
-
▪ (It is not true that there exists an x with property P if and only if all x do not have property P).
-
- Distributive Properties of Quantifiers:
-
▪
-
▪
-
▪ Important Non-Equivalences:
-
▪ is NOT equivalent to . (e.g., "Every number is even or odd" is true, but "Every number is even or every number is odd" is false).
-
▪ is NOT equivalent to . (e.g., "There is a number that is both even and prime" (2) is true, but "There is an even number and there is a prime number" is also true, but the existence of one doesn't imply the other is the same number).
-
- Interchange of Quantifiers:
-
▪
-
▪
-
▪ Order Matters for Mixed Quantifiers:
-
▪ (For every x, there exists a y such that ) is NOT equivalent to (There exists a y such that for every x, ).
-
▪ Example: Let be "x loves y". means "Everyone loves someone". means "There is someone whom everyone loves". These are clearly different.
-
- Prenex Normal Form (PNF): A formula is in PNF if all quantifiers are at the beginning of the formula, followed by a quantifier-free formula (called the matrix). Any FOL formula can be converted to an equivalent PNF.
-
Key Properties and Identities: The quantifier negation rules are fundamental for manipulating and simplifying FOL expressions. Understanding the implications of quantifier order is critical.
-
Common Pitfalls or Tricky Points:
-
Incorrect Translation: Translating natural language statements into FOL is a major source of errors. Pay close attention to words like "all", "some", "no", "only if", "unless".
-
▪ "All A are B": (NOT )
-
▪ "Some A are B": (NOT )
-
▪ "No A are B": or
-
Scope Errors: Misplacing parentheses or incorrectly determining the scope of a quantifier.
-
Variable Binding: Confusing free and bound variables, or using the same variable name for different purposes in nested scopes.
-
Order of Mixed Quantifiers: Assuming is the same as .
Standard Problem-Solving Techniques or Shortcuts:
-
Step-by-step Translation: Break down complex natural language sentences into smaller parts, translate each, and then combine them. Identify predicates, variables, and connectives first.
-
Applying Quantifier Equivalences: Use negation rules to simplify expressions or move negations inwards.
-
Domain Awareness: Always consider the domain of discourse when evaluating truth values or translating.
-
Counterexamples: To show a statement is false or not equivalent, try to find a specific example in a small domain that makes it false.
Logical Reasoning (Inference)
Logical Reasoning, or Inference, is the process of deriving conclusions from a set of premises using valid rules. It focuses on the structure of arguments to determine whether a conclusion necessarily follows from the premises, regardless of the actual truth of the premises.
- Definition and Core Idea: An argument is a sequence of propositions, where the first propositions are premises and the final proposition is the conclusion. An argument is valid if, whenever all its premises are true, the conclusion must also be true. The goal is to determine if an argument's structure guarantees the truth of its conclusion given true premises.
Important Formulas, Theorems, and Results:
-
- Argument Validity: An argument with premises and conclusion is valid if the proposition is a tautology.
-
- Rules of Inference (for Propositional Logic): These are fundamental valid argument forms.
▪ Modus Ponens (Law of Detachment):
Equivalent to being a tautology.
▪ Modus Tollens:
Equivalent to being a tautology.
▪ Hypothetical Syllogism:
Equivalent to being a tautology.
▪ Disjunctive Syllogism:
Equivalent to being a tautology.
▪ Addition:
▪ Simplification:
▪ Conjunction:
▪ Resolution:
This is particularly useful in automated theorem proving and for converting to CNF.
▪ Constructive Dilemma:
▪ Destructive Dilemma:
3. Rules of Inference (for First Order Logic)
- ▪ Universal Instantiation (UI): If is true, then is true for any arbitrary individual in the domain.
- ▪ Universal Generalization (UG): If is true for an arbitrary individual in the domain, then is true.
- ▪ Existential Instantiation (EI): If is true, then is true for some specific individual in the domain. This must be a new constant not previously used in the proof.
- ▪ Existential Generalization (EG): If is true for some specific individual in the domain, then is true.
4. Proof Methods
-
▪ Direct Proof: Assume premises are true, and use inference rules and logical equivalences to derive the conclusion.
-
▪ Indirect Proof (Proof by Contradiction): To prove from premises , assume is true along with , and derive a contradiction ().
-
▪ Proof by Contraposition: To prove , prove its contrapositive .
-
Key Properties and Identities: The validity of each inference rule is a key property. Understanding that these rules preserve truth is fundamental.
Common Pitfalls or Tricky Points:
-
Fallacies: Invalid argument forms that resemble valid ones.
-
▪ Fallacy of Affirming the Consequent: (NOT a tautology). Example: "If it rains, the ground is wet. The ground is wet. Therefore, it rained." (Could be wet from a sprinkler).
-
▪ Fallacy of Denying the Antecedent: (NOT a tautology). Example: "If it rains, the ground is wet. It did not rain. Therefore, the ground is not wet." (Could be wet from a sprinkler).
-
Confusing Validity with Soundness: A valid argument can have false premises and a false conclusion. A sound argument is a valid argument with all true premises (and thus, a true conclusion). GATE questions usually focus on validity.
-
Incorrect Application of Quantifier Rules: Especially with EI and UG, ensure the constant chosen for instantiation is new (for EI) or truly arbitrary (for UG).
-
Circular Reasoning: Assuming the conclusion (or something equivalent to it) as a premise.
Standard Problem-Solving Techniques or Shortcuts:
-
Formal Proofs: List premises and then systematically apply inference rules and logical equivalences to derive the conclusion, citing the rule for each step.
-
Truth Tables (for small arguments): Convert the argument into a single conditional statement and check if it's a tautology.
-
Resolution Principle: Convert all premises and the negation of the conclusion into CNF clauses. Add the negation of the conclusion as a clause. If an empty clause () can be derived through resolution, the original argument is valid.
-
Look for Fallacies: If an argument resembles a common fallacy, it's likely invalid.
Quick Formula Reference
Propositional Logic Equivalences
-
(Double Negation)
-
(Commutative)
-
(Commutative)
-
(Associative)
-
(Associative)
-
(Distributive)
-
(Distributive)
-
(De Morgan's)
-
(De Morgan's)
-
-
(Contrapositive)
-
-
-
-
(Inverse Law)
-
(Inverse Law)
-
(Domination Law)
-
(Domination Law)
-
(Identity Law)
-
(Identity Law)
-
(Idempotent Law)
-
(Idempotent Law)
-
(Absorption Law)
-
(Absorption Law)
Quantifier Equivalences
Rules of Inference (Propositional Logic)
-
Modus Ponens:
-
Modus Tollens:
-
Hypothetical Syllogism:
-
Disjunctive Syllogism:
-
Addition:
-
Simplification:
-
Conjunction:
-
Resolution:
Rules of Inference (First Order Logic)
-
Universal Instantiation (UI):
-
Universal Generalization (UG):
-
Existential Instantiation (EI):
-
Existential Generalization (EG):
Important Tips for GATE
-
- Master Truth Tables: They are the foundation. Be able to quickly construct and interpret truth tables for any compound proposition, especially for 2-3 variables. This helps in verifying tautologies, contradictions, and equivalences.
-
- Memorize Key Equivalences and Inference Rules: Speed and accuracy in GATE questions heavily rely on your ability to recall and apply De Morgan's laws, implication equivalences, and the common rules of inference (Modus Ponens, Modus Tollens, etc.) without hesitation.
-
- Practice Natural Language Translation: A significant portion of GATE questions involves translating English sentences into logical expressions (and vice-versa). Pay close attention to keywords like "all", "some", "no", "only if", "unless", and the correct use of quantifiers and connectives.
-
- Understand Quantifier Scope and Order: Incorrectly interpreting the scope of quantifiers or swapping the order of mixed quantifiers ( vs. ) is a very common mistake. Always visualize the domain and what each quantifier implies.
-
- Distinguish Validity from Soundness: GATE questions usually ask about the validity of an argument (whether the conclusion logically follows from the premises), not its soundness (which also requires premises to be true in the real world). Focus on the logical structure.
-
- Systematic Approach to Proofs: When asked to prove an argument's validity, don't guess. Start with the premises and systematically apply inference rules and logical equivalences, one step at a time, until you reach the conclusion. Clearly state the rule used for each step.
-
- Identify Common Fallacies: Be aware of fallacies like "Affirming the Consequent" and "Denying the Antecedent". If an argument structure matches a known fallacy, you can quickly identify it as invalid.
-
- Time Management: Some logical reasoning problems can be lengthy, especially those involving formal proofs or complex translations. If a question seems too time-consuming, make an educated guess or mark it for review if time permits, and move on to other questions.
