IAE Academy

GATE CS

Propositional and first-order logic

Propositional logic studies statements built from true/false atoms with connectives, and first-order logic adds predicates and the quantifiers and over a domain. In GATE questions you use it to decide equivalence, validity and satisfiability, to check whether an argument follows, to translate English into formulae, and to negate or compare quantified statements.

7 previous-year questions · 7 solved · 5 practice questions

Propositions, connectives and truth tables

A proposition is a declarative statement that is either true or false. We build compound propositions from atoms using the connectives (not), (and), (inclusive or), (implies), (if and only if) and (exclusive or).

Convention on brackets. Here binds tightest, then , then , then , then , and brackets are written wherever they matter. , , and are associative, but is not: and differ when , and are all false (the first is false, the second true).

Truth tables of the connectives (T = true, F = false)

T

T

F

T

T

T

T

F

T

F

F

F

T

F

F

T

F

T

T

F

T

T

F

T

F

F

T

F

F

T

T

F

The implication is false in exactly one case: true and false. When is false the implication is true whatever is (it is vacuously true).

IMPLICATION AS A DISJUNCTION

Use it to remove before any manipulation; it holds for all truth values.

BICONDITIONAL

True exactly when and have the same truth value; .

COUNTING TRUTH TABLES

For distinct atoms; the second count is the number of different possible output columns.

Classifying a formula

Term

Meaning

Tautology (valid)

True under every assignment

Contradiction (unsatisfiable)

False under every assignment

Contingency

True under some assignment and false under another

Satisfiable

True under at least one assignment (tautologies and contingencies)

A formula is a tautology exactly when is unsatisfiable. To test satisfiability by hand, try to find one assignment that makes the formula true; to test validity, try to find one that makes it false.

Logical equivalences

Two formulae are equivalent () when they have the same truth value under every assignment, i.e. is a tautology.

IDENTITY, DOMINATION AND COMPLEMENT LAWS

Here T and F stand for the constants true and false.

DE MORGAN'S LAWS

Negation swaps and and negates each part.

DISTRIBUTIVE LAWS

Each of and distributes over the other.

ABSORPTION AND DOUBLE NEGATION

Useful for quickly simplifying a formula.

NEGATION OF AN IMPLICATION

An implication fails only when the hypothesis holds and the conclusion fails.

MOVING IMPLICATIONS AROUND

Exportation and the two combining rules; note the hypotheses combine with when the conclusion is shared.

COMBINING IMPLICATIONS WITH OR

Rewrite each side with to check them. With a shared conclusion and between the implications, the hypotheses combine with .

Contrapositive, converse and inverse of $p \to q$

Statement

Form

Equivalent to ?

Original

Itself

Contrapositive

Yes

Converse

No

Inverse

No (it is the contrapositive of the converse, so equivalent to the converse)

EXAM TIP

The converse and the inverse of an implication are equivalent to each other, but not to the original. A statement is always equivalent to its contrapositive.

Normal forms and functional completeness

A literal is an atom or its negation. A clause is a disjunction of literals, and a term is a conjunction of literals. A formula is in CNF (conjunctive normal form) if it is a conjunction of clauses, and in DNF (disjunctive normal form) if it is a disjunction of terms.

Converting a formula to CNF or DNF

  1. Eliminate and using and the biconditional rule.

  2. Push every inwards with De Morgan's laws until negations sit only on atoms, and cancel double negations.

  3. Distribute over for CNF, or over for DNF.

  4. Simplify: drop repeated literals, and drop clauses (CNF) or terms (DNF) made redundant by absorption.

Reading a normal form off a truth table

  1. DNF: for each row where the formula is true, write a term that is true only on that row (a minterm: every variable appears, negated if it is F in the row); take the disjunction.

  2. CNF: for each row where the formula is false, write a clause that is false only on that row (a maxterm: every variable appears, negated if it is T in the row); take the conjunction.

  3. So a formula in variables with true rows has a full DNF of minterms and a full CNF of maxterms.

Quick tests on normal forms

Form

Test

Result

CNF

Is it valid?

Valid iff every clause contains some and

DNF

Is it satisfiable?

Satisfiable iff some term contains no together with

DNF

Is it valid?

Not a quick test

CNF

Is it satisfiable?

Not a quick test in general (this is the SAT problem)

FUNCTIONALLY COMPLETE SETS

Every Boolean function can be written using only the connectives in any one of these sets (F is the constant false). is not complete: a formula built from and alone is true whenever all its atoms are true, so it cannot express . For the same reason alone is not complete, while is, since .

EXAM TIP

Converting a formula to CNF or DNF can make it exponentially longer. For example, has no DNF with fewer than terms: a term missing a variable would also be true on a row where only that variable is flipped, and the formula is false there.

Translating English and checking arguments

Common English phrasings

English

Logic

if then ; only if ; whenever

if ; provided

is sufficient for

is necessary for

if and only if ; iff

unless

(equivalently )

neither nor

but

An argument with premises and conclusion is valid when is true in every assignment that makes all premises true. Validity is about form, not about whether the premises are actually true.

TEST FOR A VALID ARGUMENT

To refute an argument, find one assignment making every premise true and the conclusion false.

EXAM TIP

If the premises cannot all be true together (for example and ), the argument is valid whatever the conclusion is, because no assignment makes every premise true. Check that the premises are consistent before reading much into a verdict of valid.

Rules of inference

Rule

Premises

Conclusion

Modus ponens

Modus tollens

Hypothetical syllogism

Disjunctive syllogism

Resolution

Constructive dilemma

Simplification / addition

/

/

EXAM TIP

Two invalid patterns that look like valid ones: affirming the consequent ( and , so ) and denying the antecedent ( and , so ). Take false and true to see both fail.

WORKED EXAMPLE

Show that is a tautology.

Solution
  1. Suppose the formula is false for some assignment. Then the hypothesis is true and the conclusion is false.

  2. false forces and .

  3. true with forces .

  4. But then is , which is false, contradicting the hypothesis being true.

  5. So no assignment makes the formula false.

Answer: The formula is a tautology (this is hypothetical syllogism).

First-order logic: predicates and quantifiers

First-order logic adds a domain of objects (assumed non-empty throughout these notes), predicates such as or that are true or false for given objects, the universal quantifier (for all ) and the existential quantifier (there is some ). A formula is evaluated in an interpretation: a domain together with a meaning for every predicate (and every constant).

In and the variable is bound in ; a variable occurrence not captured by any quantifier is free. A formula with no free variables is a sentence and is simply true or false in an interpretation. In , is bound and is free. Convention: a quantifier applies only to the formula immediately after it, so means , in which the last is free; brackets extend the scope, as in .

NEGATING QUANTIFIERS

Push inside by flipping each quantifier and negating the body; repeat for nested quantifiers.

QUANTIFIERS THAT DISTRIBUTE

distributes over and distributes over , as equivalences.

Where distribution only goes one way

Valid implication

Converse

Counter-model for the converse

Not valid

Domain ; true only at 1, true only at 2

Not valid

Domain ; true only at 1, true only at 2

Not valid

Domain ; true only at 1, false everywhere

Not valid

Domain ; true exactly when

(non-empty domain)

Not valid

Domain ; true only at 1

PULLING A QUANTIFIER PAST A FORMULA THAT DOES NOT MENTION $X$

The same holds for with and with . The step (or ) used here relies on the domain being non-empty.

MOVING A QUANTIFIER OUT OF AN ANTECEDENT

The quantifier flips when it leaves the antecedent. It keeps its kind when it leaves the consequent: and . The forms need a non-empty domain.

EXISTENTIAL OVER AN IMPLICATION

Write the body as , distribute over , and use . By contrast, only implies .

Order of quantifiers. Like quantifiers commute: equals , and equals . Mixed quantifiers do not: lets depend on , while demands a single that works for every .

Translating English into first-order logic

English

Formula

All are

Some is

No is

Not every is

Everyone has a parent, where means is a parent of

There is exactly one with

EXAM TIP

The usual translation traps are for "all are " (it claims everything is an ) and for "some is " (it is true as soon as one object is not an , even if no is ). Use after and after .

Rules of inference for quantifiers

Rule

From

Infer

Universal instantiation

for any object of the domain

Universal generalization

for an arbitrary (nothing assumed about )

Existential instantiation

for some , using a new name that appears nowhere else

Existential generalization

for some object

WORKED EXAMPLE

Write the negation of with no negation in front of a quantifier or a bracket.

Solution
  1. Flip the outer quantifier: .

  2. Flip the inner quantifier: .

  3. Use on the body.

Answer:

Validity in first-order logic and counter-models

A first-order sentence is valid if it is true in every interpretation, satisfiable if it is true in at least one (a model), and unsatisfiable if it is true in none. A sentence is valid exactly when its negation is unsatisfiable. Unlike propositional logic, there is no truth table: validity of first-order sentences is undecidable in general (no algorithm decides it for every sentence), but a single counter-model settles that a sentence is not valid.

Deciding whether a first-order formula is valid

  1. Read the formula as an implication and ask whether the conclusion must hold whenever the premise does.

  2. If it looks valid, argue for an arbitrary interpretation: assume the premise is true and show the conclusion is true, reasoning about an arbitrary object wherever a has to be shown.

  3. If it looks invalid, build a small counter-model: choose a domain (often ), define each predicate by listing where it is true, and check the premise is true and the conclusion false.

  4. Start with a domain of one or two elements; that is enough for every counter-model in these notes. It is a place to start, not a guarantee: some satisfiable sentences have only infinite models, so a failed search over small domains does not prove validity.

WORKED EXAMPLE

Show that is not valid.

Solution
  1. Take the domain and let be true exactly when , i.e. and true, and false.

  2. Premise : for take , for take . It is true.

  3. Conclusion : for the object fails, and for the object fails. It is false.

  4. The premise is true and the conclusion false in this interpretation.

Answer: This interpretation is a counter-model, so the sentence is not valid. (The reverse implication is valid.)

COUNTING RELATIONS THAT SATISFY A SENTENCE

For a fixed set with , a relation on is a subset of . In its 0/1 matrix (row , column ) each of the rows must contain at least one 1, and a row has such patterns.

EXAM TIP

Do not confuse "true in this interpretation" with "valid". To prove invalidity you need one interpretation; to prove validity you need an argument that works in every interpretation, so testing a few examples never proves validity.

PREVIOUS-YEAR QUESTIONS

7 questions from the CS papers

Try each question first, then open the answer. We placed each question under a topic ourselves; the exam paper does not label topics.

See these papers in full: GATE CSE 2026 Set 2 · GATE CSE 2025 Set 1 · GATE CSE 2025 Set 2 · GATE CSE 2024 Set 2 · GATE CSE 2023 · GATE CSE 2020 · GATE CSE 2018

GATE 2026 CS2 Q.11

GATE 2026 · CS2Q.11 · 1 mark · MCQ

For two different persons and , the predicate denotes that knows . Consider the following statement.

There is a person who does not know anyone else, but that person is known by everyone else.

Which one of the following expressions represents the above statement?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution
See the question in the paper
GATE 2026 CS2 Q.11: answer and solution

GATE 2025 CS1 Q.48

GATE 2025 · CS1Q.48 · 2 marks · MSQ

Which of the following predicate logic formulae/formula is/are CORRECT representation(s) of the statement: "Everyone has exactly one mother"?

The meanings of the predicates used are:
- : is the mother of
- : and are not equal

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution
See the question in the paper
GATE 2025 CS1 Q.48: answer and solution

GATE 2025 CS2 Q.15

GATE 2025 · CS2Q.15 · 1 mark · MCQ

Let be an arbitrary predicate over the domain of natural numbers.

Which ONE of the following statements is TRUE?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution
See the question in the paper
GATE 2025 CS2 Q.15: answer and solution

GATE 2024 CS2 Q.12

GATE 2024 · CS2Q.12 · 1 mark · MCQ

Let and be the following propositions:

: Fail grade can be given.

: Student scores more than 50% marks.

Consider the statement: "Fail grade cannot be given when student scores more than 50% marks."

Which one of the following is the CORRECT representation of the above statement in propositional logic?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution
See the question in the paper
GATE 2024 CS2 Q.12: answer and solution

GATE 2023 CS Q.26

GATE 2023 · CSQ.26 · 1 mark · MSQ

Geetha has a conjecture about integers, which is of the form

where is a statement about integers, and is a statement about pairs of integers. Which of the following (one or more) option(s) would imply Geetha's conjecture?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution
See the question in the paper
GATE 2023 CS Q.26: answer and solution

GATE 2018 CS Q.28

GATE 2018 · CSQ.28 · 2 marks · MCQ

Consider the first-order logic sentence , where is a quantifier-free first-order logic formula using only predicate symbols, and possibly equality, but no function symbols. Suppose has a model with a universe containing 7 elements. Which one of the following statements is necessarily true?

  1. (A)

    There exists at least one model of with universe of size less than or equal to 3.

  2. (B)

    There exists no model of with universe of size less than or equal to 3.

  3. (C)

    There exists no model of with universe of size greater than 7.

  4. (D)

    Every model of has a universe of size equal to 7.

Answer and solution
See the question in the paper
GATE 2018 CS Q.28: answer and solution

OTHER EXAMS

ISRO: 1 question

From ISRO's Scientist/Engineer written test: ISRO CS 2023. They are not counted in the GATE numbers on this page.

PRACTICE

5 questions to test yourself

PRACTICE 11 mark · MCQ

Which formula is equivalent to ?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution

Answer: (A)

  1. Use : the formula becomes .

  2. De Morgan: , giving .

  3. Option C is stricter (it needs both and false); B has the wrong sign on ; D equals , which is true when is false, whereas the original is false then.

PRACTICE 21 mark · NAT

For how many of the 16 assignments to is the formula true?

Answer and solution

Answer:

  1. The formula is false only when is true and is false.

  2. is true for 3 of the 4 choices of ; is false for 3 of the 4 choices of .

  3. So assignments make it false.

  4. The number making it true is .

PRACTICE 32 marks · MSQ

Assume every domain is non-empty. Which of the following sentences are valid?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution

Answer: (A), (C)

  1. A is valid: if every -object is a -object and every object is a -object, then every object is a -object.

  2. B is not valid: domain , true only at 1, true only at 2; both existentials hold but no single object satisfies both.

  3. C is valid: if satisfies for all , then for each that same works.

  4. D is not valid: domain with true iff makes the premise true and the conclusion false.

PRACTICE 42 marks · MCQ

The premises are , and . Which one of the following is true in every assignment that makes all three premises true?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution

Answer: (B)

  1. If is true, modus ponens with gives ; if is true, gives . One of is true, so holds (constructive dilemma).

  2. A fails: satisfies all premises but is false.

  3. C fails: satisfies all premises but is false.

  4. D fails: satisfies all premises but is false.

PRACTICE 52 marks · NAT

Let . A binary relation on is a subset of . How many relations on make the sentence true?

Answer and solution

Answer:

  1. Think of as a 0/1 matrix with row and column .

  2. says every row contains at least one 1.

  3. A row of 3 entries has nonzero patterns.

  4. The three rows are independent, so the count is .

OFFICIAL GATE 2027 SYLLABUS WORDING

Copied from the GATE 2027 syllabus; see all 2027 syllabi.

GATE CS

Propositional and first order logic

Preparing in Kolkata? IAE Academy's course for GATE CSE.