Is an infinite, recursive predicate valid?

78 Views Asked by At

Consider the following predicate:

$$P(x) =\ "True\ and\ P(x)"$$

Does it make sense to claim that $P(x)$ is true $\forall x$?

Specifically,

Consider the case where, instead of a boring $True$, you had some other condition that changed based on $x$, such as the following:

$$P(s, e) =\ "s_1s_2s_3 = s\ \implies\ (s_2 \not = e\ and\ P(s_2, e))"$$

Where $s$ and $e$ are strings, and P essentialy means that no substring of $s$ is equal to $e$. However, the base case of this predicate is an empty string, in which case $s = s_1 = s_2 = s_3$. Can I just ignore $P(s_2, e)$ when $s = s_2$?

1

There are 1 best solutions below

0
On

So the two questions you ask are quite different I think.

The first part: $P(x) = "True\ and\ P(x)"$ is equivalent with just $P(x)= P(x)$ the $and \ True$ part does not do anything.

For the second part: I would sugest doing a distinction between proper substrings and the whole string, else there will not be a stop to the recursive definition, and you would end up with something like in your comment "$s_2\neq e$ and $s_2\neq e$ and ... How about the following definition instead:

$\\ s=s_1ws_2 \implies (s\neq e \wedge P(s_1w,e) \wedge P(ws_2, e))\\$

Where $s_1$ and $s_2$ are symbols and $w$ is a string. With a proper base case where we take care of what happen if we only have 1 symbol left in the string. In this way we will not get a problem from calling P with the same thing as went in the first place.