Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kwxm/plc spec/bitwise conversions #5911

Merged
merged 12 commits into from
Apr 22, 2024
Prev Previous commit
Next Next commit
Almost done
  • Loading branch information
kwxm committed Apr 18, 2024
commit 951ed4af988c59ab0c8c2ea0883f12d7747ad05d
14 changes: 7 additions & 7 deletions doc/plutus-core-spec/cardano/builtins4.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ \subsection{Batch 4}
The fourth batch of builtins adds support for
\begin{itemize}
\item The \texttt{Blake2b-224} and \texttt{Keccak-256} hash functions.
\item Conversions functions from integers to bytestrings and vice-versa.
\item Conversion functions from integers to bytestrings and vice-versa.
\item BLS12-381 elliptic curve pairing operations
(see~\cite{CIP-0381}, \cite{BLS12-381}, \cite[4.2.1]{IETF-pairing-friendly-curves}, \cite{BLST-library}).
For clarity these are described separately in Sections~\ref{sec:bls-types-4} and \ref{sec:bls-builtins-4}.
Expand Down Expand Up @@ -68,8 +68,8 @@ \subsubsection{Miscellaneous built-in functions}
The \texttt{integerToByteString} function converts non-negative integers to bytestrings.
It takes three arguments:
\begin{itemize}
\item An endianness flag $e$.
\item A width argument $w$ with $0 \leq w < 8192$.
\item A boolean endianness flag $e$.
\item An integer width argument $w$ with $0 \leq w < 8192$.
\item The integer $n$ to be converted: it is required that $0 \leq n < 256^{8192} = 2^{65536}$.
\end{itemize}

Expand All @@ -78,13 +78,13 @@ \subsubsection{Miscellaneous built-in functions}
just large enough to hold the converted integer. If $w>0$ then the output is
exactly $w$ bytes long, and it is an error if $n$ does not fit into a bytestring
of that size; if necessary, the output is padded with \texttt{0x00} bytes (on
the left if $e = \mathtt{True}$ and on the right if $e = \mathtt{False}$) to
the right if $e = \mathtt{False}$ and on the left if $e = \mathtt{True}$ ) to
make it the correct length. In all cases it is an error if $n<0$.

\newpage
\noindent The precise semantics of \texttt{integerToByteString} are given
by the functions $\itobsBE: \Z \times \Z \rightarrow \B^*$ and $\itobsLE
: \Z \times \Z \rightarrow \B^*$. Firstly we deal with out-of-range cases and
by the functions $\itobsLE: \Z \times \Z \rightarrow \withError{\B^*}$ and $\itobsBE
: \Z \times \Z \rightarrow \withError{\B^*}$. Firstly we deal with out-of-range cases and
the case $n=0$:

$$
Expand Down Expand Up @@ -134,7 +134,7 @@ \subsubsection{Miscellaneous built-in functions}
The \texttt{byteStringToInteger} function converts bytestrings to non-negative
integers. It takes two arguments:
\begin{itemize}
\item An endianness flag $e$.
\item A boolean endianness flag $e$.
\item The bytestring $s$ to be converted.
\end{itemize}
\noindent
Expand Down