proof format updates using gfm
This commit is contained in:
@@ -82,7 +82,8 @@ Let's try $R=S$.
|
||||
|
||||
Claim: The comparative ratio is $2$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Case 1: The optimal offline solution takes the elevator, then $T+E\leq S$.
|
||||
|
||||
@@ -96,13 +97,14 @@ We wait for $R$ times and then take the stairs. In worst case, we wait for $R$ t
|
||||
|
||||
Competitive ratio = $\frac{2R}{R}=2$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
Let's try $R=S-E$ instead.
|
||||
|
||||
Claim: The comparative ratio is $max\{1,2-\frac{E}{S}\}$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Case 1: The optimal offline solution takes the elevator, then $T+E\leq S$.
|
||||
|
||||
@@ -116,7 +118,7 @@ We wait for $R=S-E$ times and then take the stairs.
|
||||
|
||||
Competitive ratio = $\frac{S-E+S}{S}=2-\frac{E}{S}$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
What if we wait less time? Let's try $R=S-E-\epsilon$ for some $\epsilon>0$
|
||||
|
||||
@@ -162,7 +164,8 @@ Cache: $D A C$, the evict $D$ for $B$. 1 miss.
|
||||
|
||||
Claim: LRU is $k+1$-competitive.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Split the sequence into subsequences such that each subsequence contains $k+1$ distinct blocks.
|
||||
|
||||
@@ -174,7 +177,7 @@ The optimal offline solution: In each subsequence, must have at least $1$ miss.
|
||||
|
||||
So the competitive ratio is at most $k+1$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
Using similar analysis, we can show that LRU is $k$ competitive.
|
||||
|
||||
@@ -184,8 +187,6 @@ Split the sequence into subsequences such that each subsequence LRU has $k$ miss
|
||||
|
||||
Argue that OPT has at least $1$ miss in each subsequence.
|
||||
|
||||
QED
|
||||
|
||||
#### Many sensible algorithms are $k$-competitive
|
||||
|
||||
**Lower Bound**: No deterministic online algorithm is better than $k$-competitive.
|
||||
@@ -196,7 +197,8 @@ QED
|
||||
|
||||
Say $c=2$. LRU cache has twice as much as cache. LRU is $2$-competitive.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
LRU has cache of size $2k$.
|
||||
|
||||
@@ -210,7 +212,7 @@ So competitive ratio is at most $\frac{ck}{(c-1)k}=\frac{c}{c-1}$.
|
||||
|
||||
_Actual competitive ratio is $\sim \frac{c}{c-1+\frac{1}{k}}$._
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
### Conclusion
|
||||
|
||||
@@ -273,7 +275,8 @@ Claim: RAND is $k$-competitive.
|
||||
2. There exists $k$ pages each of which is in the cache with probability $1-\frac{1}{k}$
|
||||
3. All other pages are in the cache with probability $0$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
By induction.
|
||||
|
||||
@@ -297,11 +300,12 @@ Let $P$ be a page in the cache with probability $1-\frac{1}{k}$.
|
||||
|
||||
With probability $\frac{1}{k}$, $P$ is not in the cache and RAND evicts $P'$ in the cache and brings $P$ to the cache.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
MRU is $k$-competitive.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Case 1: Access MRU page.
|
||||
|
||||
@@ -317,4 +321,4 @@ Let's define the random variable $X$ as the number of misses of RAND MRU.
|
||||
|
||||
$E[X]\leq 1+\frac{1}{k}$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
@@ -161,7 +161,7 @@ $ISET(G,k)$ returns true if $G$ contains an independent set of size $\geq k$, a
|
||||
|
||||
Algorithm? NO! We think that this is a hard problem.
|
||||
|
||||
A lot of pQEDle have tried and could not find a poly-time solution
|
||||
A lot of people have tried and could not find a poly-time solution
|
||||
|
||||
### Example: Vertex Cover (VC)
|
||||
|
||||
|
||||
@@ -142,7 +142,8 @@ How many digits are in each integer?
|
||||
|
||||
Claim 1: If Subset Sum has a solution, then $\Psi$ is satisfiable.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Say $S'$ is a solution to Subset Sum. Then there exists a subset $S' \subseteq S$ such that $\sum_{a_i\in S'} a_i = t$. Here is an assignment of truth values to variables in $\Psi$ that satisfies $\Psi$:
|
||||
|
||||
@@ -154,11 +155,12 @@ This is a valid assignment since:
|
||||
- We pick either $v_i$ or $\overline{v_i}$
|
||||
- For each clause, at least one literal is true
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
Claim 2: If $\Psi$ is satisfiable, then Subset Sum has a solution.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
If $A$ is a satisfiable assignment for $\Psi$, then we can construct a subset $S'$ of $S$ such that $\sum_{a_i\in S'} a_i = t$.
|
||||
|
||||
@@ -174,7 +176,7 @@ Say $t=\sum$ elements we picked from $S$.
|
||||
- If $q_j=2$, then $z_j\in S'$
|
||||
- If $q_j=3$, then $y_j\in S'$
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
### Example 2: 3 Color
|
||||
|
||||
@@ -210,15 +212,16 @@ Key for dangler design:
|
||||
|
||||
Connect to all $v_i$ with true to the same color. and connect to all $v_i$ with false to another color.
|
||||
|
||||
'''
|
||||
TODO: Add dangler design image here.
|
||||
'''
|
||||
> [!TIP]
|
||||
>
|
||||
> TODO: Add dangler design image here.
|
||||
|
||||
#### Proof of reduction for 3-Color
|
||||
|
||||
Direction 1: If $\Psi$ is satisfiable, then $G$ is 3-colorable.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Say $\Psi$ is satisfiable. Then $v_i$ and $\overline{v_i}$ are in different colors.
|
||||
|
||||
@@ -228,13 +231,16 @@ For each dangler color is connected to blue, all literals cannot be blue.
|
||||
|
||||
...
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
Direction 2: If $G$ is 3-colorable, then $\Psi$ is satisfiable.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
QED
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
### Example 3:Hamiltonian cycle problem (HAMCYCLE)
|
||||
|
||||
@@ -242,9 +248,7 @@ Input: $G(V,E)$
|
||||
|
||||
Output: Does $G$ have a Hamiltonian cycle? (A cycle that visits each vertex exactly once.)
|
||||
|
||||
Proof is too hard.
|
||||
|
||||
but it is an existing NP-complete problem.
|
||||
Proof is too hard. But it is an existing NP-complete problem.
|
||||
|
||||
## On lecture
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ We could first upper bound the size of the optimal cut is at most $|E|$.
|
||||
|
||||
We will then prove that solution we found is at least half of the optimal cut $\frac{|E|}{2}$ for any graph $G$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
When we terminate, no vertex could be moved
|
||||
|
||||
@@ -153,7 +154,7 @@ Summing over all vertices, the total number of crossing edges is at least $\frac
|
||||
|
||||
So the total number of non-crossing edges is at most $\frac{|E|}{2}$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
#### Set cover
|
||||
|
||||
@@ -226,9 +227,10 @@ Need to prove its:
|
||||
|
||||
We claim that the size of the set cover found is at most $H_n\log n$ times the size of the optimal set cover.
|
||||
|
||||
###### First bound:
|
||||
Proof of first bound:
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
If the optimal picks $k$ sets, then the size of the set cover found is at most $(1+\log n)k$ sets.
|
||||
|
||||
@@ -264,15 +266,16 @@ So $n(1-\frac{1}{k})^{|C|-1}=1$, $|C|\leq 1+k\ln n$.
|
||||
|
||||
So the size of the set cover found is at most $(1+\ln n)k$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
So the greedy set cover is not too bad...
|
||||
|
||||
###### Second bound:
|
||||
Proof of second bound:
|
||||
|
||||
Greedy set cover is a $H_d$-approximation algorithm of set cover.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Assign a cost to the elements of $X$ according to the decisions of the greedy set cover.
|
||||
|
||||
@@ -350,4 +353,4 @@ $$
|
||||
|
||||
So the approximation ratio for greedy set cover is $H_d$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
@@ -260,7 +260,8 @@ $$
|
||||
|
||||
Claim: the solution to this recurrence is $E[T(n)]=O(n\log n)$ or $T(n)=c'n\log n+1$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
We prove by induction.
|
||||
|
||||
@@ -296,10 +297,13 @@ If $c'\geq 8c$, then $T(n)\leq c'n\log n+1$.
|
||||
|
||||
$E[T(n)]\leq c'n\log n+1=O(n\log n)$
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
A more elegant proof:
|
||||
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Let $X_{ij}$ be an indicator random variable that is $1$ if element of rank $i$ is compared to element of rank $j$.
|
||||
|
||||
Running time: $$X=\sum_{i=0}^{n-2}\sum_{j=i+1}^{n-1}X_{ij}$$
|
||||
@@ -344,6 +348,5 @@ E[X]&=\sum_{i=0}^{n-2}\sum_{j=i+1}^{n-1}\frac{2}{j-i+1}\\
|
||||
\end{aligned}
|
||||
$$
|
||||
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
|
||||
@@ -86,7 +86,10 @@ f(N,e):\mathbb{Z}_N^*\to \mathbb{Z}_N^*
|
||||
$$
|
||||
is a bijection.
|
||||
|
||||
Proof: Suppose $x_1^e\equiv x_2^e\mod n$
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Suppose $x_1^e\equiv x_2^e\mod n$
|
||||
|
||||
Then let $d=e^{-1}\mod \phi(N)$ (exists b/c $e\in\phi(N)^*$)
|
||||
|
||||
@@ -98,13 +101,14 @@ $x_1\equiv x_2\mod N$
|
||||
|
||||
So it's one-to-one.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
Let $y\in \mathbb{Z}_N^*$, letting $x=y^d\mod N$, where $d\equiv e^{-1}\mod \phi(N)$
|
||||
|
||||
$x^e\equiv (y^d)^e \equiv y\mod n$
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
It's easy to sample from $I$:
|
||||
|
||||
@@ -130,7 +134,7 @@ By RSA assumption
|
||||
|
||||
The second equality follows because for any finite $D$ and bijection $f:D\to D$, sampling $y\in D$ directly is equivalent to sampling $x\gets D$, then computing $y=f(x)$.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
#### Theorem If inverting RSA is hard, then factoring is hard.
|
||||
|
||||
|
||||
@@ -82,7 +82,10 @@ The NBT(Next bit test) is complete.
|
||||
|
||||
If $\{X_n\}$ on $\{0,1\}^{l(n)}$ passes NBT, then it's pseudorandom.
|
||||
|
||||
Ideas of proof: full proof is on the text.
|
||||
<details>
|
||||
<summary>Ideas of proof</summary>
|
||||
|
||||
Full proof is on the text.
|
||||
|
||||
Our idea is that we want to create $H^{l(n)}_n=\{X_n\}$ and $H^0_n=\{U_{l(n)}\}$
|
||||
|
||||
@@ -119,7 +122,7 @@ $\mathcal{D}$ can distinguish $x_{i+1}$ from a truly random $U_{i+1}$, knowing t
|
||||
|
||||
So $\mathcal{D}$ can predict $x_{i+1}$ from $x_1\dots x_i$ (contradicting with that $X$ passes NBT)
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
## Pseudorandom Generator
|
||||
|
||||
|
||||
@@ -115,7 +115,8 @@ $$
|
||||
|
||||
#### Theorem PRG exists then PRF family exists.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Let $g:\{0,1\}^n\to \{0,1\}^{2n}$ be a PRG.
|
||||
|
||||
@@ -184,6 +185,6 @@ Assume that $D$ distinguishes $f_s$ and $F\gets RF_n$ with non-negligible probab
|
||||
|
||||
By hybrid argument, there exists a hybrid $H_i$ such that $D$ distinguishes $H_i$ and $H_{i+1}$ with non-negligible probability.
|
||||
|
||||
For $H_0$,
|
||||
For $H_0$, $D$ distinguishes $H_0$ and $H_1$ with non-negligible probability.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
@@ -88,7 +88,8 @@ $$
|
||||
|
||||
is a strong one-way function.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
1. Since $\exist P.P.T.$ that computes $f(x),\forall x$ we use this $q(n)$ polynomial times to compute $g$.
|
||||
2. (Idea) $a$ has to succeed in inverting $f$ all $q(n)$ times.
|
||||
@@ -98,7 +99,7 @@ Proof:
|
||||
|
||||
Then $P[a$ inverting $g]\sim P[a$ inverts $f$ all $q(n)]$ times. $<(1-\frac{1}{p(n)})^{q(n)}=(1-\frac{1}{p(n)})^{np(n)}<(e^{-\frac{1}{p(n)}})^{np(n)}=e^{-n}$ which is negligible function.
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
_we can always force the adversary to invert the weak one-way function for polynomial time to reach the property of strong one-way function_
|
||||
|
||||
|
||||
119
content/Math4501/Math4501_L3.md
Normal file
119
content/Math4501/Math4501_L3.md
Normal file
@@ -0,0 +1,119 @@
|
||||
# Math4501 Lecture 3
|
||||
|
||||
## Review from last lecture
|
||||
|
||||
### Bisection method for finding root
|
||||
|
||||
P1. Let $f$ be a continuous function on $[a,b]\to \mathbb{R}$, find $\xi \in [a,b]$ such that $f(\xi)=0$.
|
||||
|
||||
P2. Let $g$ be a continuous function on $[a,b]\to \mathbb{R}$, find $\xi \in [a,b]$ such that $g(\xi)=\xi$.
|
||||
|
||||
#### Theorem 1:
|
||||
|
||||
solution to P1 exists if $f(a)f(b)<0$.
|
||||
|
||||
#### Theorem 2:
|
||||
|
||||
Fixed point theorem:
|
||||
|
||||
If solution to P2 exists, then $g:[a,b]\to [a,b]$.
|
||||
|
||||
#### Bijection method
|
||||
|
||||
Obtain two sequence $(a_n)_{n=1}^\infty$ and $(b_n)_{n=1}^\infty$.
|
||||
|
||||
Initially, we set $a_0=a$ and $b_0=b$.
|
||||
|
||||
If $|a_n-b_n|<2^{-n}|a_0-b_0|$, then $a_n$ and $b_n$ are Cauchy sequence. So their limit exists.
|
||||
|
||||
$\lim_{n\to\infty} a_n=\lim_{n\to\infty} b_n=\xi$.
|
||||
|
||||
### Simple iteration method
|
||||
|
||||
#### Definition of Simple Iteration
|
||||
|
||||
Given $x_0\in [a,b]$, we define a sequence $(x_n)_{n=0}^\infty$ by
|
||||
|
||||
$$
|
||||
x_{n+1}=g(x_n)
|
||||
$$
|
||||
|
||||
If a simple iteration converges, the it converges to a fixed point of
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Proof</summary>
|
||||
|
||||
Let $c\coloneqq \lim_{n\to\infty} x_n=g(c)$.
|
||||
|
||||
$g:[a,b]\to \mathbb{R}$ is continuous if and only if $g$ is continuous at $x_0\in [a,b]$.
|
||||
|
||||
</details>
|
||||
|
||||
#### Definition of Lipschitz continuous
|
||||
|
||||
A function $g:[a,b]\to \mathbb{R}$ is Lipschitz continuous if for all $x,y\in [a,b]$, there exists a constant $L>0$ such that
|
||||
|
||||
$$
|
||||
|g(x)-g(y)|\leq L|x-y|
|
||||
$$
|
||||
|
||||
for some $L>0$.
|
||||
|
||||
> [!NOTE]
|
||||
> Lipschitz continuous is a stronger condition than continuous.
|
||||
>
|
||||
> If a function is Lipschitz continuous, then it is continuous.
|
||||
>
|
||||
> However, the converse is not true.
|
||||
|
||||
#### Definition of contraction mapping
|
||||
|
||||
A function $g:[a,b]\to \mathbb{R}$ is a contraction mapping if it is Lipschitz continuous with $L<1$.
|
||||
|
||||
#### Theorem of simple iteration
|
||||
|
||||
Let $g:[a,b]\to [a,b]$ is a contraction mapping (Lipschitz continuous with $L<1$, with pointwise ontinuous $g$).
|
||||
|
||||
Then
|
||||
|
||||
- $g$ has a unique fixed point $\xi \in [a,b]$
|
||||
- Simple iteration $x_{n+1}=g(x_n)$ converges to $\xi$ for any $x_0\in [a,b]$.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Proof</summary>
|
||||
|
||||
**Uniqueness**:
|
||||
|
||||
Suppose $\xi_1$ and $\xi_2$ are two fixed points of $g$.
|
||||
|
||||
Then $|x_1-x_2|=|g(\xi_1)-g(\xi_2)|\leq L|\xi_1-\xi_2|$.
|
||||
|
||||
Thus, $(1-L)|\xi_1-\xi_2|\leq 0$, which implies $|\xi_1-\xi_2|=0$.
|
||||
|
||||
A more general result:
|
||||
|
||||
Brouwer's fixed point theorem
|
||||
|
||||
**Convergence**:
|
||||
|
||||
Let $\xi\in [a,b]$ be the unique fixed point of $g$.
|
||||
|
||||
Then,
|
||||
|
||||
$$
|
||||
\begin{aligned}
|
||||
|x_n-\xi|&=|g(x_{n-1})-g(\xi)|\\
|
||||
&\leq L|x_{n-1}-\xi|\\
|
||||
&=L|g(x_{n-2})-g(\xi)|\\
|
||||
&\leq L^2|x_{n-2}-\xi|\\
|
||||
&\vdots\\
|
||||
&\leq L^n|x_0-\xi|
|
||||
$$
|
||||
|
||||
Thus, we can always find $N$ such that $L^N|x_0-\xi|<\epsilon$ for any $\epsilon>0$. Choose $N=\log(\frac{\epsilon}{|x_0-\xi|})/\log(L)$.
|
||||
|
||||
Therefore, $x_n$ converges to $\xi$.
|
||||
|
||||
</details>
|
||||
@@ -5,4 +5,5 @@ export default {
|
||||
},
|
||||
Math4501_L1: "Numerical Applied Mathematics (Lecture 1)",
|
||||
Math4501_L2: "Numerical Applied Mathematics (Lecture 2)",
|
||||
Math4501_L3: "Numerical Applied Mathematics (Lecture 3)",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user