Representation of function applied to pairs generated from Cartesian product

47 Views Asked by At

I'm attempting to define an algorithm using math notation which runs a function on value pairs, the pairs are generated as a result of a Cartesian product of all elements in set and if the result of the function for one of the pairs exceeds 2 then return the value of the function.

Is this correct ? :

$$ s = \{s1, s2, s3, s4\dots\} $$

$$ \varphi_1 : function(s_a , s_b) $$

$$ \forall (s\times s) \varphi_1 > 2 \rightarrow value(\varphi_1) $$

I accessed if notation from Representing IF ... THEN ... ELSE ... in math notation

Update :

Each member of the set represents a group of characters and the function returns 2 if $s_a$ contains more characters than $s_b$.

So in this example where

$$ s = \{"test words" , "test"\} $$

Cartesian product of s is ("testwords" , "test"),("test" , "testwords"),("test" , "test"),("words" , "words")

function applied to ("testwords" , "test") returns 2
function applied to ("test" , "testwords") returns nothing
function applied to ("test" , "test") returns nothing
function applied to ("testwords" , "testwords") returns nothing