Skip to main content
Post Undeleted by emanresu A
Post Deleted by emanresu A
added 109 characters in body
Source Link
emanresu A
  • 46.2k
  • 27
  • 43

Input/output is ascan be lists of listspairs of positive integers, or an adjacency matrix. You can optionally take the domain of the relation (i.e. all unique values in it). The order in which you output the pairs does not matter, and you can assume the input will be nonempty.

Input/output is as lists of lists of positive integers. The order in which you output the pairs does not matter, and you can assume the input will be nonempty.

Input/output is can be lists of pairs of positive integers, or an adjacency matrix. You can optionally take the domain of the relation (i.e. all unique values in it). The order in which you output the pairs does not matter, and you can assume the input will be nonempty.

deleted 16 characters in body
Source Link
emanresu A
  • 46.2k
  • 27
  • 43

Next, the relation must be symmetric, so we need to add the inverses of \$(1, 2)\$ and \$(3, 2)\$, resulting in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (4, 4), (2, 1), (2, 3)\}\$\$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (2, 1), (2, 3)\}\$.

Finally, the relation must be transitive. Since \$(1, 2)\$ and \$(2, 3)\$ are in the relation, so must be \$(1, 3)\$, and likewise \$(3, 1)\$ must also be in the relation. Adding these results in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (4, 4), (2, 1), (2, 3), (1, 3), (3, 1)\}\$\$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (2, 1), (2, 3), (1, 3), (3, 1)\}\$, and this is an equivalence relation.

Next, the relation must be symmetric, so we need to add the inverses of \$(1, 2)\$ and \$(3, 2)\$, resulting in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (4, 4), (2, 1), (2, 3)\}\$.

Finally, the relation must be transitive. Since \$(1, 2)\$ and \$(2, 3)\$ are in the relation, so must be \$(1, 3)\$, and likewise \$(3, 1)\$ must also be in the relation. Adding these results in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (4, 4), (2, 1), (2, 3), (1, 3), (3, 1)\}\$, and this is an equivalence relation.

Next, the relation must be symmetric, so we need to add the inverses of \$(1, 2)\$ and \$(3, 2)\$, resulting in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (2, 1), (2, 3)\}\$.

Finally, the relation must be transitive. Since \$(1, 2)\$ and \$(2, 3)\$ are in the relation, so must be \$(1, 3)\$, and likewise \$(3, 1)\$ must also be in the relation. Adding these results in \$\{(1, 2), (3, 2), (4, 4), (1, 1), (2, 2), (3, 3), (2, 1), (2, 3), (1, 3), (3, 1)\}\$, and this is an equivalence relation.

added 54 characters in body
Source Link
emanresu A
  • 46.2k
  • 27
  • 43
{(1, 1)} -> {(1, 1)} {(1, 2)} -> {(1, 2), (1, 1), (2, 2), (2, 1)} {(1, 2), (3, 4)} -> {(1, 2), (1, 1), (2, 2), (2, 1), (3, 4), (3, 3), (4, 4), (4, 3)} {(1, 2), (1, 3)} -> {(1, 2), (1, 3), (1, 1), (2, 2), (3, 3), (2, 1), (3, 1), (2, 3), (3, 2)} {(1, 1), (2, 2), (3, 3)} -> {(1, 1), (2, 2), (3, 3)} {(1, 1), (2, 2), (3, 4)} -> {(1, 1), (2, 2), (3, 3), (3, 4), (4, 3)} {(1, 2), (3, 2), (4, 1)} -> {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)} {(8, 19), (4, 12), (9, 31), (4, 18)} -> {(8, 8), (8, 19), (19, 8), (19, 19), (4, 4), (4, 12), (4, 18), (12, 4), (12, 12), (12, 18), (18, 4), (18, 12), (18, 18), (9, 9), (9, 31), (31, 9), (31, 31)} {(8, 7), (2, 7), (14, 3), (3, 16)} -> {(2, 2), (2, 7), (2, 8), (7, 2), (7, 7), (7, 8), (8, 2), (8, 7), (8, 8), (3, 3), (3, 14), (3, 16), (14, 3), (14, 14), (14, 16), (16, 3), (16, 14), (16, 16)} {(1, 1), (1, 2)} -> {(1, 1), (1, 2), (2, 1), (2, 2)} 
{(1, 1)} -> {(1, 1)} {(1, 2)} -> {(1, 2), (1, 1), (2, 2), (2, 1)} {(1, 2), (3, 4)} -> {(1, 2), (1, 1), (2, 2), (2, 1), (3, 4), (3, 3), (4, 4), (4, 3)} {(1, 2), (1, 3)} -> {(1, 2), (1, 3), (1, 1), (2, 2), (3, 3), (2, 1), (3, 1), (2, 3), (3, 2)} {(1, 1), (2, 2), (3, 3)} -> {(1, 1), (2, 2), (3, 3)} {(1, 1), (2, 2), (3, 4)} -> {(1, 1), (2, 2), (3, 3), (3, 4), (4, 3)} {(1, 2), (3, 2), (4, 1)} -> {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)} {(8, 19), (4, 12), (9, 31), (4, 18)} -> {(8, 8), (8, 19), (19, 8), (19, 19), (4, 4), (4, 12), (4, 18), (12, 4), (12, 12), (12, 18), (18, 4), (18, 12), (18, 18), (9, 9), (9, 31), (31, 9), (31, 31)} {(8, 7), (2, 7), (14, 3), (3, 16)} -> {(2, 2), (2, 7), (2, 8), (7, 2), (7, 7), (7, 8), (8, 2), (8, 7), (8, 8), (3, 3), (3, 14), (3, 16), (14, 3), (14, 14), (14, 16), (16, 3), (16, 14), (16, 16)} 
{(1, 1)} -> {(1, 1)} {(1, 2)} -> {(1, 2), (1, 1), (2, 2), (2, 1)} {(1, 2), (3, 4)} -> {(1, 2), (1, 1), (2, 2), (2, 1), (3, 4), (3, 3), (4, 4), (4, 3)} {(1, 2), (1, 3)} -> {(1, 2), (1, 3), (1, 1), (2, 2), (3, 3), (2, 1), (3, 1), (2, 3), (3, 2)} {(1, 1), (2, 2), (3, 3)} -> {(1, 1), (2, 2), (3, 3)} {(1, 1), (2, 2), (3, 4)} -> {(1, 1), (2, 2), (3, 3), (3, 4), (4, 3)} {(1, 2), (3, 2), (4, 1)} -> {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)} {(8, 19), (4, 12), (9, 31), (4, 18)} -> {(8, 8), (8, 19), (19, 8), (19, 19), (4, 4), (4, 12), (4, 18), (12, 4), (12, 12), (12, 18), (18, 4), (18, 12), (18, 18), (9, 9), (9, 31), (31, 9), (31, 31)} {(8, 7), (2, 7), (14, 3), (3, 16)} -> {(2, 2), (2, 7), (2, 8), (7, 2), (7, 7), (7, 8), (8, 2), (8, 7), (8, 8), (3, 3), (3, 14), (3, 16), (14, 3), (14, 14), (14, 16), (16, 3), (16, 14), (16, 16)} {(1, 1), (1, 2)} -> {(1, 1), (1, 2), (2, 1), (2, 2)} 
added 228 characters in body
Source Link
emanresu A
  • 46.2k
  • 27
  • 43
Loading
added 37 characters in body
Source Link
emanresu A
  • 46.2k
  • 27
  • 43
Loading
Source Link
emanresu A
  • 46.2k
  • 27
  • 43
Loading