FACULTY OF INFORMATION TECHNOLOGY
Essay
Discrete Structures
Regulations
This is a group-of-2 assignment. Groups of only 1 student are not accepted.
The duration of this essay is 14 days, from the beginning of April 18th 2024 to the end of
May 2nd 2024.
Only 1 student who represents the group will submit the essay to your ELIT classroom.
Late submissions are not accepted. Submissions via email are not accepted. You need to
submit a compressed file named with your Student IDs, eg. 52200123_52201001.zip/rar,
including this structure:
• The document file is in Word format (.doc/docx), named by your Student IDs,
eg. 52200123_52201001.docx, using our faculty’s format, from 15 to 25 pages.
o The structure of this document should be:
▪ Chapter 1: The tasks of each member and self-evaluation of your
group should be declared at the end of this report.
▪ Chapter 2: Truth table
▪ Chapter 3: Quantified Reasoning over Real-World Data Using
Predicate Logic
▪ Chapter 4: RSA cryptosystem
▪ References: Using the faculty’s format.
o English is required for high-quality classes.
o Format violations will cost from 10% to 50% of your total scores.
o Any case of plagiarism will get 0.
• The source code files are named by your Student ID and Task Number, eg.
52200123_52201001_1.py.
Tasks
1. Truth table
• Write function def Infix2Postfix(Infix):
o Input: Infix is a string of logical operators and alphabet characters from “A”
to “Z” express a logic expression.
▪ “(”: Open parenthesis
▪ “~”: Not
▪ “&”: And
▪ “|”: Or
▪ “>”: Implies
▪ “=”: If and only if
FACULTY OF INFORMATION TECHNOLOGY
▪ “)”: Close parenthesis
o Output: Postfix is a string calculated from Infix using Reverse Polish
notation.
o Write the theory of Reverse Polish and Basic logic used on calculation of
Truth tables in the report document.
• Write function def Postfix2Truthtable(Postfix):
o Input: Postfix from (1.)
o Output: The truth table from the input logic expression Infix.
o Explain your program by doing step by step each function on these
testcases in the report document.
1. R|(P&Q)
2. ~P|(Q&R)>R
• Shows your experimental result on 5 testcases (run the code on 5 testcases and
capture the screen picture).
1. R|(P&Q)
2. ~P|(Q&R)>R
3. P|(R&Q)
4. (P>Q)&(Q>R)
5. (P|~Q)>~P=(P|(~Q))>~P
2. Quantified Reasoning over Real-World Data Using Predicate Logic
• Create a small dataset in CSV file with at least 20 records. It contains these fields:
StudentID, StudentName, DayOfBirth, Math, CS, Eng.
• Define these predicates based on your dataset, each predicate should return a
boolean value for a given input.
o is_passing(student): all scores are greater than or equal to 5.
o is_high_math(student): math score is greater than or equal to 9.
o is_struggling(student): math and cs score is less than 6.
o improved_in_cs(student): cs score is greater than math score.
• Implement Python functions that evaluate whether each statement is true or false
over your dataset.
o 2 Universal quantifications (e.g., ∀x P(x))
▪ "All students passed all subjects"
▪ "All students have a math score higher than 3"
o 2 Existential quantifications (e.g., ∃x P(x))
▪ "There exists a student who scored above 9 in math"
▪ "There exists a student who improved in CS over Math"
o 2 Combined/nested statements (e.g., ∀x ∃y Q(x, y))
▪ "For every student, there exists a subject in which they scored above
6"
▪ "For every student scoring below 6 in Math, there exists a subject
where they scored above 6"
• Write Python functions to evaluate the negation of the quantified statements
above and explain their meaning in plain English.
FACULTY OF INFORMATION TECHNOLOGY
3. RSA cryptosystem
• Implement a Python program to encrypt and decrypt a message with the RSA
cryptosystem. Cryptography libraries are allowed.
• Test the implemented RSA cryptosystem using sample messages and verify the
results. Capture your screen results and explain them in your report document.
• Measure encyption time and decryption time for different plaintext message
lengths. With x-coordinates are plaintext message lengths, and y-coordinates are
time consumptions, draw a graph to prepresent the changes. Discuss the
limitation(s) of the RSA cryptosystem.
• Conclude with recommendations for improving the RSA cryptosystem
implementation.
Rubric
Self-
Criteria Scale 0 score 1/2 score Full score Reason
evaluation
Correct but Correct and
Error
Implementation 1 bad good
performance performance
Not enough Correct
Theory of Reverse Do
details, no calculations,
Polish and Basic 0.5 nothing or
example, no detailed
logic wrongly
Task 1
comment explanations
Do Explain only 1 Explain 2
Explain testcases 1
1 nothing or testcase testcases
and 2
wrongly correctly. correctly.
Do Explain only Explain 5
Run all 5 testcases 1.25 nothing or <= 3 testcases testcases
wrongly correctly. correctly.
Not enough
Create dataset 0.5 No data Good data
data
Do Run only <= 3 Run only <= 6
Determine truth
Task 2
1.5 nothing or statements statements
value
wrongly correctly correctly
Do Run only <= 3 Run only <= 6
Negation 0.75 nothing or statements statements
wrongly correctly correctly
Correct but Correct and
Error
Implementation 0.5 bad good
performance performance
Test without Test and
Test 0.5 No test
verification verification
Task 3
Not enough
Do Correct,
details, no
Discussion 1 nothing or detailed
example, no
wrongly explanations
comment
Not enough
Do Correct,
details, no
Recommendation 1 nothing or detailed
example, no
wrongly explanations
comment
FACULTY OF INFORMATION TECHNOLOGY
No Wrong
Reference 0.5 Right format
reference format
Total 10 Result 0