Let $\Sigma =\{\mathrm{0,1}\}$. Let $L$ be a language. Recall $L\in \mathrm{NP}$ means that there exists a determinstic algorithm $V:{\Sigma}^{*}\times {\Sigma}^{*}\to \{\mathrm{0,1}\}$ and that $x\in L$ means that there exists a $P\in {\Sigma}^{*}$ such that $V(x,P)=1$ with $\mid P\mid <\mathrm{poly}(\mid x\mid )$. We say that $P$ is a short proof that $x\in L$.
If $V$ is randomized, then we have the MA complexity class. If $V$ can interact with $P$, then we get IP (interactive proofs). It turns out that $\mathrm{IP}=\mathrm{PSPACE}$ [Shamir].
ZeroKnowledge Proof Systems
The goal is to prove a statement without leaking extra information, for example, for some $N,x$, prove $x$ is a quadratic residue in ${\mathbb{Z}}_{N}^{*}$.
Let $L\subseteq {\Sigma}^{*}$. A zeroknowledge proof system for $L$ is a pair $(P,V)$ satisfying

(Complete) For all $x\in L$, a verifier says "yes" after interacting with the prover

(Sound) For all $x\notin L$, and for all provers ${P}^{*}$, a verifier says "no" after interacting with ${P}^{*}$ with probability at least $1/2$.

(Perfect) For all verifiers ${V}^{*}$, there exists a simulator ${S}^{*}$ that is a randomized polynomial time algorithm such that for all $x\in L$,
$$\{\mathrm{transcript}((P,{V}^{*})(x))\}=\{{S}^{*}(x)\}$$(equality of distributions)
The existence of a simulator implies that if $x\in L$, then ${V}^{*}$ cannot learn more than the fact that $x\in L$.
Example: Let $N=\mathrm{pq},x\in {\mathbb{Z}}_{N}^{*}$. Suppose we wish to prove that $x$ is a quadratic residue in ${\mathbb{Z}}_{N}^{*}$. Then let $x={\alpha}^{2}$ (modulo $N$).

$P$: $r\leftarrow {\mathbb{Z}}_{N}$, sends $a={r}^{2}$

$V$: sends $b\leftarrow \{\mathrm{0,1}\}$

$P$: sends $z=r{\alpha}^{b}$

$V$: tests ${z}^{2}={\mathrm{ax}}^{b}$. If so, output "yes", otherwise output "no"
Completeness of this scheme is immediate. As for soundness: if $a$ is not a quadratic residue, then the verifier says "no" with probability at least one half (i.e. when $b=0$). If $a$ is a quadratic residue, but $x$ is not, then the verifier says "no" with probability at least one half (i.e when $b=1$).
Claim: if $x$ is not a quadratic residue in ${\mathbb{Z}}_{N}^{*}$ then for all ${P}^{*}$, $V$ says "no" with probability at least one half.
It remains to show that the scheme is perfect zeroknowledge. Let ${V}^{*}$ be some verifier, and suppose $\mathrm{transcript}((P,{V}^{*})(N,x))=[a,b,z]$.
Then construct a blackbox simulator ${S}^{*}$ as follows:

Pick a random $z\leftarrow {\mathbb{Z}}_{N}^{*}$, and a random $b\leftarrow \{\mathrm{0,1}\}$.

Set $a={z}^{2}/{x}^{b}modN$

Run ${V}^{*}(x)$, give it $a$ as first message from prover.

${V}^{*}$ outputs some $b\prime $ in $\{\mathrm{0,1}\}$. If $b\ne b\prime $ then goto step 1, otherwise output $[a,b,z]$ as the transcript. This takes two iterations on average.
Claim: $\{\mathrm{transcript}(P,{V}^{*})(N,x)\}=\{{S}^{*}(N,x)\}$ (equality of distributions).
Sketch of proof: $a$ is uniform in the quadratic residues of ${\mathbb{Z}}_{N}^{*}$ because $x$ is a quadratic residue. $b$ is from the same distribution generated by ${V}^{*}$ given $a$. $z$ saitsfies ${z}^{2}={\mathrm{ax}}^{b}$ and is from the correct definition.
Soundness can be improved by repeating the protocol sequentially. One might consider repetition in parallel, i.e.

$P$: ${r}_{1},...,{r}_{n}\leftarrow {\mathbb{Z}}_{N}$, sends ${a}_{1}={r}_{1}^{2},...,{a}_{n}={r}_{n}^{2}$

$V$: sends ${b}_{1},...,{b}_{n}\leftarrow \{\mathrm{0,1}\}$

$P$: sends ${z}_{1}={r}_{1}{\alpha}_{1}^{b},...,{z}_{n}={r}_{n}{\mathrm{alpha}}_{n}^{b}$

$V$: tests ${z}_{i}^{2}={a}_{i}{x}_{i}^{b}$ for $i=1,...,n$. If so, output "yes", otherwise output "no"
This scheme is complete and sound, but it is not clear how to build a simulator. (We can only guess all the ${b}_{i}$'s correctly with probability $1/{2}^{n}$.)
Theorem [KG '89]: If $L$ has a threeround perfect zero knowledge proof with negligible cheating probability then $L\in \mathrm{BPP}$.
Since it is believed that quadratic residuosity is not in BPP, it is therefore also thought that no threeround strongly sound perfect zero knowledge protocol for quadratic residuosity exists.
Hence we introduce a weaker version of zero knowledge:
Computational ZK: $(P,V)$ is a $(t,\epsilon )$zeroknowledge proof system for a language $L$ if it is

Sound

Complete

Computational ZK: for all verifiers ${V}^{*}$ there exists a simulator ${S}^{*}$ such that for all $x\in L$, the distribution $\{\mathrm{transcript}((P,{V}^{*})(x))\}$ is $(t,\epsilon )$indistinguishable from $\{{S}^{*}(x)\}$.
Theorem [GMW '87]: If a $(t,\epsilon )$bit commitment scheme exists, then all languages in $\mathrm{NP}$ have computational ZK proofs.
Definition: (imprecise definition) A $(t,\epsilon )$bit commitment scheme is defined as follows:

Commiter has a bit $b\in \{\mathrm{0,1}\}$, and sends $\mathrm{commit}(b)\in \{\mathrm{0,1}{\}}^{*}$ (a commitment to a bit $b$).

Commiter can open commitment as $b\prime $ and the verifier can check that $b=b\prime $.
This scheme should be: Binding: infinitely powerful commiter can't convince verifier that commitment is a commitment to $b\prime \ne b$. Sound: $\mathrm{commit}(b)$ reveals no information about $b$, i.e. for any bit $b\in \{\mathrm{0,1}\}$, $\{\mathrm{commit}(b),b\}$ is $(t,\epsilon )$indistinguishable from $\{\mathrm{commit}(b),r\mid r\leftarrow \{\mathrm{0,1}\}\}$.
Example: oneway permutations imply commitment schemes:
Let $f:\{\mathrm{0,1}{\}}^{n}\to \{\mathrm{0,1}{\}}^{n}$ be a oneway permutation. Choose $r\leftarrow \{\mathrm{0,1}{\}}^{n}$, and set $\mathrm{commit}(b)=[f(r),B(r)\oplus b]$ where $B$ is a hardcore bit of $f$.
ZK for DDH
The language ${L}_{\mathrm{DDH}}$ is defined to be the set of all tuples $\u27e8g,{g}^{a},{g}^{b},{g}^{\mathrm{ab}}\u27e9$ where $g\in G$ is of order $q$.
ChaumPederson ZK protocol: Denote $\u27e8g,A,B,C\u27e9=\u27e8g,{g}^{a},{g}^{b},{g}^{\mathrm{ab}}\u27e9$

V: $s\leftarrow {\mathbb{Z}}_{q}$, sends $\mathrm{commit}(s)$.

P: $r\leftarrow {\mathbb{Z}}_{q}$, sends ${y}_{1}={g}^{r},{y}_{2}={B}^{r}$.

V: sends $s$ (i.e. opens the commitment)

P: sends $z=a+\mathrm{rs}(modq)$

V: checks ${g}^{z}={A}^{s}{y}_{1}(modp)$ and ${B}^{z}={C}^{s}{y}_{2}(modp)$
Aside: consider this commitment scheme: for some $s\in {\mathbb{Z}}_{q}$, set $\mathrm{commit}(s)={g}^{s}{h}^{r}$ for some $r\leftarrow {\mathbb{Z}}_{q})$, where $g,h$ are fixed and public. This is computationally binding (relying on Dlog) but unconditionally sound.
Proof of ZK: Let $\mathrm{transcript}((P,{V}^{*})(I))=[\mathrm{commit}(s),{y}_{1},{y}_{2},s,z]$. Let ${V}^{*}$ be a verifier, let $I=\u27e8g,A,B,C\u27e9=langeg,{g}^{a},{g}^{b},{g}^{\mathrm{ab}}\u27e9$. Then a simulator ${S}^{*}$ can be constructed as follows:

Pick a random $z\leftarrow {\mathbb{Z}}_{q}$

Run ${V}^{*}$ to get $\mathrm{commit}(s)$

Send random ${y}_{1},{y}_{2}$

${V}^{*}$ sends $s$, i.e. opens the commitment.

Set $y{\prime}_{1}={g}^{z}/{A}^{s},y{\prime}_{2}={B}^{z}/{C}^{s}$

Output $[\mathrm{commit}(s),y{\prime}_{1},y{\prime}_{2},s,z]$