Break up into groups of three and work on these
-
Given the definition below, what are the values of:
$q(2.3,true)$,
$q(-2.3,true)$,
$q(2.3,false)$,
$q(-2.3,false)$?
$$
\begin{array}{l}
q:\mathbb{R}\times \{true,false\}\rightarrow \mathbb{Z}\\
q(x,b) =
\left\{
\begin{array}{cl}
\lfloor x \rfloor & \text{ if } x \geq 0 \wedge \neg b
\vee x \lt 0 \wedge b\\
\lceil x \rceil & \text{ otherwise}
\end{array}
\right.
\end{array}
$$
-
Give a formal definition of the function mid that takes
two real numbers and returns the midpoint between them.
-
Give a formal definition of the function dist that takes
two real numbers and returns the distance between them.
Note: find a way to do it without using the absolute value
function!
-
Let $A = \{ \text{rock}, \text{paper}, \text{scissors} \}$.
Use a table to define the $beats(\cdot,\cdot)$ function, which returns true if and
only if the first argument beats the second in rock/paper/scissors.
For example, $beats(\text{paper},\text{scissors})=\text{false}$ because paper
does not beat scissors.
- Consider the function $m$ defined below. $m(3) = $_____________________________________
$$
\begin{array}{l}
m:\mathbb{N}\rightarrow2^{\mathbb{N}}\\
m(k) = \{ i\cdot k\ \big|\ i \in \mathbb{N} \}
\end{array}
$$