Answer each problem below briefly. (4 points each) Suffice it to write down the solutions; no computations are required.
(a) Given the premises \(\forall x\forall y\,(P(x,y)\to Q(x,y))\) and \(\forall x\forall y\forall z\,(P(x,y)\wedge Q(y,z)\to Q(x,z))\). What is the weakest condition for \(Q(a,b)\) to be true? That is, write down the weakest formula \(F\ (\ne Q(a,b))\) such that \(F\to Q(a,b)\) is a logical consequence of the premises.
(b) For each pair of sets below, determine if \(|A|\lt|B|\), \(|A|=|B|\), or \(|A|\gt|B|\). (N.B. \(\mathbf N\) is the set of natural numbers.) 1) \(A\) = the set of all computable functions from \(\mathbf N\) to \(\mathbf N\); \(B\) = the set of all uncomputable functions from \(\mathbf N\) to \(\mathbf N\). 2) \(A\) = the set of all C++ programs that terminate; \(B\) = the set of all C++ programs that don't terminate.
(c) Consider the following primality testing algorithm based on Fermat's little theorem
function FermatPrimalityTest(n, k)
for i = 1 to k do
generate an integer b in the interval (1, n-1] uniformly at random
if b^(n-1) ≢ 1 (mod n) then return false
return true
Given the smallest Carmichael number \(561=3\cdot11\cdot17\), what is the probability that the call FermatPrimalityTest(561,1) returns true?
(d) Find all solutions, if any, to the system of congruences \(2x\equiv4\pmod 8\),\(x\equiv6\pmod9\).
(a) 能推出 \(Q(a,b)\) 的充分條件有兩種:
① 前提 1:\(P(a,b)\to Q(a,b)\);② 前提 2:\(\exists y\,[P(a,y)\wedge Q(y,b)]\to Q(a,b)\)
把兩個充分條件 OR 起來(\(Q(a,b)\) 本身不算):
\(F=P(a,b)\ \vee\ \exists y\,[P(a,y)\wedge Q(y,b)]\)
其他條件(例如 \(\exists x\,[P(a,x)\wedge P(x,b)]\))因為 \(P\to Q\) 已被這兩項涵蓋;每個 disjunct 都是充分條件,OR 起來比任何一個都弱
(b) 1) 每個 computable function 對應一支程式(有限字串),全體可數,\(|A|=\aleph_0\);全體 \(\mathbf N\to\mathbf N\) 有 \(2^{\aleph_0}\) 個,扣掉可數個仍是 \(2^{\aleph_0}\)
1) \(|A|\lt|B|\)
2) C++ 程式是有限字串,全體可數;會停的與不會停的各自都有無窮多支,都是 countably infinite
2) \(|A|=|B|\)
(c) \(k=1\),\(b\) 取自 \((1,560]\) 的整數 \(2,\ldots,560\),共 559 個,機率相同
561 是 Carmichael number:\(\gcd(b,561)=1\) 時 \(b^{560}\equiv1\pmod{561}\),回傳 true;\(\gcd(b,561)=d\gt1\) 時 \(b^{560}\equiv1\) 會逼出 \(d\mid1\),不可能
與 561 互質的 \(b\):\(\varphi(561)=2\cdot10\cdot16=320\),其中 \(b=1\) 不在取值範圍,剩 319 個
\(\dfrac{319}{559}\)
(d) \(\gcd(2,8)=2\mid4\),兩邊除以 2:\(x\equiv2\pmod4\)
與 \(x\equiv6\pmod9\) 合併,\(\gcd(4,9)=1\),CRT 模 36;\(x\equiv6\pmod9\) 的數 \(6,15,24,33\) 中只有 6 滿足 \(x\equiv2\pmod4\)
\(x\equiv6\pmod{36}\)