final_answer
final_answer
Name: asdfasdfasdfasdfasdf
Student ID: asdfasdfasdfasdfasdfasdf
Problem 1. [O/X questions] (20 pts). Mark O for each correct statement
(X for wrong statement). You will get 2 points per correct answer, but
you will lose 2 points for each wrong answer. Leave a blank when you are
uncertain.
f) We can build a sound and complete static analyzer for any kinds of
non-trivial properties. (O, X) (X)
1
Let L be a Turing-complete language, and let P be a nontrivial seman-
tic property of program of L. There exists no automatic and eventually
terminating method such that,
1. Machine-assisted proving
3. Testing
4. Domain-specific verifier
for each of the following cases of giving up something among the above
keywords.
• “automatic”: 1
• “every”: 4
• “eventually terminating”: 2
Problem 3. [Soundness & Completeness], (10 pts). What are the pros and
cons of a program analyzer which is unsound but complete? What does this
analyzer guarantee?
Problem 4. [Pointer analysis], (10 pts). Write the result of flow- and
context-insensitive pointer analysis of the following program.
2
f(v) {
u = v;
return u;
}
x = &h1;
z = &h2;
y = f(x);
w = f(z);
γ
℘(Z) ←−−
−− −− Ẑ = ℘({0, 1, 2, 3})
α→
Complete the definition of γ.
α(∅) = ∅
α(X) = {n mod 4 | n ∈ X}
γ(∅) = ∅
γ(X̂) = { n | (n mod 4) ∈ X̂}
3
The collecting semantics can be described as denotational semantics:
[[n]](M ) = {n}
[[x]](M ) = {m(x) | m ∈ M }
[[E1 + E2 ]](M ) = { v1 + v2 | v1 ∈ [[E1 ]](M ), v2 ∈ [[E1 ]](M )}
where
F = λX. M ∪[[C]]([[B]](X))
1. ∀a, b ∈ A. a v a O b ∧ b v a O b
2. For all sequence (an )n∈N of abstract elements, the sequence (a0n )n∈N
defined below is ultimately stationary:
a00 = a0
a0n+1 = a’n O an
4
Problem 8. [Fixpoint Transfer Theorem] (20pts). Complete a fraction of
the following proof of the fixpoint transfer theorem which says:
Let D ← −
−−
→− D# where D and D# are CPOs. If we have a continuous
function F : D → D and a monotone function F # : D# → D# such that
F ◦ γ v γ ◦ F # . Then,
G i
lfpF v γ( F # (⊥# )))
i∈N
Problem 9. [Safe Memory Access] (10 pts). Suppose we analyze the follow-
ing program based on the interval domain. What will be the most precise
interval values we can compute for variables x, y, and z at the end of the
program?
x = 0;
y = 2;
if (*) { p = &x; }
else { p = &y; }
z = *p;
*p = 1;
5
• x: [ 0, 1 ]
• y: [ 1, 2 ]
• z: [ 0, 2 ]