Skip to content

Instantly share code, notes, and snippets.

@lrlucena
Created October 30, 2023 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrlucena/c74a851e2f6f9bd99f91120faa50808d to your computer and use it in GitHub Desktop.
Save lrlucena/c74a851e2f6f9bd99f91120faa50808d to your computer and use it in GitHub Desktop.
Relações - Matemática Discreta
R = [(1,2), (2,1), (1,1), (2,3), (3,3)]
A = [1, 2, 3]
def reflexiva(R, A):
for x in A:
if (x, x) not in R:
return False
return True
def simetrica(R):
for (a, b) in R:
if (b, a) not in R:
return False
return True
"""
def transitiva(R):
for (a, b) in R:
for (c, d) in R:
"""
print("Reflexiva:", reflexiva(R,A))
print("Simetrica:", simetrica(R))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment