Foundations to FrontierPart IX: The graduate coreBezhig

GA: Cumulative reasoning and systems assessment

6 exercises, each with a complete solution.

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.

GA.01CSolution

For n∈Nn\in\N, prove that i=0; s=0; while i<n: s=s+(2*i+1); i=i+1 returns n2n^2 in the mathematical-integer model. Give an invariant, initialization, preservation, exit argument, and termination measure.

GA.02TSolution

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.

GA.03CSolution

A directed network has capacities s→a=3s\to a=3, s→b=2s\to b=2, a→b=1a\to b=1, a→t=2a\to t=2, b→t=3b\to t=3. Give a flow and a cut with equal value, and explain why equality certifies optimality without enumerating all possible flows.

GA.04TSolution

An invertible matrix is A=diag⁡(1,10−4)A=\operatorname{diag}(1,10^{-4}). For b=(1,10−4)b=(1,10^{-4}), compare the exact solution with the one obtained after adding 10−410^{-4} to b2b_2. State the condition number and distinguish this sensitivity from a solver defect.

GA.05CSolution

A single finite FIFO server has service time 1, capacity two including the active job, and arrivals at 0,.2,.4,10,.2,.4,1. 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.

GA.06TSolution

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 ss to i2i^2 before the next body. For .03, try saturating all outgoing capacity from ss. 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 0≤i≤n0\le i\le n and s=i2s=i^2. Initially i=s=0i=s=0. Assuming it holds with i<ni<n, the new sum is i2+2i+1=(i+1)2i^2+2i+1=(i+1)^2, and the new index is i+1≤ni+1\le n. At exit, i≥ni\ge n combined with i≤ni\le n gives i=ni=n and s=n2s=n^2. The nonnegative integer variant n−in-i decreases by one each iteration, proving termination in the ideal model. Bounded machine arithmetic would require a separate overflow bound.

Back to GA.01
GA.02Show solution

An inner name is not the outer storage slot

Outer x=4x=4; 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.02
GA.03Show solution

Matching primal flow and cut bounds

Send 2 along s→a→ts\to a\to t, 1 along s→a→b→ts\to a\to b\to t, and 2 along s→b→ts\to b\to t. Every edge respects capacity and intermediate flow is conserved; the value is 5. The cut S={s}S=\{s\} has outgoing capacity 3+2=53+2=5. 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.03
GA.04Show solution

The data perturbation lies in the sensitive direction

The first solution is (1,1)(1,1) and the changed solution is (1,2)(1,2). The relative data perturbation is 10−4/1+10−810^{-4}/\sqrt{1+10^{-8}}, while relative solution change is 1/21/\sqrt2. The Euclidean condition number is 10410^4. 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.04
GA.05Show solution

A bounded state trace answers the specified queue

The job at 0 runs from 0 to 1. The job at .2.2 waits and runs from 1 to 2. At .4.4 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.05
GA.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