{"id":"polynomial-identity-check","version":"1.0.0","description":"Check a polynomial identity over exact rationals by expanding both sides; report the lowest disagreeing coefficient.","supported_operations":["check that two polynomial expressions are equal","verify a polynomial identity by exact expansion","is this expansion of a product of polynomials correct","find the first wrong coefficient in a polynomial expansion","check an algebraic identity with rational coefficients","verify sum of products of polynomials equals another"],"unsupported_operations":["parsing algebraic text such as \"(x+1)^2\" (give coefficient arrays)","multivariate polynomials, powers as exponents, or symbolic constants","floating-point or approximate coefficients","simplifying or factoring an expression (this only checks a claimed equality)"],"semantics":["Polynomials are canonical ascending coefficient arrays (entry k = coefficient of x^k, last entry nonzero, [] = zero) of exact rational strings (integer, p/q or finite decimal, <= 40 characters). Reference: Cohen 1993, A Course in Computational Algebraic Number Theory, s3.1 (reference_version cohen-gtm138-1993-ch3).","lhs and rhs are sums of up to 8 terms; each term is a product of 1 to 4 polynomials of degree <= 32 (subtract with a [\"-1\"] factor; an empty side is 0). Both sides are expanded exactly by convolution; all coefficient strings together are at most 4096 characters.","Coefficients are compared from degree 0 upward; the first difference is returned as first_discrepancy {check: coefficient, degree, lhs, relation: =, rhs} with reason coefficient_mismatch. lhs_degree and rhs_degree are the expanded degrees (null for the zero polynomial)."],"limits":{"max_degree":32,"max_terms_per_side":8,"max_factors_per_term":4,"max_number_chars":40,"max_total_number_chars":4096},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["lhs","rhs"],"properties":{"lhs":{"type":"array","maxItems":8,"items":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"array","maxItems":33,"items":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\\.[0-9]+)?$","maxLength":40}}}},"rhs":{"type":"array","maxItems":8,"items":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"array","maxItems":33,"items":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\\.[0-9]+)?$","maxLength":40}}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","lhs_degree","rhs_degree","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["coefficient_mismatch",null]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["check","factor_index","degree","lhs","relation","rhs"],"properties":{"check":{"type":"string","enum":["coefficient"]},"factor_index":{"type":["integer","null"],"minimum":0},"degree":{"type":["integer","null"],"minimum":0},"lhs":{"type":"string"},"relation":{"type":"string","enum":["="]},"rhs":{"type":"string"}}},"lhs_degree":{"type":["integer","null"],"minimum":0},"rhs_degree":{"type":["integer","null"],"minimum":0},"reference_version":{"type":"string","const":"cohen-gtm138-1993-ch3"}}},"examples":[{"input":{"lhs":[[["4","0","0","0","1"]]],"rhs":[[["2","2","1"],["2","-2","1"]]]},"output":{"valid":true,"reason":null,"first_discrepancy":null,"lhs_degree":4,"rhs_degree":4,"reference_version":"cohen-gtm138-1993-ch3"}},{"input":{"lhs":[[["2","1"],["3","1"]]],"rhs":[[["5","6","1"]]]},"output":{"valid":false,"reason":"coefficient_mismatch","first_discrepancy":{"check":"coefficient","factor_index":null,"degree":0,"lhs":"6","relation":"=","rhs":"5"},"lhs_degree":2,"rhs_degree":2,"reference_version":"cohen-gtm138-1993-ch3"}}],"execute_url":"/v1/tools/polynomial-identity-check/versions/1.0.0/execute"}