Professional Documents
Culture Documents
1
J. Propp further comments: (Quote) The solution to [this] puzzle is unique; in some
cases the knowledge that the solution is unique may actually give you a short-cut to
finding the answer to a particular question, but it’s possible to find the unique solution
even without making use of the fact that the solution is unique. (Thanks to Andy
Latto for bringing this subtlety to my attention.)
I should mention that if you don’t agree with me about the answer to #19, you
will get a different solution to the puzzle than the one I had in mind. But I should also
mention that if you don’t agree with me about the answer to #19, you are just plain
wrong. :-) (End quote)
P∃ n : S . P n, then m = ∧ (n : S | P n) ≡ P m ∧ ∀ n : S . P n ⇒ m ≤ n.
on N satisfying |
Also, n $ a = i : D a . a i = n counts occurrences of n in a. Ad hoc operators: abs is
the absolute value operator, and Evn etc. are appropriate predicates of type N → B.
Note: we provide some extra information by stating that none of the equations
contain out-of-domain applications or type violations (e.g., a right-hand side outside
5). This is ensured by the designer of the test and captured in the formalization.
Calculating the solution(s) We shall use very few words; justifications are written
between h i , equation references between [ ], using [20] for the “extra eqn.”. Heuris-
tic: we scan the list various times; first looking for equations yielding an answer by
themselves, then extracting the maximum of information out of single equations, then
in combination etc.. The numbering indicates how many answers are still left.
2
20. [19] a 19 = 4 15. a 15 = h[δ], a 9 = 0i 3 Hence a 15 = 3
19. [4] a 4 = (a<5 )− (a 4) ∧ a 4 ∈ D (a<5 )− 14. [16] a 16 = ‘33012’ (a 5)
≡hDef.− i a 4 = 4 ∧ ∀ i : 4 . a i 6= 4 ⇒h[5]i a 16 = ‘33012’2 (a 16)
18. [0] a 0 = ∧ | i: 5 | ai = 1 ⇒hCalcul. ◦i a 16 = ‘11330’ (a 16)
≡ hProp. ∧ | i a (a 0) = 1 [α] ⇒hFixpointsi a 16 = 1 ∨ a 16 = 3
∧ ∀i: 5.ai = 1 ⇒ a0 ≤ i [β] [1] ⇒hNotei ∃ i : 5 . a (i + 5) = a (i + 6)
[α] ⇒hSubstitute a 0 = 0i a 0 6= 0 [α′ ] ⇒hCh. var.i ∃ i : 5 .. 9 . a i = a (i + 1)
[β] ⇒hInstantiate i := 0i a 0 6= 1 [β ′ ] ⇒h[20]i ∀ i : 10 .. 18 . a i 6= a (i + 1)
[2] a 2 = 4 $ a ⇒hInstantiate i := 15i a 15 6= a 16
⇒ha 4 = a 19 = 4i a 2 ≥ 2 [γ ′′ ] ⇒ha 15 = 3i a 16 6= 3
⇒hPut a 0 = 2 in [α]i a 0 6= 2 [γ ′ ] ⇒ha 16 = 1 ∨ a 16 = 3i a 16 = 1
[4] ⇒hStep #19.i ∀ i : 4 . a i 6= 4 13. a 5 = h[5], a 16 = 1i 3 Hence a 5 = 3
⇒hInstantiate i := 0i a 0 6= 4 12. [6] a 6 = 4 − abs (a 7 − a 6)
⇒h[α′ , β ′ , γ ′ ], a 0 ∈ 5i a 0 = 3 ⇒hArithmetici a 6 = 4 − (a 7 − a 6)
17. [α] ⇒ha 0 = 3i a 3 = 1 ⇒h[3]i 0 $ a = 5 ∨ a 6 = 4 − (a 6 − a 7)
16. [9] a 9 = ‘30412’− (a 15) ⇒hArithmetici a 7 = 4
⇒hProp. − i a 15 = ‘30412’ (a 9) [δ] ∨ a 7 = 2 · (a 6 − 2)
[15] a 15 = ‘32104’− (a 9), hence: ⇒hWeakeni Evn (a 7)
a 9 = hProp. − i ‘32104’ (a 15) [7] a 7 = (0 $ a + 4 $ a) − 4
= h[δ]i ‘32104’ (‘30412’ (a 9)) ⇒h[2, 3], a 3 = 1i a 7 = a 2 + 1 [σ]
= hDef. ◦i (‘32104’ ◦ ‘30412’) (a 9) ⇒h[γ ′′ ] a 2 ≥ 2i a 7 ≥ 3
= hCalcul. ◦i ‘03421’ (a 9) ⇒hEvn (a 7)i a 7 = 4
= hFixpointsi 0 Hence a 9 = 0 11. [σ] ⇒ha 7 = 4i a 2 = 3
We make a halfway inventory. Remark: no more answers can be 4 (all used up).
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
ai 3 3 1 4 3 4 0 3 1 4
10. [12] a 12 = ((aEvn )− 0 − 8)/2 5. [8] a 8 = ∧| i : 5 | a (i + 9) = a 8
a 12 = 0 ≡hDef. − i (aEvn )− 0 = 12 ⇒ hProp. ∧ | i a (a 8 + 9) = a 8 [κ]
≡hEq. 12i a 12 = 2 a 8 = 0 ⇒h[12], a 12 6= 0i 0
a 12 = 1 ≡hEq. 12i (aEvn )− 0 = 10 a 8 = 1 ⇒h[κ, 10]i a 10 = 1 ∧ a 10 = 2
≡hDef. − i a 10 = 0 a 8 = 2 ⇒h[κ], 8.i a 11 = 2 ∧ a 11 = 0
≡h[10], a 3 = 1i 0 So a 8 6∈ {0, 1, 2}, hence a 8 = 3
So a 12 6∈ {0, 1, 2}, hence a 12 = 3 4. [10] a 10 = 1 $ a<10
9. [12] ⇒ha 12 = 3, def. −i a 14 = 0 ⇒ha<10 = ‘3031433430’i a 10 = 1
i 0 1 2 3 4
8. [14] a 14 = a 11 ⇒ha 14 = 0i a 11 = 0 3. Table for b := a6∈{13,17,18} :
i$b 4 3 0 7 4
7. Lemma: ∀ i : 6 .. 9 . a i 6= a (i + 1) Exactly one answer 0 remains (0 $ a = 5).
Proof: use {a 6, a 8, a 10} ∩ {0, 4} = ∅ [17] ⇒ha 17 6= 4, 0 $ a = 5i
[1] ⇒hStep 14.i ∃ i : 5 .. 9 . a i = a (i + 1) a 17 = (($ a) ⌉ (1 .. 4))− 5 − 1 [µ]
⇒hLemmai a 5 = a 6 ⇒hNote, prop.− i ∃! i : 1 .. 4 . i $ a = 5
⇒ha 5 = 3i a 6 = 3 ⇒hArith.i 1 $ a = 5 ⇒h[µ], 1 $ b = 3i
a 17 = 0 ∧ a 13 = a 18 = 1
6. [1] a 1 = ∧
| i : 5 | a (i + 5) = a (i + 6)
⇒hAs before, a 5 = a 6i a 1 = 0 0. Result: a = ‘30314334301031031014’.
References
[1] R. Boute, “Concrete Generic Functionals: Principles, Design and Applications”, in:
Jeremy Gibbons, Johan Jeuring, eds., Generic Programming, pp. 89–119, Kluwer (2003)