1

Basically, there's this website where I can create some custom calculation by describing a function based on certain variables. However, its computation is very limited and I can only use basic operators ($+, -, \times, \div$) and numerical constants ($0,1,2$, etc.). It's a restricted company website, so I can't share it.

I have four input variables $A,B,C,D$ within the range $(-\infty, \infty)$. I need to create a function $f$ (using only the operators above) that outputs $E=f(A,B,C,D)$ such that I will know what values of $E$ will make the condition, $$ A<B \text{ and } C<D $$ true. $E$ should be a single decimal number that I can compare (e.g. if $E>=0$, then the condition is True, else False).

Is it possible to create such a function $f$?

As noted above, the function $f$ can only be defined using the operators $+,-,\times,\div$, and numerical constants. You can also use parentheses. For example, $(A+B)/(C-8.99-D)$, $A/C+9$, $A/D/C$, and $A-(B-4-(D/C))+C$ are valid functions. You're not allowed to use any other operators: absolute value $|A|$, exponents, logs, mod (%), logic comparators (AND, OR, XOR, etc.), normal comparators (<, >, <=, >=), IF statements, WHILE loops, creating other functions, MAX/MIN functions, SQRT(), basically any other stuff.

Blue
  • 83,939
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on [meta], or in [chat]. Comments continuing discussion may be removed. – Xander Henderson Feb 14 '23 at 15:58
  • One of the fundamental, foundational ideas in academic communication is that you cite your sources. This allows other people to fully understand the problem or problems that you are hoping to address, and to reproduce your results at the end of the day. Personally, I think it is kind of shady to cite a "restricted company website". This feels dishonest to me. – Xander Henderson Feb 14 '23 at 16:00
  • @XanderHenderson A lot the comments WERE for clarifying the question, before I edited it. I'd argue that your subsequent comment does not, however. – Sambo Feb 14 '23 at 18:15

1 Answers1

1

The functions that you're able to create with these limited operations are precisely the rational functions over $\mathbb{Q}$ in variables $A,B,C,D$. Indeed, any rational function can be created with the operations $+,-,\times,\div$ and numerical constants, and you can prove that any function created this way is rational by strong induction on the number of operations used.

So, you want to know whether there exists a rational function $f : \mathbb{R}^4 \rightarrow \mathbb{R}$ such that $f(a,b,c,d)>0$ implies $a<b$ and $c<d$. (I have assumed for simplicity that we want a condition of the form $f>0$. A more general condition is described below.) We can simplify this question further by reducing it to two variables.

Indeed, this question is equivalent to asking if there exists a rational function $g : \mathbb{R}^2 \rightarrow \mathbb{R}$ such that $g(x,y)>0$ implies $x,y>0$. Indeed, if such a $g$ exists, then $f(a,b,c,d) = g(b-a,d-c)$ satisfies the condition: if $g(b-a,d-c)>0$, then $b-a>0$ and $d-c>0$, so $a<b$ and $c<d$. Conversely, if $f$ exists, then we can take $g(x,y) = f(0,x,0,y)$, and $f(0,x,0,y)>0$ implies $x>0$ and $y>0$.

So: does such a rational function $g$ exist? I'm not sure, but I suspect the answer is no; I've tried and failed to come up with an example. Proving this false will probably be tricky, though, so I've asked a separate question on the site and will update this answer when I find out more.


What if we want to consider more general conditions than just $f>0$? Well, you want your function $f$ to be such that the value $f(a,b,c,d)$ can be used to infer whether the condition "$a<b$ and $c<d$" is true. That is, if the condition is true for $(a,b,c,d)$ but false for $(a',b',c',d')$, then we should never have $f(a,b,c,d)=f(a',b',c',d')$. If we let $$ U = \{(a,b,c,d) \in \mathbb{R}^4 : a<b \text{ and } c<d\}, $$ then this is equivalent to saying that $f(U)$ and $f(\mathbb{R}^4 \backslash U)$ are disjoint. Then, we can use our same trick to reduce this to a function $g(x,y)$, and we're now asking whether $g(V)$ and $g(\mathbb{R}^2 \backslash V)$ are disjoint, where $V = \{(x,y) \in \mathbb{R}^2 : x,y>0\}$.

Sambo
  • 7,469