Re:Translating math into code with examples in Java, Racket,...
by j88439h84 on Tuesday May 28, 2019 @03:10PM
(#20033300)
I don't know much about this area. What about "x ∈ ℕ ∧ x > 2 ∧ x < 5 ∧ x % 2 = 0 implies x = 4." can't be expressed in common languages? Don't lots of solver systems have support for sets, and deriving facts from statements about them?
[ Parent
| on HN ]
Re:Translating math into code with examples in Java, Racket,...
by Recursing on Tuesday May 28, 2019 @03:41PM
(#20033592)
Just in case somebody might benefit from finding out how easy it is in python with z3
>>> from z3 import Int, solve
>>> x = Int('x')
>>> solve([x > 2, x < 5, x % 2 == 0])
[x = 4]
Re:Translating math into code with examples in Java, Racket,...
by taeric on Tuesday May 28, 2019 @08:12PM
(#20035713)
The argument here is that you used a program to solve an equation. You did not write your program in that way. Indeed, you are using operator overloading/fancy syntax to make this work.
If anything, this seems to support the original claim.