0
\documentclass{article}
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{algorithm}
\caption{$Game PrvInd_{G,\phi}$}
\label{pseudoPSO}
\begin{algorithmic}[1]
    \If{$f(\phi(f0) \neq\phi(f1)$} 
    \Return $\perp$ \EndIf
    \If {$ev(f_0, x_0) \neq ev(f_1, x_1)$}
    \Return $\perp$ \EndIf
    \If{$\{x_0,x_1\} \nsubseteq \{0,1\}^{{f_0}.n}$}\Return $\prep$ \EndIf
    $(F, e, d) \leftarrow Gb(1^k, f_b)$; 
    $X \leftarrow En(e, x_b)$
    \Return (F,X, d)

\end{algorithmic}
\end{algorithm}
\end{document}

While writing algorithm in latex I am getting undefined control sequence for \If at line 12.

Also is it possible to use all 3 if without having end if?

0

You need amssymb for \nsubseteq:

enter image description here

\documentclass{article}

\usepackage{algorithm,algpseudocode}
\algtext*{EndIf}% Remove \EndIf
\usepackage{amsmath,amssymb}

\begin{document}

\begin{algorithm}
  \caption{Game $\text{PrvInd}_{G,\phi}$}
  \label{pseudoPSO}
  \begin{algorithmic}[1]
    \If{$f(\phi(f0) \neq \phi(f1))$} \Return $\perp$
    \EndIf
    \If {$\text{ev}(f_0, x_0) \neq \text{ev}(f_1, x_1)$} \Return $\perp$
    \EndIf
    \If{$\{x_0,x_1\} \nsubseteq \{0,1\}^{f_0 \cdot n}$} \Return $\perp$
    \EndIf
    \State $(F, e, d) \leftarrow \text{Gb}(1^k, f_b)$; 
    \State $X \leftarrow \text{En}(e, x_b)$;
    \State \Return $(F, X, d)$;
  \end{algorithmic}
\end{algorithm}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.