├── .gitignore ├── Analysis-of-Boolean-Functions ├── README.md ├── chap01 │ └── chap01.tex ├── chap02 │ └── chap02.tex ├── chap03 │ └── chap03.tex ├── chap04 │ └── chap04.tex ├── chap05 │ └── chap05.tex ├── chap06 │ └── chap06.tex ├── chap07 │ └── chap07.tex ├── chap08 │ └── chap08.tex └── chap09 │ └── chap09.tex ├── Computational-Complexity-A-Modern-Approach ├── README.md ├── chap01 │ └── chap01.tex ├── chap02 │ └── chap02.tex ├── chap03 │ └── chap03.tex ├── chap04 │ └── chap04.tex ├── chap05 │ └── chap05.tex ├── chap06 │ └── chap06.tex ├── chap07 │ └── chap07.tex ├── chap08 │ └── chap08.tex ├── chap09 │ └── chap09.tex ├── chap10 │ └── chap10.tex ├── chap11 │ └── chap11.tex ├── chap12 │ └── chap12.tex ├── chap13 │ └── chap13.tex ├── chap14 │ └── chap14.tex ├── chap15 │ └── chap15.tex ├── chap16 │ └── chap16.tex ├── chap17 │ └── chap17.tex ├── chap18 │ └── chap18.tex ├── chap19 │ └── chap19.tex ├── chap20 │ └── chap20.tex ├── chap21 │ └── chap21.tex └── chap22 │ └── chap22.tex ├── Introduction-to-Automata-Theory-Languages-and-Computation ├── README.md ├── chap02 │ └── chap02.tex ├── chap03 │ └── chap03.tex ├── chap04 │ └── chap04.tex ├── chap05 │ └── chap05.tex ├── chap06 │ └── chap06.tex ├── chap07 │ └── chap07.tex ├── chap08 │ └── chap08.tex ├── chap09 │ └── chap09.tex ├── chap10 │ └── chap10.tex └── chap11 │ └── chap11.tex ├── Introduction-to-Modern-Cryptography ├── README.md ├── chap01 │ └── chap01.tex ├── chap02 │ └── chap02.tex ├── chap03 │ └── chap03.tex ├── chap04 │ ├── chap04.tex │ └── pics │ │ ├── algo1.tex │ │ ├── algo2.tex │ │ └── algo3.tex ├── chap05 │ └── chap05.tex ├── chap06 │ └── chap06.tex ├── chap07 │ └── chap07.tex ├── chap08 │ └── chap08.tex ├── chap10 │ └── chap10.tex ├── chap11 │ └── chap11.tex └── chap12 │ └── chap12.tex ├── LICENSE ├── README.md └── The-Probabilistic-Method ├── README.md ├── chap01 ├── chap01.tex └── ref.bib ├── chap02 └── chap02.tex ├── chap03 └── chap03.tex ├── chap04 └── chap04.tex ├── chap05 ├── chap05.tex └── ex7.cpp ├── chap06 └── chap06.tex ├── chap07 └── chap07.tex ├── chap09 └── chap09.tex ├── chap12 └── chap12.tex └── chap16 └── chap16.tex /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.pdf 3 | *.aux 4 | *.lof 5 | *.log 6 | *.lot 7 | *.fls 8 | *.out 9 | *.toc 10 | *.fmt 11 | *.fot 12 | *.cb 13 | *.cb2 14 | .*.lb 15 | 16 | ## Intermediate documents: 17 | *.dvi 18 | *.xdv 19 | *-converted-to.* 20 | # these rules might exclude image files for figures etc. 21 | # *.ps 22 | # *.eps 23 | # *.pdf 24 | 25 | ## Generated if empty string is given at "Please type another file name for output:" 26 | .pdf 27 | 28 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 29 | *.bbl 30 | *.bcf 31 | *.blg 32 | *-blx.aux 33 | *-blx.bib 34 | *.run.xml 35 | 36 | ## Build tool auxiliary files: 37 | *.fdb_latexmk 38 | *.synctex 39 | *.synctex(busy) 40 | *.synctex.gz 41 | *.synctex.gz(busy) 42 | *.pdfsync 43 | 44 | ## Auxiliary and intermediate files from other packages: 45 | # algorithms 46 | *.alg 47 | *.loa 48 | 49 | # achemso 50 | acs-*.bib 51 | 52 | # amsthm 53 | *.thm 54 | 55 | # beamer 56 | *.nav 57 | *.pre 58 | *.snm 59 | *.vrb 60 | 61 | # changes 62 | *.soc 63 | 64 | # cprotect 65 | *.cpt 66 | 67 | # elsarticle (documentclass of Elsevier journals) 68 | *.spl 69 | 70 | # endnotes 71 | *.ent 72 | 73 | # fixme 74 | *.lox 75 | 76 | # feynmf/feynmp 77 | *.mf 78 | *.mp 79 | *.t[1-9] 80 | *.t[1-9][0-9] 81 | *.tfm 82 | 83 | #(r)(e)ledmac/(r)(e)ledpar 84 | *.end 85 | *.?end 86 | *.[1-9] 87 | *.[1-9][0-9] 88 | *.[1-9][0-9][0-9] 89 | *.[1-9]R 90 | *.[1-9][0-9]R 91 | *.[1-9][0-9][0-9]R 92 | *.eledsec[1-9] 93 | *.eledsec[1-9]R 94 | *.eledsec[1-9][0-9] 95 | *.eledsec[1-9][0-9]R 96 | *.eledsec[1-9][0-9][0-9] 97 | *.eledsec[1-9][0-9][0-9]R 98 | 99 | # glossaries 100 | *.acn 101 | *.acr 102 | *.glg 103 | *.glo 104 | *.gls 105 | *.glsdefs 106 | 107 | # gnuplottex 108 | *-gnuplottex-* 109 | 110 | # gregoriotex 111 | *.gaux 112 | *.gtex 113 | 114 | # htlatex 115 | *.4ct 116 | *.4tc 117 | *.idv 118 | *.lg 119 | *.trc 120 | *.xref 121 | 122 | # hyperref 123 | *.brf 124 | 125 | # knitr 126 | *-concordance.tex 127 | # TODO Comment the next line if you want to keep your tikz graphics files 128 | *.tikz 129 | *-tikzDictionary 130 | 131 | # listings 132 | *.lol 133 | 134 | # makeidx 135 | *.idx 136 | *.ilg 137 | *.ind 138 | *.ist 139 | 140 | # minitoc 141 | *.maf 142 | *.mlf 143 | *.mlt 144 | *.mtc[0-9]* 145 | *.slf[0-9]* 146 | *.slt[0-9]* 147 | *.stc[0-9]* 148 | 149 | # minted 150 | _minted* 151 | *.pyg 152 | 153 | # morewrites 154 | *.mw 155 | 156 | # nomencl 157 | *.nlg 158 | *.nlo 159 | *.nls 160 | 161 | # pax 162 | *.pax 163 | 164 | # pdfpcnotes 165 | *.pdfpc 166 | 167 | # sagetex 168 | *.sagetex.sage 169 | *.sagetex.py 170 | *.sagetex.scmd 171 | 172 | # scrwfile 173 | *.wrt 174 | 175 | # sympy 176 | *.sout 177 | *.sympy 178 | sympy-plots-for-*.tex/ 179 | 180 | # pdfcomment 181 | *.upa 182 | *.upb 183 | 184 | # pythontex 185 | *.pytxcode 186 | pythontex-files-*/ 187 | 188 | # thmtools 189 | *.loe 190 | 191 | # TikZ & PGF 192 | *.dpth 193 | *.md5 194 | *.auxlock 195 | 196 | # todonotes 197 | *.tdo 198 | 199 | # easy-todo 200 | *.lod 201 | 202 | # xmpincl 203 | *.xmpi 204 | 205 | # xindy 206 | *.xdy 207 | 208 | # xypic precompiled matrices 209 | *.xyc 210 | 211 | # endfloat 212 | *.ttt 213 | *.fff 214 | 215 | # Latexian 216 | TSWLatexianTemp* 217 | 218 | ## Editors: 219 | # WinEdt 220 | *.bak 221 | *.sav 222 | 223 | # Texpad 224 | .texpadtmp 225 | 226 | # Kile 227 | *.backup 228 | 229 | # KBibTeX 230 | *~[0-9]* 231 | 232 | # auto folder when using emacs and auctex 233 | ./auto/* 234 | *.el 235 | 236 | # expex forward references with \gathertags 237 | *-tags.tex 238 | 239 | # standalone packages 240 | *.sta 241 | 242 | # generated if using elsarticle.cls 243 | *.spl 244 | -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/README.md: -------------------------------------------------------------------------------- 1 | ## Analysis of Boolean Functions 2 | 3 | By Ryan O'Donnell -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/chap01/chap01.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \newcommand{\abs}[1]{{\left| #1 \right|}} 57 | \newcommand{\vabs}[1]{{\left\| #1 \right\|}} 58 | \newcommand{\abra}[1]{{\left\langle #1 \right\rangle}} 59 | \newcommand{\pbra}[1]{{\left( #1 \right)}} 60 | \newcommand{\cbra}[1]{{\left\{ #1 \right\}}} 61 | \newcommand{\sbra}[1]{{\left[ #1 \right]}} 62 | \newcommand{\floorbra}[1]{{\left\lfloor #1 \right\rfloor}} 63 | \newcommand{\ceilbra}[1]{{\left\lceil #1 \right\rceil}} 64 | \newcommand{\bin}{{\{0,1\}}} 65 | \newcommand{\pmbin}{{\{-1,1\}}} 66 | \newcommand{\ZPP}{\mathtt{ZPP}} 67 | \newcommand{\RP}{\mathtt{RP}} 68 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 69 | \newcommand{\per}{\text{per}} 70 | \newcommand{\sgn}{\text{sgn}} 71 | \newcommand{\Fbb}{\mathbb{F}} 72 | \newcommand{\Nbb}{\mathbb{N}} 73 | \newcommand{\Rbb}{\mathbb{R}} 74 | \newcommand{\Zbb}{\mathbb{Z}} 75 | \newcommand{\Acal}{\mathcal{A}} 76 | \newcommand{\Bcal}{\mathcal{B}} 77 | \newcommand{\Ccal}{\mathcal{C}} 78 | \newcommand{\Fcal}{\mathcal{F}} 79 | \newcommand{\Gcal}{\mathcal{G}} 80 | 81 | \bibliographystyle{plainnat} 82 | 83 | \title{Exercise Set --- Chapter $1$} 84 | \date{} 85 | 86 | \begin{document} 87 | 88 | \maketitle 89 | 90 | \begin{exercise}{1.1} 91 | \begin{itemize} 92 | \item[(a)] $\text{min}_2(x_1,x_2)=-\frac12+\frac12x_1+\frac12x_2+\frac12x_1x_2$. 93 | \item[(b)] $\text{min}_3(x_1,x_2,x_3)=\text{min}_2(\text{min}_2(x_1,x_2),x_3)=\frac{(x_1+1)(x_2+1)(x_3+1)}4-1 94 | =-\frac34+\frac14\sum_{S\neq\emptyset}\chi_S(x)$. 95 | 96 | $\text{max}_3(x)=-\text{min}_3(-x)=\frac34-\frac14\sum_{S\neq\emptyset}(-1)^{|S|}\chi_S(x)$. 97 | \item[(c)] $\widehat{1_\cbra{a}}(S)=\E\sbra{1_\cbra{a}(x)\chi_S(x)}=2^{-n}(-1)^{\sum_{i\in S}a_i}$. 98 | \item[(d)] $\phi_\cbra{a}(x)=2^n1_\cbra{a}$, 99 | so $\widehat{\phi_\cbra{a}}(S)=2^n\widehat{1_\cbra{a}}(S)=(-1)^{\sum_{i\in S}a_i}$. 100 | \item[(e)] 101 | $$ 102 | \widehat{\phi_\cbra{a,a+e_i}}(S)=\E_{x\sim\phi_\cbra{a,a+e_i}}\sbra{\chi_S(x)} 103 | =\frac12\chi_S(a)+\frac12\chi_S(a+e_i)=\frac12\chi_S(a)\pbra{1+\chi_S(e_i)}=\begin{cases} 104 | 0&i\in S\\ 105 | (-1)^{\sum_{j\in S}a_j}&i\notin S. 106 | \end{cases} 107 | $$ 108 | \item[(f)] Let $\phi$ be the corresponding density function, then 109 | $$ 110 | \widehat{\phi}(S)=\E_{x\sim\phi}\sbra{\chi_S(x)}=\prod_{i\in S}\E_{x\sim\phi}\sbra{x_i}=\rho^{|S|}. 111 | $$ 112 | \item[(g)] $\widehat{\text{IP}_{2n}}(S_1,S_2)=\E\sbra{\text{IP}_{2n}(x,y)\chi_{S_1,S_2}(x,y)} 113 | =\prod_{i=1}^n\E\sbra{(-1)^{x_iy_i+1_{S_1}(i)x_i+1_{S_2}(i)y_i}}=(-1)^{|S_1\cap S_2|}2^{-n}$. 114 | \item[(h)] $\widehat{\text{Equ}_n}(S)=\E\sbra{\text{Equ}_n(x)\chi_S(x)}=2^{-n}\pbra{\chi_S(\bm1)+\chi_S(\bm{-1})} 115 | =2^{-n+1}(-1)^{|S|}.$ 116 | \item[(i)] $\text{NAE}_n(x)=1-\text{Equ}_n(x)$, so 117 | $$ 118 | \widehat{\text{NAE}_n}(S)=\begin{cases} 119 | -2^{-n+1}(-1)^{|S|}&S\neq\emptyset\\ 120 | 1-2^{-n+1}&S=\emptyset. 121 | \end{cases} 122 | $$ 123 | \item[(j)] $\widehat{\text{Sel}}(x)=x_2\frac{1-x_1}2+x_3\frac{1+x_1}2=\frac12x_2+\frac12x_3-\frac12x_1x_2+\frac12x_1x_3$. 124 | \item[(k)] $\widehat{\text{mod}_3}(S)=\E\sbra{\text{mod}_3(x)\chi_S(x)}=\frac18\pbra{\chi_S(\bm0)+\chi_S(\bm1)} 125 | =\frac18\pbra{1+(-1)^{|S|}}$. 126 | \item[(l)] $x_2\oplus x_3=\frac{1-(-1)^{x_2+x_3}}2$, so 127 | \begin{align*} 128 | \text{OXR}(x) 129 | &=\frac{1-(-1)^{x_1}}2+\frac{1-(-1)^{x_2+x_3}}2-\frac{1-(-1)^{x_1}}2\frac{1-(-1)^{x_2+x_3}}2\\ 130 | &=\frac34-\frac14\chi_\cbra{1}(x)-\frac14\chi_\cbra{2,3}(x)-\frac14\chi_\cbra{1,2,3}(x). 131 | \end{align*} 132 | %\item[(m)] \item[(n)] \item[(o)] \item[(p)] 133 | \end{itemize} 134 | \end{exercise} 135 | 136 | \begin{exercise}{1.2} 137 | $2^n\times 2$. 138 | \end{exercise} 139 | 140 | \begin{exercise}{1.3} 141 | $2^n\widehat f(S)=2^n\E\sbra{f(x)\chi_S(x)}=\sum_{x\in f^{-1}(1)}\chi_S(x)\equiv\abs{f^{-1}(1)}\equiv1\mod2$. 142 | \end{exercise} 143 | 144 | \begin{exercise}{1.4} 145 | $\E_{y\sim\mu}\sbra{f(y)}=\sum_S\widehat f(S)\E_{y\sim\mu}\sbra{x^S}=\sum_S\widehat f(S)\mu^S$. 146 | \end{exercise} 147 | 148 | \begin{exercise}{1.5} 149 | Since $1=\vabs{f}_2=\sqrt{\E\sbra{f^2}}=\sqrt{\sum_S\widehat{f}(S)^2}$, the claim holds for all such $f$. 150 | \end{exercise} 151 | 152 | \begin{exercise}{1.6} 153 | Assume $f:\pmbin^n\to\pmbin$ has two different Fourier expansion $a(x)=\sum_Sa_Sx^S,b(x)=\sum_Sb_Sx^S$. 154 | Then $0\equiv a(x)-b(x)=\sum_S(a_S-b_S)x^S$ and 155 | $$ 156 | 0=\vabs{a-b}_2=\sum_S(a_S-b_S)^2, 157 | $$ 158 | which gives $a_S=b_S$ for all $S\in[n]$. A contradiction. 159 | \end{exercise} 160 | 161 | \begin{exercise}{1.7} 162 | $\E_f\sbra{\widehat f(S)}=\E_f\sbra{\E_x\sbra{f(x)x^S}}=\E_f\sbra{2^{-n}\sum_xf(x)x^S}=0$. 163 | 164 | $\E_f\sbra{\widehat f(S)^2}=\E_f\sbra{2^{-2n}\sum_{x,y}f(x)f(y)x^Sy^S}=2^{-n}$. 165 | \end{exercise} 166 | 167 | \begin{exercise}{1.8} 168 | \begin{itemize} 169 | \item[(a)] $\widehat{f^\dag}(S)=(-1)^{|S|+1}\widehat f(S)$. 170 | \item[(c)] Plug in $\widehat{f^\text{odd}}(S)=\frac12\pbra{\widehat f(S)+\widehat{f^\dag}(S)}$. 171 | \end{itemize} 172 | \end{exercise} 173 | 174 | \end{document} 175 | -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/chap03/chap03.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \DeclareMathOperator{\sd}{\mathop{d}} 57 | \newcommand{\eps}{\varepsilon} 58 | \newcommand{\abs}[1]{{\left| #1 \right|}} 59 | \newcommand{\vabs}[1]{{\left\| #1 \right\|}} 60 | \newcommand{\hvabs}[1]{{\hat{\|} #1 \hat{\|}}} 61 | \newcommand{\abra}[1]{{\left\langle #1 \right\rangle}} 62 | \newcommand{\pbra}[1]{{\left( #1 \right)}} 63 | \newcommand{\cbra}[1]{{\left\{ #1 \right\}}} 64 | \newcommand{\sbra}[1]{{\left[ #1 \right]}} 65 | \newcommand{\floorbra}[1]{{\left\lfloor #1 \right\rfloor}} 66 | \newcommand{\ceilbra}[1]{{\left\lceil #1 \right\rceil}} 67 | \newcommand{\bin}{{\{0,1\}}} 68 | \newcommand{\pmbin}{{\{-1,1\}}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | \newcommand{\Acal}{\mathcal{A}} 75 | \newcommand{\Bcal}{\mathcal{B}} 76 | \newcommand{\Ccal}{\mathcal{C}} 77 | \newcommand{\Fcal}{\mathcal{F}} 78 | \newcommand{\Gcal}{\mathcal{G}} 79 | \newcommand{\Ncal}{\mathcal{N}} 80 | \newcommand{\Inf}{\mathtt{Inf}} 81 | \newcommand{\MaxInf}{\mathtt{MaxInf}} 82 | \newcommand{\Dtt}{\mathtt{D}} 83 | \newcommand{\Itt}{\mathtt{I}} 84 | \newcommand{\Ltt}{\mathtt{L}} 85 | \newcommand{\Wtt}{\mathtt{W}} 86 | \newcommand{\Ttt}{\mathtt{T}} 87 | \newcommand{\Stab}{\mathtt{Stab}} 88 | \newcommand{\NS}{\mathtt{NS}} 89 | 90 | \bibliographystyle{plainnat} 91 | 92 | \title{Exercise Set --- Chapter $3$} 93 | \date{} 94 | 95 | \begin{document} 96 | 97 | \maketitle 98 | 99 | \begin{exercise}{3.3} 100 | $$ 101 | \E[f^2]-\Stab_{1-\delta}[f]=\sum_S(1-(1-\delta)^{|S|})\hat f(S)^2\geq(1-(1-\delta)^{1/\delta})\Wtt^{\geq1/\delta}[f] 102 | \geq(1-1/e)\eps. 103 | $$ 104 | \end{exercise} 105 | 106 | \begin{exercise}{3.9} 107 | Since $\hvabs{f}_\infty=\max_S\abs{\hat f(S)},\vabs{f}_1=\E[|f|],\hvabs{f}_1=\sum_S\abs{\hat f(S)}$, we have 108 | $$ 109 | \hvabs{f}_\infty=\max_S\abs{\E\sbra{f(x)x^S}}\leq\max_S\E\sbra{|f|}=\vabs{f}_1 110 | $$ 111 | and 112 | $$ 113 | \vabs{f}_1=\E\sbra{\abs{\sum_S\hat f(S)x^S}}\leq\E\sbra{\sum_S\abs{\hat f(S)}}=\hvabs{f}_1. 114 | $$ 115 | \end{exercise} 116 | 117 | \begin{exercise}{3.10} 118 | $$ 119 | \abs{\hat f(S)} 120 | =\abs{\E\sbra{\frac{f(x^{i\to1})-f(x^{i\to-1})}2x^{S\backslash\cbra{i}}}} 121 | \leq\E\sbra{\abs{\frac{f(x^{i\to1})-f(x^{i\to-1})}2}} 122 | =\E\sbra{\frac{f(x^{i\to1})-f(x^{i\to-1})}2} 123 | =\hat f(i) 124 | $$ 125 | \end{exercise} 126 | 127 | \begin{exercise}{3.16} 128 | Let's choose $\Fcal$ to contain the top $\hvabs{f}_1^2/\eps$ ones (in absolute value). 129 | Then $\abs{\hat f(S)}\leq\hvabs{f}_1/|\Fcal|=\eps/\hvabs{f}_1$ holds for any $S\notin\Fcal$, thus 130 | $$ 131 | \sum_{S\notin\Fcal}\hat f(S)^2\leq\frac\eps{\hvabs{f}_1}\sum_{S\notin\Fcal}\abs{\hat f(S)}\leq\eps. 132 | $$ 133 | \end{exercise} 134 | 135 | \begin{exercise}{3.35} 136 | \begin{itemize} 137 | \item[(a)] For $n=2$, let $f_2=x_1\lor x_2=\frac12\pbra{x_1x_2+x_1+x_2-1}$. Then for $n=2k$, we construct 138 | $$ 139 | f_{2k}=\prod_{i=1}^kf_2(x_{2i-1},x_{2i}) 140 | =2^{-n/2}\prod_{i=1}^k\pbra{x_{2i-1}x_{2i}+x_{2i-1}+x_{2i}-1}. 141 | $$ 142 | \end{itemize} 143 | \end{exercise} 144 | 145 | \begin{exercise}{3.45} 146 | \begin{itemize} 147 | \item[(a)] Let 148 | $$ 149 | B=\cbra{s\middle|\Pr_r\sbra{A(r,f(s))=r\cdot s}\geq\frac12+\frac12\gamma}. 150 | $$ 151 | Then 152 | $$ 153 | \frac12+\gamma\leq\Pr_{r,s}\sbra{A(r,f(s))=r\cdot s}\leq\frac{|B|}{2^n}+\pbra{1-\frac{|B|}{2^n}}\pbra{\frac12+\frac12\gamma}, 154 | $$ 155 | which means $|B|/2^n\geq\frac{\gamma}{1-\gamma}\geq\gamma/2$. 156 | \item[(b)] Let $t=f(s)$, then 157 | $$ 158 | \widehat{A_{|t}}(s)=\E_r\sbra{A(r,t)(-1)^{r\cdot s}}=\Pr_r[A(r,t)=r\cdot s]-\Pr_r[A(r,t)\neq r\cdot s] 159 | \geq\gamma. 160 | $$ 161 | \item[(c)] Since 162 | $$ 163 | \sum_{t}\hat A(s\circ t)^2=\E_z\sbra{\widehat{A_{|z}}(s)^2}\geq\widehat{A_{|t}}(s)^2\geq\gamma^2, 164 | $$ 165 | we will find $s$ using Goldreich-Levin algorithm by setting threshold at $\poly\gamma$ and early stopping when 166 | the first $n$ bits (i.e., the $s$ part) are revealed; then we check its value against the input image $f(s)$. 167 | The running time is within $\poly(n,m,1/\gamma)$. 168 | \item[(d)] We can derandomize $A$ by hard-wiring the best random seed. 169 | \end{itemize} 170 | \end{exercise} 171 | 172 | \end{document} 173 | -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/chap04/chap04.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \DeclareMathOperator{\sd}{\mathop{d}} 57 | \newcommand{\eps}{\varepsilon} 58 | \newcommand{\abs}[1]{{\left| #1 \right|}} 59 | \newcommand{\vabs}[1]{{\left\| #1 \right\|}} 60 | \newcommand{\hvabs}[1]{{\hat{\|} #1 \hat{\|}}} 61 | \newcommand{\abra}[1]{{\left\langle #1 \right\rangle}} 62 | \newcommand{\pbra}[1]{{\left( #1 \right)}} 63 | \newcommand{\cbra}[1]{{\left\{ #1 \right\}}} 64 | \newcommand{\sbra}[1]{{\left[ #1 \right]}} 65 | \newcommand{\floorbra}[1]{{\left\lfloor #1 \right\rfloor}} 66 | \newcommand{\ceilbra}[1]{{\left\lceil #1 \right\rceil}} 67 | \newcommand{\bin}{{\{0,1\}}} 68 | \newcommand{\pmbin}{{\{-1,1\}}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | \newcommand{\Acal}{\mathcal{A}} 75 | \newcommand{\Bcal}{\mathcal{B}} 76 | \newcommand{\Ccal}{\mathcal{C}} 77 | \newcommand{\Fcal}{\mathcal{F}} 78 | \newcommand{\Gcal}{\mathcal{G}} 79 | \newcommand{\Ncal}{\mathcal{N}} 80 | \newcommand{\Inf}{\mathtt{Inf}} 81 | \newcommand{\MaxInf}{\mathtt{MaxInf}} 82 | \newcommand{\Dtt}{\mathtt{D}} 83 | \newcommand{\Itt}{\mathtt{I}} 84 | \newcommand{\Ltt}{\mathtt{L}} 85 | \newcommand{\Wtt}{\mathtt{W}} 86 | \newcommand{\Ttt}{\mathtt{T}} 87 | \newcommand{\Stab}{\mathtt{Stab}} 88 | \newcommand{\NS}{\mathtt{NS}} 89 | 90 | \bibliographystyle{plainnat} 91 | 92 | \title{Exercise Set --- Chapter $4$} 93 | \date{} 94 | 95 | \begin{document} 96 | 97 | \maketitle 98 | 99 | \begin{exercise}{4.4} 100 | \begin{itemize} 101 | \item[(a)] First assume $\abs{\hat f(\emptyset)}<1/4s$. 102 | Then there exists some term $C_i$ that 103 | $$ 104 | \Pr\sbra{C_i(x)=1\mid f(x)=1}\geq\frac1s, 105 | $$ 106 | which means 107 | \begin{align*} 108 | \E\sbra{f(x)\cdot C_i(x)} 109 | &=\Pr\sbra{f(x)=-1}+\Pr\sbra{f(x)=C_i(x)=1}-\Pr\sbra{f(x)=1,C_i(x)=-1}\\ 110 | &\geq\frac12-\frac1{8s}+\pbra{\frac12-\frac1{8s}}\frac1s-\pbra{\frac12+\frac1{8s}}\pbra{1-\frac1s}\\ 111 | &=\frac3{4s}. 112 | \end{align*} 113 | Assume $C_i$ has width $w$, then $C_i(x)+1=2^{-w+1}\prod_i(1+x_i)=2\E_{S\subset[w]}\sbra{\chi_S(x)}$, thus 114 | $$ 115 | \E_{S\subset[w]}\sbra{\hat f(S)} 116 | =\E\sbra{f(x)\E_S\sbra{\chi_S(x)}} 117 | =\frac12\E\sbra{f(x)\cdot (C_i(x)+1)} 118 | \geq\frac12\pbra{\frac3{4s}-\frac1{4s}}=\frac1{4s}. 119 | $$ 120 | In particular, we have some $\hat f(S)\geq1/4s$ with $|S|\leq w$. 121 | Now it suffices to prove $w\leq\log s+2$, which follows from 122 | $$ 123 | 2^{-w}=\Pr\sbra{C_i(x)=1}=\Pr\sbra{C_i(x)=1,f(x)=1}\geq\pbra{\frac12-\frac1{8s}}\frac1s>\frac1{4s}. 124 | $$ 125 | \item[(b)] 126 | By setting threshold at $\poly(1/s)$ in Goldreich-Levin algorithm, we can find some $S$ with $\abs{\hat f(S)}\geq1/4s$. 127 | Assume $\hat f(S)\geq1/4s$ (which can be verified in time $\poly(n,s)$), then we use $\chi_S(x)$ (otherwise we use $-\chi_S(x)$) as the weak learner. 128 | Its error is 129 | $$ 130 | \E\sbra{\pbra{\frac{\chi_S(x)-f(x)}2}^2}=\frac12\pbra{1-\E\sbra{f(x)\chi_S(x)}}\leq\frac12-\frac1{8s}. 131 | $$ 132 | \end{itemize} 133 | \end{exercise} 134 | 135 | \begin{exercise}{4.7} 136 | We change the output of $\text{Tribes}_n$ on a small set of inputs to make it unbiased. Since $\text{Tribes}_n$ is already close to unbiased, the modification shall not change any $\Inf_i$ a lot. 137 | \end{exercise} 138 | 139 | \begin{exercise}{4.12} 140 | \begin{itemize} 141 | \item[(c)] $\text{XOR}_n=\text{XOR}_{\sqrt n}\pbra{\text{XOR}_{\sqrt n},\ldots,\text{XOR}_{\sqrt n}}$. 142 | Let the outer $\text{XOR}_{\sqrt n}$ be a size-$2^{\sqrt n}$ CNF, and all inner $\text{XOR}_{\sqrt n}$ be 143 | size-$2^{\sqrt n}$ DNF. So the middle two layers merge and the total size is $O\pbra{\sqrt n2^{\sqrt n}}$. 144 | \item[(c)] Write $\text{XOR}_n$ as leveled composition of $\text{XOR}_{n^{1/(d-1)}}$, and use DNF/CNF alternatively for each level. 145 | \end{itemize} 146 | \end{exercise} 147 | 148 | \begin{exercise}{4.16} 149 | Since $f$ is non-trivial transitive-symmetric, $\Inf_i[f]=\MaxInf[f]=\Omega(\log n/n)\Var[f]=\Omega(\log n/n)$ holds for any $i$. 150 | Then we have $\Itt[f]=n\Inf_i[f]=\Omega(\log n)$. 151 | \end{exercise} 152 | 153 | \begin{exercise}{4.17} 154 | \begin{itemize} 155 | \item[(b)] 156 | $$ 157 | p(x) 158 | =\sum_{s\in\cbra{\Itt_j,\neg\Itt_j}^{\otimes j}}\Pr[s]\Pr\sbra{\bm x=x\mid s} 159 | =\sum_{s\in\cbra{\Itt_j,\neg\Itt_j}^{\otimes j}}\Pr[s](1/2)^{n-\sum_j s_j} 160 | =\E\sbra{\prod(1/2)^{1-\Itt_j}}. 161 | $$ 162 | \item[(c)] 163 | $$ 164 | 2^np(x)=\E\sbra{2^{\sum_j\Itt_j}}\geq\E\sbra{2\sum_j\Itt_j}=2\sum_j\E\sbra{\Itt_j}. 165 | $$ 166 | \item[(d)] First observe that the algorithm is deterministic given $\pi$ and $x$. 167 | Since $f(x)=1,f(x^{\oplus j})=0$, let $C_{i_1},\ldots,C_{i_k}$ be the terms containing $x_j$ or $\neg x_j$ that flipping $x_j$ changes it to false. Then 168 | $$ 169 | \E\sbra{\Itt_j\mid\bm x=x}=\Pr\sbra{x_j\text{ is forced}\mid\bm x=x} 170 | \geq\Pr\sbra{x_j\text{ ranks the last in }C_{i_t}\text{ for some }t\text{ under }\pi\mid\bm x=x} 171 | \geq\frac1w. 172 | $$ 173 | \item[(e)] Let $B_j=\cbra{x\mid f(x)=1,f(x^{\oplus j})=0}$, then $\Itt[f]=2^{-n}\cdot2\sum_j|B_j|$. 174 | Observe that 175 | $$ 176 | \E\sbra{\Itt_j}\geq\sum_{x\in B_j}\E\sbra{\Itt_j\mid\bm x=x}p(x) 177 | \geq\sum_{x\in B_j}\frac1w\cdot2^{-n}\cdot2\sum_j\E\sbra{\Itt_j} 178 | =2^{1-n}|B_j|\cdot\frac1w\sum_j\E\sbra{\Itt_j}, 179 | $$ 180 | then summing over all $j$ gives the desired bound $\Itt[f]\leq w$. 181 | \end{itemize} 182 | \end{exercise} 183 | 184 | \end{document} 185 | -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/chap08/chap08.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator*{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \DeclareMathOperator{\sd}{\mathop{d}} 57 | \newcommand{\eps}{\varepsilon} 58 | \newcommand{\abs}[1]{{\left| #1 \right|}} 59 | \newcommand{\vabs}[1]{{\left\| #1 \right\|}} 60 | \newcommand{\hvabs}[1]{{\hat{\|} #1 \hat{\|}}} 61 | \newcommand{\abra}[1]{{\left\langle #1 \right\rangle}} 62 | \newcommand{\pbra}[1]{{\left( #1 \right)}} 63 | \newcommand{\cbra}[1]{{\left\{ #1 \right\}}} 64 | \newcommand{\sbra}[1]{{\left[ #1 \right]}} 65 | \newcommand{\floorbra}[1]{{\left\lfloor #1 \right\rfloor}} 66 | \newcommand{\ceilbra}[1]{{\left\lceil #1 \right\rceil}} 67 | \newcommand{\bin}{{\{0,1\}}} 68 | \newcommand{\pmbin}{{\{-1,1\}}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | 75 | \newcommand{\Acal}{\mathcal{A}} 76 | \newcommand{\Bcal}{\mathcal{B}} 77 | \newcommand{\Ccal}{\mathcal{C}} 78 | \newcommand{\Fcal}{\mathcal{F}} 79 | \newcommand{\Gcal}{\mathcal{G}} 80 | \newcommand{\Ncal}{\mathcal{N}} 81 | \newcommand{\Rcal}{\mathcal{R}} 82 | \newcommand{\Scal}{\mathcal{S}} 83 | \newcommand{\Tcal}{\mathcal{T}} 84 | \newcommand{\Xcal}{\mathcal{X}} 85 | \newcommand{\Ycal}{\mathcal{Y}} 86 | \newcommand{\Zcal}{\mathcal{Z}} 87 | 88 | \newcommand{\Inf}{\mathtt{Inf}} 89 | \newcommand{\MaxInf}{\mathtt{MaxInf}} 90 | \newcommand{\Dtt}{\mathtt{D}} 91 | \newcommand{\Itt}{\mathtt{I}} 92 | \newcommand{\Ltt}{\mathtt{L}} 93 | \newcommand{\Wtt}{\mathtt{W}} 94 | \newcommand{\Ttt}{\mathtt{T}} 95 | \newcommand{\Stab}{\mathtt{Stab}} 96 | \newcommand{\NS}{\mathtt{NS}} 97 | \newcommand{\DT}{\mathtt{DT}} 98 | \newcommand{\AC}{\textsc{AC}} 99 | \newcommand{\True}{\texttt{True}} 100 | \newcommand{\False}{\texttt{False}} 101 | 102 | \bibliographystyle{plainnat} 103 | 104 | \title{Exercise Set --- Chapter $8$} 105 | \date{} 106 | 107 | \begin{document} 108 | 109 | \maketitle 110 | 111 | \begin{exercise}{8.17} 112 | We fix an arbitrary base $\phi$. 113 | \begin{itemize} 114 | \item[(a)] Since $f^{\subset[t]}(x)=\sum_{a:a_i=0,i>t}\hat f(a)\phi_a(x)$, we have 115 | \begin{align*} 116 | &\E\sbra{f^{\subset[t]}(x)\mid f^{\subset[0]}(x),\ldots,f^{\subset[t-1]}(x)}\\ 117 | =&f^{\subset[t-1]}(x) 118 | +\E\sbra{\sum_{a:a_i=0,i>t;a_t\neq0}\hat f(a)\phi_a(x)\mid f^{\subset[0]}(x),\ldots,f^{\subset[t-1]}(x)}\\ 119 | =&f^{\subset[t-1]}(x). 120 | \end{align*} 121 | \end{itemize} 122 | \end{exercise} 123 | 124 | \begin{exercise}{8.22} 125 | Since $f$ is symmetric, $f^{=S}=f^{=T}$ holds for all $T,|S|=|T|$. Thus we let $\alpha_k=\hvabs{f^{=S}}_2^2,|S|=k$, and we have 126 | $$ 127 | \Var[f^{\subset S}]=\sum_{k=1}^{|S|}\binom{|S|}k\alpha_k. 128 | $$ 129 | Hence it suffices to prove 130 | $$ 131 | \frac1{|S|}\binom{|S|}k\leq\frac1{|T|}\binom{|T|}k. 132 | $$ 133 | \end{exercise} 134 | 135 | \begin{exercise}{8.28} 136 | Since $(f_n)$ has a coarse threshold, there exists some constant $D>0$ and a sequence $n_1D$ holds for all $i$. Fix any $i$, by mean value theorem, there exists some $p_0(n_i)\leq p(n_i)\leq p_1(n_i)$ such that 138 | $$ 139 | \frac{\partial}{\partial p}\Pr\sbra{f^{p(n_i)}_{n_i}(x)=\True}=\frac{1-2\eps}{\delta(n_i)}<\frac{1-2\eps}{D\sigma_c^2(n_i)}. 140 | $$ 141 | By Margulis-Russo theorem and $f_{n_i}$ being monotone, we know 142 | $$ 143 | \frac{\partial}{\partial p}\Pr\sbra{f^{p(n_i)}_{n_i}(x)=\True}=\frac1{\sigma_c^2(n_i)}\Itt\sbra{f_{n_i}^{p(n_i)}}. 144 | $$ 145 | Thus it suffices to set $C=(1-2\eps)/D$. 146 | \end{exercise} 147 | 148 | \begin{exercise}{8.29} 149 | To clarify, we denote $1$ as $\True$ and $b\sim\pi_p$ has probability $p$ to be $1$. Then $\mu=2p-1,\sigma^2=4p(1-p)$. 150 | \begin{itemize} 151 | \item[(a)] Observe that 152 | \begin{align*} 153 | F'(p) 154 | &=\frac{\partial}{\partial p}\Pr\sbra{f^{(p)}(x)=\True}=\frac1{\sigma}\sum_i\widehat{f^{(p)}}(i) 155 | =\frac{\Itt\sbra{f^{(p)}}}{\sigma^2}=\frac{\sum_S|S|\widehat{f^{(p)}}(S)^2}{4p(1-p)}\\ 156 | &\geq\frac{\sum_{S\neq\emptyset}\widehat{f^{(p)}}(S)^2}{4p(1-p)} 157 | =\frac{1-\E[f^{(p)}]^2}{4p(1-p)} 158 | =\frac{1-(2F(p)-1)^2}{4p(1-p)} 159 | =\frac{F(p)(1-F(p))}{p(1-p)}. 160 | \end{align*} 161 | \item[(b)] Since we assume $p_c\leq1/2$, we have $(1-F(p))/(1-p)\geq1/2$ holds for all $p\leq p_c$. 162 | \item[(c)] By (b), we have 163 | $$ 164 | \ln F(p_0)=-\int_{p_0}^{p_c}\frac{\partial}{\partial p}\ln F(p)\sd p+\ln F(p_c) 165 | \leq\ln(1/2)-\int_{p_0}^{p_c}\frac1{2p}=\ln\pbra{\frac12\sqrt{\frac{p_0}{p_c}}}. 166 | $$ 167 | \end{itemize} 168 | \end{exercise} 169 | 170 | \begin{exercise}{8.41} 171 | Using Corollary 3.32, it suffices to show $\Itt[f^{(1/2)}]=O(\sqrt k)$. 172 | By OS inequality and monotonicity of $f$, we have 173 | $$ 174 | \Itt[f^{(1/2)}]=\sum\hat f(i)\leq\vabs{f}_2\sqrt{\Delta^{(1/2)}(f)}\leq\sqrt{\DT(f)}=\sqrt k. 175 | $$ 176 | \end{exercise} 177 | 178 | \begin{exercise}{8.43} 179 | For any leaf $v$, let $h_v$ be its depth. Then the probability that $v$ is hit under uniform input is $2^{-h_v}$. 180 | Then $\Delta(\Tcal)=\sum_vh_v2^{-h_v}$. On the other hand, we have $\sum_v2^{-h_v}=1$. Thus $\Delta(\Tcal)$ can be seen as the 181 | entropy of distribution $\cbra{2^{-h_v}}_v$, which is maximized at $\log\#\text{leaves}\leq\log s$. 182 | \end{exercise} 183 | 184 | \begin{exercise}{8.44} 185 | \begin{itemize} 186 | \item[(a)] By OSSS inequality, we have 187 | $$ 188 | \Var[f]\leq\sum_i\delta_i^{(\pi)}(\Tcal)\Inf_i[f]\leq\MaxInf[f]\cdot\Delta^{(\pi)}(f). 189 | $$ 190 | \item[(b)] Using the fact that $\Delta^{(\pi)}(f)\leq\DT(f)\leq\deg(f)^3$. 191 | \item[(c)] By OSSS inequality, we have 192 | $$ 193 | \Var[f]\leq\sum_i\delta_i^{(\pi)}(\Tcal)\Inf_i[f]\leq\delta^{(\pi)}(\Tcal)\sum_i\Inf_i[f]=\delta^{(\pi)}(\Tcal)\Itt[f]. 194 | $$ 195 | \end{itemize} 196 | \end{exercise} 197 | 198 | \begin{exercise}{8.45} 199 | \begin{itemize} 200 | \item[(a)] Using decision tree process, we have 201 | $\Inf_i[f]=\E_{J,x_J,x_{\bar J}}\sbra{\pbra{\Dtt_{\phi_i}f(x_J,x_{\bar J})}^2}$. 202 | If $i\notin J$, then $\Dtt_{\phi_i}f(x_J,x_{\bar J})=\sigma\Dtt_{x_i}f(x_J,x_{\bar J})=0$. 203 | Thus 204 | $$ 205 | \Inf_i[f]\leq\Pr_{J,x_J,x_{\bar J}}\sbra{i\in J}=\delta^{(\pi)}_i(f). 206 | $$ 207 | \item[(b)] Since $f$ is transitive-symmetric, we know $\Inf_i[f]=\Inf_j[f],\delta_i^{(\pi)}(f)=\delta_j^{(\pi)}(f)$. 208 | Thus by OS inequality and (a), we have 209 | $$ 210 | \Var[f]\leq n\delta_i^{(\pi)}(f)\Inf_i^{(\pi)}[f]\leq n\pbra{\delta_i^{(\pi)}}^2. 211 | $$ 212 | \end{itemize} 213 | \end{exercise} 214 | 215 | \end{document} 216 | -------------------------------------------------------------------------------- /Analysis-of-Boolean-Functions/chap09/chap09.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator*{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \DeclareMathOperator{\sd}{\mathop{d}} 57 | \newcommand{\eps}{\varepsilon} 58 | \newcommand{\abs}[1]{{\left| #1 \right|}} 59 | \newcommand{\vabs}[1]{{\left\| #1 \right\|}} 60 | \newcommand{\hvabs}[1]{{\hat{\|} #1 \hat{\|}}} 61 | \newcommand{\abra}[1]{{\left\langle #1 \right\rangle}} 62 | \newcommand{\pbra}[1]{{\left( #1 \right)}} 63 | \newcommand{\cbra}[1]{{\left\{ #1 \right\}}} 64 | \newcommand{\sbra}[1]{{\left[ #1 \right]}} 65 | \newcommand{\floorbra}[1]{{\left\lfloor #1 \right\rfloor}} 66 | \newcommand{\ceilbra}[1]{{\left\lceil #1 \right\rceil}} 67 | \newcommand{\bin}{{\{0,1\}}} 68 | \newcommand{\pmbin}{{\{-1,1\}}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | 75 | \newcommand{\Acal}{\mathcal{A}} 76 | \newcommand{\Bcal}{\mathcal{B}} 77 | \newcommand{\Ccal}{\mathcal{C}} 78 | \newcommand{\Fcal}{\mathcal{F}} 79 | \newcommand{\Gcal}{\mathcal{G}} 80 | \newcommand{\Ncal}{\mathcal{N}} 81 | \newcommand{\Rcal}{\mathcal{R}} 82 | \newcommand{\Scal}{\mathcal{S}} 83 | \newcommand{\Tcal}{\mathcal{T}} 84 | \newcommand{\Xcal}{\mathcal{X}} 85 | \newcommand{\Ycal}{\mathcal{Y}} 86 | \newcommand{\Zcal}{\mathcal{Z}} 87 | 88 | \newcommand{\Inf}{\mathtt{Inf}} 89 | \newcommand{\MaxInf}{\mathtt{MaxInf}} 90 | \newcommand{\Dtt}{\mathtt{D}} 91 | \newcommand{\Itt}{\mathtt{I}} 92 | \newcommand{\Ltt}{\mathtt{L}} 93 | \newcommand{\Wtt}{\mathtt{W}} 94 | \newcommand{\Ttt}{\mathtt{T}} 95 | \newcommand{\Stab}{\mathtt{Stab}} 96 | \newcommand{\NS}{\mathtt{NS}} 97 | \newcommand{\DT}{\mathtt{DT}} 98 | \newcommand{\AC}{\textsc{AC}} 99 | \newcommand{\True}{\texttt{True}} 100 | \newcommand{\False}{\texttt{False}} 101 | 102 | \bibliographystyle{plainnat} 103 | 104 | \title{Exercise Set --- Chapter $9$} 105 | \date{} 106 | 107 | \begin{document} 108 | 109 | \maketitle 110 | 111 | \begin{exercise}{9.6} 112 | \begin{itemize} 113 | \item[(a)] 114 | \begin{align*} 115 | \vabs{\Ttt_{(1-\delta)/\sqrt 3}f}_4 116 | \leq&\sum_k\vabs{\Ttt_{(1-\delta)/\sqrt 3}f^{=k}}_4\leq 117 | \sum_k(\sqrt 3)^k\vabs{\Ttt_{(1-\delta)/\sqrt 3}f^{=k}}_2= 118 | \sum_k(1-\delta)^k\vabs{f^{=k}}_2\leq 119 | \frac1\delta\sum_k\vabs{f^{=k}}_2\\ 120 | =&\frac1\delta\vabs{f}_2. 121 | \end{align*} 122 | \item[(c)] 123 | $$ 124 | \vabs{\Ttt_\rho f}_4^d=\vabs{\Ttt_\rho f^{\oplus d}}_4\leq\frac1\delta\vabs{f^{\oplus d}}_2=\frac1\delta\vabs{f}_2^d. 125 | $$ 126 | \end{itemize} 127 | \end{exercise} 128 | 129 | \begin{exercise}{9.12} 130 | \begin{itemize} 131 | \item[(b)] $\E[Y]=\theta^2-2\E[X]+\vabs{X}_2^2=1+\theta^2$ and 132 | $\E[Y^2]=\vabs{X-\theta}_4^4\leq\vabs{-\theta+\frac1\rho X}_2^4=\pbra{\rho^{-2}+\theta^2}^2$. 133 | \item[(c)] Since $\Pr\sbra{\abs{X-\theta}>t}=\Pr\sbra{Y>t^2}$, we have 134 | \begin{align*} 135 | \E[Y]&=\Pr[Y>t^2]\E[Y\mid Y>t^2]+\Pr[Y\leq t^2]\E[Y\mid Y\leq t^2]\\ 136 | &\leq \E\sbra{Y\cdot 1_{Y>t^2}}+t^2\\ 137 | &\leq \sqrt{\E[Y^2]\Pr[Y>t^2]}+t^2. 138 | \end{align*} 139 | Hence 140 | $$ 141 | \Pr[Y>t^2]\geq\pbra{\frac{1+\theta^2-t^2}{\rho^{-2}+\theta^2}}^2\geq(1-t^2)^2\rho^4. 142 | $$ 143 | \end{itemize} 144 | \end{exercise} 145 | 146 | \begin{exercise}{9.18} 147 | \begin{itemize} 148 | \item[(a)] $\alpha^2+\rho\Wtt^1[f]\leq\Stab_\rho[f]\leq\E[f]^{\frac2{1+\rho}}.$ 149 | \end{itemize} 150 | \end{exercise} 151 | 152 | \begin{exercise}{9.22} 153 | Using H\"older inequality with $1=1/(1/\lambda)+1/(1/(1-\lambda))$, we have 154 | \begin{align*} 155 | \vabs{\Ttt_\rho f}_q^2 156 | &=\vabs{\Ttt_{\rho^\lambda}\Ttt_{\rho^{1-\lambda}}f}_q^2\leq\vabs{\Ttt_{\rho^{1-\lambda}}f}_2^2 157 | =\sum_S\rho^{2(1-\lambda)|S|}\hat f(S)^2\\ 158 | &=\sum_S\pbra{\rho^{|S|}\hat f(S)}^{2(1-\lambda)}\hat f(S)^{2\lambda}\\ 159 | &\leq\vabs{\Ttt_\rho f}_2^{1-\lambda}\vabs{f}_2^\lambda. 160 | \end{align*} 161 | \end{exercise} 162 | 163 | \begin{exercise}{9.33} 164 | Using KKL Edge-Isoperimetric theorem, we have $\MaxInf[f]\geq\exp(-O(\Itt[f]/\Var[f]))$. 165 | By monotonicity, we also have $\Inf_i[f]=\hat f(i)$. 166 | \end{exercise} 167 | 168 | \begin{exercise}{9.34} 169 | We prove $\vabs{f}_4^4\leq\text{sparsity}(\hat f)\vabs{f}_2^4$ by induction on $n$. 170 | \begin{itemize} 171 | \item $n=0$. Trivial. 172 | \item $n>0$. Denote $f=xD+E$ where $D,E$ do not depend on $x$. 173 | Assume $s=\text{sparsity}(\hat D),t=\text{sparsity}(\hat E)$, then $\text{sparsity}(\hat f)=s+t$. 174 | Thus 175 | \begin{align*} 176 | \vabs{f}_4^4 177 | &=\vabs{D}_4^4+\vabs{E}_4^4+6\E\sbra{D^2E^2}\leq\vabs{D}_4^4+\vabs{E}_4^4+6\sqrt{\vabs{D}_4^4\vabs{E}_4^4}\\ 178 | &\leq s\vabs{D}_2^4+t\vabs{E}_2^4+6\sqrt{st\vabs{D}_2^4\vabs{E}_2^4}\\ 179 | &\leq (s+t)\vabs{D}_2^4+(s+t)\vabs{E}_2^4+2(s+t)\vabs{D}_2^2\vabs{E}_2^2\\ 180 | &=\text{sparsity}(\hat f)\vabs{f}_2^4. 181 | \end{align*} 182 | \end{itemize} 183 | \end{exercise} 184 | 185 | \end{document} 186 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/README.md: -------------------------------------------------------------------------------- 1 | ## Computational Complexity : A Modern Approach 2 | 3 | By Boaz Barak and Sanjeev Arora 4 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap03/chap03.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage[UTF8]{ctex} 8 | \usepackage{amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{refute}{Refute} 32 | \newtheorem*{example}{Example} 33 | \newtheorem*{counterexample}{Counterexample} 34 | 35 | \newenvironment{exercise}[1]{ 36 | \par 37 | \noindent\textbf{Exercise #1.}\quad 38 | }{ 39 | \par 40 | \bigskip 41 | } 42 | 43 | 44 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 45 | \newcommand{\abs}[1]{\left| #1 \right|} 46 | \newcommand{\pbra}[1]{\left( #1 \right)} 47 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 48 | \newcommand{\sbra}[1]{\left[ #1 \right]} 49 | \newcommand{\bin}{\{0,1\}} 50 | 51 | \title{Exercise Set --- Chapter $3$} 52 | \date{} 53 | 54 | \begin{document} 55 | 56 | \maketitle 57 | 58 | 59 | \begin{exercise}{3.1} 60 | Reduction from Halt. 61 | 62 | $$M_{1}=\{\lfloor M \rfloor : M \text{ is a machine that runs in } 100n^{2} + 200 \text{ time}, \text{ where } n\text{ is the size of input.}\}$$ 63 | Let $$M_{2} = \{\lfloor M \rfloor : M \text{ is a machine that runs in finite time }c.\}$$ 64 | Then $M_{2}\leq_{T} M_{1}$. 65 | 66 | Reduction: for a input $x$ of $M_{2}$. If $c< 100n^{2} + 200$, then add some steps to let $c = 100n^{2} + 200$, if $c > 100n^{2} + 200$, then add some additional input to let $x'=xy$, let the size of $x'$ equals to $100n'^{2} + 200$. Then execute $M_{1}$. 67 | 68 | Thus for a Halt instance $M(\alpha, x)$, we can execute $M_{2}$ to find that whether $M_{2}$ can halt in finite step $c$. 69 | \end{exercise} 70 | 71 | 72 | \begin{exercise}{3.2} 73 | NP is closed under polynomial-time reduction, but we shall prove $\text{SPACE}(n)$ is not. 74 | 75 | For any $L\in\text{SPACE}(n^2)$, define $L'=\cbra{x01^{|x|^2}\middle| x\in L}$. 76 | Then $L'\in\text{SPACE}(n)$ and the reduction $x\in L\to x01^{|x|^2}\in L'$ is polynomial-time. 77 | Assume $\text{NP}=\text{SPACE}(n)$, $L\in\text{SPACE}(n)$, which contradicts the Space Hierarchy Theorem. 78 | \end{exercise} 79 | 80 | \begin{exercise}{3.3} 81 | The language given in the proof of Theorem 3.7 is in $\textbf{EXP}$. To determine the membership for all string, exclude all undetermined string with shorter length than $\ell_i$ from $B$ after each stage-$i$, where $\ell_i$ is the length of the longest determined string in $B$ after stage-$i$. Note that $\ell_i = i + c$ is enough for the proof of Theorem 3.7 with some constant $c$. Thus, stage-$i$ can be done by simulating $M_i$ on $1^{\ell_i}$ within time-$\tilde O(2^i)$. Given string $x$, generate $B$ with $|x|$ stages and check the membership during the generating processing, which is obviously in \textbf{EXP}. 82 | \end{exercise} 83 | 84 | \begin{exercise}{3.4} 85 | \begin{itemize} 86 | \item [(a)] 给出superior的定义,判断DTIME($n^{1.1}$)是否superior DTIME($n$),根据前面时间层级定理的证明,我们可以证明$\exists L\in DTIME(n^{1.1}), \forall L^{'}\in DTIME(n),\exists x,|x|\in(n,n^2),M_L(x)\ne M_{L^{'}}(x)$因此DTIME($n^{1.1}$)是superior DTIME($n$)的 87 | \item [(b)] 我们并不能根据非确定性的时间层级定理证得同样的结论,因为在非确定性时间层级定理定理证明的过程中,只取反了一个元素,而不是像确定性时取反了所有元素,因此我们不能够保证取反的部分是在$[n,n^2]$内,因此无法根据前面证明得到相同结论。 88 | \end{itemize} 89 | \end{exercise} 90 | 91 | \begin{exercise}{3.8} 92 | Recall that given a language $B$, it's corresponding unary language is 93 | $$ 94 | U_B=\{1^n| \exists x\in \{0,1\}^n, x\in B \} 95 | $$ 96 | It's obvious that $U_B\in NP^B$. And 97 | $$ 98 | Pr(NP^B=P^B)\leq Pr(U_B\in P^B)= \max_{poly(n) M^B} Pr(\forall n, M^B(1^n)=U_B(1^n)) 99 | $$ 100 | $\max$ means we select the best possible polynomial time oracle Turing machine. 101 | 102 | For a specific polynomial time machine $M^B$ on input $1^n$, it at most uses $B$ oracle for polynomial times and know at most $\frac{poly(n)}{2^n}$ fraction of $n$-bit string whether it belongs to $B$. Thus 103 | \begin{align*} 104 | Pr(M^B(1^n)=U_B(1^n))&=Pr(U_B(1^n)=0)Pr(M^B(1^n)=0|U_B(1^n)=0)+Pr(U_B(1^n)=1)Pr(M^B(1^n)=1|U_B(1^n)=1)\\ 105 | &\leq\frac{1}{2}\cdot 1+\frac{1}{2}\cdot \frac{poly(n)}{2^n}\\ 106 | &\leq\frac{2}{3}; 107 | \end{align*} 108 | Thus 109 | $$ 110 | Pr(\forall n, M^B(1^n)=U_B(1^n))=\lim_{n\rightarrow \infty} c\cdot(\frac{2}{3})^n=0 111 | $$ 112 | Thus $Pr(NP^B=P^B)=0$. 113 | 114 | 115 | 116 | \end{exercise} 117 | \end{document} 118 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap04/chap04.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage[UTF8]{ctex} 8 | \usepackage{amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{refute}{Refute} 32 | \newtheorem*{example}{Example} 33 | \newtheorem*{counterexample}{Counterexample} 34 | 35 | \newenvironment{exercise}[1]{ 36 | \par 37 | \noindent\textbf{Exercise #1.}\quad 38 | }{ 39 | \par 40 | \bigskip 41 | } 42 | 43 | 44 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 45 | \newcommand{\abs}[1]{\left| #1 \right|} 46 | \newcommand{\pbra}[1]{\left( #1 \right)} 47 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 48 | \newcommand{\sbra}[1]{\left[ #1 \right]} 49 | \newcommand{\bin}{\{0,1\}} 50 | 51 | \title{Exercise Set --- Chapter $4$} 52 | \date{} 53 | 54 | \begin{document} 55 | 56 | \maketitle 57 | 58 | \begin{exercise}{4.1} 59 | The proof is analogous to that of Theorem 1.9 in section 1.7. We argue that the only difference is 60 | that we just use $\log t$ rather than $\log T$ zones since we have known $M_{\alpha}$ uses at most $t$ cells of its work tape before halting. According to the proof in section 1.7, $SU$ uses at most $1+\sum_{i=0}^{\log t} 2^{i+1}=1+2^{\log t+2 }-2=4t-1$ cells of its work tape to simulate $M_{\alpha}$. 61 | 62 | The proof of theorem 4.8 is almost the same as the one of theorem 3.1(Time Hierarchy Theorem) except time-bounded universal TM $U$ is replaced by space-bounded universal TM $SU$.And thus the logorithmic slowdown does not appear in the conclusion of theorem 4.8. 63 | \end{exercise} 64 | 65 | \begin{exercise}{4.3} 66 | Since $L$ is not the empty set or $\{0,1\}^{*}$, there exists $x\in L$ and $y\not\in L$. In the following, we prove that $path(s,t)\leq_{p} L$. We can solve path$(s,t)$ in polynomial-time, and if it the yes case, we corresponding to $x$ in $L$, otherwise corresponding to $y$ in $L$. 67 | \end{exercise} 68 | 69 | \begin{exercise}{4.4} 70 | Let $\texttt{\sf SCD}=\cbra{\llcorner G\lrcorner\middle| G\text{ is a strongly connected digraph}}$. 71 | First, $\texttt{\sf SCD}\in NL$, since we can enumerate all vertex pair $(s,t)$ and run $\texttt{\sf PATH}(G,s,t)$. 72 | 73 | Second, we construct a log-space reduction from \texttt{\sf PATH} to show \texttt{\sf SCD} is $NL$-hard. 74 | The reduction simply adds two directed edge $i\to s,t\to i$ for any $i\neq s,t$. 75 | It is easy to verify its validity. 76 | \end{exercise} 77 | 78 | \begin{exercise}{4.5} 79 | Given a Boolean formula $\phi$ with $n$ variables $x_1, \ldots, x_n$ and $m$ clauses in 2-CNF (assuming $\phi$ contains only 2-clauses w.l.o.g), we construct a directed graph $G = (V,A)$ where $V = \{v_{x_1}, \ldots, v_{x_n}, v_{\overline{x_1}}, \ldots, v_{\overline{x_n}}\}$. $A$ is constructed as following: 80 | \begin{itemize} 81 | \item Arc $v_{\overline{x_i}} \to v_{x_j}$ and $v_{\overline{x_j}} \to v_{x_i}$ are gathered in $E$ if there is clause $x_i \land x_j$ in $\phi$; 82 | \item Arc $v_{x_i} \to v_{\overline{x_j}}$ and $v_{x_j} \to v_{\overline{x_i}}$ are gathered in $E$ if there is clause $\overline{x_i} \land \overline{x_j}$ in $\phi$; 83 | \item Arc $v_{x_i} \to v_{x_j}$ and $v_{\overline{x_j}} \to v_{\overline{x_i}}$ are gathered in $E$ if there is clause $\overline{x_i} \land x_j$ in $\phi$. 84 | \end{itemize} 85 | It is clear that $\phi$ is satisfiable only if there exist no path form $v_{x_i}$ to $v_{\overline{x_i}}$ or $v_{\overline{x_i}}$ to $v_{x_i}$ for all $i \in [n]$. Note that $v_{x_i} \rightsquigarrow v_{\overline{x_i}}$ implies $v_{\overline{x_i}} \rightsquigarrow v_{x_i}$. So, it suffice to prove $\phi$ is satisfiable if $v_{x_i}$ and $v_{\overline{x_i}}$ are not in the same strongly connected component in $G$. Let $f:V \to \mathbb N$ be the topological sort for $G$, i.e., the topological sort for the condensation of $G$ such that $f(v) \geq f(w)$ if and only if $v \rightsquigarrow w$ in $G$. Define $y_i := 1$ if $f(v_{\overline{x_i}}) > f(v_{x_i})$, and $y_i := 0$ otherwise. Assume toward contradiction that $\phi(x = y) = 0$. 86 | \begin{itemize} 87 | \item If $y$ violates the clause $y_i \land y_j$, $f(v_{x_i}) \geq f(v_{\overline{x_i}})$ and $f(v_{x_j}) \geq f(v_{\overline{x_j}})$ hold. Thus, 88 | \[ 89 | f(v_{x_j}) \geq f(v_{\overline{x_j}}) \geq f(v_{x_i}) \geq f(v_{\overline{x_i}}) \geq f(v_{{x_j}}) 90 | \] 91 | holds, which conflicts with our assumption. 92 | \item An argument similar to the one use in the previous case shows that $y$ does not violates the clause $\overline{y_i} \land \overline{y_j}$ or clause $y_i \land \overline{y_j}$. 93 | \end{itemize} 94 | 95 | Note given $\phi$, $G$ can be constructed by a Log-space Turing machine. Combining the reduction and Lemma 4.18, 2SAT $\in \mathbf{NL}$ can be shown. 96 | \end{exercise} 97 | 98 | \begin{exercise}{4.6} 99 | 证明在考虑对数空间规约的情况下,SAT仍然是NP完全的。只需要注意到库克定理中的oblivious TM,只根据输入长度和当前步骤决定,我们只需要用对数空间存储和更新此类信息,因此这个TM可以是对数空间实现的,因此SAT仍然是NP完全的。 100 | \end{exercise} 101 | 102 | \begin{exercise}{4.11} 103 | We prove the corollary by the following two steps. 104 | \begin{itemize} 105 | \item[(i)] To prove $NSPACE(S(n))=CO-NSPACE(S(n))$, it suffices to prove that $NSPACE(S(n))\subset CONSPACE(S(n))$. 106 | 107 | Because if $NSPACE(S(n))\subset CONSPACE(S(n))$, then for every language $L\in CO-NSPACE(S(n))$, by definition, $\overline{L}\in NSPACE(S(n))\in CO-NSPACE(S(n))$. Then $L=\overline{\overline{L}}\in NSPACE(S(n)).$ Then $CO-NSPACE(S(n))\subset NSPACE(S(n))$ and we conclude $CO-NSPACE(S(n))=NSPACE(S(n))$. 108 | 109 | \item[(ii)] 110 | $NSPACE(S(n))\subset CONSPACE(S(n))$ means if $L\in NSPACE(S(n))$, then $\overline{L}\in NSPACE(S(n))$. 111 | 112 | To prove this, we construct Turing machine $M_{\overline{L}}$, such that for $x\in \overline{L}$, there exists a read-only-once certificate $u\in \{0,1\}^{poly(2^S(n))}$ such that $M_{\overline{L}}(x,u)=1$ and $M$ only use $S(n)$ space and only read $u$ for one time. 113 | 114 | Because $L\in NSPACE(S(n))$, there exists a non-deterministic $S(n)$ space turing machine $M$ such that $x\in L$ iff $M$ accepts $x$. If we use $G_{M,x}$ to represent the underlying configuration graph, it's equivalent to say $x\in L$ iff $C_{M,x,start}, C_{M,x,accept}$ are connected. Then $x\in\overline{L}$ iff $C_{M,x,start}, C_{M,x,accept}$ are disconnected. The construction for $M_{\overline{L}}$ and $u$ are similar to . Write 115 | $$ 116 | C_i=\{ v\in G_{M,x}| v \text{is reachable by $C_{M,x,start}$ in $i$ steps} \} 117 | $$ and for convenience, we label the the configuration by $v_j, 0\leq j\leq 2^{O(S(n))}$, each vertices is represented by a $O(s(n)$ string. We consider the following two sub-routines. 118 | 119 | \begin{itemize} 120 | \item[(1)] Given $|C_i|$, we can construct a certificate to prove whether a given vertices $v\in C_{i+1}$ or not. The checking procedure uses $O(S(n))$ space. First, if someone claim $v\in C_{i+1}$ it's easy to verify by providing the path $v_0,...,v_k$ for $v_k=v, k\leq i$. If someone claim $v\not\in C_{i+1}$, he would provide the all the vertices $u_j$ in $C_{i+1}$ in descending order and its path connecting $v_0, v$ in $i$ steps. The checking procedure, that is $M_{\overline{L}}$, will 121 | \begin{itemize} 122 | \item[(a)] Maintain $u_j$ and check wether $u_{j}+1$ is greater than $u_j$. Using $O(S(n))$ space. 123 | \item[(b)] Maintain a number to count the total number of certificates, which is supposed to $|C_{i}|$. Using $O(S(n))$ space. 124 | \item[(c)] When reading $u\in C_{i+1}$, checking whether $v\in Neighbour(u)$. 125 | \end{itemize} 126 | \item[(2)] Given $|C_i|$, we construct a certificate to prove the claimed $|C_{i+1}|$. This is done by listing the certificate for all $v\in G_{M,x}$, whether $v\in C_{i+1}$ or not, by using $(1)$. 127 | \end{itemize} 128 | \end{itemize} 129 | 130 | \end{exercise} 131 | 132 | \end{document} 133 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap05/chap05.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage[UTF8]{ctex} 8 | \usepackage{amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{refute}{Refute} 32 | \newtheorem*{example}{Example} 33 | \newtheorem*{counterexample}{Counterexample} 34 | 35 | \newenvironment{exercise}[1]{ 36 | \par 37 | \noindent\textbf{Exercise #1.}\quad 38 | }{ 39 | \par 40 | \bigskip 41 | } 42 | 43 | 44 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 45 | \newcommand{\abs}[1]{\left| #1 \right|} 46 | \newcommand{\pbra}[1]{\left( #1 \right)} 47 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 48 | \newcommand{\sbra}[1]{\left[ #1 \right]} 49 | \newcommand{\bin}{\{0,1\}} 50 | 51 | \title{Exercise Set --- Chapter $5$} 52 | \date{} 53 | 54 | \begin{document} 55 | 56 | \maketitle 57 | 58 | \begin{exercise}{5.1} 59 | It is clearly seen that $\Sigma_i SAT$ is in $\Sigma_i P$ from their definition.Therefore, the only thing we need to show is that $\Sigma_i SAT$ is $\Sigma_i P$-hard.We use mathematical induction to prove this result.Suppose the language $\Sigma_i SAT$ is $\Sigma_i P$-hard. 60 | \begin{itemize} 61 | \item The basic situation is trivial since the language $SAT$ has been proved to be $NP$-hard. 62 | \item And the induction follows for $i>1$ if we assume the result holds when $i < n$. 63 | \item When $i=n$, we need to prove every language $L \in \Sigma_n P$ is polynomial-time Karp reducible to $\Sigma_n SAT$. According to the definition of $\Sigma_n P$, 64 | \begin{equation} 65 | x \in L \iff \exists u_1\in\{0,1\}^{q(|x|)} \forall u_2 \in \{0,1\}^{q(|x|)}\cdots Q_iu_i\in\{0,1\}^{q(|x|)} M(x,u_1,\dots,u_i)=1 66 | \end{equation} 67 | where $M$ is a polynomial-time TM, $q$ is a polynomial, and $Q_i$ denotes $\forall$ or $\exists$ depending on whetehr $i$ is even or odd respectively. 68 | 69 | We define a new language $L^{\prime}$ 70 | \begin{equation} 71 | x,u_1 \in L^{\prime} \iff \forall u_2 \in \{0,1\}^{q(|x|)}\cdots Q_iu_i\in\{0,1\}^{q(|x|)} M(x,u_1,\dots,u_i)=1 72 | \end{equation} 73 | 74 | Thus, we can rewrite $L$ in another way 75 | 76 | \begin{equation} 77 | x\in L \iff \exists u_1 x,u_1 \in L^{\prime} 78 | \end{equation} 79 | 80 | Note that $L^{\prime}$ is in $\Pi_{n-1} P$ and $\Pi_{n-1} SAT $ is $\Pi_{n-1}$-hard(the proof is analogous to that of TAUTOLOGY).Thus, there is a polynomial time transformation $x \rightarrow \varphi_{x}$ from strings to boolean formulae such that 81 | \begin{equation} 82 | x,u_1 \in L^{\prime} \iff \forall u_2 \in \{0,1\}^{q(|x|)}\cdots Q_i u_i\in\{0,1\}^{q(|x|)}\varphi_{x,u_1}(u_2,\dots,u_i)=1. 83 | \end{equation} 84 | 85 | Let $\phi_{x}(u_1,u_2,\dots,\u_i)=\varphi_{x,u_1}(u_2,\dots,u_i)$, we have the following equivalent definition of $L$ 86 | \begin{equation} 87 | x\ in L^{\prime} \iff \exists u_1\in\{0,1\}^{q(|x|)} \forall u_2 \in \{0,1\}^{q(|x|)}\cdots Q_iu_i\in\{0,1\}^{q(|x|)} \phi_{x}(u_1,\dots,u_i)=1 88 | \end{equation} 89 | And obviously, we can transform $x$ to $\phi$ in polynomial time. In a word, we have proved the result in the situation when $i=n$. 90 | \end{itemize} 91 | 92 | \end{exercise} 93 | 94 | \begin{exercise}{5.3} 95 | Assume $\tt 3SAT$ is polynomial-time reducible to $\overline{\tt 3SAT}$. Denote this reduction as $f$ and the TM checking 96 | $\tt 3SAT$ as $M$, then 97 | $$ 98 | \exists y,M(x,y)=1\iff \forall y,M(f(x),y)=0. 99 | $$ 100 | Therefore 101 | $$ 102 | \forall y,M(x,y)=0\iff\neg\pbra{\exists y,M(x,y)=1}\iff\neg\pbra{\forall y,M(f(x),y)=0}\iff\exists y,M(f(x),y)=1, 103 | $$ 104 | which means $f$ is also the polynomial-time reduction from $\overline{\tt 3SAT}$ to $\tt 3SAT$. 105 | Hence $\Sigma_1^p=\mathbf{NP}=\mathbf{coNP}=\Pi_1^p$ and $\mathbf{PH}$ collapses to $\mathbf{NP}$. 106 | \end{exercise} 107 | 108 | \begin{exercise}{5.4} 109 | By Claim 5.9, $\Sigma_i^p=\bigcup_c\Sigma_i\text{TIME}(n^c),\Pi_i^p=\bigcup_c\Pi_i\text{TIME}(n^c)$. 110 | Then 111 | $$ 112 | \text{PH}=\bigcup_{i,c}\Sigma_i\text{TIME}(n^c)=\bigcup_{i,c}\Pi_i\text{TIME}(n^c). 113 | $$ 114 | \end{exercise} 115 | 116 | \begin{exercise}{5.5} 117 | $\mathbf{PSPACE} \subseteq \mathbf{AP}$ follows since $\mathsf{TQBF}$ is trivially in $\mathbf{AP}$, and every $\mathbf{PSPACE}$ language reduces to $\mathsf{TQBF}$. It suffices to show that $\mathbf{AP} \subseteq \mathbf{PSPACE}$. 118 | 119 | Given $L \in \mathbf{AP}$, there exists an ATM $M$ computing $L$. Note that can a configuration of $M$ can be representation in polynomial bits. Simulate $M$ with a Turing machine. For the non-deterministic choices, the TM simulate each subsequent configuration recursively. Since the ATM halts in polynomial-time, the depth of the recursion is polynomial. Thus, the simulation needs polynomial-space. 120 | \end{exercise} 121 | 122 | \begin{exercise}{5.6} 123 | 证明SAT$\notin TISP(n^c,n^d),c(c+d)<2$ 124 | 125 | 反证法,不妨假设SAT$\in TISP(n^c,n^d)\to NTIME(n)\subseteq TISP(n^{c^{'}}.n^{d^{'}})$$c^{'}>c,d^{'}>d\to NTIME(n^\alpha)\subseteq TISP(n^{\alpha c^{'}}.n^{\alpha d^{'}})\subseteq \sum_2TIME(n^{\frac{\alpha(c^{'}+d^{'})}{2}})$$\subseteq NTIME(n^{\frac{c^{'}\alpha(c^{'}+d^{'})}{2}})\to \alpha \le \frac{c^{'}\alpha(c^{'}+d^{'}) }{2}\to c(c+d)>2$与已知矛盾,因此原命题得证。 126 | \end{exercise} 127 | 128 | \begin{exercise}{5.12} 129 | We can prove it inductively. For $k>i$, let $L\in\Sigma_k^p$, there is a polynomial-time Turing machine $M$ and a polynomial $q$ such that 130 | $$ 131 | x\in L\Leftrightarrow\exists u_1\in\{0,1\}^{q(x)}\forall u_2\in\{0,1\}^{q(x)}\cdots Q_k u_k\in\{0,1\}^{q(x)}M(x,u_1,\dots,u_k)=1, 132 | $$ 133 | define $L'$ as follows: 134 | $$ 135 | \in L'\Leftrightarrow\forall u_2\in\{0,1\}^{q(x)}\cdots Q_k u_k\in\{0,1\}^{q(x)}M(x,u_1,\dots,u_k)=1, 136 | $$ 137 | clearly, $L'\in\Pi_{k-1}^p$ so $L'$ is in $\Sigma_{k-1}^p$. Inductively, for any $k>i$ $\Sigma_k^p=\Sigma_i^p$, so $\textbf{PH}=\Sigma_i^p$. 138 | \end{exercise} 139 | 140 | \end{document} 141 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap07/chap07.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{geometry} 11 | \usepackage{ntheorem} 12 | \usepackage{hyperref} 13 | \usepackage[ruled]{algorithm2e} 14 | \usepackage{caption,subcaption} 15 | 16 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 17 | 18 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{proof}{Proof} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | 50 | \title{Exercise Set --- Chapter $7$} 51 | \date{} 52 | 53 | \begin{document} 54 | 55 | \maketitle 56 | 57 | \begin{exercise}{7.1} 58 | Toss a coin for $T$ times where $T = \lceil\log_2(N) + \log_2(1/\delta)\rceil$. Naturally, the $T$ result forms a 0/1 sequence as the binary representation of $M$. Note that $2^T \leq N$ and $M < 2^T$. Let $k$ be the maximal integer s.t. $kN \leq 2^T$. If $M < kN$, output $\lfloor M/k\rfloor + 1$. Otherwise, output ``?''. Note that conditioned on $M < kN$, $M$ follows a uniform distribution, which implies the output is uniformly sampled from $[N]$. Whereas, $2^T - kN < N$ holds. Thus, the probability to output ``?'' is less that $(2^T - kN)/2^T < N/2^T \leq \delta$. 59 | \end{exercise} 60 | 61 | \begin{exercise}{7.6(a)} 62 | 63 | \paragraph{If.} Suppose $L$ is a language satisfying the settings mentioned. Construct a $\mathbf{ZPP}$ machine $M'$ as follows: $M'(x)$ keeps invokes $M(x)$ until $M(x)\neq ?$, and then output it. Apparently $M'$ will not err since $M$ does not. Suppose the running time of $M$ is bounded by a polynomial $T(n)$, then the expected running time of $M'$ is 64 | $$\mathbb{E}[T'(n)]\leq\frac{T(n)}{2^0}+\frac{2T(n)}{2^1}+\frac{3T(n)}{2^2}+...\leq 4T(n)$$ 65 | Therefore $L\in\mathbf{ZPP}$. 66 | 67 | \paragraph{Only if.} Suppose $L\in\mathbf{ZPP}$. Then there exists $c>0$ satisfying, there is a machine $M'$ that runs in an expected-time $T'(n)=O(n^c)$ such that for every input $x$, if $M'(x)$ halts then $M'(x)=L(x)$. Construct a new machine $M$ as follows. $M(x)$ simulates $M'(x)$ on $T(n)=2T'(n)=O(n^c)$ steps. If in this duration $M'(x)$ outputs something, then $M(x)$ outputs it; otherwise, output $?$. 68 | 69 | By definition of $\mathbf{ZTIME}$, $M'(x)$ is always correct, and thus $M(x)\in\{L(x),?\}$. By Markov's inequality, 70 | $$\Pr[\text{Runtime of }M'(x)\geq 2T'(n)]\leq\frac{T'(n)}{2T'(n)}=\frac{1}{2}$$ 71 | And thus $\Pr[M(x)=?]\leq\frac{1}{2}$. Actually the constant of the bound can be changed to $\frac{1}{3}$ or less. 72 | \end{exercise} 73 | 74 | \begin{exercise}{7.6(b)} 75 | \paragraph{$\subseteq$.} We are now going to prove $\mathbf{ZPP}\subseteq\mathbf{RP}$ and $\mathbf{ZPP}\subseteq\mathbf{coRP}$. The exercise 7.6(a) tells us there is a machine $M$ such that $M(x)\in\{L(x),?\}$ and $\Pr[M(x)=?]\leq\frac{1}{3}$. Construct $M''(x)$ as follows: if $M(x)=?$ then output $0$ otherwise output $M(x)$. Then 76 | $$L(x)=0\Rightarrow\Pr[M''(x)=0]=1$$ 77 | and 78 | $$L(x)=1\Rightarrow\Pr[M''(x)=1]\geq\frac{2}{3}$$ 79 | This gives $\mathbf{ZPP}\subseteq\mathbf{RP}$. Similar arguments can be applied to $\mathbf{ZPP}\subseteq\mathbf{coRP}$. 80 | 81 | \paragraph{$\supseteq$.} We are now going to prove that, if $L\in\mathbf{RP}$ and $L\in\mathbf{coRP}$ then $L\in\mathbf{ZPP}$. Since $L\in\mathbf{RP}$, there is a polynomial PTM $M'$ such that $M'(x)=1\Rightarrow L(x)=1$. Similarly, since $L\in\mathbf{coRP}$, there is a polynomial PTM $M''$ such that $M''(x)=0\Rightarrow L(x)=0$. Then construct a PTM $M$ as follows: 82 | \begin{enumerate} 83 | \item $M(x)$ invokes $M'(x)$. If $M'(x)=1$ then output $1$. 84 | \item $M(x)$ invokes $M''(x)$. If $M''(x)=0$ then output $0$. 85 | \item Goto the first step. 86 | \end{enumerate} 87 | 88 | The loop continues only if $M'(x)=0$ and $M''(x)=1$ happens simutaneously. By definition, this happens with probability no more than $\frac{1}{9}$, and the expected running time of $M$ is 89 | $$\mathbb{E}[T(n)]\leq\frac{T'(n)+T''(n)}{9^0}+\frac{2(T'(n)+T''(n))}{9^1}+...< 2(T'(n)+T''(n))$$ 90 | which is a polynomial. This yields $L\in\mathbf{ZPP}$. 91 | 92 | \end{exercise} 93 | 94 | \begin{exercise}{7.7} 95 | Assuming $L\in \textbf{BP}\cdot\textbf{NP}$, by encoding the randomness and certification of $L$ to $y$, let the circuit work as a verifier, then $L\in\textbf{NP}/poly$. 96 | \end{exercise} 97 | 98 | \begin{exercise}{7.8} 99 | To prove $PH$ collapses to $\Sigma_3^p$, it suffices to show that $\Pi_3 SAT\subset \Sigma_3^p$. 100 | 101 | $$ 102 | \Pi_3 SAT=\{\varphi(\cdot,\cdot,\cdot)| \forall x_1, \exists x_2, \forall x_3, \varphi(x_1,x_2,x_3)=0\}. 103 | $$ 104 | 105 | $\varphi\in \Pi_3SAT$ iff $\forall x_1, \exists x_2$ such that $\varphi(x_1,x_2,\cdot)\in \overline{3SAT}$. 106 | 107 | Since $\overline{3SAT}\leq_r 3SAT$, there exists deterministic polynomial time Turing Machine $M$, $n=\max(|x_1|,|x_2|,|\varphi|)$, integer $m$, such that $\forall \varphi(x_1,x_2,\cdot)$ 108 | $$ 109 | P_{r\in\{0,1\}^m}( \varphi(x_1,x_2,\cdot)\in \overline{3SAT} \text{ iff } M(r,\varphi(x_1,x_2,\cdot))\in 3SAT)\geq 1- 2^{-3n-1}. 110 | $$ 111 | Say that a random bit $r$ is bad if the event in the $P(\cdot)$ does not happen. Add over all $\varphi(x_1,x_2,\cdot)$, the bad random bit is at most $2^{-3n-1}*2^{m}*2^{3n}<2^{m}$. Thus there exists a $r_0$ which is good for all inputs, that is 112 | 113 | $$ 114 | \varphi(x_1,x_2,\cdot)\in \overline{3SAT} \text{ iff } M(r_0,\varphi(x_1,x_2,\cdot))\in 3SAT 115 | $$ 116 | 117 | $$ 118 | \Rightarrow 119 | \varphi\in \Pi_3SAT \text{ iff } \exists r_0, \forall x_1, \exists x_2, \exists u, \langle M(r_0,\varphi(x_1,x_2,\cdot)), u\rangle =1 120 | $$. 121 | 122 | %\Leftarrow \varphi\not\in \Pi_3SAT, then \forall r, there exists 123 | 124 | 125 | 126 | Thus we conclude if $\overline{3SAT}\leq_r 3SAT$, then $\Pi_3 SAT\subset \Sigma_3^p$. 127 | \end{exercise} 128 | 129 | \begin{exercise}{7.9} 130 | 131 | From the definition , $BPL\subseteq NL$, and because $NL\subseteq P$,so easily get that $BPL\subseteq P$. 132 | 133 | \end{exercise} 134 | 135 | \end{document} 136 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap08/chap08.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{geometry} 11 | % \usepackage{ntheorem} 12 | \usepackage{hyperref} 13 | \usepackage[ruled]{algorithm2e} 14 | \usepackage{caption,subcaption} 15 | 16 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 17 | 18 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{answer}{Answer} 29 | \newtheorem*{refute}{Refute} 30 | \newtheorem*{example}{Example} 31 | \newtheorem*{counterexample}{Counterexample} 32 | 33 | \newenvironment{exercise}[1]{ 34 | \par 35 | \noindent\textbf{Exercise #1.}\quad 36 | }{ 37 | \par 38 | \bigskip 39 | } 40 | 41 | 42 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 43 | \newcommand{\abs}[1]{\left| #1 \right|} 44 | \newcommand{\pbra}[1]{\left( #1 \right)} 45 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 46 | \newcommand{\sbra}[1]{\left[ #1 \right]} 47 | \newcommand{\bin}{\{0,1\}} 48 | 49 | \title{Exercise Set --- Chapter 8} 50 | \date{} 51 | 52 | \begin{document} 53 | 54 | \maketitle 55 | 56 | \begin{exercise}{8.1} 57 | (a) It is obvious that $IP\subseteq IP'$. To prove the other hand. We first observe that if $L \in IP'[2]$, then we have iteration process: 58 | 59 | Give $x$ and $r,r'$, if $\exists a_{1}, a_{2}$ subject to 60 | \begin{itemize} 61 | \item $f(x, r) = a_{1}$ 62 | \item $g(x, a_{1}, r') = a_{2}$ 63 | \item $a_{2} = 1\Rightarrow $ ACC. 64 | \item $a_{2} = 0 \Rightarrow $ REJ. 65 | \end{itemize} 66 | 67 | Firstly, when prover knows the answer, then $r, r'$ can be omitted. In the other hand, when prover don't know answer, it has a strategy $r'$ or without strategy would have the same result since verifier can check whether the prover is honest. That is, there exists $u(r, r')$ such that 68 | 69 | $\exists a_{1}, a_{2}$ subject to 70 | \begin{itemize} 71 | \item $f(x, u(r,r')) = a_{1}$ 72 | \item $g(x) = a_{2}$ 73 | \item $a_{2} = 1\Rightarrow $ ACC. 74 | \item $a_{2} = 0 \Rightarrow $ REJ. 75 | \end{itemize} 76 | Thus $IP'\subseteq IP$. 77 | %In other hand,$\exists f$ can be computed polynomially, for any $g$ and $x$, 78 | %\begin{itemize} 79 | %\item $x \in L \Rightarrow $ $\Pr(ACC)\geq 1 - \frac{1}{2^{n}}$. 80 | %\item $x \not\in L \Rightarrow $ for any $r'$, $\Pr(REJ)\geq 1 - \frac{1}{2^{n}}$. 81 | %\end{itemize} 82 | 83 | (2) Prove $IP\subseteq PSPACE$. 84 | 85 | Review the definition of PSPACE, if $L\in PSPACE$, we need to find the prover in $poly(|x|)$ space. $L\in IP$, given any verifier, we can compute the optimal prover in $poly(|x|)$ space, i.e., $L\in PSPACE$. 86 | 87 | (3) IP' : changing $2/3$ in $(8.2)$ to 1. 88 | 89 | Review the proof of Theorem 8.19: $IP = PSPACE$. We prove that there is a protocol for TQBF that uses public coins, if $x\in TQBF$, then there is a prover that makes the verifier accept with probability 1. Thus we can change the successful probability to $1$ in IP. 90 | 91 | (4) Changing $1/3$ in $(8.3)$ to 1. 92 | 93 | That is, $\exists V (f), r$, for any $P (g)$ 94 | \begin{itemize} 95 | \item $x \in L \Rightarrow \exists P\Pr[\text{out}_{V}\langle{V,P}\rangle(x) = 1] = 1$. 96 | \item $x \not\in L \Rightarrow \forall P \Pr[\text{out}_{V}\langle{V,P}\rangle(x) = 1] =0$. 97 | \end{itemize} 98 | $\Rightarrow IP' = NP$. 99 | \end{exercise} 100 | 101 | \begin{exercise}{8.2} 102 | Since $\textbf{IP}'\subseteq\textbf{IP}=\textbf{PSPACE}$, it suffices to show $\textbf{PSPACE}\subseteq\textbf{IP}'$. 103 | The protocol designed for TQBF naturally satisfies the requirement. 104 | \end{exercise} 105 | 106 | \begin{exercise}{8.9} 107 | Assuming the time complexity is $O(n^c)$, oracles for the same input size will not be used at the same time, so the space complexity is $O(\sum_{k=1}^n k^c)=O(n^{c+1})$. 108 | \end{exercise} 109 | 110 | \begin{exercise}{8.11} 111 | Give the definition of $MIP$ and probabilistic oracle machine:\\ 112 | 113 | $P_1,...,P_k$ and $V$ form a multi-prover interactive protocol for a language $L$ if : 114 | 115 | \begin{enumerate} 116 | \item[(1)] If $x\in L$, $\exists P_1,\ldots,P_k$, have $Pr[\text{$P_1,\ldots,P_k$ and $V$ on $x$ accecpt}]>1-2^{-n}$; 117 | \item[(2)] If $x\notin L$, $\forall P_1,\ldots,P_k$, have $Pr[\text{$P_1,\ldots,P_k$ and $V$ on $x$ accecpt}]<2^{-n}$ 118 | \end{enumerate} 119 | 120 | $MIP$ is the class of all languages which have multi-prover interactive protocols.\\ 121 | 122 | Let $M$ be a probabilistic ploy-time Turing machine with access to an oracle $O$,a language L is accepted by M iff 123 | 124 | \begin{enumerate} 125 | \item[(1)] For all $x\in L$, $\exists O$,have $Pr[M^O(x)=1]>1-2^{-n}$; 126 | \item[(2)] For all $x\notin L$, $\forall O$,have $Pr[M^O(x)=1]]<2^{-n}$ 127 | \end{enumerate} 128 | 129 | By Lemma 1 and Lemma 2, we can proof $MIP \subseteq NEXP $.\\ 130 | 131 | \begin{lemma} 132 | If a language $L$ is accepted by a a multi-prover interactive protocol , then $L$ can be accepted by a probabilistic oracle machine. 133 | \end{lemma} 134 | 135 | \begin{proof} 136 | Suppose now that $L$ is accepted by a multi-prover interactive protocol. Then define $M$ as follows: Have $M$ simulate $V$ with $M$ remembering all messages. When $V$ sends the $j$th message to the $i$th prover, $M$ asks the oracle the question$(i,j,l,\beta_i1,...,\beta_ij)$ properly encoded and uses the response as the $l$th bit of the $j$th response from prover $i$ where $\beta_i1,...,\beta_ij$ is everything prover $i$ can see in the point. 137 | 138 | \begin{itemize} 139 | \item[(a)] If $x\in L$, then the oracle $O$ could convince $M$ to accept by just encoding each prover's answer to each question. 140 | \item[(b)] If an oracle $O$ could convince $M$ to accept a string x then the provers could convince the verifier to accept by just using that $O$ to create their responses. 141 | \end{itemize} 142 | \end{proof} 143 | 144 | \begin{lemma} 145 | If a language $L$ is accepted by a probabilistic oracle machine, then $L$ can be computed in nondeterministic exponential time. 146 | \end{lemma} 147 | 148 | \begin{proof} 149 | By lemma 1,$M$ accept $L$ with $M$ using time $n^k$ on inputs length $n$ for some $k>0$.We create a nondeterministic exponential time machine to accept $L$ as follow: 150 | 151 | On input $x$($|x|=n$),guess the value of the oracle $O$ on all questions of length at most $n^k$.Note $M(k)$ can only ask oracle questions of lendth no longer than $n^k$,there are $2^{n^k +1} -1)$ such questions.For $r$ is a string of length $n^k$, let $f(x,O,r)=1$ if $M$ on input $x$ accepts using random coin tosses $r$ and getting the oracle answers from $O$ and $f(x,O,r)=0$ otherwise. Compute 152 | 153 | $S= \sum_{r \in \{0,1\}^{n^k}}f(x,O,r)$ 154 | 155 | Accept if $S>2^{n^k}/2$. 156 | 157 | By the definition of probabilistic oracle machine,for $x\in L$ there exist a setting of the oracle such that $S\ge(1-2^{-n})2^{n^k}$. If $x \notin L$ then for any setting of the oracle ,$S\leq 2^{-n}2^{n^k}$. 158 | \end{proof} 159 | \end{exercise} 160 | 161 | \end{document} 162 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap09/chap09.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{geometry} 11 | % \usepackage{ntheorem} 12 | \usepackage{hyperref} 13 | \usepackage[ruled]{algorithm2e} 14 | \usepackage{caption,subcaption} 15 | 16 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 17 | 18 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{answer}{Answer} 29 | \newtheorem*{refute}{Refute} 30 | \newtheorem*{example}{Example} 31 | \newtheorem*{counterexample}{Counterexample} 32 | 33 | \newenvironment{exercise}[1]{ 34 | \par 35 | \noindent\textbf{Exercise #1.}\quad 36 | }{ 37 | \par 38 | \bigskip 39 | } 40 | 41 | 42 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 43 | \newcommand{\abs}[1]{\left| #1 \right|} 44 | \newcommand{\pbra}[1]{\left( #1 \right)} 45 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 46 | \newcommand{\sbra}[1]{\left[ #1 \right]} 47 | \newcommand{\bin}{\{0,1\}} 48 | 49 | 50 | \def\sD{\textsf{D}} 51 | \def\sE{\textsf{E}} 52 | \def\cD{\mathcal{D}} 53 | 54 | \title{Exercise Set --- Chapter 9} 55 | \date{} 56 | 57 | \begin{document} 58 | 59 | \maketitle 60 | 61 | \begin{exercise}{9.2} 62 | If for any two messages $x,x'$ such that $E_{U_{n}}(x)$ has the same distributions to $E_{U_{n}}(x')$. Then there exists $r$, s.t. $x$ and $x'$ are encrypted by the same key $k$. i.e., $\Pr[E_{k}(x) = y] = \Pr[E_{k'}(x)] = y$. In the other hand, if $E_{k}(x) = E_{k}(x') = y$, then we can not obtain the correct plaintext with $y$. Thus there exists $x,x'$, $E_{U_{n}}(x)$ is not the same distributions as $E_{U_{n}}(x')$. 63 | \end{exercise} 64 | 65 | \begin{exercise}{9.3} 66 | Since $\mathrm E_k(\cdot)$ is one-time pad encryption, the distribution of $\mathrm E_k(\cdot)$ is uniform. 67 | Then the desired inequality follows immediately. 68 | \end{exercise} 69 | 70 | \begin{exercise}{9.4} 71 | Define a distinguisher $A$ for each $x$ as 72 | \[ 73 | A_x(y): = \left\{\begin{array}{cl} 74 | x & \Pr[\sD_{U_n}(y) = x] \geq 2^{-n},\\ 75 | 0 & \text{otherwise.} 76 | \end{array}\right. 77 | \] 78 | Define $\text{error}(x)$ as the failure probability to distinguish $0$ and $x$. Thus, 79 | \begin{align*} 80 | \text{error}(x) 81 | = &\frac12 \Pr_{k_1,r} [A_x(\sE_{k_1,r}(0))=x] + \frac12 \Pr_{k_1,r} [A_x(\sE_{k_1,r}(x))=0]\\ 82 | = &\frac12 \Pr_{k_1,r} \left[\Pr_{k_2}[\sD_{k_2}(\sE_{k_1,r}(0))=x] \geq 2^{-n}\right] + \frac12 \Pr_{k_1,r} \left[\Pr_{k_2}[\sD_{k_2}(\sE_{k_1,r}(x))=x] < 2^{-n}\right]\\ 83 | \leq &\frac12 \Pr_{k_1,k_2,r} \left[\sD_{k_2}(\sE_{k_1,r}(0))=x\right]\cdot 2^n 84 | \end{align*} 85 | Furthermore, we have 86 | \[ 87 | \sum_x \text{error}(x) \leq \sum_x \Pr_{k_1,k_2,r} \left[\sD_{k_2}(\sE_{k_1,r}(0))=x\right]\cdot 2^{n - 1} \leq 2^{n - 1}, 88 | \] 89 | which implies there exists $x$ such that $\text{error}(x) \leq 2^{n - m - 1}$ as required. 90 | \end{exercise} 91 | 92 | \begin{exercise}{9.12} 93 | Suppose $g(n)$ is a one-way permutation,then construct the function $f(n)$: 94 | \begin{equation} 95 | f(z,x)=0^ng(x); 96 | f(0^n,x)=0^{2n}. 97 | \end{equation} 98 | 99 | the function $f(x)$ is a one-way function, but for every $c>0$,$f(x)^{n^c}$ is not a one-way function.Next we give the proof. 100 | 101 | (1)$f(n)$ is a one-way function. 102 | 103 | Assume $f(n)$ is not a one-way function ,then there is a ploy-time algorithm $A$ and 104 | \begin{equation} 105 | Pr_{s\in\{0,1\}^{2n};u=f(s)}(A(u)=s' \ s.t.\ f(s')=u)\geq\epsilon_1(2n) 106 | \end{equation} 107 | 108 | then we can construct a ploy-time algorithm $B$ by $A$ : 109 | 110 | \begin{center} 111 | \fbox{\shortstack[l]{$A$:\\input $u(|u|=2n)$;\\output $s(|s|=2n)$}} 112 | \qquad\qquad\qquad 113 | \fbox{\shortstack[l]{$B$:\\input $y(|y|=n)$;\\$A(0^ny)=S^1S^2\dots S^{2n}$;\\output $x=S^{n+1}\dots S^{2n}$}}; 114 | 115 | \end{center} 116 | We name $P_1=Pr_{s\in\{0,1\}^{2n};u=f(s)}(A(u)=s' \ s.t.\ f(s')=u\ |\ u=0^{2n});P_2=Pr_{s\in\{0,1\}^{2n};u=f(s)}(A(u)=s' \ s.t.\ f(s')=u\ |\ u\ne0^{2n});P_3=Pr_{x\in\{0,1\}^{n};y=g(x)}(B(y)=x'\ s.t.\ g(x')=y\ |\ y=0^n)$ 117 | 118 | \begin{equation} 119 | Pr_{s\in\{0,1\}^{2n};u=f(s)}(A(u)=s' \ s.t.\ f(s')=u)=\frac{1}{2^n}P_1+\frac{2^n-1}{2^n}P_2 120 | \end{equation} 121 | 122 | \begin{equation} 123 | Pr_{x\in\{0,1\}^{n};y=g(x)}(B(y)=x'\ s.t.\ g(x')=y)=\frac{1}{2^n}P_3+\frac{2^n-1}{2^n}P_2\geq\epsilon_1(2n)-\frac{1}{2^n} 124 | \end{equation} 125 | 126 | For every fixed negligible function$\epsilon_2(n)$,that $\forall c_2,\exists N_2,\forall n>N_2$,there is $\epsilon_2<\frac{1}{n^c_2}$.we can construct another negligible function$\epsilon_1(2n)$,that $\exists N_1,\forall 2n>N_1$,there is $\epsilon_1(2n)=\epsilon_1(n)-\frac{1}{2^n}<\frac{1}{n^{C_2}}+\frac{1}{2^n}<\frac{1}{(2n)^{\frac{C_2}{2}}}$. 127 | 128 | so, 129 | \begin{equation} 130 | Pr_{x\in\{0,1\}^{n};y=g(x)}(B(y)=x'\ s.t.\ g(x')=y)\geq \epsilon_2(n) 131 | \end{equation} 132 | 133 | It's contrast to that $g(x)$ is a one-way function, so f(x) is also a one-way function. 134 | 135 | (2)$\forall c>0$($n^c$ is still polynomial);$f^{n^c}(s)$ is not one-way function.Because 136 | \begin{equation} 137 | Pr_{s\in\{0,1\}^{2n};u=f^{n^c}(s)}(A(u)=s' \ s.t.\ f^{n^c}(s')=u)=1 138 | \end{equation} 139 | 140 | \end{exercise} 141 | 142 | \begin{exercise}{9.15} 143 | \begin{itemize} 144 | \item [a.] 145 | There exists indistinguishable function $f^{-1}$, and polynomial $A$ s.t., 146 | \begin{align*} 147 | |\Pr[A(f^{-1}(f(X_{n})))] - A(f^{-1}(f(Y_{n})))]|<\epsilon(n) 148 | \end{align*} 149 | i.e., $f(X_{n})$ and $f(Y_{n})$ are indistinguishable. 150 | 151 | \item[b.] 152 | $\Leftarrow$ By definition 9.8. 153 | 154 | $\Rightarrow$ Obvious? 155 | 156 | \item[c.] 157 | 158 | \end{itemize} 159 | \end{exercise} 160 | 161 | \begin{exercise}{9.16} 162 | Assume $f$ is a one-way permutation. 163 | Let 164 | $$ 165 | L=\cbra{(y,r,b)\in\bin^n\times\bin^n\times\bin\middle|b=r\odot f^{-1}(y)}, 166 | $$ 167 | then 168 | $$ 169 | \overline L=\cbra{(y,r,b)\in\bin^n\times\bin^n\times\bin\middle|b\neq r\odot f^{-1}(y)}. 170 | $$ 171 | Since $f$ is a permutation, $L$ is polynomially sampleable, 172 | as we first randomly select $r,x$ then let $b=r\odot x,y=f(x)$. 173 | Similar argument works for $\overline L$ as well. 174 | Then by Goldreich-Levin Theorem, uniform distribution over $L$ is computationally indistinguishable from 175 | uniform distribution over $\overline L$. 176 | 177 | Now we move to \textsc{3-Coloring}. Since $L\in\textbf{NP}$, there is a polynomial-time algorithm $\mathcal A$ 178 | such that $s\in L$ iff $\mathcal A(s)\in\textsc{3-Coloring}$. 179 | Thus, the uniform distribution over $L$ induces a polynomially sampleable distribution over \textsc{3-Coloring} 180 | and ditto for $\overline L$ and $\overline{\textsc{3-Coloring}}$. 181 | Meanwhile, these two distributions are polynomial-time indistinguishable, following from the hardness of 182 | distinguishing $L$ and $\overline L$. 183 | 184 | \end{exercise} 185 | 186 | \end{document} 187 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap10/chap10.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{geometry} 11 | % \usepackage{ntheorem} 12 | \usepackage{hyperref} 13 | \usepackage[ruled]{algorithm2e} 14 | \usepackage{caption,subcaption} 15 | 16 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 17 | 18 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{answer}{Answer} 29 | \newtheorem*{refute}{Refute} 30 | \newtheorem*{example}{Example} 31 | \newtheorem*{counterexample}{Counterexample} 32 | 33 | \newenvironment{exercise}[1]{ 34 | \par 35 | \noindent\textbf{Exercise #1.}\quad 36 | }{ 37 | \par 38 | \bigskip 39 | } 40 | 41 | 42 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 43 | \newcommand{\abs}[1]{\left| #1 \right|} 44 | \newcommand{\pbra}[1]{\left( #1 \right)} 45 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 46 | \newcommand{\sbra}[1]{\left[ #1 \right]} 47 | \newcommand{\bin}{\{0,1\}} 48 | 49 | 50 | \def\sD{\textsf{D}} 51 | \def\sE{\textsf{E}} 52 | \def\cD{\mathcal{D}} 53 | 54 | \title{Exercise Set --- Chapter 10} 55 | \date{} 56 | 57 | \begin{document} 58 | 59 | \maketitle 60 | 61 | \begin{exercise}{10.8} 62 | 题目不可证。改为 $10\log T$ 是 trival 的。 63 | \end{exercise} 64 | 65 | \begin{exercise}{10.12} 66 | If $N,A$ are coprime, then there exists $u,v\in\mathbb Z$ such that $uN+vA=1$. 67 | Thus $uBN+vAB=B$. Now observe that $N$ divides $uBN+vAB$ as claimed, then $N$ must divide $B$. 68 | \end{exercise} 69 | 70 | \begin{exercise}{10.13} 71 | \begin{itemize} 72 | \item [\textbf{(a)}] Consider the following partition of $\mathbb Z_p^*$: 73 | \[ 74 | \{\{1, p - 1\}, \{2, p - 2\}, \ldots, \{(p - 1)/2, (p + 1)/2\}\}. 75 | \] 76 | Since that $x_1^2 - x_2^2 \equiv (x_1 - x_2)(x_1 + x_2) \equiv 0 \pmod p$, it maps $x_1, x_2$ to the same element if and only if they are in the same pair. 77 | 78 | \item [\textbf{(b)}] Actually, if $2 \mid \ord(x)$, $\ord(x^2) = \ord(x)/2$. 79 | 80 | \item [\textbf{(c)}] Let $N = n_1\cdot n_2 \cdot \ldots \cdot n_k$ where $n_i$ is power of a prime and $n_i \perp n_j$ for all distinct $i, j \in [k]$. Assume $n_1 < \ldots < n_k$. If $n_1 \neq 2$ or $k > 2$, $r / 2$ can be divided by $\text{lcm}(\varphi(n_1), \ldots, \varphi(n_k))$, which means $x^{r/2} = 1$ for all $x \in \mathbb Z_{N}^*$. Thus, it suffices to proof $\Pr[x_2^{\varphi(n_2)/2} = 1] \geq 1/4$ due to Chinese Remainder Theorem, where $x_2$ is uniformly sampled from $\mathbb Z_{n_2}^*$. Let $x = a\cdot p + b$. We have: 81 | \[ 82 | (a\cdot p + b)^{p^{k - 1}(p - 1)/2} \equiv (b^{(p - 1)/2})^{p^{k - 1}} \pmod {p^k}. 83 | \] 84 | Note that $(b^{(p - 1)/2})^{p^{k - 1}} \bmod {p^k} = b^{(p - 1)/2} \bmod p$. If $b$ is a quadratic residue modulo $p$, $b^{(p - 1)/2} \equiv 1 \pmod p$ holds, since there exists $b'$ s.t. $b'^2 = b$ and $b'^{(p - 1)} = 1$. According to \textbf{(a)}, there are $(p - 1)/2$ quadratic residues, which finishes the proof. 85 | 86 | % Note that $x^{r/2} \neq -1$ means $\ord(x) = r / c$ where $c$ is an odd. Let $N = n_1\cdot n_2 \cdot \ldots \cdot n_k$ where $n_i \perp n_j$ for all distinct $i, j \in [k]$. Due to Chinese Remainder Theorem, there exist $x_1 \in \mathbb Z_{n_1}^*, \ldots, x_k \in \mathbb Z_{n_k}^*$ such that $x \equiv x_i \pmod {n_i}$ for all $i \in [k]$. Whereas, $x^{r/2} \neq -1$ holds if and only if there exists $i \in [k]$, such that $\ord(x_i) \mid \varphi(n_i)/2$ holds. Since $k \geq 2$ and $x_i$ is uniformly sampled from $\mathbb Z_{n_i}^*$ for all $i \in [k]$, it suffices to proof $\Pr[x_1^{\varphi(n_1)/2} = 1] \geq 1/2$. 87 | \end{itemize} 88 | \end{exercise} 89 | 90 | \end{document} 91 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap11/chap11.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX spellcheck = LaTeX 3 | 4 | \documentclass[a4paper]{article} 5 | 6 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 7 | \usepackage{mathrsfs} 8 | \usepackage{bm} 9 | \usepackage{geometry} 10 | % \usepackage{ntheorem} 11 | \usepackage{hyperref} 12 | \usepackage{caption,subcaption} 13 | 14 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 15 | 16 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 17 | 18 | \newtheorem{theorem}{Theorem} 19 | \newtheorem{lemma}{Lemma} 20 | \newtheorem{proposition}{Proposition} 21 | \newtheorem{corollary}{Corollary} 22 | \newtheorem{claim}{Claim} 23 | \newtheorem{conjecture}{conjecture} 24 | \newtheorem{definition}{Definition} 25 | \newtheorem{construction}{Construction} 26 | \newtheorem*{answer}{Answer} 27 | \newtheorem*{refute}{Refute} 28 | \newtheorem*{example}{Example} 29 | \newtheorem*{counterexample}{Counterexample} 30 | 31 | \newenvironment{exercise}[1]{ 32 | \par 33 | \noindent\textbf{Exercise #1.}\quad 34 | }{ 35 | \par 36 | \bigskip 37 | } 38 | 39 | 40 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 41 | \newcommand{\abs}[1]{\left| #1 \right|} 42 | \newcommand{\pbra}[1]{\left( #1 \right)} 43 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 44 | \newcommand{\sbra}[1]{\left[ #1 \right]} 45 | \newcommand{\bin}{\{0,1\}} 46 | 47 | 48 | \def\sD{\textsf{D}} 49 | \def\sE{\textsf{E}} 50 | \def\cD{\mathcal{D}} 51 | 52 | \usepackage{algorithm,xspace} 53 | \usepackage{algorithmicx} 54 | \usepackage[noend]{algpseudocode} 55 | 56 | \title{Exercise Set --- Chapter 11} 57 | \date{} 58 | 59 | \begin{document} 60 | 61 | \maketitle 62 | 63 | \begin{exercise}{11.5} 64 | In Page 51 and Page 52, the proof of Theorem 2.14 introduce a way to reduce 3SAT to INDSET. Follow the way,we can transform in poly-time every $m$-clause 3CNF formula $\varphi$ into a $7m$-vertex graph $G$ such that if and only if $G$ has an independent set of size at least $m$. 65 | 66 | We add something in the construction:make the $7$ vertices which are show the same clause are connected to each other. Make $f$ is it, so $f(\varphi)$ is an $n$-vertex graph, and the largest independent set has size $var(\varphi)n/7$. 67 | \end{exercise} 68 | 69 | \begin{exercise}{11.9} $ $ 70 | \begin{itemize} 71 | \item $\text{L-PCP}(\log n)\subseteq\text{NP}$: 72 | Assume $\mathcal A\in\text{L-PCP}(\log n)$ and $V_{\mathcal A}$ be the corresponding checker. 73 | For any input $x$, we can guess the certificate $y$, 74 | which is of polynomial length since $V_{\mathcal A}$ is logspace. 75 | Then simulate $V_{\mathcal A}$ on all $2^{r(n)}=\text{poly}(n)$ possible randomness and count the number of accepted 76 | ones. 77 | If $x\in\mathcal A$, there exists $y$ such that all $2^{r(n)}$ cases accept. 78 | Otherwise, no $y$ would achieve success rate better than $\frac12$ as assumption. 79 | \item $\text{NP}\subseteq\text{L-PCP}(\log n)$: 80 | Since all languages in $\text{NP}$ can be reduced to \textsc{3-SAT} in logspace, it suffices to prove 81 | $\textsc{3-SAT}\in\text{L-PCP}(\log n)$. 82 | 83 | Assume there are $n$ variables and $m$ clauses. The certificate $y$ consists of $nm$ bits and partitioned into 84 | $a_1a_2\cdots a_m$, where $a_1=\cdots=a_m$ is a satisfiable assignment. 85 | Then we describe $V_\textsc{3-SAT}$ in two parts. 86 | \begin{itemize} 87 | \item \textbf{Satisfiability Checker:} 88 | $V_\textsc{3-SAT}$ simply checks the satisfiability of the $i$-th clause in $a_i$, which can be done 89 | as in one pass. 90 | \item \textbf{Validity Checker:} 91 | To make sure the certificate is consistent, i.e., $a_1=\cdots=a_m$, $V_\textsc{3-SAT}$ checks the validity 92 | along the one pass. 93 | 94 | With $O(\log n)$ random bits, 95 | it selects a random prime $1\leq p\leq n^c$ and a random integer $x\in[n^d]$, 96 | where $c,d$ are constants sufficiently large. 97 | For $i\in[m]$, it computes 98 | $$ 99 | f_i=\sum_{j=1}^na_i[j]x^j\pmod{p} 100 | $$ 101 | and checks if $f_i=f_{i+1}$, which can be done in logspace. 102 | Assume $a_i\neq a_{i+1}$, 103 | \begin{align*} 104 | &\Pr\sbra{f_i=f_j}\\ 105 | \leq&\Pr\sbra{f_i=f_j\middle|\sum_{j=1}^n(a_i[j]-a_{i+1}[j])x^j\neq0} 106 | +\Pr\sbra{\sum_{j=1}^n(a_i[j]-a_{i+1}[j])x^j=0}\\ 107 | \leq& 108 | \frac{\displaystyle\max_{t\in\sbra{n^{dn+1}}}\#\cbra{\text{prime }p\middle|p\text{ divides }t}} 109 | {\pi(n^c)} 110 | +\frac{n+1}{n^d}\\ 111 | \leq& 112 | \frac{(dn+1)\log n}{\frac{n^c}{c\log n}}+\frac{n+1}{n^d}. 113 | \end{align*} 114 | Thus by union bound, the probability that fake $y$ fools $V_\textsc{3-SAT}$ is upper bounded by 115 | $$ 116 | m\times\pbra{\frac{(dn+1)\log^2 n}{cn^c}+\frac{n+1}{n^d}}=o(1) 117 | $$ 118 | as $c,d$ sufficiently large. 119 | \end{itemize} 120 | \end{itemize} 121 | \end{exercise} 122 | 123 | 124 | \begin{exercise}{11.10} 125 | Given input $x$ and random bits $s$, $V_{x, s}(\pi)$ is a function which outputs $1$ if and only the prover accepts $x$ under $\pi, s$. Denote $R_{x, s}$ as the range of bits read by $V_{x, s}$ on $\pi$. Note that $V_{x, r}(\pi)$ and $R_{x, r}$ can be computed by a log-space Turing machine. Thus, $x \in L$ if there exists $\pi$ s.t. $V_{x, s}(\pi) = 1$ for all $s$, and $x \not\in L$ if for all $\pi$, $|\{s \mid V_{x, s}(\pi) = 1\}| \leq 2^{r(n)}/2$. These 2 cases can be distinguished by the following algorithm. 126 | 127 | \begin{algorithm}[H] 128 | \caption{A log-space membership checking algorithm}\label{alg:soc} 129 | \begin{algorithmic} 130 | \Function{Check}{$x, \ell, r$} \Comment{\textsc{Check} can be computed in log-space when $r - \ell = O(\log n)$.} 131 | \State Output $|\{s \in \{0,1\}^{r(n)} \mid R_{x, s} \subseteq [\ell, r]\}|$ 132 | \State Output $\max_\pi|\{s \in \{0,1\}^{r(n)} \mid R_{x, s} \subseteq [\ell, r], V_{x,s}(\pi) = 1\}|$ 133 | \EndFunction 134 | \\ 135 | \State $tot \gets 0, val \gets 0$ 136 | \State $\ell \gets 1, r \gets 2a\log n$ 137 | \While{$\ell \leq |\pi|$} 138 | \State $(t, v) \gets $ \Call{Check}{$x, \ell, r$} 139 | \State $tot \gets tot + t, val \gets val + v$ 140 | \State $\ell \gets r + 1, r \gets \ell + 2a\log n - 1$ 141 | \EndWhile 142 | \\ 143 | \State $tot' \gets 0, val' \gets 0$ 144 | \State $\ell \gets a\log n + 1, r \gets 3a\log n$ 145 | \While{$\ell \leq |\pi|$} 146 | \State $(t, v) \gets $ \Call{Check}{$x, \ell, r$} 147 | \State $tot' \gets tot' + t, val' \gets val' + v$ 148 | \State $\ell \gets r + 1, r \gets \ell + 2a\log n - 1$ 149 | \EndWhile 150 | \\ 151 | \If{$tot > tot'$} 152 | \State \Return $\mathbf 1_{tot = val}$ 153 | \Else 154 | \State \Return $\mathbf 1_{tot' = val'}$ 155 | \EndIf 156 | \end{algorithmic} 157 | \end{algorithm} 158 | \end{exercise} 159 | 160 | \end{document} 161 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap12/chap12.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{geometry} 11 | % \usepackage{ntheorem} 12 | \usepackage{hyperref} 13 | \usepackage[ruled]{algorithm2e} 14 | \usepackage{caption,subcaption} 15 | 16 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 17 | 18 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{answer}{Answer} 29 | \newtheorem*{refute}{Refute} 30 | \newtheorem*{example}{Example} 31 | \newtheorem*{counterexample}{Counterexample} 32 | 33 | \newenvironment{exercise}[1]{ 34 | \par 35 | \noindent\textbf{Exercise #1.}\quad 36 | }{ 37 | \par 38 | \bigskip 39 | } 40 | 41 | 42 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 43 | \newcommand{\abs}[1]{\left| #1 \right|} 44 | \newcommand{\pbra}[1]{\left( #1 \right)} 45 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 46 | \newcommand{\sbra}[1]{\left[ #1 \right]} 47 | \newcommand{\bin}{\{0,1\}} 48 | 49 | 50 | \def\sD{\textsf{D}} 51 | \def\sE{\textsf{E}} 52 | \def\cD{\mathcal{D}} 53 | 54 | \title{Exercise Set --- Chapter 12} 55 | \date{} 56 | 57 | \begin{document} 58 | 59 | \maketitle 60 | \begin{exercise}{12.1} 61 | 根据题意,假设对应每个 $i$,都有 $x_i$ 使得 $f({x_i}^i)\neq f(x_i)$. 根据鸽巢原理,有:存在 $\{x_1,\dots,x_n\}$ 的一个大小为 $n/{2^k}$ 的子集 $S$,对于 $S$ 内的元素,决策树的前 $k$ 次查询都是相同的答案。则对于最后一个不为空的 $S=\{x_0\}$,即 $n/{2^{k_0}}=1$,则对于其中的元素有 $k_0=\log n$ 个 $i$ 使 $f({x_0}^i)\neq f(x_0)$。则根据定义 $S(f)=\Omega(\log n)$。 62 | \end{exercise} 63 | \begin{exercise}{12.5} 64 | Simply compute 65 | $$ 66 | g(\bm x)=\sum_{\bm s\in\bin^n}f(\bm s)\prod_{i:s_i=0}(1-x_i)\prod_{j:s_j=1}x_j. 67 | $$ 68 | It is unique since we can reverse the construction of $g$ and obtain the corresponding $f(\bm s)$. 69 | \end{exercise} 70 | 71 | \end{document} 72 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap14/chap14.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | 50 | 51 | \def\sD{\textsf{D}} 52 | \def\sE{\textsf{E}} 53 | \def\cD{\mathcal{D}} 54 | 55 | \title{Exercise Set --- Chapter 14} 56 | \date{} 57 | 58 | \begin{document} 59 | \maketitle 60 | \begin{exercise}{14.6} 61 | 1.若$m$是一个包含$p$因子的合数,则可以利用$MOD m$与不限扇入度的与,或,非门模拟$MOD p$.模拟规则为:先利用常数个(记为$c$)与,或,非门实现“减p”的操作,重复$(m/p-1)$层,而后连接一个$MOD m$门,即可计算得$MOD p$。 62 | 63 | 2.若$m$的因子都与$p$互素,无法证明,但已知加入$MOD 6$无法模拟任何$p>6$且$p$为素数的$MOD p$门。 64 | \end{exercise} 65 | 66 | \begin{exercise}{14.7} 67 | Let $N$ be the exact degree a polynomial over $GF(q)$ requires to exactly represent the OR function of $n$ varaibles $x_1,x_2,\dots,x_n $. Note that OR function can be represented by $1-\prod _{i=1}^n (1-x_i)$, so $N \leq n$. 68 | 69 | Let $\hat{f}$ be any function agrees with $OR$ function on $\{0,1\}^n$. Since $x_i^2 =1 \mod q$ on $\{0,1\}$, we can assume $\hat{f}$ is a multilinear polynomial without loss of generality. It is not hard to prove that $\hat{f}$ is unique over $GF(q)$ by mathematical induction. Hence, $\hat{f}=1-\prod _{i=1}^n (1-x_i)$ and $N=n$. 70 | \end{exercise} 71 | 72 | \begin{exercise}{14.9} 73 | Assume $L$ can be computed by a width-$c$ ($c=O(1)$) depth-$d$ branching program. 74 | Assume the $i$-th layer queries the $a_i$-th bit. Then the $i$-th layer can be seen as two functions 75 | $f_i,g_i:[c]\to[c]$, where we go along $f_i$ iff $x_{a_i}=0$. 76 | 77 | Now we construct an $O(\log d)$ circuit $\mathcal C$ for $L$. In the first $O(1)$ layers, $\mathcal C$ concurrently evaluates 78 | $h_i^1:[c]\to[c]$, where 79 | $$ 80 | h_i^1=\begin{cases} 81 | f_i&x_{a_i}=0\\ 82 | g_i&x_{a_i}=1. 83 | \end{cases} 84 | $$ 85 | Then with $O(\log d)$ layers, $\mathcal C$ computes the composition of $h_i$'s, i.e., compute 86 | $h_i^k=h_{2i}^{k-1}\circ h_{2i-1}^{k-1}$ for $k\in[\log d]$. 87 | At last, $\mathcal C$ simply evaluates its value as we have computed $h_d^1\circ\cdots\circ h_2^1\circ h_1^1$ like the evaluation of the original branching program. 88 | \end{exercise} 89 | 90 | \begin{exercise}{14.10} 91 | Given a DAG $G = (V, A)$ with $|V| = n, |A| = m$ and the depth of $d$, select an arbitrary mapping $f: V \to [d]$ s.t., for each $(u \to v) \in A$, $c(u) < c(v)$ holds. Label the edges as 92 | \[ 93 | (u \to v) \mapsto \lfloor \log(c(u)\oplus c(v))\rfloor. 94 | \] 95 | Suppose the path containing at least $2^\ell$ vertices contains at least $\ell$ distinct edge-labels. Assume a path $P$ contains $2^{\ell + 1}$ vertices whose labels are gathered by $T = c(S) = \{a_1, \ldots, a_{2^{\ell + 1}}\}$ where $a_1 < \ldots < a_{2^{\ell + 1}}$. W.l.o.g, assume there exist $i$ s.t. $\lfloor\log a_i\rfloor \neq \lfloor\log a_{i + 1}\rfloor$ where $i$ is the maximum one. Thus, $\lfloor \log a_{i + 1}\rfloor$ appears in an edges of the path and all the others are less than it. Note that either the subpath containing the first $i$ vertices of $P$, or the one containing the last $2^{\ell + 1} - i$ has $2^{\ell}$ vertices, which means there are $\ell$ distinct and less than $\lfloor \log a_{i + 1}\rfloor$ edge-labels in either the first- or the second-part of $P$ due to the induction assumption. Remove all the edges labeled by the $k$ ``least popular'' numbers, which will be no more than $km/\lceil\log d\rceil$. After that, the longest path will be shorter than $2^{\ell - k} \leq d/2^{k - 1}$ as we want. 96 | \end{exercise} 97 | \end{document} 98 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap15/chap15.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | 50 | 51 | \def\sD{\textsf{D}} 52 | \def\sE{\textsf{E}} 53 | \def\cD{\mathcal{D}} 54 | 55 | \title{Exercise Set --- Chapter 15} 56 | \date{} 57 | 58 | \begin{document} 59 | \maketitle 60 | \begin{exercise}{15.1} 61 | Firstly, we proof the resolution will end. Suppose the resolution never end, which means $\forall x_i, i \in [n], x_i$ and $\overline{x_i}$ don't exist simultaneously. W.L.O.G we assume that only $x_i$ exist, then we assign $x_i = 1$(if $\overline{x_i}$ exist we let $x_i=0$), then the $\varphi$ is satisfiable, which lead to a contradiction. 62 | \par Secondly, we do one resolution refutation will create a new clause in $2^{S},S=\{x_1,x_2,\cdots,x_n\}$. So we can only add $2^O(n)$ new term into CNF, which means that there exist a resolution refutation for $\varphi$ of length $O(2^n)$. 63 | \end{exercise} 64 | \end{document} 65 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap16/chap16.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | 50 | 51 | \def\sD{\textsf{D}} 52 | \def\sE{\textsf{E}} 53 | \def\cD{\mathcal{D}} 54 | 55 | \title{Exercise Set --- Chapter 16} 56 | \date{} 57 | 58 | \begin{document} 59 | \maketitle 60 | 61 | \begin{exercise}{16.1} 62 | 任选一个函数$f$,存在一个拥有$S$个门的布尔线路计算$f$.对于该线路内的任一逻辑门$gate_i$,可用$l_i$长的代数直线程序实现,即可用$3l_i$规模的代数路线模拟,则该函数可使用$\sum_i 3i\cdot l_i$规模的代数路线模拟,令$c=3\cdot max{l_i,1/l_i}$,可知该代数路线的规模介于$c\cdot S$与$c/S$之间。 63 | \end{exercise} 64 | 65 | \begin{exercise}{16.4} 66 | \begin{itemize} 67 | \item[(a)] 68 | Let $\#\texttt{ADDs}$ be the number of additions in the $k\times k$ algorithm. 69 | We may assume $n=k^\ell$ and then use divide-and-conquer: 70 | $$ 71 | \begin{bmatrix} 72 | \bm A_{1,1} & \cdots & \bm A_{1,k} \\ 73 | \vdots & \ddots & \vdots \\ 74 | \bm A_{k,1} & \cdots & \bm A_{k,k} 75 | \end{bmatrix} 76 | \begin{bmatrix} 77 | \bm B_{1,1} & \cdots & \bm B_{1,k} \\ 78 | \vdots & \ddots & \vdots \\ 79 | \bm B_{k,1} & \cdots & \bm B_{k,k} 80 | \end{bmatrix} 81 | = 82 | \begin{bmatrix} 83 | \bm C_{1,1} & \cdots & \bm C_{1,k} \\ 84 | \vdots & \ddots & \vdots \\ 85 | \bm C_{k,1} & \cdots & \bm C_{k,k} 86 | \end{bmatrix}, 87 | $$ 88 | where each $\bm C_{i,j}$ comes from the $k\times k$ algorithm and 89 | uses recursion for the multiplications required by $\bm C_{i,j}$. 90 | Thus 91 | \begin{align*} 92 | S(k^\ell) 93 | &=k^\omega S(k^{\ell-1})+k^{2(\ell-1)}\cdot\#\texttt{ADDs}\\ 94 | &=n^{\omega}+\#\texttt{ADDs}\cdot\sum_{i=1}^\ell k^{2(\ell-i)}\cdot k^{(i-1)\omega}\\ 95 | &=O(n^\omega). 96 | \end{align*} 97 | \item[(b)] 98 | By (a) and Strassen's algorithm\footnote{\url{https://en.wikipedia.org/wiki/Strassen_algorithm}}, we can compute 99 | matrix multiplication of $2\times2$ matrices using $7$ multiplication gates. Thus $\omega=\log_27<2.81$. 100 | \end{itemize} 101 | \end{exercise} 102 | 103 | \begin{exercise}{16.12} 104 | 对于$\forall L\in P/poly$,存在一个多项式规模的线路族${C_n}$判定L,该线路族可以编码为一个实数:令该线路族内每个线路编码成的二进制串位数固定为$n^c$位(多余位补零,c是一个足够大的实数),而后转化为该线路族的二进制编码,形成表示该线路族的实数。 105 | 106 | 同时在BBS模型上,该实数可作为某个状态所关联的函数$p(x)$的系数,即该线路族的每个线路的多项式编码都蕴含在该系数上。对于BBS模型输入$|x|=n$,只需要抽取出表示$C_n$线路的多项式编码,即可在多项式时间上判定$x$是否属于L。 107 | 108 | 由于BBS模型增加了判断$a>0$的能力,只需要将该系数进行多项式次数的除以2,加多项次$MOD 2$,每次取余数用分支测试查看所得值是否大于0,即得对应$n$输入的线路$C_n$的多项式长度的编码。然后用多项式时间模拟该线路,既可以判定输入是否属于L。 109 | 110 | 故题给BBS模型可以判定P/poly内所有问题。 111 | \end{exercise} 112 | 113 | 114 | \end{document} 115 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap17/chap17.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | \newcommand{\SAT}{\texttt{SAT}} 50 | 51 | 52 | \title{Exercise Set --- Chapter 17} 53 | \date{} 54 | 55 | \begin{document} 56 | \maketitle 57 | 58 | \begin{exercise}{17.1} 59 | Let $\SAT_0$ be the event that the Boolean formula is satisfied. 60 | We assume $\Pr\sbra{\SAT_0}>0$, otherwise $\Pr\sbra{x_1=1\mid\SAT_0}$ is undefined. 61 | Then we find a satisfying assignment $y$ as follows where $i$ starts from $1$ to $n$. 62 | \begin{itemize} 63 | \item If $\Pr\sbra{x_i=1\mid\SAT_{i-1}}>0$, then set $y_i=1$; otherwise set $y_i=0$. 64 | \item Let $\SAT_i$ be the event that the Boolean formula, when setting $x_1=y_1,\ldots,x_i=y_i$, is satisfied. 65 | \end{itemize} 66 | Observe that 67 | \begin{align*} 68 | &\Pr\sbra{x_1=y_1\mid\SAT_0}\Pr\sbra{\SAT_0}=\Pr\sbra{x_1=y_1}\Pr\sbra{\SAT_0\mid x_1=y_1}=\frac12\Pr\sbra{\SAT_1},\\ 69 | &\Pr\sbra{x_2=y_2\mid\SAT_1}\Pr\sbra{\SAT_1}=\frac12\Pr\sbra{\SAT_2},\\ 70 | &\ldots,\\ 71 | &\Pr\sbra{x_n=y_n\mid\SAT_{n-1}}\Pr\sbra{\SAT_{n-1}}=\frac12\Pr\sbra{\SAT_n}=\frac12, 72 | \end{align*} 73 | where each conditional probability is well defined as $y$ is a satisfying assignment. 74 | By telescoping product, we have 75 | $$ 76 | \#\SAT=2^n\cdot\Pr\sbra{\SAT_0}=\frac1{\Pr\sbra{x_1=y_1\mid\SAT_0}}\frac1{\Pr\sbra{x_2=y_2\mid\SAT_1}}\cdots\frac1{\Pr\sbra{x_n=y_n\mid\SAT_{n-1}}}. 77 | $$ 78 | \end{exercise} 79 | 80 | \end{document} 81 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap18/chap18.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | \newcommand{\SAT}{\texttt{SAT}} 50 | 51 | 52 | \title{Exercise Set --- Chapter 18} 53 | \date{} 54 | 55 | \begin{document} 56 | \maketitle 57 | 58 | \begin{exercise}{18.5} 59 | Since $\mathcal P^{\#\mathcal P}\neq\mathcal P$, we know $\#\mathcal P\neq\mathcal{FP}$. Thus, the number of perfect matchings in a balanced bipartite graph is not polynomial-time computable. Now consider the following $\mathcal P$-sampleable distribution $D$: 60 | \begin{itemize} 61 | \item On input $1^n$, uniformly select $(x,y)\in\bin^{n^2}\times\bin^{n^2}$. 62 | \item We interpret $x$ as the adjacency matrix of a balanced bipartite graph $G$ where each side has $n$ vertices. 63 | \item If $y$ represents a perfect matching in $G$ (we may use arbitrary encoding for this), then output $x1$. 64 | \item Otherwise, output $x0$. 65 | \end{itemize} 66 | Assume $D$ is also $\mathcal P$-computable; then given any balanced bipartite graph $G$ (let $x$ be its adjacency matrix), we have 67 | $$ 68 | \#\text{Perfect matchings in $G$}=2^{2n^2}\cdot\Pr\sbra{D(1^n)=x1}. 69 | $$ 70 | \end{exercise} 71 | 72 | \end{document} 73 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap19/chap19.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | \newcommand{\Rbb}{\mathbb{R}} 50 | \newcommand{\Fbb}{\mathbb{F}} 51 | \newcommand{\eps}{\varepsilon} 52 | \newcommand{\poly}{\text{poly}} 53 | 54 | 55 | \title{Exercise Set --- Chapter 19} 56 | \date{} 57 | 58 | \begin{document} 59 | \maketitle 60 | 61 | \begin{exercise}{19.5} 62 | It naturally follows from the general form of von Neumann's minimax theorem\footnote{See from \url{https://en.wikipedia.org/wiki/Minimax_theorem}}: 63 | \textit{ 64 | Let $X\subset\Rbb^n$ and $Y\subset\Rbb^m$ be compact convex sets. If $f:X\times Y\to\Rbb$ is a continuous function 65 | that 66 | \begin{itemize} 67 | \item $f(\cdot,y):X\to\Rbb$ is concave for fixed $y$, 68 | \item $f(x,\cdot):Y\to\Rbb$ is convex for fixed $x$. 69 | \end{itemize} 70 | Then we have 71 | $$ 72 | \max_{x\in X}\min_{y\in Y}f(x,y)=\min_{y\in Y}\max_{x\in X}f(x,y). 73 | $$ 74 | } 75 | \end{exercise} 76 | 77 | \begin{exercise}{19.17} 78 | \begin{itemize} 79 | \item[(a)] Observe that 80 | $$ 81 | \text{dist}(E)=\min_{x\neq x'}\Delta(E(x),E(x'))=\min_{x\neq x'}\abs{E(x)-E(x')}=\min_{x\neq x'}\abs{E(x-x')} 82 | =\min_{y\neq0}\abs{E(y)}. 83 | $$ 84 | \item[(b)] Let $m=1.1n/(1-H(\delta))$ with $\delta<1/2$, and sample a random matrix $A\in\Fbb_2^{m\times n}$. 85 | Then we take $E(x)=Ax$ and show 86 | $$ 87 | \Pr_A\sbra{\abs{Ax}\geq\delta m,\forall x\neq0}>0. 88 | $$ 89 | Thus it suffices to show for any fixed $x\neq0$, 90 | $$ 91 | \Pr_A\sbra{\abs{Ax}<\delta m}=\Pr_{a_1,\ldots,a_m}\sbra{\sum_ia_i<\delta m}<2^{-n}, 92 | $$ 93 | where $a_i=(Ax)_i$ are independent uniform bits, and the inequality follows from Chernoff's bound. 94 | \item[(c)] We view $\Fbb_{2^k}$ as $\Fbb_2[x]/(f(x))$ where $f$ is an irreducible degree-$k$ $\Fbb_2$ polynomial. 95 | We denote $P:\Fbb_2^k\to\Fbb_2[x]/(f(x))$ as the usual encoding, and denote $P^{-1}$ as its inverse. 96 | Then $P,P^{-1}$ are linear. Now let $k=k(n,\delta)=O_\delta(\log n)$ be a suitable parameter and define 97 | $$ 98 | E(x)=(P^{-1})^{\otimes 2^k}(E_\text{RS}(P^{\otimes n/k}(x))), 99 | $$ 100 | where $E_\text{RS}:(\Fbb_{2^k})^{n/k}\to(\Fbb_{2^k})^{2^k}$ is the Reed-Solomon code with distance $\delta$. 101 | Then $E$ is linear and has distance $\delta$, and its polynomial-time 102 | encoding/decoding mechanisms follow from the Reed-Solomon code. 103 | \item[(d)] 104 | We follow the notation in (c). 105 | \begin{itemize} 106 | \item There exists a linear $\eps$-biased code $E_1:\bin^n\to\bin^m,m=n/\eps^2$ with 107 | $2^{O\pbra{n^2/\eps^2}}$ encoding time. 108 | \begin{proof} 109 | Similar as (b), we sample a random matrix $A\in\Fbb_2^{m\times n}$ and have 110 | $$ 111 | \Pr_A\sbra{\abs{\abs{Ax}-m/2}>\eps} 112 | =\Pr_{a_1,\ldots,a_m}\sbra{\abs{\frac1m\sum_ia_i-\frac12}>\eps} 113 | \leq2e^{-2\eps^2m}<2^{-n}. 114 | $$ 115 | Thus there exists a valid $A$ and we set $E_1(x)=Ax$. Moreover, $A$ can be found in time 116 | $$ 117 | \underbrace{2^{n\cdot m}}_\text{brute force $A$}\cdot\underbrace{2^n\cdot\poly(n)}_\text{check validity}. 118 | $$ 119 | \end{proof} 120 | \item There exists a linear $\eps$-biased code $E_2:\bin^n\to\bin^m,m=2^k\cdot 4k/\eps^2$ with 121 | $2^{O\pbra{k^2/\eps^2}}\cdot\poly(n/\eps)$ encoding time, where $k=\log(n/\eps)$. 122 | \begin{proof} 123 | Let $k=\log(n/\eps)$, and apply $E_1$ with input length $k$ and bias $\eps/2$. Then 124 | $$ 125 | E_2(x)=E_1^{\otimes 2^k}\pbra{(P^{-1})^{\otimes 2^k}\pbra{E_\text{RS}\pbra{P^{\otimes n/k}(x)}}} 126 | $$ 127 | satisfies the following property: 128 | \begin{itemize} 129 | \item $E_2:\bin^n\to\bin^{2^k\cdot\ell}=\bin^m,\ell=4k/\eps^2$ is linear, 130 | and the encoding time is 131 | $$ 132 | 2^{O\pbra{k^2/\eps^2}}+\poly(2^k,n)\leq2^{O\pbra{k^2/\eps^2}}\cdot\poly(n/\eps); 133 | $$ 134 | \item for any $x\neq0$, the number of zeros in $E_2(x)$ is at most 135 | $$ 136 | \frac nk\cdot\ell+\pbra{2^k-\frac nk}\cdot\pbra{\frac12+\frac\eps2}\cdot\ell 137 | \leq\pbra{\frac12+\eps}\cdot2^k\cdot\ell; 138 | $$ 139 | \item for any $x\neq0$, the number of zeros in $E_2(x)$ is at least 140 | $$ 141 | 2^k\cdot\pbra{\frac12-\frac\eps2}\cdot\ell 142 | \geq\pbra{\frac12-\eps}\cdot2^k\cdot\ell. 143 | $$ 144 | \end{itemize} 145 | \end{proof} 146 | \item There exists a linear $\eps$-biased code $E_3:\bin^n\to\bin^m,m=2^k\cdot 2^\ell\cdot16\ell/\eps^2=\poly(n/\eps)$ with 147 | $\poly(n/\eps)$ encoding time, where $k=\log(n/\eps),\ell=\log(2k/\eps)$. 148 | \begin{proof} 149 | Let $k=\log(n/\eps)$, and apply $E_2$ with input length $k$ and bias $\eps/2$. Then 150 | $$ 151 | E_3(x)=E_2^{\otimes 2^k}\pbra{(P^{-1})^{\otimes 2^k}\pbra{E_\text{RS}\pbra{P^{\otimes n/k}(x)}}} 152 | $$ 153 | satisfies the following property: 154 | \begin{itemize} 155 | \item $E_3$ is $\eps$-biased. 156 | \item $E_3:\bin^n\to\bin^{2^k\cdot 2^\ell\cdot16\ell/\eps^2}=\bin^m$ is linear, 157 | and the encoding time is 158 | $$ 159 | 2^{O(\ell^2/\eps^2)}\cdot\poly(k/\eps)\cdot\poly(2^k,n)=\poly(n/\eps). 160 | $$ 161 | \end{itemize} 162 | \end{proof} 163 | \end{itemize} 164 | \end{itemize} 165 | \end{exercise} 166 | 167 | \end{document} 168 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap20/chap20.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | \newcommand{\Rbb}{\mathbb{R}} 50 | \newcommand{\Fbb}{\mathbb{F}} 51 | \newcommand{\eps}{\varepsilon} 52 | \newcommand{\poly}{\text{poly}} 53 | \newcommand{\NEXP}{\textbf{NEXP}} 54 | \newcommand{\MA}{\textbf{MA}} 55 | \newcommand{\Ppoly}{\textbf{P}_\textbf{/poly}} 56 | \newcommand{\EXP}{\textbf{EXP}} 57 | \newcommand{\BPP}{\textbf{BPP}} 58 | \newcommand{\NE}{\textbf{NE}} 59 | \newcommand{\SUBEXP}{\textbf{SUBEXP}} 60 | \newcommand{\NSUBEXP}{\textbf{NSUBEXP}} 61 | 62 | 63 | \title{Exercise Set --- Chapter 20} 64 | \date{} 65 | 66 | \begin{document} 67 | \maketitle 68 | 69 | \begin{exercise}{20.10} 70 | We assume $\NEXP=\MA$ and $\NEXP\not\subseteq\Ppoly$. 71 | Since $\MA\subseteq\EXP$, we know $\NEXP=\EXP\not\subseteq\Ppoly$. 72 | Then by derandomization (Theorem 20.7 and the remarks below), we know $\BPP\subseteq\SUBEXP$. 73 | This means $\NEXP=\MA\subseteq\NSUBEXP\subseteq\NE$, which violates nondeterministic time hierarchy theorem. 74 | \end{exercise} 75 | 76 | 77 | \end{document} 78 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap21/chap21.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 46 | \newcommand{\pbra}[1]{\left( #1 \right)} 47 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 48 | \newcommand{\sbra}[1]{\left[ #1 \right]} 49 | \newcommand{\bin}{\{0,1\}} 50 | 51 | 52 | \def\sD{\textsf{D}} 53 | \def\sE{\textsf{E}} 54 | \def\cD{\mathcal{D}} 55 | 56 | \title{Exercise Set --- Chapter 21} 57 | \date{} 58 | 59 | \begin{document} 60 | \maketitle 61 | 62 | \begin{exercise}{21.9} 63 | By reordering vertices in $G$, we assume 64 | $$ 65 | \bm A=\begin{bmatrix} 66 | &\bm B\\ 67 | \bm C & 68 | \end{bmatrix}, 69 | $$ 70 | where $\bm B$ is $a$ by $n-a$ and $\bm C$ is $n-a$ by $a$. 71 | Since 72 | $$ 73 | \bm A\begin{bmatrix}1\\\vdots\\1\end{bmatrix}=\begin{bmatrix}1\\\vdots\\1\end{bmatrix}, 74 | $$ 75 | we have 76 | $$ 77 | \bm A\begin{bmatrix}-1\\\vdots\\-1\\1\\\vdots\\1\end{bmatrix} 78 | =\begin{bmatrix}&\bm B\\\bm C &\end{bmatrix}\begin{bmatrix}-1\\\vdots\\-1\\1\\\vdots\\1\end{bmatrix} 79 | =\begin{bmatrix}1\\\vdots\\1\\-1\\\vdots\\-1\end{bmatrix}. 80 | $$ 81 | \end{exercise} 82 | 83 | \begin{exercise}{21.14} 84 | Let $\bm A$ be the random walk matrix of $G$ and 85 | $$ 86 | (\bm 1_S)_i=\begin{cases} 87 | \frac1{|S|} & i\in S\\ 88 | 0 & i\notin S 89 | \end{cases},\quad 90 | (\bm 1_T)_i=\begin{cases} 91 | \frac1{|T|} & i\in S\\ 92 | 0 & i\notin S 93 | \end{cases},\quad 94 | \bm e=\frac1{\sqrt n}\begin{bmatrix}1\\\vdots\\1\end{bmatrix}. 95 | $$ 96 | Then $\bm 1_T=\frac1{\sqrt n}\bm e+\alpha$, where $\alpha$ is orthogonal to $\bm e$, and 97 | \begin{align*} 98 | \abs{\frac{|E(S,T)|}{d|S||T|}-\frac1n} 99 | &=\abs{\bm 1_S^\top\bm A\bm 1_T-\frac1n} 100 | =\abs{\bm 1_S^\top\bm A\pbra{\frac1{\sqrt n}\bm e+\alpha}-\frac1n} 101 | =\abs{\bm 1_S^\top\bm A\alpha} 102 | =\vabs{\bm 1_S^\top\bm A\alpha}_2\\ 103 | &\leq\vabs{\bm1_S}_2\vabs{\bm A\alpha}_2 104 | \leq\frac\lambda{\sqrt{|S|}}\vabs{\alpha}_2 105 | <\frac\lambda{\sqrt{|S|}}\vabs{\bm1_T}_2\\ 106 | &=\frac\lambda{\sqrt{|S||T|}}. 107 | \end{align*} 108 | \end{exercise} 109 | 110 | \end{document} 111 | -------------------------------------------------------------------------------- /Computational-Complexity-A-Modern-Approach/chap22/chap22.tex: -------------------------------------------------------------------------------- 1 | 2 | % !TeX encoding = UTF-8 3 | % !TeX program = XeLaTeX 4 | % !TeX spellcheck = LaTeX 5 | 6 | \documentclass[a4paper]{article} 7 | 8 | \usepackage{amsthm,amsmath,amsfonts,amssymb} 9 | \usepackage{mathrsfs} 10 | \usepackage{bm} 11 | \usepackage{geometry} 12 | % \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 46 | \newcommand{\pbra}[1]{\left( #1 \right)} 47 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 48 | \newcommand{\sbra}[1]{\left[ #1 \right]} 49 | \newcommand{\bin}{\{0,1\}} 50 | \newcommand{\Inf}{\mathbf{Inf}} 51 | \newcommand{\Var}{\mathbf{Var}} 52 | 53 | 54 | \def\sD{\textsf{D}} 55 | \def\sE{\textsf{E}} 56 | \def\cD{\mathcal{D}} 57 | 58 | \title{Exercise Set --- Chapter 22} 59 | \date{} 60 | 61 | \begin{document} 62 | \maketitle 63 | 64 | \begin{exercise}{22.11} 65 | \begin{itemize} 66 | \item[(a)] 67 | $$ 68 | \text{as}(f)=\Inf[f]\ge\Var[f]=1, 69 | $$ 70 | where the first equality comes from the definition of average sensitivity, the second comes from Poincare inequality, and the third come from that $f$ is balanced. 71 | \item[(b)] 72 | Since $\Inf[f]=\sum_S|S|\hat f^2(S)$ and $\Var[f]=\sum_{S\neq\emptyset}\hat f^2(S)$, 73 | the equality holds iff $\hat f(S)\equiv0$ for all $|S|>1$. 74 | \end{itemize} 75 | \end{exercise} 76 | 77 | \end{document} 78 | -------------------------------------------------------------------------------- /Introduction-to-Automata-Theory-Languages-and-Computation/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction to Automata Theory, Languages, and Computation 2 | 3 | By John Hopcroft and Jeffrey Ullman 4 | -------------------------------------------------------------------------------- /Introduction-to-Automata-Theory-Languages-and-Computation/chap03/chap03.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | \usepackage{tikz} 17 | 18 | \usetikzlibrary{automata} 19 | 20 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 21 | 22 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 23 | 24 | \newtheorem{theorem}{Theorem} 25 | \newtheorem{lemma}{Lemma} 26 | \newtheorem{proposition}{Proposition} 27 | \newtheorem{corollary}{Corollary} 28 | \newtheorem{claim}{Claim} 29 | \newtheorem{conjecture}{conjecture} 30 | \newtheorem{definition}{Definition} 31 | \newtheorem{construction}{Construction} 32 | \newtheorem*{proof}{Proof} 33 | \newtheorem*{answer}{Answer} 34 | \newtheorem*{example}{Example} 35 | \newtheorem*{counterexample}{Counterexample} 36 | 37 | \newenvironment{exercise}[1]{ 38 | \par 39 | \noindent\textbf{Exercise #1.}\quad 40 | }{ 41 | \par 42 | \bigskip 43 | } 44 | \newenvironment{problem}[1]{ 45 | \par 46 | \noindent\textbf{Problem #1.}\quad 47 | }{ 48 | \par 49 | \bigskip 50 | } 51 | 52 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 53 | \DeclareMathOperator*{\argmax}{\arg\,\max} 54 | \DeclareMathOperator*{\argmin}{\arg\,\min} 55 | \DeclareMathOperator{\E}{\mathbb E} 56 | \DeclareMathOperator{\Var}{\mathrm{Var}} 57 | \DeclareMathOperator{\tr}{\mathrm{tr}} 58 | \DeclareMathOperator{\poly}{\mathrm{poly}} 59 | \newcommand{\abs}[1]{\left| #1 \right|} 60 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 61 | \newcommand{\abra}[1]{\left\langle #1 \right\rangle} 62 | \newcommand{\pbra}[1]{\left( #1 \right)} 63 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 64 | \newcommand{\sbra}[1]{\left[ #1 \right]} 65 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 66 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 67 | \newcommand{\bin}{\{0,1\}} 68 | \newcommand{\ZPP}{\mathtt{ZPP}} 69 | \newcommand{\RP}{\mathtt{RP}} 70 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 71 | \newcommand{\per}{\text{per}} 72 | \newcommand{\sgn}{\text{sgn}} 73 | \newcommand{\Fbb}{\mathbb{F}} 74 | \newcommand{\Nbb}{\mathbb{N}} 75 | \newcommand{\Rbb}{\mathbb{R}} 76 | \newcommand{\Zbb}{\mathbb{Z}} 77 | \newcommand{\Sset}{\mathbb{S}} 78 | \newcommand{\Fset}{\mathbb{F}} 79 | \newcommand{\Nset}{\mathbb{N}} 80 | \newcommand{\Zset}{\mathbb{Z}} 81 | \newcommand{\Uset}{\mathbb{U}} 82 | \newcommand{\Acal}{\mathcal{A}} 83 | \newcommand{\Bcal}{\mathcal{B}} 84 | \newcommand{\Ccal}{\mathcal{C}} 85 | \newcommand{\Fcal}{\mathcal{F}} 86 | \newcommand{\Gcal}{\mathcal{G}} 87 | \newcommand{\qd}[2]{{\left(\frac{#1}{#2}\right)}} 88 | 89 | \bibliographystyle{plainnat} 90 | 91 | \title{Exercise Set --- Chapter $3$} 92 | \date{} 93 | 94 | \begin{document} 95 | 96 | \maketitle 97 | 98 | \noindent\textbf{Clarification:} In the following work, 99 | \begin{itemize} 100 | \item if the set of the states of a finite state automaton $A$ is $Q$, 101 | then $Q=\{q_0,q_1,\cdots,q_{|Q|-1}\}$. So $q_t\in Q$ if and only if $t\in\{0,1,\cdots,|Q|-1\}$. 102 | \end{itemize} 103 | 104 | \begin{exercise}{3.2.6} Let the new $\varepsilon$-NFA be $B$ and $L=L(A)$.\\ 105 | \textbf{a)} $L(B)=LL^*$\\ 106 | \textbf{b)} $L(B)=\{x\in\Sigma^*|\exists y\in\Sigma^*, yx\in L\}$\\ 107 | \textbf{c)} $L(B)=\{x\in\Sigma^*|\exists y\in\Sigma^*, xy\in L\}$\\ 108 | \textbf{d)} $L(B)=\{x\in\Sigma^*|\exists y\in\Sigma^*, yxy\in L\}$ 109 | \end{exercise} 110 | 111 | \begin{exercise}{3.2.7} $\{1\},\{2\},\{3\},\{1,2\}$\end{exercise} 112 | 113 | \begin{exercise}{3.2.8} 114 | Since $A=(Q,\Sigma,\delta,q_0,F)$ is DFA, 115 | different strings mean different paths.\par 116 | Let $f[i][j][k]$ be the number of different strings of length $k$ going from $q_i$ 117 | to $q_j$. Let $\delta[i][j]$ be the number of ways to go from $q_i$ to $q_j$ in one step, which means 118 | $$ 119 | \delta[i][j]=\sum_{c\in\Sigma} [\delta(q_i,c)=q_j]. 120 | $$\par 121 | Then the transfer equation is 122 | \begin{gather*} 123 | f[i][j][k]=\sum_{t=0}^{|Q|-1} f[i][t][k-1]\cdot\delta[t][j]. 124 | \end{gather*} 125 | The final answer will be $\sum_{q_t\in F} f[0][t][n]$; and 126 | time complexity is $O(|Q|^3n)$. 127 | \end{exercise} 128 | 129 | \end{document} 130 | -------------------------------------------------------------------------------- /Introduction-to-Automata-Theory-Languages-and-Computation/chap05/chap05.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | \usepackage{tikz} 17 | 18 | \usetikzlibrary{automata} 19 | 20 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 21 | 22 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 23 | 24 | \newtheorem{theorem}{Theorem} 25 | \newtheorem{lemma}{Lemma} 26 | \newtheorem{proposition}{Proposition} 27 | \newtheorem{corollary}{Corollary} 28 | \newtheorem{claim}{Claim} 29 | \newtheorem{conjecture}{conjecture} 30 | \newtheorem{definition}{Definition} 31 | \newtheorem{construction}{Construction} 32 | \newtheorem*{proof}{Proof} 33 | \newtheorem*{answer}{Answer} 34 | \newtheorem*{example}{Example} 35 | \newtheorem*{counterexample}{Counterexample} 36 | 37 | \newenvironment{exercise}[1]{ 38 | \par 39 | \noindent\textbf{Exercise #1.}\quad 40 | }{ 41 | \par 42 | \bigskip 43 | } 44 | \newenvironment{problem}[1]{ 45 | \par 46 | \noindent\textbf{Problem #1.}\quad 47 | }{ 48 | \par 49 | \bigskip 50 | } 51 | 52 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 53 | \DeclareMathOperator*{\argmax}{\arg\,\max} 54 | \DeclareMathOperator*{\argmin}{\arg\,\min} 55 | \DeclareMathOperator{\E}{\mathbb E} 56 | \DeclareMathOperator{\Var}{\mathrm{Var}} 57 | \DeclareMathOperator{\tr}{\mathrm{tr}} 58 | \DeclareMathOperator{\poly}{\mathrm{poly}} 59 | \newcommand{\abs}[1]{\left| #1 \right|} 60 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 61 | \newcommand{\abra}[1]{\left\langle #1 \right\rangle} 62 | \newcommand{\pbra}[1]{\left( #1 \right)} 63 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 64 | \newcommand{\sbra}[1]{\left[ #1 \right]} 65 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 66 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 67 | \newcommand{\bin}{\{0,1\}} 68 | \newcommand{\ZPP}{\mathtt{ZPP}} 69 | \newcommand{\RP}{\mathtt{RP}} 70 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 71 | \newcommand{\per}{\text{per}} 72 | \newcommand{\sgn}{\text{sgn}} 73 | \newcommand{\Fbb}{\mathbb{F}} 74 | \newcommand{\Nbb}{\mathbb{N}} 75 | \newcommand{\Rbb}{\mathbb{R}} 76 | \newcommand{\Zbb}{\mathbb{Z}} 77 | \newcommand{\Sset}{\mathbb{S}} 78 | \newcommand{\Fset}{\mathbb{F}} 79 | \newcommand{\Nset}{\mathbb{N}} 80 | \newcommand{\Zset}{\mathbb{Z}} 81 | \newcommand{\Uset}{\mathbb{U}} 82 | \newcommand{\Acal}{\mathcal{A}} 83 | \newcommand{\Bcal}{\mathcal{B}} 84 | \newcommand{\Ccal}{\mathcal{C}} 85 | \newcommand{\Fcal}{\mathcal{F}} 86 | \newcommand{\Gcal}{\mathcal{G}} 87 | \newcommand{\qd}[2]{{\left(\frac{#1}{#2}\right)}} 88 | \newcommand{\dv}{\ |\ } 89 | \newcommand{\mylm}{\xLongrightarrow[lm]{}} 90 | \newcommand{\myrm}{\xLongrightarrow[rm]{}} 91 | 92 | \bibliographystyle{plainnat} 93 | 94 | \title{Exercise Set --- Chapter $5$} 95 | \date{} 96 | 97 | \begin{document} 98 | 99 | \maketitle 100 | 101 | \begin{exercise}{5.1.5} $G=(V,T,P,S)=(\{S,S'\},\{0,1\},P,S)$, where $P$ is 102 | \begin{align*} 103 | S &\to S'\dv SS\dv S+S\dv S^*\dv (S)\\ 104 | S' &\to e\dv 0\dv 1 \dv \varnothing 105 | \end{align*} 106 | \end{exercise} 107 | 108 | \begin{exercise}{5.2.2} 109 | Let $T$ be the parse tree built step by step with the $m$-steps derivation; 110 | so $T$ has $m$ non-leaf nodes. 111 | Since $|w|=n$ and there is no $\varepsilon$ as right side in any production rule, 112 | $T$ has $n$ leaf nodes. 113 | As a result, the parse tree has $n+m$ nodes. 114 | \end{exercise} 115 | 116 | \begin{exercise}{5.2.3} 117 | Let $T$ be the parse tree built step by step with the $m$-steps derivation; 118 | so $T$ has $m$ non-leaf nodes. 119 | Since $|w|=n,n>0$, $T$ has $n$ non-$\varepsilon$ leaf nodes. 120 | \begin{itemize} 121 | \item If $m>1$, then the root of parse tree can not give rise to $\varepsilon$. 122 | So the number of $\varepsilon$ leaf nodes is no more than $m-1$. 123 | As a result, the parse tree has no more than $n+2m-1$ nodes. 124 | \item If $m=1$ and $w\neq\varepsilon$, then $w$ is derived in one step; thus 125 | the number of nodes in parse tree is no more than $n+2m-1$. 126 | \end{itemize} 127 | \end{exercise} 128 | 129 | \begin{exercise}{5.4.3} $G=(V,T,P,S)=(\{S,S_1,S_2\},\{a,b\},P,S)$, where $P$ is 130 | \begin{align*} 131 | S &\to SaS_2bS_1\dv S_1\\ 132 | S_1 &\to aS_1\dv \varepsilon\\ 133 | S_2 &\to aS_2bS_2\dv \varepsilon\\ 134 | \end{align*} 135 | \end{exercise} 136 | 137 | \begin{exercise}{5.4.7}\hspace{0pt}\\ 138 | \textbf{a)} 139 | \begin{itemize} 140 | \item \textit{Leftmost derivation:} 141 | \begin{align*} 142 | E&\mylm +EE\mylm +*EEE\mylm +*-EEEE\\ 143 | &\mylm +*-xEEE\mylm +*-xyEE\mylm +*-xyxE\mylm +*-xyxy 144 | \end{align*} 145 | \item \textit{Rightmost derivation:} 146 | \begin{align*} 147 | E&\myrm +EE\myrm +Ey\myrm +*EEy\myrm +*Exy\\ 148 | &\myrm +*-EExy\myrm +*-Eyxy\myrm +*-xyxy 149 | \end{align*} 150 | \item \textit{Parse tree:} 151 | \begin{center} 152 | \begin{tikzpicture}[level/.style={level distance=10mm}] 153 | \node {E}[level 1/.style={sibling distance=40mm}, 154 | level 2/.style={sibling distance=30mm}, 155 | level 3/.style={sibling distance=20mm}, 156 | level 4/.style={sibling distance=10mm}, 157 | ] 158 | child {node {+}} 159 | child {node {E} 160 | child {node {*} 161 | } 162 | child {node {E} 163 | child {node {-} 164 | } 165 | child {node {E} 166 | child {node {x} 167 | } 168 | } 169 | child {node {E} 170 | child {node {y}} 171 | } 172 | } 173 | child {node {E} 174 | child {node {x} 175 | } 176 | } 177 | } 178 | child {node {E} 179 | child {node {y}} 180 | }; 181 | \end{tikzpicture} 182 | \end{center} 183 | \end{itemize} 184 | \textbf{b)} 185 | \begin{proof} 186 | Assume this grammar is ambiguous, there exists a $w$ and it has two distinct 187 | leftmost derivations, say $D_1$ and $D_2$.\par 188 | Since both $D_1,D_2$ are leftmost derivation and they are distinct, they 189 | must separate somewhere during the derivation. Thus 190 | \begin{align*} 191 | D_1: E&\xLongrightarrow[lm]{*} t_1t_2\cdots t_kET_1T_2\cdots T_m\\ 192 | &\mylm t_1t_2\cdots t_kE_1EE\cdots E\\ 193 | D_2: E&\xLongrightarrow[lm]{*} t_1t_2\cdots t_kET_1T_2\cdots T_m\\ 194 | &\mylm t_1t_2\cdots t_kE_2EE\cdots E,\\ 195 | & t_k\in\{+,-,*,x,y\} 196 | \end{align*} 197 | where $E_1,E_2\in\{+EE,*EE,-EE,x,y\},E_1\neq E_2$. 198 | However, after this step, they will have different prefix as the $(k+1)$th character 199 | is different; at least one of them will be different from $w$. A contradiction. 200 | \end{proof} 201 | \end{exercise} 202 | 203 | \end{document} 204 | -------------------------------------------------------------------------------- /Introduction-to-Automata-Theory-Languages-and-Computation/chap11/chap11.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | \usepackage{tikz} 17 | 18 | \usetikzlibrary{automata} 19 | 20 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 21 | 22 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 23 | 24 | \newtheorem{theorem}{Theorem} 25 | \newtheorem{lemma}{Lemma} 26 | \newtheorem{proposition}{Proposition} 27 | \newtheorem{corollary}{Corollary} 28 | \newtheorem{claim}{Claim} 29 | \newtheorem{conjecture}{conjecture} 30 | \newtheorem{definition}{Definition} 31 | \newtheorem{construction}{Construction} 32 | \newtheorem*{proof}{Proof} 33 | \newtheorem*{answer}{Answer} 34 | \newtheorem*{example}{Example} 35 | \newtheorem*{counterexample}{Counterexample} 36 | 37 | \newenvironment{exercise}[1]{ 38 | \par 39 | \noindent\textbf{Exercise #1.}\quad 40 | }{ 41 | \par 42 | \bigskip 43 | } 44 | \newenvironment{problem}[1]{ 45 | \par 46 | \noindent\textbf{Problem #1.}\quad 47 | }{ 48 | \par 49 | \bigskip 50 | } 51 | 52 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 53 | \DeclareMathOperator*{\argmax}{\arg\,\max} 54 | \DeclareMathOperator*{\argmin}{\arg\,\min} 55 | \DeclareMathOperator{\E}{\mathbb E} 56 | \DeclareMathOperator{\Var}{\mathrm{Var}} 57 | \DeclareMathOperator{\tr}{\mathrm{tr}} 58 | \DeclareMathOperator{\poly}{\mathrm{poly}} 59 | \newcommand{\abs}[1]{\left| #1 \right|} 60 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 61 | \newcommand{\abra}[1]{\left\langle #1 \right\rangle} 62 | \newcommand{\pbra}[1]{\left( #1 \right)} 63 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 64 | \newcommand{\sbra}[1]{\left[ #1 \right]} 65 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 66 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 67 | \newcommand{\bin}{\{0,1\}} 68 | \newcommand{\ZPP}{\mathtt{ZPP}} 69 | \newcommand{\RP}{\mathtt{RP}} 70 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 71 | \newcommand{\per}{\text{per}} 72 | \newcommand{\sgn}{\text{sgn}} 73 | \newcommand{\Fbb}{\mathbb{F}} 74 | \newcommand{\Nbb}{\mathbb{N}} 75 | \newcommand{\Rbb}{\mathbb{R}} 76 | \newcommand{\Zbb}{\mathbb{Z}} 77 | \newcommand{\Sset}{\mathbb{S}} 78 | \newcommand{\Fset}{\mathbb{F}} 79 | \newcommand{\Nset}{\mathbb{N}} 80 | \newcommand{\Zset}{\mathbb{Z}} 81 | \newcommand{\Uset}{\mathbb{U}} 82 | \newcommand{\Acal}{\mathcal{A}} 83 | \newcommand{\Bcal}{\mathcal{B}} 84 | \newcommand{\Ccal}{\mathcal{C}} 85 | \newcommand{\Fcal}{\mathcal{F}} 86 | \newcommand{\Gcal}{\mathcal{G}} 87 | \newcommand{\qd}[2]{{\left(\frac{#1}{#2}\right)}} 88 | \newcommand{\dv}{\ |\ } 89 | \newcommand{\mylm}{\xLongrightarrow[lm]{}} 90 | \newcommand{\myrm}{\xLongrightarrow[rm]{}} 91 | 92 | \bibliographystyle{plainnat} 93 | 94 | \title{Exercise Set --- Chapter $11$} 95 | \date{} 96 | 97 | \begin{document} 98 | 99 | \maketitle 100 | 101 | \begin{exercise}{11.1.1} \hspace{0pt}\\ 102 | \textbf{a)} TRUE-SAT problem is in $\mathcal{NP}$. Just check whether it is true when all variables are true, 103 | then guess another truth assignment and check if it yields true.\par 104 | co-TRUE-SAT consists of all inputs that are 105 | \begin{itemize} 106 | \item not well-formed 107 | \item well-formed but yields false when all variables are assigned true 108 | \item well-formed and yields true if and only if all variables are assigned true 109 | \end{itemize}\par 110 | TRUE-SAT problem is NPC. SAT problem is polynomial-time reducible to it. Given a SAT instance $E'$, the variables of 111 | which are $x_1,x_2,\cdots,x_n$, construct a 112 | TRUE-SAT instance $E$ as follows: 113 | \begin{itemize} 114 | \item If $E'=\it true$ when all $x$'s are true, then $E=x_1\vee\neg x_1$ 115 | \item If $E'=\it false$ when all $x$'s are true, then $E=E'\vee(x_1\wedge x_2\wedge \cdots\wedge x_n)$ 116 | \end{itemize} 117 | Then $E'$ is satisfiable if and only if $E$ is TRUE-SAT.\par 118 | Since whether $\mathcal{NP}=co\mathcal{-NP}$ is unknown, it is not clear whether co-TRUE-SAT is NPC.\\ 119 | \textbf{b)} FALSE-SAT problem is in $\mathcal{NP}$. Just check whether it is false when all variables are false, 120 | then guess another truth assignment and check if it yields false.\par 121 | co-FALSE-SAT consists of all inputs that are 122 | \begin{itemize} 123 | \item not well-formed 124 | \item well-formed but yields true when all variables are assigned false 125 | \item well-formed and yields false if and only if all variables are assigned false 126 | \end{itemize}\par 127 | FALSE-SAT problem is NPC. SAT problem is polynomial-time reducible to it. Given a SAT instance $E'$, the variables of 128 | which are $x_1,x_2,\cdots,x_n$, construct a 129 | FALSE-SAT instance $E$ as follows: 130 | \begin{itemize} 131 | \item If $E'=\it true$ when all $x$'s are false, then $E=x_1\wedge\neg x_1$ 132 | \item If $E'=\it false$ when all $x$'s are false, then $E=(\neg E')\wedge(x_1\vee x_2\vee \cdots\vee x_n)$ 133 | \end{itemize} 134 | Then $E'$ is satisfiable if and only if $E$ is FALSE-SAT.\par 135 | Since whether $\mathcal{NP}=co\mathcal{-NP}$ is unknown, it is not clear whether co-FALSE-SAT is NPC. 136 | \end{exercise} 137 | 138 | \begin{exercise}{11.1.2} $L=\{(x,y)|f^{-1}(x)\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 19 | 20 | \newtheorem{theorem}{Theorem} 21 | \newtheorem{lemma}{Lemma} 22 | \newtheorem{proposition}{Proposition} 23 | \newtheorem{corollary}{Corollary} 24 | \newtheorem{claim}{Claim} 25 | \newtheorem{conjecture}{conjecture} 26 | \newtheorem{definition}{Definition} 27 | \newtheorem{construction}{Construction} 28 | \newtheorem*{proof}{Proof} 29 | \newtheorem*{answer}{Answer} 30 | \newtheorem*{refute}{Refute} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \newcommand{\abs}[1]{\left| #1 \right|} 45 | \newcommand{\pbra}[1]{\left( #1 \right)} 46 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 47 | \newcommand{\sbra}[1]{\left[ #1 \right]} 48 | \newcommand{\bin}{\{0,1\}} 49 | 50 | \title{Exercise Set --- Chapter $1$} 51 | \date{} 52 | 53 | \begin{document} 54 | 55 | \maketitle 56 | 57 | \begin{exercise}{1.3} 58 | Let $\Sigma=\{a,b,\dots,z\}$ and $\Gamma=\{A,B,\dots,Z\}$. 59 | Denote $[n]$ as $\{1,2,\dots,n\}$. 60 | \begin{definition}[$\mathrm{Num}$] 61 | $\mathrm{Num}:\Sigma\to\{0,1,\dots,25\}$ is $\mathrm{Num}(a)=0,\mathrm{Num}(b)=1,\cdots,\mathrm{Num}(z)=25.$ 62 | \end{definition} 63 | \begin{definition}[$\mathrm{Cap}$] 64 | $\mathrm{Cap}:\Sigma\to\Gamma$ is $\mathrm{Cap}(a)=A,\mathrm{Cap}(b)=B,\cdots,\mathrm{Cap}(z)=Z.$ 65 | \end{definition} 66 | \begin{definition}[$\mathrm{RShift}$] 67 | $\mathrm{RShift}:\Sigma\times\Sigma\to\Gamma$ is 68 | $$ 69 | \mathrm{RShift}(\alpha,\beta)=\mathrm{Num}^{-1}(\mathrm{Num}(\alpha)+\mathrm{Num}(\beta)\mod 26). 70 | $$ 71 | \end{definition} 72 | \begin{definition}[$\mathrm{LShift}$] 73 | $\mathrm{LShift}:\Sigma\times\Sigma\to\Gamma$ is 74 | $$ 75 | \mathrm{LShift}(\alpha,\beta)=\mathrm{Num}^{-1}(\mathrm{Num}(\alpha)-\mathrm{Num}(\beta)\mod 26). 76 | $$ 77 | \end{definition} 78 | 79 | Assume the maximum possible length of plaintext is $\ell$. 80 | Thus $\mathcal K=\bigcup_{i=1}^\ell\Sigma^i,\mathcal M=\bigcup_{i=1}^\ell\Sigma^i,\mathcal C=\bigcup_{i=1}^\ell\Gamma^i$. 81 | \begin{definition}[$\mathrm{Gen}$] 82 | $\mathrm{Gen}:\varnothing\to\mathcal K$ is a randomized algorithm, 83 | which randomly outputs an element from $\mathcal K$ with uniform distribution. 84 | \end{definition} 85 | \begin{definition}[$\mathrm{Enc}$] 86 | $\mathrm{Enc}:\mathcal K\times\mathcal M\to\mathcal C$ is a deterministic algorithm. 87 | Assume $k\in\Sigma^i,m\in\Sigma^j,i,j\in[\ell]$. Let $\hat k=k^\ell$, then 88 | $\mathrm{Enc}(k,m)=c$, where $c\in\Gamma^j$ and $c_t=\mathrm{Cap}(\mathrm{RShift}(m_t,\hat k_t)),t\in[j]$. 89 | \end{definition} 90 | \begin{definition}[$\mathrm{Dec}$] 91 | $\mathrm{Dec}:\mathcal K\times\mathcal C\to\mathcal M$ is a deterministic algorithm. 92 | Assume $k\in\Sigma^i,c\in\Gamma^j,i,j\in[\ell]$. Let $\hat k=k^\ell$, then 93 | $\mathrm{Dec}(k,c)=m$, where $m\in\Sigma^j$ and $m_t=\mathrm{LShift}(\mathrm{Cap}^{-1}(c_t),\hat k_t),t\in[j]$. 94 | \end{definition} 95 | \end{exercise} 96 | 97 | \end{document} 98 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap02/chap02.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | % Author : Shlw 6 | 7 | \documentclass[a4paper]{article} 8 | 9 | \usepackage{amsmath,amsfonts,amssymb} 10 | \usepackage{mathrsfs} 11 | \usepackage{bm} 12 | \usepackage{geometry} 13 | \usepackage{ntheorem} 14 | \usepackage{hyperref} 15 | \usepackage{ifthen} 16 | \usepackage{tikz} 17 | 18 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 19 | 20 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 21 | 22 | \newtheorem{theorem}{Theorem} 23 | \newtheorem{definition}{Definition} 24 | \newtheorem*{proof}{Proof} 25 | \newtheorem{answer}{Answer} 26 | \newtheorem{refute}{Refute} 27 | 28 | \newenvironment{exercise}[1]{ 29 | \par 30 | \noindent\textbf{Exercise #1.}\quad 31 | }{ 32 | \par 33 | \bigskip 34 | } 35 | 36 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 37 | \newcommand{\rawE}{\mathop{\mathbb E}} 38 | \newcommand{\E}[1]{\mathop{\mathbb E}_{#1}} 39 | \newcommand{\abs}[1]{\left| #1 \right|} 40 | \newcommand{\pbra}[1]{\left( #1 \right)} 41 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 42 | \newcommand{\sbra}[1]{\left[ #1 \right]} 43 | 44 | \title{Exercise Set --- Chapter $2$} 45 | \date{} 46 | 47 | \begin{document} 48 | 49 | \maketitle 50 | 51 | \begin{exercise}{2.3} 52 | Let $\Pi=(\mathcal K,\mathcal M,\mathcal C,\mathrm{Gen},\mathrm{Enc},\mathrm{Dec})$, where 53 | $\mathcal K=\cbra{0,1},\mathcal M=\cbra{0,1},\mathcal C=\cbra{01,10,11,00}$ and 54 | \begin{itemize} 55 | \item $\mathrm{Gen}:\varnothing\to\mathcal K$ is a randomized algorithm, 56 | which outputs $0$ and $1$ with equal probability. 57 | \item $\mathrm{Enc}:\mathcal K\times\mathcal M\to\mathcal C$ is a randomized algorithm and 58 | $$ 59 | \Pr\sbra{\mathrm{Enc}(k,m)=0(k\oplus m)}=\frac13,\quad 60 | \Pr\sbra{\mathrm{Enc}(k,m)=1(k\oplus m)}=\frac23. 61 | $$ 62 | \item $\mathrm{Dec}:\mathcal K\times\mathcal C\to\mathcal M$ is a deterministic algorithm and 63 | $$ 64 | \mathrm{Dec}(k,c_1c_2)=k\oplus c_2. 65 | $$ 66 | \end{itemize} 67 | Apparently, $\Pr\sbra{M=b\mid C=cd}=\Pr\sbra{M=b},\forall b,c,d\in\{0,1\}$. 68 | Therefore $\Pi$ is a perfectly secret encryption scheme.\par 69 | Assume the probability distribution over $\mathcal M$ is uniform, then 70 | \begin{align*} 71 | \Pr\sbra{C=00}=\frac13\times\frac12\neq\frac23\times\frac12=\Pr\sbra{C=10}. 72 | \end{align*} 73 | \end{exercise} 74 | 75 | \begin{exercise}{2.11 (Construction)} 76 | Assume $|\mathcal M|=n$ is sufficiently large and $\mathcal M=\cbra{m_1,m_2,\cdots,m_n}$. Without loss of generality, assume $n\times 2^{-t}$ is an integer. Construct an encryption scheme $\Pi=(\mathcal K,\mathcal M,\mathcal C,\mathrm{Gen},\mathrm{Enc},\mathrm{Dec})$ as follows. 77 | \begin{itemize} 78 | \item $|\mathcal K|=n'=n\times 2^{-t}$ and $\mathcal K=\cbra{k_1,k_2,\cdots,k_{n'}}$. 79 | \item $|\mathcal C|=n$ and $\mathcal C=\cbra{c_1,c_2,\cdots,c_n}$. 80 | \item $\mathrm{Gen}:\varnothing\to\mathcal K$ outputs any key with equal probability. 81 | \item $\mathrm{Enc}:\mathcal K\times\mathcal M\to\mathcal C$ be a randomized algorithm, where 82 | for any $i\in[n],j\in[n']$ 83 | \begin{align*} 84 | \Pr\sbra{\mathrm{Enc}(k_j,m_i)=c_\ell}=\begin{cases} 85 | 2^{-t}, & \ell=i\oplus_{n} j\\ 86 | \frac 1 n, & \ell=i\oplus_{n} n'\oplus_{n}t,1\leq t\leq n-n'\\ 87 | 0, & \it otherwise. 88 | \end{cases} 89 | \end{align*} 90 | \item $\mathrm{Dec}:\mathcal K\times\mathcal C\to\mathcal M$ be a deterministic algorithm, where 91 | for any $\ell\in[n],j\in[n']$ 92 | \begin{align*} 93 | \mathrm{Dec}(k_j,c_\ell)=m_{\ell\ominus_{n} j}. 94 | \end{align*} 95 | \end{itemize} 96 | Therefore, for any $m\in\mathcal M$, $\mathrm{Enc}_K(m)\sim \mathcal C$, 97 | which indicates $\Pi$ is perfectly secure. 98 | 99 | On the other hand, for any $m_i\in\mathcal M$ 100 | \begin{align*} 101 | \Pr\sbra{\mathrm{Dec}_K(\mathrm{Enc}_K(m_i))=m_i} 102 | &=\sum_{k_j\in\mathcal K}\frac{1}{n'}\Pr\sbra{\mathrm{Dec}_{k_j}(\mathrm{Enc}_{k_j}(m_i))=m_i}\\ 103 | &\geq\sum_{k_j\in\mathcal K}\frac{1}{n'} 104 | \Pr\sbra{\mathrm{Dec}_{k_j}(\mathrm{Enc}_{k_j}(m_i))=m_i,\mathrm{Enc}_{k_j}(m_i)=c_{i\oplus_{n}j}}\\ 105 | &\geq\sum_{k_j\in\mathcal K}\frac{1}{n'}\times 2^{-t}\times 106 | \Pr\sbra{\mathrm{Dec}_{k_j}(c_{i\oplus_{n}j})=m_i\mid\mathrm{Enc}_{k_j}(m_i)=c_{i\oplus_{n}j}}\\ 107 | &=2^{-t}. 108 | \end{align*} 109 | Thus, we have achieved perfectly secure with $|\mathcal K|=n\times 2^{-t}0$. 116 | Then 117 | $$|\mathcal K|\geq\frac{|\mathcal M|}{2^t}.$$ 118 | \end{theorem} 119 | \begin{proof} 120 | Since $\Pi$ is perfectly secure, 121 | $\Delta\pbra{\mathrm{Enc}_K(m_1),\mathrm{Enc}_K(m_2)}=0$ holds for any $m_1,m_2\in\mathcal M$. 122 | Therefore, fix $m_1\in\mathcal M$, by the definition of $\Delta$, we have 123 | \begin{align*} 124 | 0&=\sum_{m_2\in\mathcal M}\Delta\pbra{\mathrm{Enc}_K(m_1),\mathrm{Enc}_K(m_2)}\\ 125 | &=\sum_{m_2\in\mathcal M}\sum_{c\in\mathcal C} 126 | \max\cbra{\Pr\sbra{\mathrm{Enc}_K(m_1)=c}-\Pr\sbra{\mathrm{Enc}_K(m_2)=c},0}. 127 | \end{align*} 128 | Let 129 | $$ 130 | \mathcal M_c=\cbra{m\in\mathcal M\mid \exists k\in\mathcal K,\mathrm{Dec}_k(c)=m}. 131 | $$ 132 | Then $|\mathcal M_c|\leq |\mathcal K|$. Thus let $\overline{\mathcal M}_c=\mathcal M\backslash\mathcal{M}_c$, we have 133 | $|\overline{\mathcal M}_c|\geq|\mathcal M|-|\mathcal K|$. Therefore 134 | \begin{align*} 135 | 0&=\sum_{m_2\in\mathcal M}\sum_{c\in\mathcal C} 136 | \max\cbra{\Pr\sbra{\mathrm{Enc}_K(m_1)=c}-\Pr\sbra{\mathrm{Enc}_K(m_2)=c},0}\\ 137 | &\geq\sum_{c\in\mathcal C}\sum_{m_2\in\overline{\mathcal M}_c} 138 | \max\cbra{\Pr\sbra{\mathrm{Enc}_K(m_1)=c}-\Pr\sbra{\mathrm{Enc}_K(m_2)=c},0}\\ 139 | &\geq\sum_{c\in\mathcal C}\sum_{m_2\in\overline{\mathcal M}_c} 140 | \Pr\sbra{\mathrm{Enc}_K(m_1)=c}-\Pr\sbra{\mathrm{Enc}_K(m_2)=c}. 141 | \end{align*} 142 | 143 | On one hand, 144 | \begin{align*} 145 | \sum_{c\in\mathcal C}\sum_{m_2\in\overline{\mathcal M}_c}\Pr\sbra{\mathrm{Enc}_K(m_1)=c} 146 | &=\sum_{c\in\mathcal C}|\overline{\mathcal M}_c|\times\Pr\sbra{\mathrm{Enc}_K(m_1)=c}\\ 147 | &\geq \pbra{|\mathcal M|-|\mathcal K|}\times\sum_{c\in\mathcal C}\Pr\sbra{\mathrm{Enc}_K(m_1)=c}\\ 148 | &=|\mathcal M|-|\mathcal K|. 149 | \end{align*} 150 | 151 | On the other, let 152 | $$ 153 | S=\cbra{(c,m)\in\mathcal C\times\mathcal M\mid\forall k\in\mathcal K,\mathrm{Dec}_k(c)\neq m} 154 | $$ 155 | and 156 | $$ 157 | \overline{\mathcal C}_m=\cbra{c\in\mathcal C\mid \forall k\in\mathcal K,\mathrm{Dec}_k(c)\neq m}, 158 | $$ 159 | we have 160 | \begin{align*} 161 | \sum_{c\in\mathcal C}\sum_{m_2\in\overline{\mathcal M}_c}\Pr\sbra{\mathrm{Enc}_K(m_2)=c} 162 | &=\sum_{(c,m_2)\in S}\Pr\sbra{\mathrm{Enc}_K(m_2)=c} 163 | =\sum_{m_2\in\mathcal M}\sum_{c\in \overline{\mathcal C}_{m_2}}\Pr\sbra{\mathrm{Enc}_K(m_2)=c}\\ 164 | &=\sum_{m_2\in\mathcal M}\Pr\sbra{\mathrm{Enc}_K(m_2)\in\overline{\mathcal C}_{m_2}}\\ 165 | &=\sum_{m_2\in\mathcal M}\Pr\sbra{\forall k\in\mathcal K,\mathrm{Dec}_k(\mathrm{Enc}_K(m_2))\neq m_2}\\ 166 | &\leq\sum_{m_2\in\mathcal M}\Pr\sbra{\mathrm{Dec}_K(\mathrm{Enc}_K(m_2))\neq m_2}\\ 167 | &\leq\sum_{m_2\in\mathcal M}1-2^{-t}=|\mathcal M|\times(1-2^{-t}). 168 | \end{align*} 169 | 170 | Therefore, 171 | \begin{align*} 172 | 0&\geq\sum_{c\in\mathcal C}\sum_{m_2\in\overline{\mathcal M}_c} 173 | \Pr\sbra{\mathrm{Enc}_K(m_1)=c}-\Pr\sbra{\mathrm{Enc}_K(m_2)=c}\\ 174 | &\geq |\mathcal M|-|\mathcal K|-|\mathcal M|\times(1-2^{-t}). 175 | \end{align*} 176 | Then $|\mathcal K|\geq\frac{|\mathcal M|}{2^t}$. 177 | \end{proof} 178 | \end{exercise} 179 | 180 | 181 | \end{document} 182 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap04/pics/algo1.tex: -------------------------------------------------------------------------------- 1 | \begin{minipage}{\textwidth} 2 | \centering 3 | \begin{minipage}{0.46\textwidth} 4 | \centering 5 | \scriptsize 6 | \begin{algorithm}[H] 7 | \caption{Experiment $1$} 8 | \DontPrintSemicolon 9 | \SetKwFunction{enc}{Encrypt} 10 | \SetKwFunction{dec}{Decrypt} 11 | \SetKwProg{func}{Function}{}{} 12 | 13 | $M,C,S,T\gets\varnothing$\; 14 | \func{\enc{$m\in\bin^{n/2}$}}{ 15 | $r\sim\bin^{n/2},u\gets m\|r$\; 16 | \If{$u\notin M$}{ 17 | $c\sim\bin^n\backslash C$\; 18 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 19 | $S[u]\gets c,T[c]\gets u$\; 20 | } 21 | \KwRet $S[u]$\; 22 | } 23 | \func{\dec{$c\in\bin^{n}$}}{ 24 | \If{$c\notin C$}{ 25 | $u\sim\bin^n\backslash M$\; 26 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 27 | $S[u]\gets c,T[c]\gets u$\; 28 | } 29 | \KwRet first half of $T[c]$\; 30 | } 31 | \end{algorithm} 32 | \end{minipage} 33 | \begin{minipage}{0.46\textwidth} 34 | \centering 35 | \scriptsize 36 | \begin{algorithm}[H] 37 | \caption{Experiment $2$} 38 | \DontPrintSemicolon 39 | \SetKwFunction{enc}{Encrypt} 40 | \SetKwFunction{dec}{Decrypt} 41 | \SetKwProg{func}{Function}{}{} 42 | 43 | $M,C,S,T,R\gets\varnothing$\; 44 | \func{\enc{$m\in\bin^{n/2}$}}{ 45 | $r\sim\bin^{n/2}\backslash R,u\gets m\|r$\; 46 | \If{$u\notin M$}{ 47 | $c\sim\bin^n$\; 48 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 49 | $S[u]\gets c,T[c]\gets u,R\gets R\cup\{r\}$\; 50 | } 51 | \KwRet $S[u]$\; 52 | } 53 | \func{\dec{$c\in\bin^{n}$}}{ 54 | \If{$c\notin C$}{ 55 | $u\gets m\|r\sim\bin^{n/2}\times(\bin^{n/2}\backslash R)$\; 56 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 57 | $S[u]\gets c,T[c]\gets u,R\gets R\cup\{r\}$\; 58 | } 59 | \KwRet first half of $T[c]$\; 60 | } 61 | \end{algorithm} 62 | \end{minipage} 63 | \end{minipage} 64 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap04/pics/algo2.tex: -------------------------------------------------------------------------------- 1 | \begin{minipage}{\textwidth} 2 | \centering 3 | \begin{minipage}{0.46\textwidth} 4 | \centering 5 | \scriptsize 6 | \begin{algorithm}[H] 7 | \caption{Experiment $3$} 8 | \DontPrintSemicolon 9 | \SetKwFunction{enc}{Encrypt} 10 | \SetKwFunction{dec}{Decrypt} 11 | \SetKwProg{func}{Function}{}{} 12 | 13 | $M,C,S,T,R\gets\varnothing$\; 14 | \func{\enc{$m\in\bin^{n/2}$}}{ 15 | $r\sim\bin^{n/2}\backslash R,u\gets m\|r$\; 16 | $c\sim\bin^n$\; 17 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 18 | $S[u]\gets c,T[c]\gets u,R\gets R\cup\{r\}$\; 19 | \KwRet $S[u]$\; 20 | } 21 | \func{\dec{$c\in\bin^{n}$}}{ 22 | \If{$c\notin C$}{ 23 | $u\gets m\|r\sim\bin^{n/2}\times(\bin^{n/2}\backslash R)$\; 24 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 25 | $S[u]\gets c,T[c]\gets u,R\gets R\cup\{r\}$\; 26 | } 27 | \KwRet first half of $T[c]$\; 28 | } 29 | \end{algorithm} 30 | \end{minipage} 31 | \begin{minipage}{0.46\textwidth} 32 | \centering 33 | \scriptsize 34 | \begin{algorithm}[H] 35 | \caption{Experiment $4$} 36 | \DontPrintSemicolon 37 | \SetKwFunction{enc}{Encrypt} 38 | \SetKwFunction{dec}{Decrypt} 39 | \SetKwProg{func}{Function}{}{} 40 | 41 | $M,C,S,T\gets\varnothing$\; 42 | \func{\enc{$m\in\bin^{n/2}$}}{ 43 | $r\sim\bin^{n/2},u\gets m\|r$\; 44 | $c\sim\bin^n$\; 45 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 46 | $S[u]\gets c,T[c]\gets u$\; 47 | \KwRet $S[u]$\; 48 | } 49 | \func{\dec{$c\in\bin^{n}$}}{ 50 | \If{$c\notin C$}{ 51 | $u\gets m\|r\sim\bin^{n}$\; 52 | $M\gets M\cup\{u\},C\gets C\cup\{c\}$\; 53 | $S[u]\gets c,T[c]\gets u$\; 54 | } 55 | \KwRet first half of $T[c]$\; 56 | } 57 | \end{algorithm} 58 | \end{minipage} 59 | \end{minipage} 60 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap04/pics/algo3.tex: -------------------------------------------------------------------------------- 1 | \begin{minipage}{\textwidth} 2 | \centering 3 | \begin{minipage}{0.46\textwidth} 4 | \centering 5 | \scriptsize 6 | \begin{algorithm}[H] 7 | \caption{Experiment $5$} 8 | \DontPrintSemicolon 9 | \SetKwFunction{enc}{Encrypt} 10 | \SetKwFunction{dec}{Decrypt} 11 | \SetKwProg{func}{Function}{}{} 12 | 13 | $C,T\gets\varnothing$\; 14 | \func{\enc{$m\in\bin^{n/2}$}}{ 15 | $r\sim\bin^{n/2},u\gets m\|r$\; 16 | $c\sim\bin^n$\; 17 | $T[c]\gets u,C\gets C\cup\{c\}$\; 18 | \KwRet $c$\; 19 | } 20 | \func{\dec{$c\in\bin^{n}$}}{ 21 | \If{$c\notin C$}{ 22 | $u\sim\bin^{n}$\; 23 | $T[c]\gets u,C\gets C\cup\{c\}$\; 24 | } 25 | \KwRet first half of $T[c]$\; 26 | } 27 | \end{algorithm} 28 | \end{minipage} 29 | \begin{minipage}{0.46\textwidth} 30 | \centering 31 | \scriptsize 32 | \begin{algorithm}[H] 33 | \caption{Experiment $6$} 34 | \DontPrintSemicolon 35 | \SetKwFunction{enc}{Encrypt} 36 | \SetKwFunction{dec}{Decrypt} 37 | \SetKwProg{func}{Function}{}{} 38 | 39 | \func{\enc{$m\in\bin^{n/2}$}}{ 40 | $c\sim\bin^n$\; 41 | \KwRet $c$\; 42 | } 43 | \func{\dec{$c\in\bin^{n}$}}{ 44 | $m\sim\bin^{n/2}$\; 45 | \KwRet $m$\; 46 | } 47 | \end{algorithm} 48 | \end{minipage} 49 | \end{minipage} 50 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap08/chap08.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | % Author : Shlw 6 | 7 | \documentclass[a4paper]{article} 8 | 9 | \usepackage{amsmath,amsfonts,amssymb} 10 | \usepackage{mathrsfs} 11 | \usepackage{bm} 12 | \usepackage{geometry} 13 | \usepackage{ntheorem} 14 | \usepackage{hyperref} 15 | \usepackage[ruled]{algorithm2e} 16 | \usepackage{caption,subcaption} 17 | 18 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 19 | 20 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 21 | 22 | \newtheorem{theorem}{Theorem} 23 | \newtheorem{lemma}{Lemma} 24 | \newtheorem{proposition}{Proposition} 25 | \newtheorem{corollary}{Corollary} 26 | \newtheorem{claim}{Claim} 27 | \newtheorem{conjecture}{conjecture} 28 | \newtheorem{definition}{Definition} 29 | \newtheorem{construction}{Construction} 30 | \newtheorem*{proof}{Proof} 31 | \newtheorem*{answer}{Answer} 32 | \newtheorem*{refute}{Refute} 33 | \newtheorem*{example}{Example} 34 | \newtheorem*{counterexample}{Counterexample} 35 | \newenvironment{exercise}[1]{ 36 | \par 37 | \noindent\textbf{Exercise #1.}\quad 38 | }{ 39 | \par 40 | \bigskip 41 | } 42 | 43 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 44 | \DeclareMathOperator{\lequiv}{\ \Leftrightarrow\ } 45 | \DeclareMathOperator{\Image}{\mathop{Im}} 46 | \newcommand{\rawE}{\mathop{\mathbb E}} 47 | \newcommand{\E}[1]{\mathop{\mathbb E}_{#1}} 48 | \newcommand{\abs}[1]{\left| #1 \right|} 49 | \newcommand{\pbra}[1]{\left( #1 \right)} 50 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 51 | \newcommand{\sbra}[1]{\left[ #1 \right]} 52 | \newcommand{\bin}{\{0,1\}} 53 | \newcommand{\Enc}{\mathrm{Enc}} 54 | \newcommand{\hc}{\mathrm{hc}} 55 | \newcommand{\Gen}{\mathrm{Gen}} 56 | \newcommand{\Ext}{\mathrm{Ext}} 57 | \newcommand{\Dec}{\mathrm{Dec}} 58 | \newcommand{\Mac}{\mathrm{Mac}} 59 | \newcommand{\Vrfy}{\mathrm{Vrfy}} 60 | \newcommand{\PrivK}{\mathrm{PrivK}} 61 | \newcommand{\Macforge}{\mathrm{Mac}\text{-}\mathrm{forge}} 62 | \newcommand{\Macsforge}{\mathrm{Mac}\text{-}\mathrm{sforge}} 63 | \newcommand{\Encforge}{\mathrm{Enc}\text{-}\mathrm{Forge}} 64 | \newcommand{\Invert}{\mathrm{Invert}} 65 | \newcommand{\Feistel}{\mathrm{Feistel}} 66 | \newcommand{\Hashcoll}{\mathrm{Hash}\text{-}\mathrm{coll}} 67 | \newcommand{\negl}{\mathrm{negl}} 68 | \newcommand{\ppt}{{\sc ppt} } 69 | \newcommand{\eav}{\mathrm{eav}} 70 | \newcommand{\out}{\mathrm{out}} 71 | \newcommand{\mult}{\mathrm{mult}} 72 | \newcommand{\cpa}{\mathrm{cpa}} 73 | \newcommand{\cca}{\mathrm{cca}} 74 | \newcommand{\Used}{\mathrm{Used}} 75 | \newcommand{\Asked}{\mathrm{Asked}} 76 | \newcommand{\Acal}{\mathcal{A}} 77 | \newcommand{\Xcal}{\mathcal{X}} 78 | \newcommand{\Ycal}{\mathcal{Y}} 79 | \newcommand{\Zcal}{\mathcal{Z}} 80 | \newcommand{\Ocal}{\mathcal{O}} 81 | \newcommand{\Dcal}{\mathcal{D}} 82 | \newcommand{\Pcal}{\mathcal{P}} 83 | \newcommand{\Gset}{\mathbb{G}} 84 | \newcommand{\Nset}{\mathbb{N}} 85 | \newcommand{\Zset}{\mathbb{Z}} 86 | \newcommand{\Hset}{\mathbb{H}} 87 | 88 | \title{Exercise Set --- Chapter $8$} 89 | \date{} 90 | 91 | \begin{document} 92 | 93 | \maketitle 94 | 95 | \begin{exercise}{8.1} 96 | Assume $e_1,e_2\in\Gset$ are two identities, then 97 | $$ 98 | e_1=e_1\circ e_2=e_2. 99 | $$ 100 | For any $g\in\Gset$, assume $h_1,h_2\in\Gset$ are two inverses of $g$ and $e$ is the identity, then 101 | $$ 102 | h_2=h_2\circ e=h_2\circ(g\circ h_1)=(h_2\circ g)\circ h_1=e\circ h_1=h_1. 103 | $$ 104 | \end{exercise} 105 | 106 | \begin{exercise}{8.3} 107 | \begin{itemize} 108 | \item $\Gset$ is finite. ($|\Gset|=n$) 109 | \begin{proof} 110 | By definition, $\langle g\rangle=\cbra{g^0,g^1,g^2,\cdots}$. 111 | It suffices to verify the definition of group as follows: 112 | \begin{itemize} 113 | \item Closure: $g^i\circ g^j=g^{i+j}\in\Gset$. 114 | \item Identity: $e=g^0\in\Gset$. 115 | \item Inverse: $g^{-1}=g^{n-1}\in\Gset$. 116 | \item Associativity: $g^i\circ(g^j\circ g^k)=g^{i+j+k}=(g^i\circ g^j)\circ g^k$. 117 | \end{itemize} 118 | \end{proof} 119 | \item $\Gset$ is infinite. 120 | \begin{counterexample} 121 | Assume $\Gset=(\Zset,+)$ and $g=1$. Then $\langle g\rangle=\cbra{0,1,2,\cdots}$. 122 | Apparently, $1\in\langle g\rangle$ does not have inverse, which is $-1\in\Gset$. 123 | \end{counterexample} 124 | \end{itemize} 125 | \end{exercise} 126 | 127 | \begin{exercise}{8.8} 128 | It suffices to verify the definition of group as follows: 129 | \begin{itemize} 130 | \item Closure: $(u,v)\circ_{\Gset\times\Hset}(x,y)=(u\circ_\Gset x,v\circ_\Hset y)\in\Gset\times\Hset$. 131 | \item Identity: $e_{\Gset\times\Hset}=(e_\Gset,e_\Hset)\in\Gset\times\Hset$. 132 | \item Inverse: $(u,v)^{-1}=(u^{-1},v^{-1})\in\Gset\times\Hset$. 133 | \item Associativity: $(u,v)\circ_{\Gset\times\Hset}((x,y)\circ_{\Gset\times\Hset} (a,b))= 134 | (u\circ_\Gset x\circ_\Gset a,v\circ_\Hset y\circ_\Hset b)= 135 | ((u,v)\circ_{\Gset\times\Hset}(x,y))\circ_{\Gset\times\Hset}(a,b)$. 136 | \end{itemize} 137 | \end{exercise} 138 | 139 | \begin{exercise}{8.14} 140 | Construct $\Acal'$ as follows: 141 | \begin{enumerate} 142 | \item $\Acal'$ is given $y,N,e$. 143 | \item Pick an arbitrary $r\in\Zset^*_N$ and let $t=y\cdot r^{-e}$. 144 | \item Run $\Acal(t)$ and get $k$. If $k^e=t$, output $k\cdot r$; 145 | otherwise repeat from step $2$. 146 | \item If $\Acal(t)$ is called for $500$ times yet still no valid answer, 147 | $\Acal'$ fails. 148 | \end{enumerate} 149 | Since $y^{1/e}=(t\cdot r^{e})^{1/e}=k\cdot r$, $\Acal'$ is correct if it successfully outputs. 150 | On the other hand, $f_e:\Zset^*_N\to\Zset^*_N,f_e(x)=x^e$ is a bijection, thus 151 | $t$ is uniform in $\Zset^*_N$. 152 | Therefore, for any $x\in\Zset^*_N$, we have 153 | \begin{align*} 154 | \Pr\sbra{\Acal'\pbra{\sbra{x^e\mod N}}=x}&=1-\Pr_{t\sim\Zset^*_N}\sbra{\Acal\pbra{\sbra{t\mod N}}=t^{1/e}}^{500}\\ 155 | &=1-\Pr_{u\sim\Zset^*_N}\sbra{\Acal\pbra{\sbra{u^e\mod N}}=u}^{500}\\ 156 | &=1-0.99^{500}\geq 0.99. 157 | \end{align*} 158 | Since $\Acal$ is called for at most $500$ times, 159 | sampling algorithm and multiplication is polynomial, 160 | the running time $t'$ of $\Acal'$ is polynomial in $t$ and $\|N\|$. 161 | \end{exercise} 162 | 163 | \begin{exercise}{8.16} 164 | After tedious calculation, there are $16$ points on $E$: 165 | $$ 166 | \cbra{\Ocal}\cup\cbra{(9,0),(0,\pm 1),(1,\pm 2),(3,\pm 1),(5,\pm 2),(6,\pm 3),(8,\pm 1),(10,\pm 3)}. 167 | $$ 168 | \end{exercise} 169 | 170 | \begin{exercise}{8.19} 171 | This problem can be solved in polynomial time, since $x\in\Zset_{p-1}^*$ has inverse. 172 | \end{exercise} 173 | 174 | \begin{exercise}{8.20} 175 | It is easy to see 176 | $$ 177 | H^s(x)=y^{\sum_{i=1}^{3n}e^{i-1}x_i}. 178 | $$ 179 | Assume $H^s(m)=H^s(m')$, then 180 | \begin{itemize} 181 | \item If $H^s(m)=y^{1+et},H^s(m')=y^{et'}$, then $y^{1/e}\equiv y^{t'-t}\mod N$. 182 | \item If $H^s(m)=y^{et},H^s(m')=y^{et'}$, then reduce to $y^t\equiv y^{t'}\mod N$. 183 | \item If $H^s(m)=y^{1+et},H^s(m')=y^{1+et'}$, then reduce to $y^t\equiv y^{t'}\mod N$. 184 | \end{itemize} 185 | \end{exercise} 186 | 187 | \begin{exercise}{8.21 (a)} 188 | Assume $H^s(x)=H^s(x')$ and $g$ is the generator. 189 | Then $H^s(x)=H^s(x')$ is equivalent to $\sum_{i=1}^t (x_i-x_i')\log_g h_i\equiv 0\mod q$. 190 | Simply guess one of the different coordinates and set the corresponding $h$ as $y$ from discrete-logarithm problem. 191 | \end{exercise} 192 | 193 | \end{document} 194 | -------------------------------------------------------------------------------- /Introduction-to-Modern-Cryptography/chap10/chap10.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | % Author : Shlw 6 | 7 | \documentclass[a4paper]{article} 8 | 9 | \usepackage{amsmath,amsfonts,amssymb} 10 | \usepackage{mathrsfs} 11 | \usepackage{bm} 12 | \usepackage{geometry} 13 | \usepackage{ntheorem} 14 | \usepackage{hyperref} 15 | \usepackage[ruled]{algorithm2e} 16 | \usepackage{caption,subcaption} 17 | 18 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 19 | 20 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 21 | 22 | \newtheorem{theorem}{Theorem} 23 | \newtheorem{lemma}{Lemma} 24 | \newtheorem{proposition}{Proposition} 25 | \newtheorem{corollary}{Corollary} 26 | \newtheorem{claim}{Claim} 27 | \newtheorem{conjecture}{conjecture} 28 | \newtheorem{definition}{Definition} 29 | \newtheorem{construction}{Construction} 30 | \newtheorem*{proof}{Proof} 31 | \newtheorem*{answer}{Answer} 32 | \newtheorem*{refute}{Refute} 33 | \newtheorem*{example}{Example} 34 | \newtheorem*{counterexample}{Counterexample} 35 | 36 | \newenvironment{exercise}[1]{ 37 | \par 38 | \noindent\textbf{Exercise #1.}\quad 39 | }{ 40 | \par 41 | \bigskip 42 | } 43 | 44 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 45 | \DeclareMathOperator{\lequiv}{\ \Leftrightarrow\ } 46 | \DeclareMathOperator{\Image}{\mathop{Im}} 47 | \newcommand{\rawE}{\mathop{\mathbb E}} 48 | \newcommand{\E}[1]{\mathop{\mathbb E}_{#1}} 49 | \newcommand{\abs}[1]{\left| #1 \right|} 50 | \newcommand{\pbra}[1]{\left( #1 \right)} 51 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 52 | \newcommand{\sbra}[1]{\left[ #1 \right]} 53 | \newcommand{\bin}{\{0,1\}} 54 | \newcommand{\Enc}{\mathrm{Enc}} 55 | \newcommand{\hc}{\mathrm{hc}} 56 | \newcommand{\half}{\mathrm{half}} 57 | \newcommand{\lsb}{\mathrm{lsb}} 58 | \newcommand{\Gen}{\mathrm{Gen}} 59 | \newcommand{\Ext}{\mathrm{Ext}} 60 | \newcommand{\Dec}{\mathrm{Dec}} 61 | \newcommand{\Mac}{\mathrm{Mac}} 62 | \newcommand{\Vrfy}{\mathrm{Vrfy}} 63 | \newcommand{\PrivK}{\mathrm{PrivK}} 64 | \newcommand{\PubK}{\mathrm{PubK}} 65 | \newcommand{\KEM}{\mathrm{KEM}} 66 | \newcommand{\Encaps}{\mathrm{Encaps}} 67 | \newcommand{\GenRSA}{\mathrm{GenRSA}} 68 | \newcommand{\Decaps}{\mathrm{Decaps}} 69 | \newcommand{\Macforge}{\mathrm{Mac}\text{-}\mathrm{forge}} 70 | \newcommand{\Macsforge}{\mathrm{Mac}\text{-}\mathrm{sforge}} 71 | \newcommand{\Encforge}{\mathrm{Enc}\text{-}\mathrm{Forge}} 72 | \newcommand{\Invert}{\mathrm{Invert}} 73 | \newcommand{\Feistel}{\mathrm{Feistel}} 74 | \newcommand{\Hashcoll}{\mathrm{Hash}\text{-}\mathrm{coll}} 75 | \newcommand{\negl}{\mathrm{negl}} 76 | \newcommand{\ppt}{{\sc ppt}~} 77 | \newcommand{\eav}{\mathrm{eav}} 78 | \newcommand{\out}{\mathrm{out}} 79 | \newcommand{\mult}{\mathrm{mult}} 80 | \newcommand{\cpa}{\mathrm{cpa}} 81 | \newcommand{\cca}{\mathrm{cca}} 82 | \newcommand{\Used}{\mathrm{Used}} 83 | \newcommand{\Asked}{\mathrm{Asked}} 84 | \newcommand{\Acal}{\mathcal{A}} 85 | \newcommand{\Bcal}{\mathcal{B}} 86 | \newcommand{\Dcal}{\mathcal{D}} 87 | \newcommand{\Gcal}{\mathcal{G}} 88 | \newcommand{\Ocal}{\mathcal{O}} 89 | \newcommand{\Pcal}{\mathcal{P}} 90 | \newcommand{\Xcal}{\mathcal{X}} 91 | \newcommand{\Ycal}{\mathcal{Y}} 92 | \newcommand{\Zcal}{\mathcal{Z}} 93 | \newcommand{\Gset}{\mathbb{G}} 94 | \newcommand{\Nset}{\mathbb{N}} 95 | \newcommand{\Zset}{\mathbb{Z}} 96 | \newcommand{\Hset}{\mathbb{H}} 97 | 98 | \title{Exercise Set --- Chapter $10$} 99 | \date{} 100 | 101 | \begin{document} 102 | 103 | \maketitle 104 | 105 | \begin{exercise}{10.1} 106 | The proof is similar with secure-KEM + secure-PrivK gives secure-PubK in chapter 11 (Theorem 11.12). 107 | \end{exercise} 108 | 109 | \begin{exercise}{10.4} 110 | By the protocol, it is easy to see 111 | $$ 112 | w=u\oplus r=s\oplus t\oplus r=k\oplus r\oplus t\oplus r=k\oplus t, 113 | $$ 114 | thus $k=w\oplus t$, which means Alice and Bob output the same key. 115 | 116 | This protocol is not secure, since 117 | $u\oplus w\oplus s=u\oplus u\oplus r\oplus k\oplus r=k$, which means an eavesdropper 118 | can easily obtain the key from the communication. 119 | \end{exercise} 120 | 121 | \end{document} 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Books-and-Exercises 2 | 3 | Book list: 4 | 5 | - Analysis of Boolean Functions 6 | - Computational Complexity : A Modern Approach 7 | - Introduction to Automata Theory, Languages, and Computation 8 | - Introduction to Modern Cryptography 9 | - The Probabilistic Method 10 | 11 | *if there are mistakes or you know answers to the unsolved (but hard) exercises, please let me know.* 12 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/README.md: -------------------------------------------------------------------------------- 1 | ## The Probabilistic Method 2 | 3 | By Joel Spencer and Noga Alon 4 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap01/ref.bib: -------------------------------------------------------------------------------- 1 | @article{alon1995123, 2 | title={The 123 theorem and its extensions}, 3 | author={Alon, Noga and Yuster, Raphael}, 4 | journal={Journal of Combinatorial Theory, Series A}, 5 | volume={72}, 6 | number={2}, 7 | pages={322--331}, 8 | year={1995}, 9 | publisher={Elsevier} 10 | } 11 | @article{szekeres1965problem, 12 | title={On a problem of Sch{\"u}tte and Erd{\"o}s}, 13 | author={Szekeres, Esther and Szekeres, George}, 14 | journal={The Mathematical Gazette}, 15 | pages={290--293}, 16 | year={1965}, 17 | publisher={JSTOR} 18 | } 19 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap03/chap03.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \newcommand{\abs}[1]{\left| #1 \right|} 54 | \newcommand{\pbra}[1]{\left( #1 \right)} 55 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 56 | \newcommand{\sbra}[1]{\left[ #1 \right]} 57 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 58 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 59 | \newcommand{\bin}{\{0,1\}} 60 | \newcommand{\ZPP}{\mathtt{ZPP}} 61 | \newcommand{\RP}{\mathtt{RP}} 62 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 63 | \newcommand{\per}{\text{per}} 64 | \newcommand{\Nbb}{\mathbb{N}} 65 | \newcommand{\Zbb}{\mathbb{Z}} 66 | \newcommand{\Acal}{\mathcal{A}} 67 | \newcommand{\Bcal}{\mathcal{B}} 68 | \newcommand{\Ccal}{\mathcal{C}} 69 | \newcommand{\Fcal}{\mathcal{F}} 70 | 71 | \bibliographystyle{plainnat} 72 | 73 | \title{Exercise Set --- Chapter $3$} 74 | \date{} 75 | 76 | \begin{document} 77 | 78 | \maketitle 79 | 80 | \begin{exercise}{1} 81 | $$ 82 | R(k,k)>n-\binom nk2^{1-\binom k2}\geq n-\pbra{\frac{en}k}^k2^{1-\binom k2}. 83 | $$ 84 | Let 85 | $$ 86 | n=\frac1{\sqrt[k-1]{2e}}\frac ke2^{k/2} 87 | $$ 88 | then 89 | $$ 90 | R(k,k)\geq\pbra{1-\frac1k}\frac1{\sqrt[k-1]{2e}}\frac ke2^{k/2}=(1-o(1))\frac ke2^{k/2}. 91 | $$ 92 | \end{exercise} 93 | 94 | \begin{exercise}{2} 95 | As shown in Section 3.1, 96 | $$ 97 | R(4,k)>n-\binom n4p^6-\binom nk(1-p)^{\binom k2}\geq n-n^4p^6-\frac{n^k}{k!}e^{-p\frac{k^2}4}. 98 | $$ 99 | Let $p=\frac{4\ln n}k\delta$, then 100 | $$ 101 | R(4,k)>n-n^4\pbra{\frac{4\delta\ln n}k}^6-\frac{n^{k(1-\delta)}}{k!}. 102 | $$ 103 | Let $n=\Theta\pbra{\pbra{\frac k{\ln k}}^2}$ and $\delta=O(1)$, we have $R(4,k)\geq\Omega\pbra{(k/\ln k)^2}$. 104 | \end{exercise} 105 | 106 | \begin{exercise}{3} 107 | Independently select every vertex with probability $\sqrt{\frac n{3m}}\leq 1$ to form set $A$. 108 | Let $B$ be the set of edges induced by vertices in 109 | $A$. Then 110 | $$ 111 | \E\sbra{|A|-|B|}=np-mp^3=\frac{2n^{3/2}}{3\sqrt3\sqrt m}. 112 | $$ 113 | By removing at most $1$ vertex in every edge in $B$, there exists an independent set of size at least 114 | $\frac{2n^{3/2}}{3\sqrt3\sqrt m}$. 115 | \end{exercise} 116 | 117 | \begin{exercise}{4} 118 | Let $G$ be a digraph of order $n$ and each vertex has outdegree at least $\delta=\log n-\frac1{10}\log\log n$. 119 | For any $v\in G$, define $N_G(v)=\cbra{u\in G\middle|v\to u\in E(G)}$. 120 | Independently for any vertex $v$ choose its color $c_v$ as black or white with equal possibility; thus 121 | \begin{align*} 122 | \E\sbra{\#\cbra{v\middle|\exists u,\pbra{c_u\neq c_v}\land\pbra{u\in N_G(v)}}} 123 | \geq n\pbra{\frac12}^\delta=\pbra{\log n}^{1/10}=o(\log n). 124 | \end{align*} 125 | Then fix such coloring and remove $o(\log n)$ vertices in 126 | $\cbra{v\middle|\exists u,\pbra{c_u\neq c_v}\land\pbra{u\in N_G(v)}}$. Every vertex $v$ in the remaining graph $G'$ 127 | has outdegree at least $1$ and at least one vertex in $N_{G'}(v)$ has different color. 128 | 129 | Choose an arbitrary vertex $v_1\in G'$ and go to another one of different color repeatedly, then we have 130 | $$ 131 | v_1\to v_2\to\cdots\to v_k\to v_{k+1}=v_i,i\leq k. 132 | $$ 133 | The simple directed cycle $v_i\to v_{i+1}\to\cdots\to v_k\to v_i$ has even length since $c_{v_i}\neq c_{v_k}$. 134 | \end{exercise} 135 | 136 | \end{document} 137 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap05/ex7.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | const int m = 10000; 6 | const int n = 10 * m; 7 | 8 | bool x[n + 1]; 9 | int sigma[31][n + 1]; 10 | int clause[31][11][m]; 11 | 12 | void swap(int& a, int& b) { 13 | int c = a; 14 | a = b; 15 | b = c; 16 | } 17 | 18 | void init() { 19 | srand(time(0)); 20 | for (int i = 1; i <= 30; ++i) { 21 | for (int j = 1; j <= n; ++j) 22 | sigma[i][j] = j; 23 | // Knuth Shuffle 24 | for (int j = 1; j <= n; ++j) 25 | swap(sigma[i][j], sigma[i][j + rand() % (n + 1 - j)]); 26 | } 27 | // initialize negation 28 | for (int i = 1; i <= 30; ++i) 29 | for (int k = 1; k <= 10; ++k) 30 | for (int j = 0; j < m; ++j) 31 | clause[i][k][j] = rand() & 1; 32 | // inital assignment 33 | for (int i = 1; i <= n; ++i) 34 | x[i] = rand() & 1; 35 | } 36 | 37 | pair check() { 38 | for (int i = 1; i <= 30; ++i) 39 | for (int j = 0; j < m; ++j) { 40 | bool f = 0; 41 | for (int k = 1; k <= 10; ++k) 42 | f |= x[sigma[i][10 * j + k]] ^ clause[i][k][j]; 43 | if (!f) 44 | return make_pair(i, j); 45 | } 46 | return make_pair(0, 0); 47 | } 48 | 49 | int main() { 50 | init(); 51 | 52 | int cnt = 0; 53 | pair badclause; 54 | while ((badclause = check()) != make_pair(0, 0)) { 55 | int i = badclause.first; 56 | int t = badclause.second; 57 | for (int l = 1; l <= 10; ++l) 58 | x[sigma[i][10 * t + l]] = rand() & 1; 59 | cnt += 1; 60 | } 61 | 62 | printf("Solution found in %d round\n", cnt); 63 | } 64 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap06/chap06.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \newcommand{\abs}[1]{\left| #1 \right|} 55 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 56 | \newcommand{\pbra}[1]{\left( #1 \right)} 57 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 58 | \newcommand{\sbra}[1]{\left[ #1 \right]} 59 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 60 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 61 | \newcommand{\bin}{\{0,1\}} 62 | \newcommand{\ZPP}{\mathtt{ZPP}} 63 | \newcommand{\RP}{\mathtt{RP}} 64 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 65 | \newcommand{\per}{\text{per}} 66 | \newcommand{\sgn}{\text{sgn}} 67 | \newcommand{\Fbb}{\mathbb{F}} 68 | \newcommand{\Nbb}{\mathbb{N}} 69 | \newcommand{\Rbb}{\mathbb{R}} 70 | \newcommand{\Zbb}{\mathbb{Z}} 71 | \newcommand{\Acal}{\mathcal{A}} 72 | \newcommand{\Bcal}{\mathcal{B}} 73 | \newcommand{\Ccal}{\mathcal{C}} 74 | \newcommand{\Fcal}{\mathcal{F}} 75 | \newcommand{\Gcal}{\mathcal{G}} 76 | 77 | \bibliographystyle{plainnat} 78 | 79 | \title{Exercise Set --- Chapter $6$} 80 | \date{} 81 | 82 | \begin{document} 83 | 84 | \maketitle 85 | 86 | \begin{exercise}{1} 87 | Let $f,g:2^{G}\to\bin$ be the indicator functions of the connectivity, i.e., 88 | \begin{gather*} 89 | f(G')=\begin{cases} 90 | 1 & G'\text{ is connected and spanning}\\ 91 | 0 & \text{otherwise}, 92 | \end{cases}\\ 93 | g(G')=\begin{cases} 94 | 1 & G\backslash G'\text{ is connected and spanning}\\ 95 | 0 & \text{otherwise}. 96 | \end{cases} 97 | \end{gather*} 98 | Define $\mu:2^{G}\to\Rbb^+$ as $\mu(S)=2^{-|G|}$. Then $\mu$ is log-supermodular, $f$ is increasing, and $g$ is decreasing. 99 | By FKG inequality, we have 100 | $$ 101 | \pbra{\sum_{G'\subseteq G}\mu(G')f(G')}\pbra{\sum_{G'\subseteq G}\mu(G')g(G')}\geq 102 | \pbra{\sum_{G'\subseteq G}\mu(G')f(G')g(G')}\pbra{\sum_{G'\subseteq G}\mu(G')}, 103 | $$ 104 | which means 105 | \begin{align*} 106 | P^2&=\Pr\sbra{\text{connected }G'}\times\Pr\sbra{\text{connected }G'}\\ 107 | &=\Pr\sbra{\text{connected }G'}\times\Pr\sbra{\text{connected }G\backslash G'}\\ 108 | &=\pbra{\sum_{G'\subseteq G}\mu(G')f(G')}\pbra{\sum_{G'\subseteq G}\mu(G')g(G')}\\ 109 | &\geq\pbra{\sum_{G'\subseteq G}\mu(G')f(G')g(G')}\pbra{\sum_{G'\subseteq G}\mu(G')}\\ 110 | &=\Pr\sbra{\text{connected }G'\land\text{connected }G\backslash G'}\\ 111 | &=Q. 112 | \end{align*} 113 | \end{exercise} 114 | 115 | \begin{exercise}{2} 116 | Without loss of generality, assume for any $i\in[k]$, $\pbra{S\in\Fcal_i}\land\pbra{S\subseteq S'}\implies S'\in\Fcal_i$. 117 | Let $\Gcal_i=2^{[n]}\backslash\Fcal_i$ and $g_i:2^{[n]}\to\bin$ be the indicator function, i.e., 118 | $$ 119 | g_i(S)=[S\in\Gcal_i]. 120 | $$ 121 | Define $\mu:2^{[n]}\to\Rbb^+$ as $\mu(S)=2^{-n}$. Then $\mu$ is log-supermodular and $g_i$'s are decreasing. 122 | By FKG inequality, we have 123 | $$ 124 | \prod_{i=1}^k\pbra{\sum_{S\subseteq[n]}\mu(S)g_i(S)}\leq\pbra{\sum_{S\subseteq[n]}\mu(S)\prod_{i=1}^kg_i(S)} 125 | \pbra{\sum_{S\subseteq[n]}\mu(S)}^{k-1}=\abs{\bigcap_{i=1}^k\Gcal_i}2^{-n}. 126 | $$ 127 | On the other hand, by pigeonhole principle $\abs{\Fcal_i}\leq2^{n-1}$ since $S$ and $[n]\backslash S$ 128 | can not be simultaneously in $\Fcal_i$. Thus $\sum_{S\subseteq[n]}\mu(S)g_i(S)\geq\frac12$. Therefore, we have 129 | $$ 130 | \abs{\bigcup_{i=1}^k\Fcal_i}=2^n-\abs{\bigcap_{i=1}^k\Gcal_i}\leq2^n-2^{n-k}. 131 | $$ 132 | \end{exercise} 133 | 134 | \begin{exercise}{3} 135 | Let $n=2k$ and $f_i:2^{\binom n2}\to\bin,i\in[n]$ be the degree indicator function of the $i$-th vertex, i.e., 136 | $$ 137 | f_i(S)=\begin{cases} 138 | 1 & \abs{S\cap\cbra{\cbra{i,j}\middle|j\neq i}}\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \newcommand{\abs}[1]{\left| #1 \right|} 55 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 56 | \newcommand{\pbra}[1]{\left( #1 \right)} 57 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 58 | \newcommand{\sbra}[1]{\left[ #1 \right]} 59 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 60 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 61 | \newcommand{\bin}{\{0,1\}} 62 | \newcommand{\ZPP}{\mathtt{ZPP}} 63 | \newcommand{\RP}{\mathtt{RP}} 64 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 65 | \newcommand{\per}{\text{per}} 66 | \newcommand{\sgn}{\text{sgn}} 67 | \newcommand{\Fbb}{\mathbb{F}} 68 | \newcommand{\Nbb}{\mathbb{N}} 69 | \newcommand{\Rbb}{\mathbb{R}} 70 | \newcommand{\Zbb}{\mathbb{Z}} 71 | \newcommand{\Acal}{\mathcal{A}} 72 | \newcommand{\Bcal}{\mathcal{B}} 73 | \newcommand{\Ccal}{\mathcal{C}} 74 | \newcommand{\Fcal}{\mathcal{F}} 75 | \newcommand{\Gcal}{\mathcal{G}} 76 | 77 | \bibliographystyle{plainnat} 78 | 79 | \title{Exercise Set --- Chapter $7$} 80 | \date{} 81 | 82 | \begin{document} 83 | 84 | \maketitle 85 | 86 | \begin{exercise}{1} 87 | Define 88 | $$ 89 | f(\bm x)=\min_{\bm y\in U}\text{Dist}(\bm x,\bm y). 90 | $$ 91 | Let $x_1,\cdots,x_n$ be iid random variables in $\Zbb_7$ with uniform distribution 92 | and $Y_i=\E\sbra{f(\bm x)\middle|x_1,\cdots,x_i},i=0,1,\cdots,n$. 93 | Then $Y_i$ is a martingale. Since 94 | $$ 95 | \abs{Y_i-Y_{i-1}}= 96 | \abs{\E_{x_i',\cdots,x_n'}\sbra{f(x_1,\cdots,x_i,x_i',\cdots,x_n')-f(x_1,\cdots,x_{i-1},x_i',\cdots,x_n')}} 97 | \leq1. 98 | $$ 99 | Thus by Azuma's Inequality, we have 100 | $$ 101 | \Pr\sbra{Y_n-Y_0<-c\sqrt{n}}(c+2)\sqrt n}\leq\Pr\sbra{Y_n>Y_0+c\sqrt n}\leq e^{-c^2/2}, 110 | $$ 111 | which means $|W|\leq7^ne^{-c^2/2}$ as desired. 112 | \end{exercise} 113 | 114 | \end{document} 115 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap12/chap12.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \newcommand{\abs}[1]{\left| #1 \right|} 57 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 58 | \newcommand{\abra}[1]{\left\langle #1 \right\rangle} 59 | \newcommand{\pbra}[1]{\left( #1 \right)} 60 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 61 | \newcommand{\sbra}[1]{\left[ #1 \right]} 62 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 63 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 64 | \newcommand{\bin}{\{0,1\}} 65 | \newcommand{\ZPP}{\mathtt{ZPP}} 66 | \newcommand{\RP}{\mathtt{RP}} 67 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 68 | \newcommand{\per}{\text{per}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | \newcommand{\Acal}{\mathcal{A}} 75 | \newcommand{\Bcal}{\mathcal{B}} 76 | \newcommand{\Ccal}{\mathcal{C}} 77 | \newcommand{\Fcal}{\mathcal{F}} 78 | \newcommand{\Gcal}{\mathcal{G}} 79 | 80 | \bibliographystyle{plainnat} 81 | 82 | \title{Exercise Set --- Chapter $12$} 83 | \date{} 84 | 85 | \begin{document} 86 | 87 | \maketitle 88 | 89 | \begin{exercise}{1} 90 | Each gate is one of the following possibilities: \emph{And gate, Or gate, Negation gate}. Each gate has at most two input wires. Thus the number of binary Boolean circuits of size $s$ on $n$ variables is at most 91 | $$ 92 | \prod_{i=1}^s\underbrace{3}_{\text{gate kinds}}\times\underbrace{(s+n)^2}_{\text{input wire}} 93 | =\pbra{\sqrt3(s+n)}^{2s}. 94 | $$ 95 | 96 | \end{exercise} 97 | \noindent\textbf{\it Remark:} The bound in the exercise is not true. It can be easily refuted by $s=1$. 98 | 99 | \begin{exercise}{2} 100 | Directly applying Local Lemma, we have 101 | $$ 102 | e\times 2^{-10}\times 100<1. 103 | $$ 104 | Thus there exists a satisfying assignment. 105 | \end{exercise} 106 | 107 | \begin{exercise}{3} 108 | We describe layers of And gates and Or gates, and use And-Or iterations to amplify the threshold gap. 109 | Assume input as $pn$ ones. 110 | \begin{itemize} 111 | \item The first (bottom) layer consists of $\bigwedge_{\log n}$ gates and each has uniformly random input. 112 | Then the probability of being one shifts 113 | $$ 114 | \begin{cases} 115 | p\geq\frac12+\frac1{\log n}\\ 116 | p\leq\frac12-\frac1{\log n} 117 | \end{cases} 118 | \Rightarrow 119 | \begin{cases} 120 | p'\geq\pbra{\frac12+\frac1{\log n}}^{\log n}\approx\frac{e^2}n\\ 121 | p'\leq\pbra{\frac12-\frac1{\log n}}^{\log n}\approx\frac1{e^2n}. 122 | \end{cases} 123 | $$ 124 | \item The second layer consists of $\bigvee_{n}$ gates and each has disjoint input from first layer. 125 | Then the probability of being one shifts 126 | $$ 127 | \begin{cases} 128 | p\geq\frac{e^2}{n}\\ 129 | p\leq\frac1{e^2n} 130 | \end{cases} 131 | \Rightarrow 132 | \begin{cases} 133 | p'\geq1-\pbra{1-\frac{e^2}{n}}^{n}\approx1-e^{-e^2}>\frac78\\ 134 | p'\leq1-\pbra{1-\frac1{e^2n}}^{n}\approx1-e^{-\frac1{e^2}}<\frac17. 135 | \end{cases} 136 | $$ 137 | \item The third layer consists of $\bigwedge_{\log n}$ gates and each has disjoint input from second layer. 138 | Then the probability of being one shifts 139 | $$ 140 | \begin{cases} 141 | p\geq\frac78\\ 142 | p\leq\frac17 143 | \end{cases} 144 | \Rightarrow 145 | \begin{cases} 146 | p'\geq\pbra{\frac78}^{\log n}=n^{-3+\log7}\geq n^{-0.2}\\ 147 | p'\leq\pbra{\frac17}^{\log n}=n^{-\log 7}\leq n^{-2.8}. 148 | \end{cases} 149 | $$ 150 | \item The fourth layer consists of $\bigvee_{n^{1.5}}$ gates and each has disjoint input from third layer. 151 | Then the probability of being one shifts 152 | $$ 153 | \begin{cases} 154 | p\geq n^{-0.2}\\ 155 | p\leq n^{-2.8} 156 | \end{cases} 157 | \Rightarrow 158 | \begin{cases} 159 | p'\geq1-\pbra{1-n^{-0.2}}^{n^{1.5}}\approx 1-e^{-n^{1.3}}\\ 160 | p'\leq1-\pbra{1-n^{-2.8}}^{n^{1.5}}\leq n^{-1.3}. 161 | \end{cases} 162 | $$ 163 | \item The fifth layer consists of $\bigwedge_{n}$ gates and each has disjoint input from fourth layer. 164 | Then the probability of being one shifts 165 | $$ 166 | \begin{cases} 167 | p\geq 1-e^{-n^{1.3}}\\ 168 | p\leq n^{-1.3} 169 | \end{cases} 170 | \Rightarrow 171 | \begin{cases} 172 | p'\geq\pbra{1-e^{-n^{1.3}}}^n\geq1-ne^{-n^{1.3}}>1-2^{-n}\\ 173 | p'\leq n^{-1.3n}< 2^{-n}. 174 | \end{cases} 175 | $$ 176 | \end{itemize} 177 | Thus, for any given input, the bounded-depth, polynomial-size, monotone circuit above satisfies the condition 178 | with probability at least $1-2^{-n}$. 179 | By union bound, there exists a desired circuit coincides with all $f(\bm x)$ for 180 | $$ 181 | \pbra{\sum_{i=1}^nx_i\geq\frac n2+\frac n{\log n}}\lor 182 | \pbra{\sum_{i=1}^nx_i\leq\frac n2-\frac n{\log n}}. 183 | $$ 184 | \end{exercise} 185 | 186 | \end{document} 187 | -------------------------------------------------------------------------------- /The-Probabilistic-Method/chap16/chap16.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | % !TeX program = XeLaTeX 3 | % !TeX spellcheck = LaTeX 4 | 5 | \documentclass[a4paper]{article} 6 | 7 | \usepackage{amsmath,amsfonts,amssymb} 8 | \usepackage{mathrsfs} 9 | \usepackage{bm} 10 | \usepackage{extarrows} 11 | \usepackage{geometry} 12 | \usepackage{ntheorem} 13 | \usepackage{hyperref} 14 | \usepackage[ruled]{algorithm2e} 15 | \usepackage{caption,subcaption} 16 | 17 | \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm} 18 | 19 | \def\UrlBreaks{\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\[\do\\\do\]\do\^\do\_\do\`\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]\do\)\do\,\do\?\do\'\do+\do\=\do\#} 20 | 21 | \newtheorem{theorem}{Theorem} 22 | \newtheorem{lemma}{Lemma} 23 | \newtheorem{proposition}{Proposition} 24 | \newtheorem{corollary}{Corollary} 25 | \newtheorem{claim}{Claim} 26 | \newtheorem{conjecture}{conjecture} 27 | \newtheorem{definition}{Definition} 28 | \newtheorem{construction}{Construction} 29 | \newtheorem*{proof}{Proof} 30 | \newtheorem*{answer}{Answer} 31 | \newtheorem*{example}{Example} 32 | \newtheorem*{counterexample}{Counterexample} 33 | 34 | \newenvironment{exercise}[1]{ 35 | \par 36 | \noindent\textbf{Exercise #1.}\quad 37 | }{ 38 | \par 39 | \bigskip 40 | } 41 | \newenvironment{problem}[1]{ 42 | \par 43 | \noindent\textbf{Problem #1.}\quad 44 | }{ 45 | \par 46 | \bigskip 47 | } 48 | 49 | \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62} 50 | \DeclareMathOperator*{\argmax}{\arg\,\max} 51 | \DeclareMathOperator*{\argmin}{\arg\,\min} 52 | \DeclareMathOperator{\E}{\mathbb E} 53 | \DeclareMathOperator{\Var}{\mathrm{Var}} 54 | \DeclareMathOperator{\tr}{\mathrm{tr}} 55 | \DeclareMathOperator{\poly}{\mathrm{poly}} 56 | \newcommand{\abs}[1]{\left| #1 \right|} 57 | \newcommand{\vabs}[1]{\left\| #1 \right\|} 58 | \newcommand{\abra}[1]{\left\langle #1 \right\rangle} 59 | \newcommand{\pbra}[1]{\left( #1 \right)} 60 | \newcommand{\cbra}[1]{\left\{ #1 \right\}} 61 | \newcommand{\sbra}[1]{\left[ #1 \right]} 62 | \newcommand{\floorbra}[1]{\left\lfloor #1 \right\rfloor} 63 | \newcommand{\ceilbra}[1]{\left\lceil #1 \right\rceil} 64 | \newcommand{\bin}{\{0,1\}} 65 | \newcommand{\ZPP}{\mathtt{ZPP}} 66 | \newcommand{\RP}{\mathtt{RP}} 67 | \newcommand{\coRP}{\mathtt{co}\text{-}\mathtt{RP}} 68 | \newcommand{\per}{\text{per}} 69 | \newcommand{\sgn}{\text{sgn}} 70 | \newcommand{\Fbb}{\mathbb{F}} 71 | \newcommand{\Nbb}{\mathbb{N}} 72 | \newcommand{\Rbb}{\mathbb{R}} 73 | \newcommand{\Zbb}{\mathbb{Z}} 74 | \newcommand{\Acal}{\mathcal{A}} 75 | \newcommand{\Bcal}{\mathcal{B}} 76 | \newcommand{\Ccal}{\mathcal{C}} 77 | \newcommand{\Fcal}{\mathcal{F}} 78 | \newcommand{\Gcal}{\mathcal{G}} 79 | 80 | \bibliographystyle{plainnat} 81 | 82 | \title{Exercise Set --- Chapter $16$} 83 | \date{} 84 | 85 | \begin{document} 86 | 87 | \maketitle 88 | 89 | \begin{exercise}{1} 90 | Pick $\chi(i)\in\bin$ uniformly and independently. Then 91 | \begin{align*} 92 | \Pr\sbra{\chi\text{ is valid}} 93 | =&\Pr\sbra{\forall i\in[n],\chi(A_i)=\bin}\\ 94 | =&1-\Pr\sbra{\exists i\in[n],\chi(A_i)=\cbra{0}\text{ or }\cbra{1}}\\ 95 | \geq&1-\sum_{i=1}^n\Pr\sbra{\chi(A_i)=\cbra{0}\text{ or }\cbra{1}}\\ 96 | =&1-\sum_{i=1}^n2^{1-|A_i|}\\ 97 | >&0. 98 | \end{align*} 99 | Thus there exists a valid $\chi$. 100 | 101 | When $m=n$, we find such a $\chi$ by the following algorithm. 102 | \begin{enumerate} 103 | \item Initialize $i\gets1$ and $\chi(t)\gets*$ for all $t\in[n]$. 104 | \item Let $\chi(i)=b,b\in\bin$ and compute 105 | $$ 106 | x_b=\sum_{i=1}^n\Pr\sbra{\chi(A_i)=\cbra{0}\text{ or }\cbra{1}} 107 | =\sum_{i=1}^n\begin{cases} 108 | 0 & c_0(A_i),c_1(A_i)>0\\ 109 | 2^{1-|A_i|} & c_0(A_i)=c_1(A_i)=0\\ 110 | 2^{c_0(A_i)-|A_i|} & c_0(A_i)>0,c_1(A_i)=0\\ 111 | 2^{c_1(A_i)-|A_i|} & c_1(A_i)>0,c_0(A_i)=0, 112 | \end{cases} 113 | $$ 114 | where $c_b(A_i)=\#\cbra{t\in A_i\middle|\chi(t)=b}$. 115 | \item $b^*\gets\argmin_bx_b$. 116 | \item $\chi(i)\gets b^*$. 117 | \item $i\gets i+1$. If $i>m$, return $\chi$; otherwise go to Step 2. 118 | \end{enumerate} 119 | \end{exercise} 120 | 121 | %\begin{exercise}{2} 122 | % Let every $F\in\Fcal$ independently consist of $10\log n$ elements drawn with replacement from $N$. 123 | % Then 124 | % \begin{align*} 125 | % \Pr\sbra{\Fcal\text{ is valid}} 126 | % =&\Pr\sbra{\forall\Gcal,\exists F\in\Fcal,\forall i\in[n],F\cap G_i\neq\emptyset}\\ 127 | % =&1-\Pr\sbra{\exists\Gcal,\forall F\in\Fcal,\exists i\in[n],F\cap G_i=\emptyset}\\ 128 | % \geq&1-\sum_\Gcal\Pr\sbra{\forall F\in\Fcal,\exists i\in[n],F\cap G_i=\emptyset}\\ 129 | % =&1-\sum_\Gcal\pbra{\Pr\sbra{\exists i\in[n],F\cap G_i=\emptyset}}^{|\Fcal|}\\ 130 | % \geq&1-\sum_\Gcal\pbra{\sum_{i=1}^n\Pr\sbra{F\cap G_i=\emptyset}}^{|\Fcal|}\\ 131 | % =&1-\sum_\Gcal\pbra{\sum_{i=1}^n2^{-10\log n}}^{|\Fcal|}\\ 132 | % \geq&1-\binom{n}{\frac n2}^nn^{-9n^{10}}\geq1-(2e)^{\frac{n^2}2}n^{-9n^{10}}=1-o(1). 133 | % \end{align*} 134 | %\end{exercise} 135 | 136 | \end{document} 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | --------------------------------------------------------------------------------