mathguard

v0.4.0
io.github.C0MaE/mathguard Checked 1 day ago Published 20 days ago

Verify maths from language models: identities, derivations, calculus, solutions, units, answers.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

verify_math

Verify mathematical claims. `checks` is a list of check objects such as {"check": "equal", "lhs": "(a+b)^2", "rhs": "a^2 + 2a b + b^2"}, {"check": "chain", "steps": [...]}, {"check": "derivative", ...}, {"check": "antiderivative", ...}, {"check": "definite_integral", ...}, {"check": "solutions", ...}, {"check": "value", ...}, {"check": "limit", ...} or {"check": "dimensions", "equation": "E = m c^2", "units": {...}}. See the server instructions for all fields.

ParameterTypeDescription
checks *array

check_identity

Check that lhs == rhs for all values of the variables. assumptions example: {"x": "positive"}.

ParameterTypeDescription
lhs *string
rhs *string
assumptions

check_derivation

Check a derivation step by step; reports which step is wrong.

ParameterTypeDescription
steps *array
assumptions

check_units

Check an equation for dimensional consistency. units example: {"E": "J", "m": "kg", "c": "m/s"}.

ParameterTypeDescription
equation *string
units *object

check_solution

Check a whole worked solution written in Markdown with LaTeX formulas ($...$, $$...$$, align). Every chain a = b = c is checked step by step, numbers like \approx 35{,}3\,\mathrm{m} are recomputed, later equations are compared with earlier ones. Give units (e.g. {"v0": "m/s"}) to also check the dimensions of every step. Variables count as positive. Use this on your own answer before presenting it; fix every refuted line.

ParameterTypeDescription
text *string
assumptions
units

check_answer

Grade the final results of an answer against a reference solution. reference maps each wanted quantity to a formula or a value with unit, e.g. {"v": "sqrt(10 g h / 7)"} or {"v": {"formula": "sqrt(10 g h / 7)", "unit": "m/s"}} or {"t": "2.04 s"}. given holds known values ({"h": "1.2 m", "g": "9.81 m/s^2"}) so formulas can be turned into numbers; units gives units of other variables ({"m": "kg"}). Formulas are compared symbolically, numbers with unit conversion and a 1 % tolerance (or the rounding of the written digits). Use this when a ref…

ParameterTypeDescription
answer *string
reference *object
given
units