Created
October 30, 2023 21:08
-
-
Save lrlucena/c74a851e2f6f9bd99f91120faa50808d to your computer and use it in GitHub Desktop.
Relações - Matemática Discreta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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