Can a Case Function Take Logical Expression? Or, Can I Call It a Boolean/Logical Case Function?

13 Views Asked by At

$P$ and $P'$ are strings (sequence of characters).

$P_i$ and $P_i'$ are characters.

I want to define equality condition between $P$ and $P'$ like the following:

$Equal(P,P')=\begin{cases} \mathrm{false}, & |P| \neq |P'| \\ \underset{i=1}{\stackrel{|P|}{\bigwedge}} (~ P_i = P'_i ~), & \text{otherwise} \end{cases} $

Can I call it a 'function?' Logical/Boolean/Pseudo-function, anything...

What should I call it?

1

There are 1 best solutions below

0
On

It's a relation, not a function.

You don't perform any kind of operation on $P$ and $P'$, but rather test for a kind of equality between them. That is a relation, just like $=$ and $<$ are relations.

Of course, you could look at it as a function from a pair of $P$ objects to $\{ True, False \}$, but that is rather unnatural. Also, the fact that you are dealing with cases here does not automatically mean you are dealing with a function; you can use these case constructions to define relations as well.

Finally, as a relation, you can simplify your definition to:

$Equal(P,P')$ iff $\underset{i=1}{\stackrel{|P|}{\bigwedge}} (~ P_i = P'_i ~)$