[
[
['129','add','hl'],
['132','add','hl'],
['19','remove','slide-up'],
['2','add','slide-down']
],
[
['30','add','hl'],
['30','remove','hidden'],
['31','add','hl'],
['31','remove','hidden'],
['4','add','hidden'],
['129','remove','hl'],
['129','add','slide-left'],
['132','remove','hl'],
['132','add','slide-right']
],
[
['30','remove','hl'],
['31','remove','hl'],
['5','add','hl'],
['128','add','hl'],
['37','remove','slide-up'],
['19','add','slide-down']
],
[
['39','add','hl'],
['39','remove','hidden'],
['129','add','hl'],
['129','remove','slide-left'],
['130-slide','remove','slide-left'],
['5','remove','hl'],
['5','add','hidden'],
['128','remove','hl'],
['128','add','slide-right']
],
[
['39','remove','hl'],
['129','remove','hl']
],
[
['130-flip','add','flipped'],
['37','add','slide-down']
],
[
['39','add','hl'],
['131','add','hl']
],
[
['5','add','hl'],
['5','remove','hidden'],
['132','add','hl'],
['132','remove','slide-right'],
['39','remove','hl'],
['39','add','hidden'],
['131','remove','hl'],
['131','add','slide-left'],
['130-slide','add','slide-left']
],
[
['5','remove','hl'],
['132','remove','hl'],
['135','add','hl'],
['13','add','hl'],
['30','add','hl'],
['111','remove','slide-up']
],
[
['113','remove','hidden'],
['136','add','hl'],
['136','remove','slide-left'],
['135','remove','hl'],
['135','add','slide-right'],
['13','remove','hl'],
['13','add','hidden'],
['30','remove','hl'],
['30','add','hidden']
],
[
['136','remove','hl']
]
]
We start with $\L_h$,
then isolate the case of $count == h+1$ into its own conditional branch.
We can write the body of the new branch in terms of $\lib{pk-1cpa-*}$. Since this branch is executed at most once during the library's execution, this compound library calls $\cpaoneenc$ at most once. Importantly, the library can still encrypt ciphertexts in the else-branch, because it knows the public key! This is the step in the proof that would fail with a symmetric-key scheme.
The if and else-if branches can now be unified, and the result is $\L_{h+1}$, as desired.
$\L_h$
$\L_{h+1}$
$(\pk,\sk) := \Sigma.\KeyGen()$
$\pk := \cpaonepk()$
return $\pk$
$count := count + 1$
$\ctxt \gets \Sigma.\C(|\ptxt|)$
else if $count == h+1$:
$\ctxt $
${}:= {}$
$\Sigma.\Enc(\pk, \ptxt)$
$\cpaoneenc(\ptxt)$
${}\gets \Sigma.\C(|\ptxt|)$
else:
$\ctxt := \Sigma.\Enc(\pk, \ptxt)$
return $\ctxt$
$\link$
$\lib{pk-1cpa-real}$
$(\pk,\sk) := \Sigma.\KeyGen()$
return $\pk$
if $\ctxt^*$ undefined:
$\ctxt^* := \Sigma.\Enc(\pk, \ptxt)$
return $\ctxt^*$
$\lib{pk-1cpa-rand}$
$(\pk,\sk) := \Sigma.\KeyGen()$
return $\pk$
if $\ctxt^*$ undefined:
$\ctxt^* \gets \Sigma.\C(|\ptxt|)$
return $\ctxt^*$