Example 1: is a very abstract and rather obscure but necessary way to say:
"$x + y =5$ is either true or false"
"Let $P...:$" means let $P$ be a way of writing a statement.
"Let $P:\mathbb Z\times \mathbb Z \to...."$ means let $P$ be a way of writing a statement about two integers. That is to say the input of $P$ will be $(x,y)$ a pair of integers. So $P(x,y)$ will be a statement about $x$ and $y$.
"Let $P:\mathbb Z \times \mathbb Z \to \{T,F\}$ means the output of the statement will be either TRUE or FALSE. So given $x$ and $y$ the the statement $P(x,y)$ will either... be TRUE or FALSE.
So sayings $P(x,y)$ means "$x + y = 5$" Means that we will evaluate any $P(x,y)$ as "Does $x + y = 5$ and we will determine that either ... yes, $x + y = 5$ or ... no, $x + y$ doesn't $=5$>
For example $P(2,3) = T$ because $2+3 = 5$. And $P(4,2) = F$ because $4 + 2 \ne 5$.
....
The idea is that we are trying to use the algebraic concept of function in a logical context.
In this case "{{A}}+{{B}} = 5" is a statement that takes to integers as input and outputs a single T/F value. In terms of functions this means $P$ is a function that maps an ordered pair of integers to a single T/F. So the domain of $P$ is $\mathbb Z\times \mathbb Z$ and the codomain of $P$ is $\{T,F\}$.
Example 2:
We have three statements $p, q,$ or $r$ and each of those are either $TRUE$ or $FALSE$ and we want to know if the statement $(p\to q)\to r$ is $TRUE$ or $FALSE$.
So $P$ is the the statement $(p\to q) \to r$.
The input of $P$ is $(p,q,r)$ (not $(p,q,r,....)$ by the way; you typed that wrong) which is an ordered triple of TRUE/FALSE values. And the output is a single output TRUE/FALSE value.
So $P$ is a function. If $B$ is the set $\{T, F\}$ then the domain of $P$ is $B\times B\times B$. That is the set of all possible triplets. That is $B\times B\times B = \{(T,T,T), (T,T,F), (T,F,T), (T,F,F), (F,T,T), (F,T,F), (T,F,T),(F,F,F)\}$. The codomain of $P$ is $B = \{T,f\}$.
And the function is defined as $P(p,q, r)$ as $(p\to q)\to r$.
For example $P("bats\ are\ birds", "pigs\ eat\ corn", "Dogs\ teach\ algebra") = P(F, T,F) = (F\to T) \to F = T \to F = F$.
If we wanted foralize:
$P$ is the function:
$(T,T,T) \mapsto T$
$(T,T,F) \mapsto F$
$(T,F,T) \mapsto T$
$(T,F,F) \mapsto T$
$(F,T,T) \mapsto T$
$(F,T,F) \mapsto F$
$(F,F,T) \mapsto T$
$(F,F,F) \mapsto F$
[Math does get fairly abstract. But it always makes sense.]