from eureka.math_agent.tools.claim_ir import token_estimate from eureka.math_agent.tools.runtime import run def _fact(i, t, payload, domain="unit"): return {"id": i, "type": t, "payload": payload, "assumptions": [], "domain": domain, "provenance": "unit fixture"} def _capsule(i, facts): return {"id": i, "source": {"kind": "primary", "ref": f"fixture:{i}", "version": "1", "primary": True}, "facts": facts} def test_math_runtime_structural_mining(): capsules = [ _capsule("A", [ _fact("a", "action", {"parameter": "t", "op": "negation", "scope": "x"}), _fact("e", "expansion", {"parameter": "t", "branches": [[1,2,3],[1,-2,3]], "branch_labels": ["left","right"], "scope": "x"}), ]), _capsule("B", [ _fact("f1", "family", {"parameter": "R", "unbounded": True, "nested": True, "region": {"kind": "symmetric_interval", "base_radius": 1.0, "new_radius": 1.25}, "scope": "x"}), _fact("f2", "family", {"parameter": "M", "dense": True, "scope": "x"}), _fact("r", "relation", {"op": "difference", "scope": "x"}), _fact("m", "map", {"op": "identity", "scope": "x"}), ]), _capsule("C", [ _fact("q", "representation", {"parameter": "M", "size_formula": "4*M+2", "index_rule": "0..N", "index_action": "identity", "scope": "x"}), ]), ] out = run("Open conjecture unit fixture", capsules) kinds = {x["kind"] for x in out["structural_results"]} assert {"projection_order", "axis_inventory", "size_increment", "index_increment", "orbit_profile", "relation_extent", "inverse_map_values"} <= kinds assert out["active_context"]["deterministic_operator_model_calls"] == 0 assert token_estimate(out["model_frontier_ir"]) > 0