{"id":"unit-factor-check","version":"1.0.0","description":"Check a claimed conversion factor and offset between two unit expressions using caller-defined exact unit definitions","supported_operations":["check unit conversion factor","verify conversion formula between units","is this unit factor correct","check affine temperature conversion formula","validate compound unit conversion factor","exact conversion factor checker","check offset and scale between units"],"unsupported_operations":["a built-in unit catalog (every unit is defined by the caller)","logarithmic units such as dB or pH","irrational factors such as degree to radian (pi)","currency or other time-varying rates"],"semantics":["units: caller-defined catalog {symbol, dimension (7 integers L, M, T, I, Theta, N, J), factor > 0, offset}, meaning value_SI = value x factor + offset; symbols are compared code unit for code unit. Numbers are exact strings: integer, decimal or p/q, at most 60 characters, no exponent.","Claim: v_to = v_from x claimed_factor + claimed_offset. Check order: unknown units in from_unit then to_unit (term order), affine misuse in from_unit then to_unit, dimensions (dimension_mismatch with the 7-integer vectors), factor = F(from) / F(to) (factor_mismatch), offset = (O(from) - O(to)) / F(to) (offset_mismatch).","quantity_kind \"absolute\": an affine unit (non-zero offset) must be the only term, power 1, else invalid_affine_composition; \"interval\": offsets are ignored, the offset is always 0 and affine units compose freely (temperature differences, gradients).","Claims are compared by exact value (3600, 3600.0 and 7200/2 are equal). factor and offset are output in canonical exact form (plain decimal when terminating, else reduced p/q) whenever the units are compatible, otherwise null.","Structural problems throw invalid_input; more than 200 units, 8 terms, |power| 6, 32-byte symbols, 60-character numbers or a 4000-digit exact intermediate throws limit_exceeded.","Reference: JCGM 200:2012 (VIM) 1.24 and SI Brochure 9th ed. (2019) 2.3.3-2.3.4; reference_version \"jcgm-200-2012-vim3-si-brochure-9e-2019\"."],"limits":{"max_units":200,"max_symbol_bytes":32,"max_terms":8,"max_abs_power":6,"max_number_chars":60,"max_exact_digits":4000},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["units","quantity_kind","from_unit","to_unit","claimed_factor","claimed_offset"],"properties":{"units":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["symbol","dimension","factor","offset"],"properties":{"symbol":{"type":"string","minLength":1,"maxLength":32},"dimension":{"type":"array","minItems":7,"maxItems":7,"items":{"type":"integer","minimum":-12,"maximum":12}},"factor":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"},"offset":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"}}}},"quantity_kind":{"type":"string","enum":["absolute","interval"]},"from_unit":{"type":"array","maxItems":8,"items":{"type":"object","additionalProperties":false,"required":["unit","power"],"properties":{"unit":{"type":"string","minLength":1,"maxLength":32},"power":{"type":"integer","enum":[-6,-5,-4,-3,-2,-1,1,2,3,4,5,6]}}}},"to_unit":{"type":"array","maxItems":8,"items":{"type":"object","additionalProperties":false,"required":["unit","power"],"properties":{"unit":{"type":"string","minLength":1,"maxLength":32},"power":{"type":"integer","enum":[-6,-5,-4,-3,-2,-1,1,2,3,4,5,6]}}}},"claimed_factor":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"},"claimed_offset":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","factor","offset","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"unknown_unit","invalid_affine_composition","dimension_mismatch","factor_mismatch","offset_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["field","index","term_index","unit","expected","actual"],"properties":{"field":{"type":"string","enum":["from_unit","to_unit","claimed_factor","claimed_offset"]},"index":{"type":["integer","null"],"minimum":0},"term_index":{"type":["integer","null"],"minimum":0},"unit":{"type":["string","null"]},"expected":{"type":["string","null"]},"actual":{"type":["string","null"]}}},"factor":{"type":["string","null"]},"offset":{"type":["string","null"]},"reference_version":{"type":"string","const":"jcgm-200-2012-vim3-si-brochure-9e-2019"}}},"examples":[{"input":{"units":[{"symbol":"m","dimension":[1,0,0,0,0,0,0],"factor":"1","offset":"0"},{"symbol":"km","dimension":[1,0,0,0,0,0,0],"factor":"1000","offset":"0"},{"symbol":"s","dimension":[0,0,1,0,0,0,0],"factor":"1","offset":"0"},{"symbol":"h","dimension":[0,0,1,0,0,0,0],"factor":"3600","offset":"0"}],"quantity_kind":"absolute","from_unit":[{"unit":"km","power":1},{"unit":"h","power":-1}],"to_unit":[{"unit":"m","power":1},{"unit":"s","power":-1}],"claimed_factor":"5/18","claimed_offset":"0"},"output":{"valid":true,"reason":null,"first_discrepancy":null,"factor":"5/18","offset":"0","reference_version":"jcgm-200-2012-vim3-si-brochure-9e-2019"}},{"input":{"units":[{"symbol":"K","dimension":[0,0,0,0,1,0,0],"factor":"1","offset":"0"},{"symbol":"°C","dimension":[0,0,0,0,1,0,0],"factor":"1","offset":"273.15"},{"symbol":"°F","dimension":[0,0,0,0,1,0,0],"factor":"5/9","offset":"45967/180"}],"quantity_kind":"absolute","from_unit":[{"unit":"°F","power":1}],"to_unit":[{"unit":"°C","power":1}],"claimed_factor":"5/9","claimed_offset":"-32"},"output":{"valid":false,"reason":"offset_mismatch","first_discrepancy":{"field":"claimed_offset","index":null,"term_index":null,"unit":null,"expected":"-160/9","actual":"-32"},"factor":"5/9","offset":"-160/9","reference_version":"jcgm-200-2012-vim3-si-brochure-9e-2019"}}],"execute_url":"/v1/tools/unit-factor-check/versions/1.0.0/execute"}