Remix.run Logo
curtisf 6 hours ago

It's basically using the "-" embedded in the definition of the eml operator.

Table 4 shows the "size" of the operators when fully expanded to "eml" applications, which is quite large for +, -, ×, and /.

Here's one approach which agrees with the minimum sizes they present:

        eml(x, y             ) = exp(x) − ln(y) # 1 + x + y
        eml(x, 1             ) = exp(x)         # 2 + x
        eml(1, y             ) = e - ln(y)      # 2 + y
        eml(1, exp(e - ln(y))) = ln(y)          # 6 + y; construction from eq (5)
                         ln(1) = 0              # 7
After you have ln and exp, you can invert their applications in the eml function

              eml(ln x, exp y) = x - y          # 9 + x + y
Using a subtraction-of-subtraction to get addition leads to the cost of "27" in Table 4; I'm not sure what formula leads to 19 but I'm guessing it avoids the expensive construction of 0 by using something simpler that cancels:

                   x - (0 - y) = x + y          # 25 + {x} + {y}
5 hours ago | parent [-]
[deleted]