CS208 Coursework 2
Proofs in Predicate Logic
This is the second coursework for semester one of CS208 Logic and Algorithms 2024/25.
It is worth 7.5% towards your final mark for all of CS208 (both semesters). The rest was the first Logic coursework (worth 7.5%), Algorithms coursework in semester two (worth 15% in total), and a final exam in April/May 2025 worth 70%.
This coursework is comprised of several proofs for you to complete using the tool introduced in the lectures and videos.
The whole page is marked out of 20.
This page will remember the answers you type in, even if you leave the page and come back. Your browser's local storage API is used to store the data. If you delete saved data in your browser, or visit this page in private browsing mode and then close the window, you will lose your answers.
Once you have completed the questions, please click on the “Download” button to download your answers as a file called cs208-2024-coursework2.answers
. When you are ready to submit your answers, please upload the file to the MyPlace submission page.
The deadline is 17:00 Wednesday 27th November 2024. All extension requests should be submitted via MyPlace.
Question 0 (no marks)
Please enter your name and registration number:
Name:
<name>Registration number:
<registration-number>
Question 1 : Proofs about Edges in Graphs (6 marks)
The following questions all use the rules for “for all” and “exists”, as well as the rules for the propositional connectives.
Question 1(a) (1 mark)
“If every time there is an edge from x to y there is an edge from y to x, and every x has an edge from it to somewhere, then every x has an edge leading to it.”
Question 1(b) (1 mark)
“If every time there is an edge from x to y, there is an edge from y to x, and there is no edge from a() to b(), then there is no edge from b() to a().”
Question 1(c) (1 mark)
“If every time there is edge from x to y and an edge from y to z, there is an edge from x to z, then if there is an edge from a() to b() and an edge from b() to c(), there is an edge from a() to c().”
Question 1(d) (1 mark)
“If every time there is edge from x to y and an edge from y to z, there is an edge from x to z, and if every time there is an edge from x to y there is an edge from y to x, and every x has an edge to some y, then for all z, there is an edge from z to z.”
Question 1(e) (1 mark)
“If, for all x and y there is either an edge from x to y or an edge from y to x, and there is no edge from a() to b(), then there is an edge from b() to a().”
Question 1(f) (1 mark)
“If, for all x and y there is either an edge from x to y or an edge from y to x, and for every x and y, if there is an edge from x to y there is an edge from y to x, then for all x and y, there is an edge from x to y.”
Question 2, Children and Dragons (2 marks)
Question 2(a) (1 mark)
“If every dragon has a child that rides it, and there exists a dragon, then there exists a child.”
Question 2(b) (1 mark)
“If every child rides a dragon, and there is a child who doesn't ride a dragon, then the earth is hollow.”
Question 3, Equality (2 marks)
The following proofs all use the rules for equality.
Question 3(a) (1 mark)
Equalities can be chained together:
Question 3(b) (1 mark)
This question asks you to prove that a mirroring function mirrors a specific input, using some axioms that describe how mirroring works on nodes and leaves:
Question 4, Monoids (3 marks)
The following proofs all use the rules for equality, and the axioms of a commutative monoid, which is like an abelian group except that there are no inverses (think of positive numbers with addition).
This question and the two following are about a definition of “less than or equal” in terms of addition. We define “x <= y” to be the formula “∃ k. x + k = y”. So x is less than y if there is a difference of k between them.
Question 4(a) (1 mark)
The first theorem to prove is that everything is less than or equal to itself for this definition of less than or equal:
Question 4(b) (1 mark)
Next, zero is less than or equal to everything (so that 0 is the bottom element of the ordering):
Question 4(c) (1 mark)
And this ordering is transitive, x <= y and y <= z, then x <= z:
Question 5, Induction (7 marks)
The following questions all require proofs by induction using the Peano axioms for arithmetic. In some cases, additional consequences of those axioms that were proved on that page are required. These have been provided as additional assumptions.
Question 5(a) (1 mark)
“Every number is even or odd”.
Question 5(b) (1 mark)
“x*0 = 0”.
Question 5(c) (1 mark)
“x * (1 + y) = x + (x * y)”.
Question 5(d) (2 marks)
“if x + y = 0, then x = 0”.
Question 5(e) (2 marks)
“if x + y = x, then y = 0”.