GA: Cumulative reasoning and systems assessment
Prerequisites: G01–G10. Reserve these questions until you can work without opening the earlier solutions. Use roughly 60–90 minutes or split into two sessions. Do not use timing as a gate when a documented accessibility or learning need requires another format. Assess setup, reasoning, execution, verification, and communication separately.
For , prove that i=0; s=0; while i<n: s=s+(2*i+1); i=i+1 returns in the mathematical-integer model. Give an invariant, initialization, preservation, exit argument, and termination measure.
Evaluate let("x",4,let("x",x*2,x)+x) under the project language. Give the binding-to-slot relationship a compiler should use and explain a plausible bug that returns 16.
A directed network has capacities , , , , . Give a flow and a cut with equal value, and explain why equality certifies optimality without enumerating all possible flows.
An invertible matrix is . For , compare the exact solution with the one obtained after adding to . State the condition number and distinguish this sensitivity from a solver defect.
A single finite FIFO server has service time 1, capacity two including the active job, and arrivals at . Under the lab’s departure-before-arrival convention at equal times, give each accepted job’s start/end times and the rejected arrivals. Explain why an infinite-buffer queue formula is not a substitute for this trace.
Three replicas require writes to any two and reads from any two. Explain what set intersection guarantees, then construct a partial-write situation in which returning the maximum observed version without read repair can let a completed read observe a new value and a later read return the old value.
Smallest useful hints#
For .01, relate to before the next body. For .03, try saturating all outgoing capacity from . For .06, a failed or incomplete write may reach only one replica even though the completed-write rule requires two.
Complete solutions: GA#
Compare the first step where your work differs. A corrected answer is not yet an independent success.
GA.01Show solution
A changed summand needs a changed invariant
Use and . Initially . Assuming it holds with , the new sum is , and the new index is . At exit, combined with gives and . The nonnegative integer variant decreases by one each iteration, proving termination in the ideal model. Bounded machine arithmetic would require a separate overflow bound.
Back to GA.01GA.02Show solution
An inner name is not the outer storage slot
Outer ; the inner initializer uses it to compute 8; the inner body returns 8; the final outer occurrence is still 4. The result is 12. Allocate distinct slots, such as outer slot 0 and inner slot 1, and map names lexically during compilation. Overwriting one shared slot for both names makes the final occurrence read 8 and returns 16. A test with no shadowing would not reveal this bug.
Back to GA.02GA.03Show solution
Matching primal flow and cut bounds
Send 2 along , 1 along , and 2 along . Every edge respects capacity and intermediate flow is conserved; the value is 5. The cut has outgoing capacity . Any feasible flow value cannot exceed any cut capacity, so this flow attains the upper bound and is maximum. The argument does not rely on which augmenting paths the implementation happened to choose.
Back to GA.03GA.04Show solution
The data perturbation lies in the sensitive direction
The first solution is and the changed solution is . The relative data perturbation is , while relative solution change is . The Euclidean condition number is . The exact diagonal arithmetic already displays sensitivity; blaming numerical instability would misidentify the issue. A residual check alone may not communicate coefficient uncertainty.
Back to GA.04GA.05Show solution
A bounded state trace answers the specified queue
The job at 0 runs from 0 to 1. The job at waits and runs from 1 to 2. At there are already two admitted unfinished jobs, so reject it. At time 1 the first job has departed; the new arrival is accepted and runs from 2 to 3. The finite capacity and deterministic arrivals/service differ from an infinite-buffer stationary stochastic model. Keep rejection and waiting definitions explicit.
Back to GA.05GA.06Show solution
Intersection of completed quorums is not a whole register protocol
Any size-two read and size-two completed-write sets among three replicas intersect. However, let an incomplete write place new version 1 only at replica A while B and C retain version 0. A read of A,B returns version 1. Without writing it back, a later read of B,C can return version 0. Thus the intersection arithmetic alone does not prove linearizable behavior for the simple maximum-observed-value rule under incomplete writes. A proper register protocol needs additional rules and assumptions; consensus is not supplied merely by choosing majority sizes.
Back to GA.06