Question: Write a program that determines whether a given relation on a set exhibits the following properties: reflexive, symmetric, transitive, and equivalence ( if it satisfies

Write a program that determines whether a given relation on a set exhibits the following properties: reflexive, symmetric, transitive, and equivalence (if it satisfies all three properties). Please review section 4.4 of the textbook.
Input:
Take a list of pairs as input, representing a relation on a set. The elements in the pairs represent elements of the set on which the relation is defined.
Output:
Determine if the relation is:
i. Reflexive: For every element a in the set, (a,a) should be in the relation.
ii. Symmetric: If (a,b) is in the relation, then (b,a) should also be in the relation.
iii. Transitive: If (a,b) and (b,c) are in the relation, then (a,c) should also be in the relation.
iv. Equivalence: Satisfied if the relation is reflexive, symmetric, and transitive.
Validate using the following test cases whether each property is satisfied for the relation.
Example test cases:
Test case 1:
Input: {(1,1),(2,2),(1,2),(2,1)}
Output: Reflexive, Symmetric, Transitive, Equivalence
Test case 2:
Input: {(1,1),(2,2),(1,2)}
Output: Reflexive, Not Symmetric, Transitive, Not Equivalence
Test case 3
Input: {(1,2),(2,3)}
Output: Not Reflexive, Not Symmetric, Not Transitive, Not Equivalence.
Write a program that determines whether a given

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!