Im wondering if the notation of the following function is correct?
$f:\mathbb N\to\mathbb N$
$n \mapsto 7+5n$
$f(n) = n-1$
That the inputs and outputs to this function are
n=0 => f(7) = 6
n=1 => f(12) = 11
n=2 => f(17) = 16
n=3 => f(22) = 21
? or does it work like this?
n=0 => f(0) = 6
n=1 => f(1) = 11
n=2 => f(2) = 16
n=3 => f(3) = 21
Is subtraction allowed in $\mathbb N$ ? or should I define it in $\mathbb Z^+$?
Another question I have is, is it possible in mathematics to use boolean algebra symbols when working with functions where $n \in \mathbb N$, for example $f(n) = 5n + (n+1) \oplus (n-1)$ and compute with algebraic symbols?.
I gather you are defining $\mathbb{N}$ to be the set of nonnegative integers $\{0, 1, 2, 3, \ldots\}$.
We cannot define a function $f: \mathbb{N} \to \mathbb{N}$ by $f(n) = n - 1$ since $f(0) = -1 \notin \mathbb{N}$.
That problem can be fixed by defining $f$ to be the function $f: \mathbb{Z}^{+} \to \mathbb{N}$ defined by $f(n) = n - 1$.
With that definition, we obtain \begin{align*} f(1) & = 0\\ f(2) & = 1\\ f(3) & = 2 \end{align*}
If we define a new function $g: \mathbb{N} \to \mathbb{Z}^{+}$ by $g(n) = 5n + 7$, then we can define the composition of $f$ and $g$, $f \circ g: \mathbb{N} \to \mathbb{N}$ by $$(f \circ g)(n) = f(g(n)) = f(5n + 7) = 5n + 6$$
We then obtain \begin{align*} (f \circ g)(0) & = 6\\ (f \circ g)(1) & = 11\\ (f \circ g)(2) & = 16\\ (f \circ g)(3) & = 21 \end{align*} For the composition $f \circ g$ to be defined, we require that the range of $g$ be a subset of the domain of $f$ and that the range of $f \circ g$ be contained in $\mathbb{N}$. Since $g$ maps $\mathbb{N}$ to $\mathbb{Z}^+$ and the domain of $f$ is $\mathbb{Z}^+$, the range of $g$ is in the domain of $f$. Since $(g \circ f)(n) = 5n + 6$ is an increasing function that assumes integer values when the input is an integer and $(g \circ f)(0) = 6$, $(g \circ f)(n) \in \mathbb{N}$ for each $n \in \mathbb{N}$.
If we define the composition of $g$ and $f$, $g \circ f: \mathbb{Z}^+ \to \mathbb{N}$ by $$(g \circ f)(n) = g(f(n)) = g(n - 1) = 5(n - 1) + 7 = 5n - 5 + 7 = 5n + 2$$ Since $f$ maps $\mathbb{Z}^{+}$ to $\mathbb{N}$ and the domain of $g$ is $\mathbb{N}$, the range of $g$ is contained in the domain of $f$. Since $(g \circ f)(n) = 5n - 2$ is an increasing function that assumes integer values when the input is an integer and $(g \circ f)(1) = 7$, $g \circ f \in \mathbb{N}$ for each $n \in \mathbb{Z}^+$. Hence, the composition is well-defined. With this definition, we obtain \begin{align*} (f \circ g)(1) & = 7\\ (f \circ g)(2) & = 12\\ (f \circ g)(3) & = 17 \end{align*}
In Boolean algebra, the variables are truth values. You could define the symbols of Boolean algebra to have another meaning when applied to the integers, although that could be a source of confusion.