Can you use any two OPcodes to implement OP_LESSTHAN?
There is more than one way :D

joe tipped:

0.01
USD

1 year ago
joe
1 year ago

Not using two opcodes, but here's a way without any comparison operators. assuming the stack looks like [a, b].
OP_SUB makes the stack [a-b]
If a < b then a-b < 0, which would mean the last byte must be have the significant bit enabled.
OP_SIZE OP_1SUB OP_SPLIT
will let us extract the last byte.
So the stack will look like [(a-b)[:-1], (a-b)[1:-1]]
then use, 0x01 0x80 OP_AND to see if the bit is set, then you must use OP_7 OP_RSHIFT because the bitcoin stack machine will consider negative zero (0x80) as equivalent to zero. Optionally, use OP_NIP to clean up.
All in all this is the following script in full: OP_SUB OP_SIZE OP_1SUB OP_SPLIT 80 OP_AND OP_7 OP_RSHIFT OP_NIP

venezia tipped:

0.01
USD

1 year ago
venezia replied:

Wow! You made the question into a deeper level.

joe replied:

Haha, I really like Bitcoin Script

covid replied:

Wow