Impact
POST /verify/math (and batch math items) return VERIFIED, is_valid: true and admission ADMIT for false identities. Two separate parser behaviours cause it: safe_parse_expr turns an unknown function name into a product of single-letter symbols, and it gives the name n hidden assumptions (positive integer).
expression |
main @ b74ac00 |
Correct |
|---|---|---|
sinc(0) = 0 |
VERIFIED, is_valid: true, ADMIT |
false: sinc(0) = 1 |
zeta(0) = 0 |
VERIFIED, is_valid: true, ADMIT |
false: ζ(0) = −1/2 |
Abs(n) = n |
VERIFIED, is_valid: true, ADMIT |
false for negative n |
sqrt(n**2) = n |
VERIFIED, is_valid: true, ADMIT |
false for negative n |
floor(7/2) = 3 |
VERIFIED, is_valid: false (proven false) |
true claim |
ln(e) = 1 |
VERIFIED, is_valid: false (proven false) |
true claim |
Abs(x) = x, 2+2 = 5 (controls) |
VERIFIED, is_valid: false |
correct |
What the parser builds:
safe_parse_expr("sinc(0)")→0:sincis split intos*i*n*c, which is 0 at the argument 0.zeta(0)→0the same way.safe_parse_expr("floor(7/2)")→7*f*l*o**2*r/2.safe_parse_expr("n")→ a Symbol withinteger=True, positive=True. The assumption appears in neither the evidence nor the agent message.
Affected
qwed (PyPI) through 8.0.0. Reproduced on main @ b74ac00.
Reachable from:
POST /verify/mathina = bform, and batch math items (both usemath_identity_result);safe_parse_expr, and every engine that parses with it.
Reproduction
from qwed_new.core.math_identity import math_identity_result
from qwed_new.core.diagnostics import admission_decision
from qwed_new.core.safe_parser import safe_parse_expr
for ex in ["sinc(0) = 0", "zeta(0) = 0", "Abs(n) = n", "sqrt(n**2) = n", "floor(7/2) = 3", "2+2 = 5"]:
dr = math_identity_result(ex)
print(ex, dr.status.value, dr.developer_fields.get("is_valid"), admission_decision(dr).value)
print(safe_parse_expr("floor(7/2)"), safe_parse_expr("n").assumptions0)
Details
src/qwed_new/core/safe_parser.py:
- Lines 986-989: the main parse uses
implicit_multiplication_application, which includessplit_symbolsandimplicit_application. A name the allowlist does not bind, followed by(, is split into letters and multiplied by the bracket. - Lines 855-861: the local namespace binds
nasSymbol("n", integer=True, positive=True)and Greek names such aszetaandgammaas plain Symbols, sozeta(0)andgamma(…)also become products.
Patches
Fixed in 9.0.0 (48c4bc0). Upgrade to 9.0.0 or later.
- The parser no longer splits a name into letters: a multi-letter name is one symbol.
2x,x(x+1)andsin xread as before. - A name of two or more letters in call position (before a bracket or an operand, after a power, or in parentheses) must be a supported function. Any other is an input error (
Unknown function), which/verify/mathreports asBLOCKEDwithmath.parse_error. A single letter before a bracket is still a product:f(0)isf*0. nis a plain symbol with no assumptions.
On 9.0.0, sinc(0) = 0, zeta(0) = 0 and floor(7/2) = 3 are refused as unknown functions, and Abs(n) = n and sqrt(n**2) = n are proven false. ln(e) = 1 is still proven false: e is a free symbol, and Euler's number is E (ln(E) = 1 is VERIFIED).
Upgrade note: write * between names you mean to multiply. xy is now one name, so xy and yx are different symbols.
