Description
Part 1: Predicate Logic
1. 1. When D1 = [0,∞)
Statement 1 is True because every number x ∈ D1 is smaller than a y ∈ D1 (For example, y = x+1 > x). Statement 2 is False because when y = 0, there isn’t an x ∈ D1 smaller than y.
2. When D2 = Z
Statement 1 is True because every integer x is smaller than some integer y (For example, y = x + 1 > x). Statement 2 is True because every integer y is greater than some integer x (For example, x = y − 1 < y).
3. When D3 = {0}
Statement 1 is False because when x = 0, there isn’t a y ∈ D3 greater than x.
Statement 2 is False because when y = 0, there isn’t an x ∈ D3 smaller than y.
2. 1. P(x) : 1 < x < 8 where x ∈ S
2. Q(x) : x < 8 where x ∈ S
When x ≤ 1 and x ≥ 8, P(x) is False, so P(x) ∧ Q(x) would be False and P(x) =⇒ Q(x) would be True. When 1 < x < 8, P(x) and Q(x) are both True, so both P(x) ∧ Q(x) and P(x) =⇒ Q(x) would be True. Since S = {0,1,2,3,4,5,6,7,8,9},
Statement 3 would be False because P(x) ∧ Q(x) is False when x = 0,
Statement 4 would be True because P(x) =⇒ Q(x) is true for all values of x ∈ S.
3. Complete this part in the provided a2 part1.py starter file. Do not include your solution in this file.
4. Complete this part in the provided a2 part1.py starter file. Do not include your solution in this file.
Part 2: Conditional Execution
Complete this part in the provided a2 part2.py starter file. Do not include your solution in this file.
Part 3: Generating a Timetable
1. Complete this part in the provided a2 part3.py starter file. Do not include your solution in this file.
2. (a) IMPORTANT DEFINITIONS/NOTATION (don’t change this text!) We define the following sets:
• C: the set of all possible courses
• S: the set of all possible sections
• M: the set of all possible meeting times
• SC: the set of all possible schedules
We also define the following notation for expressions involving the elements of these sets:
• The first three (courses/sections/meeting times) are represented as tuples (as described in the assignment handout), and you can use the indexing operation on these values. For example, you could translate “every section term is in {0F0,0 S0,0 Y 0}” into predicate logic as the statement:
• The start and end times of a meeting time can be compared chronologically using the standard <, ≤, >, and ≥ operators.
– ∀s ∈ S, s[2] ⊆ M
– ∀s ∈ S, ∀m ∈ s[2], m[1] < m[2]
• Finally, for a schedule sc ∈ SC, you can use the notation sc.sections to refer to a set of all sections in that schedule. You can use quantifiers with that set of schedules as well, e.g. ∀s ∈ sc.sections, …
Predicate for meeting times conflicting:
MeetingTimesConflict(m1,m2) : m1[0] == m2[0] ∧ m1[2] > m2[1] ∧ m2[2] > m1[1]
where m1,m2 ∈ M
Predicate for sections conflicting:
SectionsConflict(s1,s2) : (s1[1] = ’Y’ ∨ s2[1] = ’Y’ ∨ s1[1] = s2[1])∧
∃m1 ∈ s1[2],∃m2 ∈ s2[2], s.t. MeetingTimesConflict(m1,m2)
where s1,s2 ∈ S
Predicate for valid schedule:
IsV alidSchedule(sc) : ∀s1,s2 ∈ sc.sections,SectionsConflict(s1,s2) ⇒ s1 = s2 where sc ∈ SC
(b) Complete this part in the provided a2 part3.py starter file. Do not include your solution in this file.
Predicate for section-schedule compatibility:
IsCompatibleSection(sc,s) : ∀s1 ∈ sc.sections,¬SectionsConflict(s,s1) where sc ∈ SC,s ∈ S Predicate for course-schedule compatibility:
IsCompatibleCourse(sc,c) : ∃s ∈ c[2] s.t. IsCompatibleSection(sc,s) where sc ∈ SC,c ∈ C (b) Complete this part in the provided a2 part3.py starter file. Do not include your solution in this file.
Part 4: Processing Raw Data
Complete this part in the provided a2 part4.py starter file. Do not include your solution in this file.
Reviews
There are no reviews yet.