{"id":"polynomial-factorization-check","version":"1.0.0","description":"Check a claimed factorization c * prod f_i^e_i of a rational polynomial: monic distinct factors, degrees, coefficients.","supported_operations":["check a factorization of a polynomial","verify polynomial factors multiply back to the original","is this polynomial factored correctly over the rationals","check factors are monic and the leading constant is right","validate repeated factors and multiplicities of a polynomial","verify a quadratic factor is irreducible over q"],"unsupported_operations":["factoring a polynomial (supply the claimed factorization)","proving irreducibility of factors of degree 3 or more (accepted, reported as irreducibility_verified false)","factorization over finite fields, Z[x] content conventions, or multivariate polynomials","floating-point coefficients or approximate roots"],"semantics":["Polynomials are canonical ascending coefficient arrays (entry k = coefficient of x^k, last entry nonzero) of exact rational strings (<= 40 characters), degree <= 64. Claim: f = leading_coefficient * prod factors[i].coefficients ^ multiplicity with distinct monic non-constant factors (Cohen 1993, ch. 3; reference_version cohen-gtm138-1993-ch3). f = [] is not_computable.","Order: per factor i ascending: degree >= 1 (factor_degree_violation), monic (factor_not_monic), distinct from earlier factors (duplicate_factor); then leading_coefficient = lc(f) (leading_coefficient_mismatch); then sum of multiplicity * degree = deg f (degree_mismatch); then coefficients from degree 0 upward (coefficient_mismatch); then each quadratic factor must have a discriminant that is not a rational square (factor_reducible, rhs = the square-root witness).","first_discrepancy is {check, factor_index, degree, lhs, relation, rhs}. degree = deg f is always returned; irreducibility_verified is true only when valid and every factor has degree <= 2 (degree 1 always irreducible, degree 2 by the exact discriminant test)."],"limits":{"max_degree":64,"max_factors":16,"max_multiplicity":64,"max_number_chars":40},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["polynomial","leading_coefficient","factors"],"properties":{"polynomial":{"type":"array","maxItems":65,"items":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\\.[0-9]+)?$","maxLength":40}},"leading_coefficient":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\\.[0-9]+)?$","maxLength":40},"factors":{"type":"array","maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["coefficients","multiplicity"],"properties":{"coefficients":{"type":"array","maxItems":65,"items":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\\.[0-9]+)?$","maxLength":40}},"multiplicity":{"type":"integer","minimum":1,"maximum":64}}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","degree","irreducibility_verified","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["factor_degree_violation","factor_not_monic","duplicate_factor","leading_coefficient_mismatch","degree_mismatch","coefficient_mismatch","factor_reducible",null]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["check","factor_index","degree","lhs","relation","rhs"],"properties":{"check":{"type":"string","enum":["factor_degree","factor_monic","duplicate_factor","leading_coefficient","degree_sum","coefficient","factor_irreducible"]},"factor_index":{"type":["integer","null"],"minimum":0},"degree":{"type":["integer","null"],"minimum":0},"lhs":{"type":"string"},"relation":{"type":"string","enum":["=",">=","!=","not_square"]},"rhs":{"type":"string"}}},"degree":{"type":"integer","minimum":0},"irreducibility_verified":{"type":"boolean"},"reference_version":{"type":"string","const":"cohen-gtm138-1993-ch3"}}},"examples":[{"input":{"polynomial":["-2","0","2"],"leading_coefficient":"2","factors":[{"coefficients":["-1","1"],"multiplicity":1},{"coefficients":["1","1"],"multiplicity":1}]},"output":{"valid":true,"reason":null,"first_discrepancy":null,"degree":2,"irreducibility_verified":true,"reference_version":"cohen-gtm138-1993-ch3"}},{"input":{"polynomial":["-1","0","1"],"leading_coefficient":"1","factors":[{"coefficients":["-1","0","1"],"multiplicity":1}]},"output":{"valid":false,"reason":"factor_reducible","first_discrepancy":{"check":"factor_irreducible","factor_index":0,"degree":null,"lhs":"4","relation":"not_square","rhs":"2"},"degree":2,"irreducibility_verified":false,"reference_version":"cohen-gtm138-1993-ch3"}}],"execute_url":"/v1/tools/polynomial-factorization-check/versions/1.0.0/execute"}