Set theory, relations, functions and lattices — Unit 1 Notes (Discrete Structures and Theory of Logic)

BCS302 · Unit 1

Set theory, relations, functions and lattices notes — Unit 1

Free unit-wise study notes on set theory, relations, functions and lattices for Discrete Structures and Theory of Logic, Semester 3 of B.Tech — Computer Science & Engineering — key concepts, examples, important questions and a revision checklist for semester exams.

An exhaustive exploration of Set Theory, Relations, Functions, Partially Ordered Sets (POSETs), and Lattices. Forms the mathematical foundation for databases and algorithm analysis.

Notebook — 14 pages

Page 1

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

1. Introduction to Set Theory

A Set is a well-defined collection of distinct objects, considered as an object in its own right. The objects in a set are called its elements or members.

1.1 Representation of Sets

  • Roster (Tabular) Form: Listing all elements inside braces. e.g., A={1,2,3,4}A = \{1, 2, 3, 4\}
  • Set-Builder Form: Stating the properties that its members must satisfy. e.g., A={xx is an even integer and 0<x<10}A = \{x \mid x \text{ is an even integer and } 0 < x < 10\}

1.2 Types of Sets

  • Null/Empty Set: A set with no elements. Denoted by \emptyset or {}\{\}.
  • Singleton Set: A set with exactly one element.
  • Finite and Infinite Sets: Sets with a countable vs uncountable number of elements.
  • Universal Set: The set containing all objects or elements and of which all other sets are subsets. Denoted by UU or SS.
  • Power Set: The set of all subsets of a set AA, denoted by P(A)P(A). If A=n|A| = n, then P(A)=2n|P(A)| = 2^n.

Next — Set Operations

1 of 14

Page 2

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

2. Set Operations

Fundamental operations can be performed on sets to construct new sets.

2.1 Basic Operations

  • Union (ABA \cup B): The set of all elements that are in AA, or in BB, or in both.
  • Intersection (ABA \cap B): The set of all elements that are in both AA and BB.
  • Difference (ABA - B): The set of all elements that are in AA but not in BB. Note that ABBAA - B \neq B - A.
  • Symmetric Difference (ABA \oplus B or ABA \triangle B): The set of elements that are in AA or BB, but not in both. (AB)(BA)(A - B) \cup (B - A).
  • Complement (AA' or AcA^c): The set of all elements in the universal set UU that are not in AA.

2.2 Laws of Set Algebra

Sets obey specific algebraic laws, which are heavily used in proofs:

  • Idempotent Laws: AA=AA \cup A = A and AA=AA \cap A = A
  • Commutative Laws: AB=BAA \cup B = B \cup A and AB=BAA \cap B = B \cap A
  • Associative Laws: (AB)C=A(BC)(A \cup B) \cup C = A \cup (B \cup C)
  • Distributive Laws: A(BC)=(AB)(AC)A \cup (B \cap C) = (A \cup B) \cap (A \cup C)
  • De Morgan's Laws: (AB)=AB(A \cup B)' = A' \cap B' and (AB)=AB(A \cap B)' = A' \cup B'

Next — Cartesian Product and Relations

2 of 14

Page 3

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

3. Cartesian Product and Relations

The Cartesian Product of two sets AA and BB, denoted by A×BA \times B, is the set of all ordered pairs (a,b)(a, b) where aAa \in A and bBb \in B.

A×B={(a,b)aA and bB}A \times B = \{(a, b) \mid a \in A \text{ and } b \in B\}

3.1 Definition of a Relation

A Relation RR from set AA to set BB is a subset of the Cartesian product A×BA \times B. If (a,b)R(a, b) \in R, we say that aa is related to bb under RR, denoted as aRbaRb.

3.2 Domain and Range

  • Domain: The set of all first elements of the ordered pairs in a relation RR.
  • Range: The set of all second elements of the ordered pairs in a relation RR.
  • Inverse Relation (R1R^{-1}): If RR is a relation from AA to BB, then R1R^{-1} is a relation from BB to AA defined by R1={(b,a)(a,b)R}R^{-1} = \{(b, a) \mid (a, b) \in R\}.

Next — Properties of Relations

3 of 14

Page 4

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

4. Properties of Relations

A relation RR defined on a single set AA (i.e., RA×AR \subseteq A \times A) can have the following properties:

  • Reflexive: Every element is related to itself. For all aAa \in A, (a,a)R(a, a) \in R.
  • Irreflexive: No element is related to itself. For all aAa \in A, (a,a)R(a, a) \notin R.
  • Symmetric: If aa is related to bb, then bb is related to aa. If (a,b)R(a, b) \in R, then (b,a)R(b, a) \in R.
  • Asymmetric: If (a,b)R(a, b) \in R, then (b,a)R(b, a) \notin R.
  • Antisymmetric: If (a,b)R(a, b) \in R and (b,a)R(b, a) \in R, then it must be that a=ba = b.
  • Transitive: If (a,b)R(a, b) \in R and (b,c)R(b, c) \in R, then (a,c)R(a, c) \in R.

4.1 Equivalence Relation

A relation RR on a set AA is an Equivalence Relation if it is strictly:

  • 1. Reflexive
  • 2. Symmetric
  • 3. Transitive

Example: The relation "is equal to" (=) on the set of real numbers.

Next — Equivalence Classes and Partitions

4 of 14

Page 5

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

5. Equivalence Classes and Partitions

5.1 Equivalence Classes

Let RR be an equivalence relation on a set AA. The equivalence class of an element aAa \in A, denoted by [a][a], is the set of all elements in AA that are related to aa by RR.

[a]={xA(x,a)R}[a] = \{x \in A \mid (x, a) \in R\}

5.2 Partitions of a Set

A Partition of a set AA is a collection of mutually disjoint, non-empty subsets of AA whose union is exactly AA.

Fundamental Theorem of Equivalence Relations: An equivalence relation on a set partitions the set into disjoint equivalence classes. Conversely, any partition of a set induces an equivalence relation.

Next — Functions

5 of 14

Page 6

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

6. Functions (Mappings)

A Function ff from set AA to set BB is a special type of relation where every element in AA is assigned to exactly one element in BB.

  • Domain: Set AA.
  • Codomain: Set BB.
  • Image: If f(a)=bf(a) = b, then bb is the image of aa.
  • Pre-image: aa is the pre-image of bb.
  • Range: The set of all actual images. Range \subseteq Codomain.

6.1 Types of Functions

  • Injective (One-to-One): Every element in the codomain is mapped to by at most one element in the domain. If f(x)=f(y)f(x) = f(y), then x=yx = y.
  • Surjective (Onto): Every element in the codomain is mapped to by at least one element in the domain. Range == Codomain.
  • Bijective (One-to-One and Onto): A function that is both injective and surjective. Only bijective functions have an inverse.

Next — Composition of Functions

6 of 14

Page 7

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

7. Composition of Functions

Let f:ABf: A \to B and g:BCg: B \to C be two functions. The Composition of ff and gg, denoted by gfg \circ f, is the function from AA to CC defined by:

(gf)(x)=g(f(x))(g \circ f)(x) = g(f(x)) for all xAx \in A.

7.1 Properties of Composition

  • Composition is not commutative: generally, fggff \circ g \neq g \circ f.
  • Composition is associative: (fg)h=f(gh)(f \circ g) \circ h = f \circ (g \circ h).
  • If ff and gg are both injective, then gfg \circ f is injective.
  • If ff and gg are both surjective, then gfg \circ f is surjective.
  • If ff and gg are both bijective, then gfg \circ f is bijective.

7.2 Inverse Functions

If f:ABf: A \to B is bijective, its inverse f1:BAf^{-1}: B \to A exists such that f1(b)=af^{-1}(b) = a if and only if f(a)=bf(a) = b. Note that (f1)1=f(f^{-1})^{-1} = f, and (gf)1=f1g1(g \circ f)^{-1} = f^{-1} \circ g^{-1}.

Next — Partial Order Relations (POSETs)

7 of 14

Page 8

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

8. Partially Ordered Sets (POSETs)

A relation RR on a set AA is a Partial Order if it is:

  • 1. Reflexive
  • 2. Antisymmetric
  • 3. Transitive

A set AA together with a partial order relation \le is called a Partially Ordered Set or POSET, denoted as (A,)(A, \le).

8.1 Why 'Partial'?

It is called 'partial' because not every pair of elements in the set needs to be comparable. If aba \le b or bab \le a, they are comparable. If neither is true, they are incomparable.

Example: The set of positive integers under the relation "divides" (aba|b). 242|4, so 2 and 4 are comparable. However, neither 232|3 nor 323|2 is true, so 2 and 3 are incomparable.

Next — Hasse Diagrams

8 of 14

Page 9

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

9. Hasse Diagrams

A Hasse Diagram is a graphical representation of a finite POSET that strips away redundant information (reflexivity and transitivity) to make the hierarchy clear.

9.1 How to construct a Hasse Diagram

  • Start with the directed graph of the relation.
  • Remove all self-loops (because reflexivity is implied).
  • Remove all transitive edges (if ABA \to B and BCB \to C, remove the direct edge ACA \to C).
  • Arrange the nodes so that if ABA \le B, node BB is placed physically higher than node AA.
  • Remove the arrows (direction is implied to be upwards).

The Hasse Diagram is critical for visually identifying the maximal, minimal, greatest, and least elements of a POSET.

Next — Extremal Elements in POSETs

9 of 14

Page 10

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

10. Extremal Elements of POSETs

By analysing the Hasse diagram, we can identify various extremal elements.

  • Maximal Element: An element aa in AA is maximal if there is no xAx \in A such that a<xa < x. (It is at the top of a chain in the Hasse diagram).
  • Minimal Element: An element aa in AA is minimal if there is no xAx \in A such that x<ax < a. (It is at the bottom of a chain).
  • Greatest Element (Maximum): An element aa is the greatest element if xax \le a for all xAx \in A. There can be at most one greatest element.
  • Least Element (Minimum): An element aa is the least element if axa \le x for all xAx \in A. There can be at most one least element.

Note: A POSET can have multiple maximal/minimal elements, but it can have at most one greatest/least element. If a greatest element exists, it is the unique maximal element.

Next — Upper and Lower Bounds

10 of 14

Page 11

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

11. Upper and Lower Bounds

Let SS be a subset of a POSET (A,)(A, \le).

11.1 Upper Bound and Supremum (LUB)

  • Upper Bound: An element uAu \in A is an upper bound of SS if xux \le u for all xSx \in S.
  • Least Upper Bound (LUB) / Supremum: The smallest of all the upper bounds of SS. If it exists, it is unique.

11.2 Lower Bound and Infimum (GLB)

  • Lower Bound: An element lAl \in A is a lower bound of SS if lxl \le x for all xSx \in S.
  • Greatest Lower Bound (GLB) / Infimum: The largest of all the lower bounds of SS. If it exists, it is unique.

Next — Lattices

11 of 14

Page 12

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

12. Introduction to Lattices

A Lattice is a specific type of POSET in which every pair of elements has a unique Least Upper Bound (LUB) and a unique Greatest Lower Bound (GLB).

Notation:

12.1 Properties of Lattices

Because a Lattice is an algebraic structure, the Join and Meet operations satisfy several laws:

  • Commutative: ab=baa \lor b = b \lor a and ab=baa \land b = b \land a
  • Associative: a(bc)=(ab)ca \lor (b \lor c) = (a \lor b) \lor c and a(bc)=(ab)ca \land (b \land c) = (a \land b) \land c
  • Absorption: a(ab)=aa \lor (a \land b) = a and a(ab)=aa \land (a \lor b) = a
  • Idempotent: aa=aa \lor a = a and aa=aa \land a = a

Next — Types of Lattices

12 of 14

Page 13

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

13. Types of Lattices

13.1 Bounded Lattice

A lattice that has both a greatest element (denoted by II or 11) and a least element (denoted by OO or 00). Every finite lattice is a bounded lattice.

13.2 Distributive Lattice

A lattice is distributive if the operations of Join and Meet distribute over each other.
a(bc)=(ab)(ac)a \lor (b \land c) = (a \lor b) \land (a \lor c)

13.3 Complemented Lattice

A bounded lattice where every element aa has at least one complement aa', such that:
aa=Ia \lor a' = I (Join is the greatest element)
aa=Oa \land a' = O (Meet is the least element)

13.4 Boolean Algebra (Boolean Lattice)

A lattice that is both Distributive and Complemented is called a Boolean Lattice or Boolean Algebra. In a Boolean Lattice, the complement of every element is unique.

Next — Summary & Review Checklist

13 of 14

Page 14

Wink Notes

B.Tech CSE — 3rd Semester

Discrete Structures and Theory of Logic

Unit - 1

14. Summary & Review Checklist

Set theory and Lattices form the structural backbone of Discrete Mathematics.

14.1 University Exam Checklist

  • Prove De Morgan’s laws using set builder notation and Venn diagrams.
  • Define an Equivalence Relation and prove that a given relation is an equivalence relation.
  • Explain the difference between Injective, Surjective, and Bijective functions.
  • Given a relation matrix or set of pairs, draw the corresponding Hasse Diagram.
  • From a Hasse Diagram, identify the maximal, minimal, greatest, and least elements.
  • Define a Lattice. State the absorption laws of a lattice.

14.2 Technical Interview & Application Focus

  • How do Equivalence Classes relate to consistent hashing in distributed systems?
  • How are POSETs and Hasse Diagrams used to model dependency resolution (e.g., package managers like npm/pip)?
  • Why is a Boolean Lattice significant in the design of digital logic circuits?

14 of 14

Continue in this subject