Release 10.3 (full): coverage by the store assembled (the search over learned program structures), one judge over every answer, the opening table on the first interrogative, names written another way learned; full: no organ answers over a terminal refusal; release test pre-registration v39, run once; hashes anchored on Solana (part 14)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- root/organs10/physics/specialists/solved-mean-free-time/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mean-free-time/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mean-free-time/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mean-free-time/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-mean-free-time/program.pyAdded+7
- root/organs10/physics/specialists/solved-mean-free-time/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-mean-free-time/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-mean-free-time/verdict_dev.jsonAdded+125
- root/organs10/physics/specialists/solved-mean-lifetime-2/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-mean-lifetime-2/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mean-lifetime-2/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mean-lifetime-2/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mean-lifetime-2/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-mean-lifetime-2/program.pyAdded+7
- root/organs10/physics/specialists/solved-mean-lifetime-2/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-mean-lifetime-2/spec.jsonAdded+111
- root/organs10/physics/specialists/solved-mean-lifetime-2/verdict_dev.jsonAdded+125
- root/organs10/physics/specialists/solved-mean-lifetime/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-mean-lifetime/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mean-lifetime/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mean-lifetime/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mean-lifetime/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-mean-lifetime/program.pyAdded+7
- root/organs10/physics/specialists/solved-mean-lifetime/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-mean-lifetime/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-mean-lifetime/verdict_dev.jsonAdded+125
- root/organs10/physics/specialists/solved-mean-linear-range/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-mean-linear-range/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mean-linear-range/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mean-linear-range/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mean-linear-range/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-mean-linear-range/program.pyAdded+7
- root/organs10/physics/specialists/solved-mean-linear-range/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-mean-linear-range/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-mean-linear-range/verdict_dev.jsonAdded+125
- root/organs10/physics/specialists/solved-mean-mass-range/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-mean-mass-range/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mean-mass-range/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mean-mass-range/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mean-mass-range/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-mean-mass-range/program.pyAdded+7
- root/organs10/physics/specialists/solved-mean-mass-range/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-mean-mass-range/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-mean-mass-range/verdict_dev.jsonAdded+125
- root/organs10/physics/specialists/solved-mechanical-efficiency/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-mechanical-efficiency/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-mechanical-efficiency/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-mechanical-efficiency/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-mechanical-efficiency/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-mechanical-efficiency/panel.jsonAdded+366
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mean free time for average particle speed 107.961 and mean free path 59.4105?", "a": "0.5502976449934551", "valid": true, "kind": "compute", "expect": 0.5502976449934551, "dtype": "quantity", "unit": "s", "why": "mean free time for [107.960666, 59.4105] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 107.961 and mean free path of 59.4105.", "a": "0.5502976449934551", "valid": true, "kind": "compute", "expect": 0.5502976449934551, "dtype": "quantity", "unit": "s", "why": "mean free time for [107.960666, 59.4105] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 169.527 and mean free path 280.774?", "a": "1.656218609813279", "valid": true, "kind": "compute", "expect": 1.656218609813279, "dtype": "quantity", "unit": "s", "why": "mean free time for [169.526958, 280.773702] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 169.527 and mean free path of 280.774.", "a": "1.656218609813279", "valid": true, "kind": "compute", "expect": 1.656218609813279, "dtype": "quantity", "unit": "s", "why": "mean free time for [169.526958, 280.773702] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 1.91195 and mean free path 82.2401?", "a": "43.01367504910926", "valid": true, "kind": "compute", "expect": 43.01367504910926, "dtype": "quantity", "unit": "s", "why": "mean free time for [1.911952, 82.240072] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 1.91195 and mean free path of 82.2401.", "a": "43.01367504910926", "valid": true, "kind": "compute", "expect": 43.01367504910926, "dtype": "quantity", "unit": "s", "why": "mean free time for [1.911952, 82.240072] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 1.64379 and mean free path 252.709?", "a": "153.73507534197344", "valid": true, "kind": "compute", "expect": 153.73507534197344, "dtype": "quantity", "unit": "s", "why": "mean free time for [1.643795, 252.709024] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 1.64379 and mean free path of 252.709.", "a": "153.73507534197344", "valid": true, "kind": "compute", "expect": 153.73507534197344, "dtype": "quantity", "unit": "s", "why": "mean free time for [1.643795, 252.709024] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 18.3169 and mean free path 6.8386?", "a": "0.37334976843585305", "valid": true, "kind": "compute", "expect": 0.37334976843585305, "dtype": "quantity", "unit": "s", "why": "mean free time for [18.316867, 6.838598] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 18.3169 and mean free path of 6.8386.", "a": "0.37334976843585305", "valid": true, "kind": "compute", "expect": 0.37334976843585305, "dtype": "quantity", "unit": "s", "why": "mean free time for [18.316867, 6.838598] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 156.502 and mean free path 185.886?", "a": "1.187757975790468", "valid": true, "kind": "compute", "expect": 1.187757975790468, "dtype": "quantity", "unit": "s", "why": "mean free time for [156.50181, 185.886273] (the system mean free time (Wikidata Q1940665))" }, { "q": "Tell me the mean free time with average particle speed of 156.502 and mean free path of 185.886.", "a": "1.187757975790468", "valid": true, "kind": "compute", "expect": 1.187757975790468, "dtype": "quantity", "unit": "s", "why": "mean free time for [156.50181, 185.886273] (the system mean free time (Wikidata Q1940665))" }, { "q": "What is the mean free time for average particle speed 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mean free path is not given" }, { "q": "Tell me the mean free time with average particle speed of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mean free path is not given" }, { "q": "What is the mean free time of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mean free time of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mean free time with average particle speed of -1.91195 and mean free path of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative average particle speed: no example had one" }, { "q": "Which mean free time is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the average particle speed is 8.50728 and the mean free path is 17.7888, what is the mean free time?", "a": "2.0910058888280627", "valid": true, "kind": "compute", "expect": 2.0910058888280627, "dtype": "quantity", "unit": "s", "why": "mean free time for [8.507283, 17.788778] (the system mean free time (Wikidata Q1940665))" }, { "q": "Could you work out the mean free time given average particle speed = 8.50728, mean free path = 17.7888?", "a": "2.0910058888280627", "valid": true, "kind": "compute", "expect": 2.0910058888280627, "dtype": "quantity", "unit": "s", "why": "mean free time for [8.507283, 17.788778] (the system mean free time (Wikidata Q1940665))" }, { "q": "I need the mean free time for an average particle speed of 8.24951 and a mean free path of 0.634021, please.", "a": "0.07685559300301205", "valid": true, "kind": "compute", "expect": 0.07685559300301205, "dtype": "quantity", "unit": "s", "why": "mean free time for [8.24951, 0.634021] (the system mean free time (Wikidata Q1940665))" }, { "q": "If the average particle speed is 8.24951 and the mean free path is 0.634021, what is the mean free time?", "a": "0.07685559300301205", "valid": true, "kind": "compute", "expect": 0.07685559300301205, "dtype": "quantity", "unit": "s", "why": "mean free time for [8.24951, 0.634021] (the system mean free time (Wikidata Q1940665))" }, { "q": "Could you work out the mean free time given average particle speed = 0.318734, mean free path = 9.56607?", "a": "30.01270513508963", "valid": true, "kind": "compute", "expect": 30.01270513508963, "dtype": "quantity", "unit": "s", "why": "mean free time for [0.318734, 9.566071] (the system mean free time (Wikidata Q1940665))" }, { "q": "I need the mean free time for an average particle speed of 0.318734 and a mean free path of 9.56607, please.", "a": "30.01270513508963", "valid": true, "kind": "compute", "expect": 30.01270513508963, "dtype": "quantity", "unit": "s", "why": "mean free time for [0.318734, 9.566071] (the system mean free time (Wikidata Q1940665))" }, { "q": "If the average particle speed is 0.671697 and the mean free path is 14.2496, what is the mean free time?", "a": "21.214275301882097", "valid": true, "kind": "compute", "expect": 21.214275301882097, "dtype": "quantity", "unit": "s", "why": "mean free time for [0.671697, 14.249569] (the system mean free time (Wikidata Q1940665))" }, { "q": "Could you work out the mean free time given average particle speed = 0.671697, mean free path = 14.2496?", "a": "21.214275301882097", "valid": true, "kind": "compute", "expect": 21.214275301882097, "dtype": "quantity", "unit": "s", "why": "mean free time for [0.671697, 14.249569] (the system mean free time (Wikidata Q1940665))" }, { "q": "I need the mean free time for an average particle speed of 21.7931 and a mean free path of 29.5106, please.", "a": "1.3541245984297685", "valid": true, "kind": "compute", "expect": 1.3541245984297685, "dtype": "quantity", "unit": "s", "why": "mean free time for [21.793126, 29.510609] (the system mean free time (Wikidata Q1940665))" }, { "q": "If the average particle speed is 21.7931 and the mean free path is 29.5106, what is the mean free time?", "a": "1.3541245984297685", "valid": true, "kind": "compute", "expect": 1.3541245984297685, "dtype": "quantity", "unit": "s", "why": "mean free time for [21.793126, 29.510609] (the system mean free time (Wikidata Q1940665))" }, { "q": "Could you work out the mean free time given average particle speed = 153.15, mean free path = 18.5953?", "a": "0.12141899904566884", "valid": true, "kind": "compute", "expect": 0.12141899904566884, "dtype": "quantity", "unit": "s", "why": "mean free time for [153.149965, 18.595315] (the system mean free time (Wikidata Q1940665))" }, { "q": "I need the mean free time for an average particle speed of 153.15 and a mean free path of 18.5953, please.", "a": "0.12141899904566884", "valid": true, "kind": "compute", "expect": 0.12141899904566884, "dtype": "quantity", "unit": "s", "why": "mean free time for [153.149965, 18.595315] (the system mean free time (Wikidata Q1940665))" }, { "q": "If the average particle speed is 8.50728, what is the mean free time?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mean free path is not given" }, { "q": "Could you work out the mean free time given average particle speed = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mean free path is not given" }, { "q": "Do you know the mean free time of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mean free time of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mean free time given average particle speed = -0.318734, mean free path = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative average particle speed: no example had one" }, { "q": "What is a typical mean free time?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""mean free time from average particle speed, mean free path (mean free time (Wikidata Q1940665))The maths organ (systems.py): solved from the system q1 = ((q2)/(q0)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(average_particle_speed, mean_free_path): return 1.0*mean_free_path/average_particle_speed12345678910111213141516171819202122232425262728293031"""scorer_formula_v1 - scorer for composed formula specialists: (good, asserted).A must-decline item answered is a false yes. A valid quantity item is right when the FIRST number in the reply (theanswer, before any working) is within 0.5% of the sealed answer; a valid text item is right when the answer appears in thereply as a whole word, exactly as written."""import re
def _first_num(text): m = re.search(r"-?\d[\d,]*(?:\.\d+)?(?:[eE][+-]?\d+)?", text) if not m: return None try: return float(m.group(0).replace(",", "")) except ValueError: return None
def ok(p, r): r = r or {} text = str(r.get("response", "")) answered = str(r.get("status", "")) == "answered" if not p["valid"]: return (not answered), answered if not answered: return False, False if p.get("dtype") == "quantity": want, got = float(p["expect"]), _first_num(text) if got is None: return False, True return abs(got - want) <= (0.005 * abs(want) if want else 0.005), True return re.search(r"(?<![\w])%s(?![\w])" % re.escape(str(p["expect"])), text) is not None, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128{ "title": "mean free time from average particle speed, mean free path (mean free time (Wikidata Q1940665))", "inputs": [ "average particle speed (m/s)", "mean free path (m)" ], "output": "mean free time (s)", "input_kinds": [ "number", "number" ], "expression": "1.0*q2/q0", "expression_x": null, "said": "solved from the system q1 = ((q2)/(q0)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q1 = ((q2)/(q0))" ], "constants": {}, "quantities": { "q0": "average particle speed (m/s)", "q1": "mean free time (s)", "q2": "mean free path (m)" }, "symbols": [ "q0", "q2" ], "out_symbol": "q1" }, "points": [ { "in": [ 107.960666, 59.4105 ], "out": 0.5502976449934551 }, { "in": [ 8.507283, 17.788778 ], "out": 2.0910058888280627 }, { "in": [ 169.526958, 280.773702 ], "out": 1.656218609813279 }, { "in": [ 8.24951, 0.634021 ], "out": 0.07685559300301205 }, { "in": [ 1.911952, 82.240072 ], "out": 43.01367504910926 }, { "in": [ 0.318734, 9.566071 ], "out": 30.01270513508963 }, { "in": [ 1.643795, 252.709024 ], "out": 153.73507534197344 }, { "in": [ 0.671697, 14.249569 ], "out": 21.214275301882097 }, { "in": [ 18.316867, 6.838598 ], "out": 0.37334976843585305 }, { "in": [ 21.793126, 29.510609 ], "out": 1.3541245984297685 }, { "in": [ 156.50181, 185.886273 ], "out": 1.187757975790468 }, { "in": [ 153.149965, 18.595315 ], "out": 0.12141899904566884 } ], "domain": { "inputs": [ "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "id": "solved-mean-free-time", "split": "dev", "decision": "WOULD FAIL", "reasons": [ "DOMAIN: gain 0, needs 3" ], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 6, "fy": 0, "wrong": 0 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "What is the mean free time for average particle speed 107.961 and mean free path 59.4105?", "expected": "0.5502976449934551", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 107.961 and mean free path of 59.4105.", "expected": "0.5502976449934551", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean free time for average particle speed 169.527 and mean free path 280.774?", "expected": "1.656218609813279", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 169.527 and mean free path of 280.774.", "expected": "1.656218609813279", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean free time for average particle speed 1.91195 and mean free path 82.2401?", "expected": "43.01367504910926", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 1.91195 and mean free path of 82.2401.", "expected": "43.01367504910926", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean free time for average particle speed 1.64379 and mean free path 252.709?", "expected": "153.73507534197344", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 1.64379 and mean free path of 252.709.", "expected": "153.73507534197344", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean free time for average particle speed 18.3169 and mean free path 6.8386?", "expected": "0.37334976843585305", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 18.3169 and mean free path of 6.8386.", "expected": "0.37334976843585305", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean free time for average particle speed 156.502 and mean free path 185.886?", "expected": "1.187757975790468", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "Tell me the mean free time with average particle speed of 156.502 and mean free path of 185.886.", "expected": "1.187757975790468", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" } ], "files_sha": "f60bddc8973336dba5669d6b22ee762f23823ef1fce8d4a43b10bdbc0b104ac5", "panel_sha": "efc01138ab2708ab272220e54cf5a0e10a60aee13cc4690804cd61c21abb8c16", "time": "2026-10-25T01:00:47Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 0, "mode": "full" }}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-mean-lifetime-2", "name": "Solved: mean lifetime from decay constant (mean lifetime (Wikidata Q1758559))", "sources": [ { "name": "the maths organ: solved from the system q0 = ((1)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "licence": "yours" } ], "organ": { "module": "organ_formula_v3", "class": "FormulaOrgan", "init": {} }, "accept": { "kinds": [ "compute" ], "declines_in_domain": [ "missing_input", "out_of_domain" ], "context_regex": "\\bmean\\ lifetime\\b" }, "panel": { "path": "panel.json", "scorer_module": "scorer_formula_v1", "scorer_fn": "ok" }, "budgets": { "latency_p50_ms": 200 }, "notes": "Solved by the maths organ from the system mean lifetime (Wikidata Q1758559): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the mean lifetime for decay constant?" ], "gap": "", "node": "hod" }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mean lifetime for decay constant 107.961?", "a": "0.00926263275385168", "valid": true, "kind": "compute", "expect": 0.00926263275385168, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [107.960666] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 107.961.", "a": "0.00926263275385168", "valid": true, "kind": "compute", "expect": 0.00926263275385168, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [107.960666] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime for decay constant 22.652?", "a": "0.044146167826513254", "valid": true, "kind": "compute", "expect": 0.044146167826513254, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [22.652023] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 22.652.", "a": "0.044146167826513254", "valid": true, "kind": "compute", "expect": 0.044146167826513254, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [22.652023] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime for decay constant 173.394?", "a": "0.0057672242718762815", "valid": true, "kind": "compute", "expect": 0.0057672242718762815, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [173.393638] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 173.394.", "a": "0.0057672242718762815", "valid": true, "kind": "compute", "expect": 0.0057672242718762815, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [173.393638] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime for decay constant 126.709?", "a": "0.007892083536070259", "valid": true, "kind": "compute", "expect": 0.007892083536070259, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [126.709252] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 126.709.", "a": "0.007892083536070259", "valid": true, "kind": "compute", "expect": 0.007892083536070259, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [126.709252] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime for decay constant 0.671697?", "a": "1.4887660694527203", "valid": true, "kind": "compute", "expect": 1.4887660694527203, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.671697] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 0.671697.", "a": "1.4887660694527203", "valid": true, "kind": "compute", "expect": 1.4887660694527203, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.671697] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime for decay constant 1.16997?", "a": "0.8547242274066585", "valid": true, "kind": "compute", "expect": 0.8547242274066585, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.169968] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Tell me the mean lifetime with decay constant of 1.16997.", "a": "0.8547242274066585", "valid": true, "kind": "compute", "expect": 0.8547242274066585, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.169968] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "What is the mean lifetime?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the decay constant is not given" }, { "q": "Could you work out the mean lifetime, please?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the decay constant is not given" }, { "q": "What is the mean lifetime of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mean lifetime of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mean lifetime with decay constant of -173.394.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative decay constant: no example had one" }, { "q": "Which mean lifetime is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the decay constant is 2.57003, what is the mean lifetime?", "a": "0.38910052946214563", "valid": true, "kind": "compute", "expect": 0.38910052946214563, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [2.57003] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Could you work out the mean lifetime given decay constant = 2.57003?", "a": "0.38910052946214563", "valid": true, "kind": "compute", "expect": 0.38910052946214563, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [2.57003] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "I need the mean lifetime for a decay constant of 48.921, please.", "a": "0.02044112317474344", "valid": true, "kind": "compute", "expect": 0.02044112317474344, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [48.920991] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "If the decay constant is 48.921, what is the mean lifetime?", "a": "0.02044112317474344", "valid": true, "kind": "compute", "expect": 0.02044112317474344, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [48.920991] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Could you work out the mean lifetime given decay constant = 0.348438?", "a": "2.869953759769417", "valid": true, "kind": "compute", "expect": 2.869953759769417, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.348438] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "I need the mean lifetime for a decay constant of 0.348438, please.", "a": "2.869953759769417", "valid": true, "kind": "compute", "expect": 2.869953759769417, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.348438] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "If the decay constant is 252.709, what is the mean lifetime?", "a": "0.0039571202610184176", "valid": true, "kind": "compute", "expect": 0.0039571202610184176, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [252.709024] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Could you work out the mean lifetime given decay constant = 252.709?", "a": "0.0039571202610184176", "valid": true, "kind": "compute", "expect": 0.0039571202610184176, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [252.709024] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "I need the mean lifetime for a decay constant of 20.3966, please.", "a": "0.04902788018766951", "valid": true, "kind": "compute", "expect": 0.04902788018766951, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [20.396558] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "If the decay constant is 20.3966, what is the mean lifetime?", "a": "0.04902788018766951", "valid": true, "kind": "compute", "expect": 0.04902788018766951, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [20.396558] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "Could you work out the mean lifetime given decay constant = 134.993?", "a": "0.007407793842889246", "valid": true, "kind": "compute", "expect": 0.007407793842889246, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [134.992958] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "I need the mean lifetime for a decay constant of 134.993, please.", "a": "0.007407793842889246", "valid": true, "kind": "compute", "expect": 0.007407793842889246, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [134.992958] (the system mean lifetime (Wikidata Q1758559))" }, { "q": "I need the mean lifetime, please.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the decay constant is not given" }, { "q": "Can you tell me the mean lifetime?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the decay constant is not given" }, { "q": "Do you know the mean lifetime of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mean lifetime of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mean lifetime given decay constant = -0.348438?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative decay constant: no example had one" }, { "q": "What is a typical mean lifetime?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""mean lifetime from decay constant (mean lifetime (Wikidata Q1758559))The maths organ (systems.py): solved from the system q0 = ((1)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(decay_constant): return 1.0/decay_constant12345678910111213141516171819202122232425262728293031"""scorer_formula_v1 - scorer for composed formula specialists: (good, asserted).A must-decline item answered is a false yes. A valid quantity item is right when the FIRST number in the reply (theanswer, before any working) is within 0.5% of the sealed answer; a valid text item is right when the answer appears in thereply as a whole word, exactly as written."""import re
def _first_num(text): m = re.search(r"-?\d[\d,]*(?:\.\d+)?(?:[eE][+-]?\d+)?", text) if not m: return None try: return float(m.group(0).replace(",", "")) except ValueError: return None
def ok(p, r): r = r or {} text = str(r.get("response", "")) answered = str(r.get("status", "")) == "answered" if not p["valid"]: return (not answered), answered if not answered: return False, False if p.get("dtype") == "quantity": want, got = float(p["expect"]), _first_num(text) if got is None: return False, True return abs(got - want) <= (0.005 * abs(want) if want else 0.005), True return re.search(r"(?<![\w])%s(?![\w])" % re.escape(str(p["expect"])), text) is not None, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111{ "title": "mean lifetime from decay constant (mean lifetime (Wikidata Q1758559))", "inputs": [ "decay constant (Hz)" ], "output": "mean lifetime (s)", "input_kinds": [ "number" ], "expression": "1.0/q1", "expression_x": null, "said": "solved from the system q0 = ((1)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q0 = ((1)/(q1))" ], "constants": {}, "quantities": { "q0": "mean lifetime (s)", "q1": "decay constant (Hz)" }, "symbols": [ "q1" ], "out_symbol": "q0" }, "points": [ { "in": [ 107.960666 ], "out": 0.00926263275385168 }, { "in": [ 2.57003 ], "out": 0.38910052946214563 }, { "in": [ 22.652023 ], "out": 0.044146167826513254 }, { "in": [ 48.920991 ], "out": 0.02044112317474344 }, { "in": [ 173.393638 ], "out": 0.0057672242718762815 }, { "in": [ 0.348438 ], "out": 2.869953759769417 }, { "in": [ 126.709252 ], "out": 0.007892083536070259 }, { "in": [ 252.709024 ], "out": 0.0039571202610184176 }, { "in": [ 0.671697 ], "out": 1.4887660694527203 }, { "in": [ 20.396558 ], "out": 0.04902788018766951 }, { "in": [ 1.169968 ], "out": 0.8547242274066585 }, { "in": [ 134.992958 ], "out": 0.007407793842889246 } ], "domain": { "inputs": [ "positive" ], "output": "positive", "order": [], "facts": [] }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "id": "solved-mean-lifetime-2", "split": "dev", "decision": "WOULD FAIL", "reasons": [ "DOMAIN: gain 0, needs 3" ], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 6, "fy": 0, "wrong": 0 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.01, "budget_ms": 200.0, "fails": [ { "q": "What is the mean lifetime for decay constant 107.961?", "expected": "0.00926263275385168", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 107.961.", "expected": "0.00926263275385168", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for decay constant 22.652?", "expected": "0.044146167826513254", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 22.652.", "expected": "0.044146167826513254", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for decay constant 173.394?", "expected": "0.0057672242718762815", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 173.394.", "expected": "0.0057672242718762815", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for decay constant 126.709?", "expected": "0.007892083536070259", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 126.709.", "expected": "0.007892083536070259", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for decay constant 0.671697?", "expected": "1.4887660694527203", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 0.671697.", "expected": "1.4887660694527203", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for decay constant 1.16997?", "expected": "0.8547242274066585", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with decay constant of 1.16997.", "expected": "0.8547242274066585", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" } ], "files_sha": "adcca6894fb804e60e5afc86205135017877fe20dadf034632b92c4f8a222da1", "panel_sha": "ef3e3ca2c7231e0f163172dd041a4bd9d5e21b3b7743af18711d5540a6ad97c4", "time": "2026-10-25T01:19:59Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 0, "mode": "full" }}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-mean-lifetime", "name": "Solved: mean lifetime from diffusion length, mass diffusivity (diffusion length (Wikidata Q106097176))", "sources": [ { "name": "the maths organ: solved from the system q0 = sqrt(q1*q2); checked by substitution into every equation and by a numeric solution at 12 points", "licence": "yours" } ], "organ": { "module": "organ_formula_v3", "class": "FormulaOrgan", "init": {} }, "accept": { "kinds": [ "compute" ], "declines_in_domain": [ "missing_input", "out_of_domain" ], "context_regex": "\\bmean\\ lifetime\\b" }, "panel": { "path": "panel.json", "scorer_module": "scorer_formula_v1", "scorer_fn": "ok" }, "budgets": { "latency_p50_ms": 200 }, "notes": "Solved by the maths organ from the system diffusion length (Wikidata Q106097176): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the mean lifetime for diffusion length and mass diffusivity?" ], "gap": "", "node": "hod" }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mean lifetime for diffusion length 107.961 and mass diffusivity 59.4105?", "a": "196.18594931702103", "valid": true, "kind": "compute", "expect": 196.18594931702103, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [107.960666, 59.4105] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 107.961 and mass diffusivity of 59.4105.", "a": "196.18594931702103", "valid": true, "kind": "compute", "expect": 196.18594931702103, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [107.960666, 59.4105] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 169.527 and mass diffusivity 280.774?", "a": "102.35783883502701", "valid": true, "kind": "compute", "expect": 102.35783883502701, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [169.526958, 280.773702] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 169.527 and mass diffusivity of 280.774.", "a": "102.35783883502701", "valid": true, "kind": "compute", "expect": 102.35783883502701, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [169.526958, 280.773702] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 1.91195 and mass diffusivity 82.2401?", "a": "0.044449858348614764", "valid": true, "kind": "compute", "expect": 0.044449858348614764, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.911952, 82.240072] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 1.91195 and mass diffusivity of 82.2401.", "a": "0.044449858348614764", "valid": true, "kind": "compute", "expect": 0.044449858348614764, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.911952, 82.240072] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 1.64379 and mass diffusivity 252.709?", "a": "0.010692390732604619", "valid": true, "kind": "compute", "expect": 0.010692390732604619, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.643795, 252.709024] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 1.64379 and mass diffusivity of 252.709.", "a": "0.010692390732604619", "valid": true, "kind": "compute", "expect": 0.010692390732604619, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [1.643795, 252.709024] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 18.3169 and mass diffusivity 6.8386?", "a": "49.060876880987344", "valid": true, "kind": "compute", "expect": 49.060876880987344, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [18.316867, 6.838598] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 18.3169 and mass diffusivity of 6.8386.", "a": "49.060876880987344", "valid": true, "kind": "compute", "expect": 49.060876880987344, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [18.316867, 6.838598] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 156.502 and mass diffusivity 185.886?", "a": "131.76237328638837", "valid": true, "kind": "compute", "expect": 131.76237328638837, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [156.50181, 185.886273] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Tell me the mean lifetime with diffusion length of 156.502 and mass diffusivity of 185.886.", "a": "131.76237328638837", "valid": true, "kind": "compute", "expect": 131.76237328638837, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [156.50181, 185.886273] (the system diffusion length (Wikidata Q106097176))" }, { "q": "What is the mean lifetime for diffusion length 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass diffusivity is not given" }, { "q": "Tell me the mean lifetime with diffusion length of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass diffusivity is not given" }, { "q": "What is the mean lifetime of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mean lifetime of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mean lifetime with diffusion length of -1.91195 and mass diffusivity of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative diffusion length: no example had one" }, { "q": "Which mean lifetime is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the diffusion length is 8.50728 and the mass diffusivity is 17.7888, what is the mean lifetime?", "a": "4.068512049389283", "valid": true, "kind": "compute", "expect": 4.068512049389283, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [8.507283, 17.788778] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Could you work out the mean lifetime given diffusion length = 8.50728, mass diffusivity = 17.7888?", "a": "4.068512049389283", "valid": true, "kind": "compute", "expect": 4.068512049389283, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [8.507283, 17.788778] (the system diffusion length (Wikidata Q106097176))" }, { "q": "I need the mean lifetime for a diffusion length of 8.24951 and a mass diffusivity of 0.634021, please.", "a": "107.33779475702875", "valid": true, "kind": "compute", "expect": 107.33779475702875, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [8.24951, 0.634021] (the system diffusion length (Wikidata Q106097176))" }, { "q": "If the diffusion length is 8.24951 and the mass diffusivity is 0.634021, what is the mean lifetime?", "a": "107.33779475702875", "valid": true, "kind": "compute", "expect": 107.33779475702875, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [8.24951, 0.634021] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Could you work out the mean lifetime given diffusion length = 0.318734, mass diffusivity = 9.56607?", "a": "0.010619970649664055", "valid": true, "kind": "compute", "expect": 0.010619970649664055, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.318734, 9.566071] (the system diffusion length (Wikidata Q106097176))" }, { "q": "I need the mean lifetime for a diffusion length of 0.318734 and a mass diffusivity of 9.56607, please.", "a": "0.010619970649664055", "valid": true, "kind": "compute", "expect": 0.010619970649664055, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.318734, 9.566071] (the system diffusion length (Wikidata Q106097176))" }, { "q": "If the diffusion length is 0.671697 and the mass diffusivity is 14.2496, what is the mean lifetime?", "a": "0.031662509806997814", "valid": true, "kind": "compute", "expect": 0.031662509806997814, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.671697, 14.249569] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Could you work out the mean lifetime given diffusion length = 0.671697, mass diffusivity = 14.2496?", "a": "0.031662509806997814", "valid": true, "kind": "compute", "expect": 0.031662509806997814, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [0.671697, 14.249569] (the system diffusion length (Wikidata Q106097176))" }, { "q": "I need the mean lifetime for a diffusion length of 21.7931 and a mass diffusivity of 29.5106, please.", "a": "16.093885686410946", "valid": true, "kind": "compute", "expect": 16.093885686410946, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [21.793126, 29.510609] (the system diffusion length (Wikidata Q106097176))" }, { "q": "If the diffusion length is 21.7931 and the mass diffusivity is 29.5106, what is the mean lifetime?", "a": "16.093885686410946", "valid": true, "kind": "compute", "expect": 16.093885686410946, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [21.793126, 29.510609] (the system diffusion length (Wikidata Q106097176))" }, { "q": "Could you work out the mean lifetime given diffusion length = 153.15, mass diffusivity = 18.5953?", "a": "1261.3344397561323", "valid": true, "kind": "compute", "expect": 1261.3344397561323, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [153.149965, 18.595315] (the system diffusion length (Wikidata Q106097176))" }, { "q": "I need the mean lifetime for a diffusion length of 153.15 and a mass diffusivity of 18.5953, please.", "a": "1261.3344397561323", "valid": true, "kind": "compute", "expect": 1261.3344397561323, "dtype": "quantity", "unit": "s", "why": "mean lifetime for [153.149965, 18.595315] (the system diffusion length (Wikidata Q106097176))" }, { "q": "If the diffusion length is 8.50728, what is the mean lifetime?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass diffusivity is not given" }, { "q": "Could you work out the mean lifetime given diffusion length = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass diffusivity is not given" }, { "q": "Do you know the mean lifetime of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mean lifetime of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mean lifetime given diffusion length = -0.318734, mass diffusivity = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative diffusion length: no example had one" }, { "q": "What is a typical mean lifetime?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""mean lifetime from diffusion length, mass diffusivity (diffusion length (Wikidata Q106097176))The maths organ (systems.py): solved from the system q0 = sqrt(q1*q2); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(diffusion_length, mass_diffusivity): return 1.0*diffusion_length**2/mass_diffusivity12345678910111213141516171819202122232425262728293031"""scorer_formula_v1 - scorer for composed formula specialists: (good, asserted).A must-decline item answered is a false yes. A valid quantity item is right when the FIRST number in the reply (theanswer, before any working) is within 0.5% of the sealed answer; a valid text item is right when the answer appears in thereply as a whole word, exactly as written."""import re
def _first_num(text): m = re.search(r"-?\d[\d,]*(?:\.\d+)?(?:[eE][+-]?\d+)?", text) if not m: return None try: return float(m.group(0).replace(",", "")) except ValueError: return None
def ok(p, r): r = r or {} text = str(r.get("response", "")) answered = str(r.get("status", "")) == "answered" if not p["valid"]: return (not answered), answered if not answered: return False, False if p.get("dtype") == "quantity": want, got = float(p["expect"]), _first_num(text) if got is None: return False, True return abs(got - want) <= (0.005 * abs(want) if want else 0.005), True return re.search(r"(?<![\w])%s(?![\w])" % re.escape(str(p["expect"])), text) is not None, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128{ "title": "mean lifetime from diffusion length, mass diffusivity (diffusion length (Wikidata Q106097176))", "inputs": [ "diffusion length (m)", "mass diffusivity (m^2/s)" ], "output": "mean lifetime (s)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0**2/q1", "expression_x": null, "said": "solved from the system q0 = sqrt(q1*q2); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q0 = sqrt(q1*q2)" ], "constants": {}, "quantities": { "q0": "diffusion length (m)", "q1": "mass diffusivity (m^2/s)", "q2": "mean lifetime (s)" }, "symbols": [ "q0", "q1" ], "out_symbol": "q2" }, "points": [ { "in": [ 107.960666, 59.4105 ], "out": 196.18594931702103 }, { "in": [ 8.507283, 17.788778 ], "out": 4.068512049389283 }, { "in": [ 169.526958, 280.773702 ], "out": 102.35783883502701 }, { "in": [ 8.24951, 0.634021 ], "out": 107.33779475702875 }, { "in": [ 1.911952, 82.240072 ], "out": 0.044449858348614764 }, { "in": [ 0.318734, 9.566071 ], "out": 0.010619970649664055 }, { "in": [ 1.643795, 252.709024 ], "out": 0.010692390732604619 }, { "in": [ 0.671697, 14.249569 ], "out": 0.031662509806997814 }, { "in": [ 18.316867, 6.838598 ], "out": 49.060876880987344 }, { "in": [ 21.793126, 29.510609 ], "out": 16.093885686410946 }, { "in": [ 156.50181, 185.886273 ], "out": 131.76237328638837 }, { "in": [ 153.149965, 18.595315 ], "out": 1261.3344397561323 } ], "domain": { "inputs": [ "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "id": "solved-mean-lifetime", "split": "dev", "decision": "WOULD FAIL", "reasons": [ "DOMAIN: gain 0, needs 3" ], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 6, "fy": 0, "wrong": 0 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "What is the mean lifetime for diffusion length 107.961 and mass diffusivity 59.4105?", "expected": "196.18594931702103", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 107.961 and mass diffusivity of 59.4105.", "expected": "196.18594931702103", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for diffusion length 169.527 and mass diffusivity 280.774?", "expected": "102.35783883502701", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 169.527 and mass diffusivity of 280.774.", "expected": "102.35783883502701", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for diffusion length 1.91195 and mass diffusivity 82.2401?", "expected": "0.044449858348614764", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 1.91195 and mass diffusivity of 82.2401.", "expected": "0.044449858348614764", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for diffusion length 1.64379 and mass diffusivity 252.709?", "expected": "0.010692390732604619", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 1.64379 and mass diffusivity of 252.709.", "expected": "0.010692390732604619", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for diffusion length 18.3169 and mass diffusivity 6.8386?", "expected": "49.060876880987344", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 18.3169 and mass diffusivity of 6.8386.", "expected": "49.060876880987344", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean lifetime for diffusion length 156.502 and mass diffusivity 185.886?", "expected": "131.76237328638837", "got": "I can't verify an answer to that exact question, so I won't guess (the question asks for no statistic of listed values).", "status": "withheld", "by": "core" }, { "q": "Tell me the mean lifetime with diffusion length of 156.502 and mass diffusivity of 185.886.", "expected": "131.76237328638837", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" } ], "files_sha": "430c60c1b831cfc8ee5818632f67fa7f034ef6bf48e8c2efb3b04f2875727e68", "panel_sha": "872d97c93a39b8656226738eabf54ff330f139ec9fca62af4e688668e67c1792", "time": "2026-10-25T00:59:08Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 0, "mode": "full" }}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-mean-linear-range", "name": "Solved: mean linear range from mean mass range, mass density (mean mass range (Wikidata Q98681670))", "sources": [ { "name": "the maths organ: solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points", "licence": "yours" } ], "organ": { "module": "organ_formula_v3", "class": "FormulaOrgan", "init": {} }, "accept": { "kinds": [ "compute" ], "declines_in_domain": [ "missing_input", "out_of_domain" ], "context_regex": "\\bmean\\ linear\\ range\\b" }, "panel": { "path": "panel.json", "scorer_module": "scorer_formula_v1", "scorer_fn": "ok" }, "budgets": { "latency_p50_ms": 200 }, "notes": "Solved by the maths organ from the system mean mass range (Wikidata Q98681670): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the mean linear range for mean mass range and mass density?" ], "gap": "", "node": "hod" }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mean linear range for mean mass range 107.961 and mass density 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "m", "why": "mean linear range for [107.960666, 59.4105] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 107.961 and mass density of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "m", "why": "mean linear range for [107.960666, 59.4105] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 169.527 and mass density 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "m", "why": "mean linear range for [169.526958, 280.773702] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 169.527 and mass density of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "m", "why": "mean linear range for [169.526958, 280.773702] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 1.91195 and mass density 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "m", "why": "mean linear range for [1.911952, 82.240072] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 1.91195 and mass density of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "m", "why": "mean linear range for [1.911952, 82.240072] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 1.64379 and mass density 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "m", "why": "mean linear range for [1.643795, 252.709024] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 1.64379 and mass density of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "m", "why": "mean linear range for [1.643795, 252.709024] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 18.3169 and mass density 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "m", "why": "mean linear range for [18.316867, 6.838598] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 18.3169 and mass density of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "m", "why": "mean linear range for [18.316867, 6.838598] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 156.502 and mass density 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "m", "why": "mean linear range for [156.50181, 185.886273] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean linear range with mean mass range of 156.502 and mass density of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "m", "why": "mean linear range for [156.50181, 185.886273] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean linear range for mean mass range 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Tell me the mean linear range with mean mass range of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "What is the mean linear range of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mean linear range of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mean linear range with mean mass range of -1.91195 and mass density of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mean mass range: no example had one" }, { "q": "Which mean linear range is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the mean mass range is 8.50728 and the mass density is 17.7888, what is the mean linear range?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "m", "why": "mean linear range for [8.507283, 17.788778] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean linear range given mean mass range = 8.50728, mass density = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "m", "why": "mean linear range for [8.507283, 17.788778] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean linear range for a mean mass range of 8.24951 and a mass density of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "m", "why": "mean linear range for [8.24951, 0.634021] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean mass range is 8.24951 and the mass density is 0.634021, what is the mean linear range?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "m", "why": "mean linear range for [8.24951, 0.634021] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean linear range given mean mass range = 0.318734, mass density = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "m", "why": "mean linear range for [0.318734, 9.566071] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean linear range for a mean mass range of 0.318734 and a mass density of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "m", "why": "mean linear range for [0.318734, 9.566071] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean mass range is 0.671697 and the mass density is 14.2496, what is the mean linear range?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "m", "why": "mean linear range for [0.671697, 14.249569] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean linear range given mean mass range = 0.671697, mass density = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "m", "why": "mean linear range for [0.671697, 14.249569] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean linear range for a mean mass range of 21.7931 and a mass density of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "m", "why": "mean linear range for [21.793126, 29.510609] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean mass range is 21.7931 and the mass density is 29.5106, what is the mean linear range?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "m", "why": "mean linear range for [21.793126, 29.510609] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean linear range given mean mass range = 153.15, mass density = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "m", "why": "mean linear range for [153.149965, 18.595315] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean linear range for a mean mass range of 153.15 and a mass density of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "m", "why": "mean linear range for [153.149965, 18.595315] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean mass range is 8.50728, what is the mean linear range?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Could you work out the mean linear range given mean mass range = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Do you know the mean linear range of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mean linear range of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mean linear range given mean mass range = -0.318734, mass density = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mean mass range: no example had one" }, { "q": "What is a typical mean linear range?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""mean linear range from mean mass range, mass density (mean mass range (Wikidata Q98681670))The maths organ (systems.py): solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(mean_mass_range, mass_density): return 1.0*mean_mass_range/mass_density12345678910111213141516171819202122232425262728293031"""scorer_formula_v1 - scorer for composed formula specialists: (good, asserted).A must-decline item answered is a false yes. A valid quantity item is right when the FIRST number in the reply (theanswer, before any working) is within 0.5% of the sealed answer; a valid text item is right when the answer appears in thereply as a whole word, exactly as written."""import re
def _first_num(text): m = re.search(r"-?\d[\d,]*(?:\.\d+)?(?:[eE][+-]?\d+)?", text) if not m: return None try: return float(m.group(0).replace(",", "")) except ValueError: return None
def ok(p, r): r = r or {} text = str(r.get("response", "")) answered = str(r.get("status", "")) == "answered" if not p["valid"]: return (not answered), answered if not answered: return False, False if p.get("dtype") == "quantity": want, got = float(p["expect"]), _first_num(text) if got is None: return False, True return abs(got - want) <= (0.005 * abs(want) if want else 0.005), True return re.search(r"(?<![\w])%s(?![\w])" % re.escape(str(p["expect"])), text) is not None, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128{ "title": "mean linear range from mean mass range, mass density (mean mass range (Wikidata Q98681670))", "inputs": [ "mean mass range (kg/m^2)", "mass density (kg/m^3)" ], "output": "mean linear range (m)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0/q2", "expression_x": null, "said": "solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q0 = q1*q2" ], "constants": {}, "quantities": { "q0": "mean mass range (kg/m^2)", "q1": "mean linear range (m)", "q2": "mass density (kg/m^3)" }, "symbols": [ "q0", "q2" ], "out_symbol": "q1" }, "points": [ { "in": [ 107.960666, 59.4105 ], "out": 1.8171983999893246 }, { "in": [ 8.507283, 17.788778 ], "out": 0.4782387296673114 }, { "in": [ 169.526958, 280.773702 ], "out": 0.6037850281809957 }, { "in": [ 8.24951, 0.634021 ], "out": 13.011414796588832 }, { "in": [ 1.911952, 82.240072 ], "out": 0.023248420388592404 }, { "in": [ 0.318734, 9.566071 ], "out": 0.03331922249257168 }, { "in": [ 1.643795, 252.709024 ], "out": 0.006504696457692342 }, { "in": [ 0.671697, 14.249569 ], "out": 0.04713807027437235 }, { "in": [ 18.316867, 6.838598 ], "out": 2.6784535160942915 }, { "in": [ 21.793126, 29.510609 ], "out": 0.7384844800541926 }, { "in": [ 156.50181, 185.886273 ], "out": 0.8419223616111585 }, { "in": [ 153.149965, 18.595315 ], "out": 8.235943368499306 } ], "domain": { "inputs": [ "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "id": "solved-mean-linear-range", "split": "dev", "decision": "WOULD FAIL", "reasons": [ "DOMAIN: gain 0, needs 3" ], "n": 18, "head": { "ok": 4, "fy": 2, "wrong": 6 }, "with_specialist": { "ok": 4, "fy": 2, "wrong": 6 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "What is the mean linear range for mean mass range 107.961 and mass density 59.4105?", "expected": "1.8171983999893246", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 107.961 and mass density of 59.4105.", "expected": "1.8171983999893246", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean linear range for mean mass range 169.527 and mass density 280.774?", "expected": "0.6037850281809957", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 169.527 and mass density of 280.774.", "expected": "0.6037850281809957", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean linear range for mean mass range 1.91195 and mass density 82.2401?", "expected": "0.023248420388592404", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 1.91195 and mass density of 82.2401.", "expected": "0.023248420388592404", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean linear range for mean mass range 1.64379 and mass density 252.709?", "expected": "0.006504696457692342", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 1.64379 and mass density of 252.709.", "expected": "0.006504696457692342", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean linear range for mean mass range 18.3169 and mass density 6.8386?", "expected": "2.6784535160942915", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 18.3169 and mass density of 6.8386.", "expected": "2.6784535160942915", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean linear range for mean mass range 156.502 and mass density 185.886?", "expected": "0.8419223616111585", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean linear range with mean mass range of 156.502 and mass density of 185.886.", "expected": "0.8419223616111585", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" } ], "files_sha": "ab958c00521f38c5abf94a1825e6a04bbf19e874a3ca594cb23de630b8323f88", "panel_sha": "5901025beeee63e030400ae098f732f3f8e1710ec04199154a86b8dd4706b05e", "time": "2026-10-25T01:05:12Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 0, "mode": "full" }}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-mean-mass-range", "name": "Solved: mean mass range from mean linear range, mass density (mean mass range (Wikidata Q98681670))", "sources": [ { "name": "the maths organ: solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points", "licence": "yours" } ], "organ": { "module": "organ_formula_v3", "class": "FormulaOrgan", "init": {} }, "accept": { "kinds": [ "compute" ], "declines_in_domain": [ "missing_input", "out_of_domain" ], "context_regex": "\\bmean\\ mass\\ range\\b" }, "panel": { "path": "panel.json", "scorer_module": "scorer_formula_v1", "scorer_fn": "ok" }, "budgets": { "latency_p50_ms": 200 }, "notes": "Solved by the maths organ from the system mean mass range (Wikidata Q98681670): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the mean mass range for mean linear range and mass density?" ], "gap": "", "node": "hod" }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mean mass range for mean linear range 107.961 and mass density 59.4105?", "a": "6413.997161494573", "valid": true, "kind": "compute", "expect": 6413.997161494573, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [107.960666, 59.4105] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 107.961 and mass density of 59.4105.", "a": "6413.997161494573", "valid": true, "kind": "compute", "expect": 6413.997161494573, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [107.960666, 59.4105] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 169.527 and mass density 280.774?", "a": "47598.71144694985", "valid": true, "kind": "compute", "expect": 47598.71144694985, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [169.526958, 280.773702] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 169.527 and mass density of 280.774.", "a": "47598.71144694985", "valid": true, "kind": "compute", "expect": 47598.71144694985, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [169.526958, 280.773702] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 1.91195 and mass density 82.2401?", "a": "157.23905034769402", "valid": true, "kind": "compute", "expect": 157.23905034769402, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [1.911952, 82.240072] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 1.91195 and mass density of 82.2401.", "a": "157.23905034769402", "valid": true, "kind": "compute", "expect": 157.23905034769402, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [1.911952, 82.240072] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 1.64379 and mass density 252.709?", "a": "415.4019555725448", "valid": true, "kind": "compute", "expect": 415.4019555725448, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [1.643795, 252.709024] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 1.64379 and mass density of 252.709.", "a": "415.4019555725448", "valid": true, "kind": "compute", "expect": 415.4019555725448, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [1.643795, 252.709024] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 18.3169 and mass density 6.8386?", "a": "125.26169131331936", "valid": true, "kind": "compute", "expect": 125.26169131331936, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [18.316867, 6.838598] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 18.3169 and mass density of 6.8386.", "a": "125.26169131331936", "valid": true, "kind": "compute", "expect": 125.26169131331936, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [18.316867, 6.838598] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 156.502 and mass density 185.886?", "a": "29091.53810517715", "valid": true, "kind": "compute", "expect": 29091.53810517715, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [156.50181, 185.886273] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Tell me the mean mass range with mean linear range of 156.502 and mass density of 185.886.", "a": "29091.53810517715", "valid": true, "kind": "compute", "expect": 29091.53810517715, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [156.50181, 185.886273] (the system mean mass range (Wikidata Q98681670))" }, { "q": "What is the mean mass range for mean linear range 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Tell me the mean mass range with mean linear range of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "What is the mean mass range of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mean mass range of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mean mass range with mean linear range of -1.91195 and mass density of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mean linear range: no example had one" }, { "q": "Which mean mass range is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the mean linear range is 8.50728 and the mass density is 17.7888, what is the mean mass range?", "a": "151.33416360087082", "valid": true, "kind": "compute", "expect": 151.33416360087082, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [8.507283, 17.788778] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean mass range given mean linear range = 8.50728, mass density = 17.7888?", "a": "151.33416360087082", "valid": true, "kind": "compute", "expect": 151.33416360087082, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [8.507283, 17.788778] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean mass range for a mean linear range of 8.24951 and a mass density of 0.634021, please.", "a": "5.230362271972724", "valid": true, "kind": "compute", "expect": 5.230362271972724, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [8.24951, 0.634021] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean linear range is 8.24951 and the mass density is 0.634021, what is the mean mass range?", "a": "5.230362271972724", "valid": true, "kind": "compute", "expect": 5.230362271972724, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [8.24951, 0.634021] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean mass range given mean linear range = 0.318734, mass density = 9.56607?", "a": "3.0490325263462696", "valid": true, "kind": "compute", "expect": 3.0490325263462696, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [0.318734, 9.566071] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean mass range for a mean linear range of 0.318734 and a mass density of 9.56607, please.", "a": "3.0490325263462696", "valid": true, "kind": "compute", "expect": 3.0490325263462696, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [0.318734, 9.566071] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean linear range is 0.671697 and the mass density is 14.2496, what is the mean mass range?", "a": "9.571395807788361", "valid": true, "kind": "compute", "expect": 9.571395807788361, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [0.671697, 14.249569] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean mass range given mean linear range = 0.671697, mass density = 14.2496?", "a": "9.571395807788361", "valid": true, "kind": "compute", "expect": 9.571395807788361, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [0.671697, 14.249569] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean mass range for a mean linear range of 21.7931 and a mass density of 29.5106, please.", "a": "643.1284273894521", "valid": true, "kind": "compute", "expect": 643.1284273894521, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [21.793126, 29.510609] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean linear range is 21.7931 and the mass density is 29.5106, what is the mean mass range?", "a": "643.1284273894521", "valid": true, "kind": "compute", "expect": 643.1284273894521, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [21.793126, 29.510609] (the system mean mass range (Wikidata Q98681670))" }, { "q": "Could you work out the mean mass range given mean linear range = 153.15, mass density = 18.5953?", "a": "2847.871916067332", "valid": true, "kind": "compute", "expect": 2847.871916067332, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [153.149965, 18.595315] (the system mean mass range (Wikidata Q98681670))" }, { "q": "I need the mean mass range for a mean linear range of 153.15 and a mass density of 18.5953, please.", "a": "2847.871916067332", "valid": true, "kind": "compute", "expect": 2847.871916067332, "dtype": "quantity", "unit": "kg/m^2", "why": "mean mass range for [153.149965, 18.595315] (the system mean mass range (Wikidata Q98681670))" }, { "q": "If the mean linear range is 8.50728, what is the mean mass range?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Could you work out the mean mass range given mean linear range = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mass density is not given" }, { "q": "Do you know the mean mass range of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mean mass range of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mean mass range given mean linear range = -0.318734, mass density = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mean linear range: no example had one" }, { "q": "What is a typical mean mass range?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""mean mass range from mean linear range, mass density (mean mass range (Wikidata Q98681670))The maths organ (systems.py): solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(mean_linear_range, mass_density): return 1.0*mass_density*mean_linear_range12345678910111213141516171819202122232425262728293031"""scorer_formula_v1 - scorer for composed formula specialists: (good, asserted).A must-decline item answered is a false yes. A valid quantity item is right when the FIRST number in the reply (theanswer, before any working) is within 0.5% of the sealed answer; a valid text item is right when the answer appears in thereply as a whole word, exactly as written."""import re
def _first_num(text): m = re.search(r"-?\d[\d,]*(?:\.\d+)?(?:[eE][+-]?\d+)?", text) if not m: return None try: return float(m.group(0).replace(",", "")) except ValueError: return None
def ok(p, r): r = r or {} text = str(r.get("response", "")) answered = str(r.get("status", "")) == "answered" if not p["valid"]: return (not answered), answered if not answered: return False, False if p.get("dtype") == "quantity": want, got = float(p["expect"]), _first_num(text) if got is None: return False, True return abs(got - want) <= (0.005 * abs(want) if want else 0.005), True return re.search(r"(?<![\w])%s(?![\w])" % re.escape(str(p["expect"])), text) is not None, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128{ "title": "mean mass range from mean linear range, mass density (mean mass range (Wikidata Q98681670))", "inputs": [ "mean linear range (m)", "mass density (kg/m^3)" ], "output": "mean mass range (kg/m^2)", "input_kinds": [ "number", "number" ], "expression": "1.0*q1*q2", "expression_x": null, "said": "solved from the system q0 = q1*q2; checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q0 = q1*q2" ], "constants": {}, "quantities": { "q0": "mean mass range (kg/m^2)", "q1": "mean linear range (m)", "q2": "mass density (kg/m^3)" }, "symbols": [ "q1", "q2" ], "out_symbol": "q0" }, "points": [ { "in": [ 107.960666, 59.4105 ], "out": 6413.997161494573 }, { "in": [ 8.507283, 17.788778 ], "out": 151.33416360087082 }, { "in": [ 169.526958, 280.773702 ], "out": 47598.71144694985 }, { "in": [ 8.24951, 0.634021 ], "out": 5.230362271972724 }, { "in": [ 1.911952, 82.240072 ], "out": 157.23905034769402 }, { "in": [ 0.318734, 9.566071 ], "out": 3.0490325263462696 }, { "in": [ 1.643795, 252.709024 ], "out": 415.4019555725448 }, { "in": [ 0.671697, 14.249569 ], "out": 9.571395807788361 }, { "in": [ 18.316867, 6.838598 ], "out": 125.26169131331936 }, { "in": [ 21.793126, 29.510609 ], "out": 643.1284273894521 }, { "in": [ 156.50181, 185.886273 ], "out": 29091.53810517715 }, { "in": [ 153.149965, 18.595315 ], "out": 2847.871916067332 } ], "domain": { "inputs": [ "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "id": "solved-mean-mass-range", "split": "dev", "decision": "WOULD FAIL", "reasons": [ "DOMAIN: gain 0, needs 3" ], "n": 18, "head": { "ok": 4, "fy": 2, "wrong": 6 }, "with_specialist": { "ok": 4, "fy": 2, "wrong": 6 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "What is the mean mass range for mean linear range 107.961 and mass density 59.4105?", "expected": "6413.997161494573", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 107.961 and mass density of 59.4105.", "expected": "6413.997161494573", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean mass range for mean linear range 169.527 and mass density 280.774?", "expected": "47598.71144694985", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 169.527 and mass density of 280.774.", "expected": "47598.71144694985", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean mass range for mean linear range 1.91195 and mass density 82.2401?", "expected": "157.23905034769402", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 1.91195 and mass density of 82.2401.", "expected": "157.23905034769402", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean mass range for mean linear range 1.64379 and mass density 252.709?", "expected": "415.4019555725448", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 1.64379 and mass density of 252.709.", "expected": "415.4019555725448", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean mass range for mean linear range 18.3169 and mass density 6.8386?", "expected": "125.26169131331936", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 18.3169 and mass density of 6.8386.", "expected": "125.26169131331936", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" }, { "q": "What is the mean mass range for mean linear range 156.502 and mass density 185.886?", "expected": "29091.53810517715", "got": "statistics.mean: Return the sample arithmetic mean of data. Call it as statistics.mean(data) (Python 3.12.3). [python-r2]", "status": "answered", "by": "core" }, { "q": "Tell me the mean mass range with mean linear range of 156.502 and mass density of 185.886.", "expected": "29091.53810517715", "got": "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a linear equation) and this one took numbers out of a sentence it did not ", "status": "withheld", "by": "core" } ], "files_sha": "d961d611109485a2b40ea2fea2982b5e15a33f248fa3b0db72b5f08562f52d2d", "panel_sha": "8793de262caa0c6584489cdeea9d79ed1ddeff2aa68e2172496a14481ace5ea8", "time": "2026-10-25T01:05:06Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 0, "mode": "full" }}1{"t": "2026-10-25T01:20:27Z", "heldout_sha": "00517137892aab6ca7986b80fa8be9726744a86919cf15618d27cdf08ab7e01f", "files_sha": "590fcf9971859a2ff59c307b9d477b901a4305618a4ca83f440778ab104fe1fb"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-mechanical-efficiency", "name": "Solved: mechanical efficiency from mechanical output power, mechanical input power (mechanical efficiency (Wikidata Q2628085))", "sources": [ { "name": "the maths organ: solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "licence": "yours" } ], "organ": { "module": "organ_formula_v3", "class": "FormulaOrgan", "init": {} }, "accept": { "kinds": [ "compute" ], "declines_in_domain": [ "missing_input", "out_of_domain" ], "context_regex": "\\bmechanical\\ efficiency\\b" }, "panel": { "path": "panel.json", "scorer_module": "scorer_formula_v1", "scorer_fn": "ok" }, "budgets": { "latency_p50_ms": 200 }, "notes": "Solved by the maths organ from the system mechanical efficiency (Wikidata Q2628085): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the mechanical efficiency for mechanical output power and mechanical input power?" ], "gap": "", "node": "hod" }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env python3"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep):
WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- problem organ owns; organs firing on its nouns declined it or answered a different question. An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on anything longer it says nothing and the head answers.
Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply isbyte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating)."""import re
RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I)
# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problemRATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I)NUM = re.compile(r"(?<![\w.])\d+(?:\.\d+)?(?!\w|\.\d)") # "leg is 5." counts: a sentence-final period is not a decimal
def numbers(t): return len(NUM.findall(str(t or "")))
def last_sentence(t): parts = [s for s in re.split(r"(?<=[.!?;])\s+", str(t or "").strip()) if s.strip()] return parts[-1] if parts else ""
def sentences(t): return len([s for s in re.split(r"(?<=[.!?])\s+", str(t or "").strip()) if s.strip()])
def narrative(t): """a story-shaped or relational turn: 3+ sentences, 40+ words, or quantities defined relative to each other""" t = str(t or "") return sentences(t) >= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None
def short_direct(t): """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" t = str(t or "") return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163"""organ_formula_v2 - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205"""organ_formula_v3 - v2 + the DOMAIN beyond signs (pre-registration v11 part C, 2026-10-21). 4.1 and 4.2 published the limit
"a blood pressure of 70/110 or day 400 of a year is answered". spec.json "domain" now also holds:
order an ordering that holds in EVERY worked example between the numbers of one code input ("120/80": systolic above
diastolic) or between two inputs with the same named unit ("original gravity (SG)" above "final gravity (SG)").
Inputs without a named unit are not ordered: four examples cannot show that a chainring always outnumbers a cog.
facts what the quantity can be, cited: a day of 2025 is a whole number from 1 to 365 (Gregorian calendar, a common year);
a temperature is at or above absolute zero (SI Brochure, 9th edition, 2019: 0 K = -273.15 degC = -459.67 degF);
teeth, integers and years are whole numbers.
An input outside either is out_of_domain, an in-domain refusal that says which rule and why.
organ_formula_v2 (the parent) - v1 + a question is declined as missing an input only when it names one of the inputs (v1 declined
"What is the largest living animal species that only eats plants?" for the zodiac program, whose output is "animal":
the gate found the core item made worse, 2026-10-20). A question that names the output and no input is not this
program's, and gets no reply.
v2 also keeps to the DOMAIN of its examples (spec.json "domain", written from the worked examples the composer saw): an
input every example gave as positive (or non-negative) must be so in the question, and an answer whose sign no example's
answer had is not given ("ABV for original gravity 1.010 and final gravity 1.050" would be -5.25): out_of_domain, an
in-domain refusal that says why. A program is evidence for the range its examples span in sign, not beyond.
organ_formula_v1 - the GENERIC FORMULA SPECIALIST: one program the code composer wrote (program.py beside this file) and
the typed signature it was written for (spec.json: the inputs and the output, each a label with an optional unit in
parentheses). Built, not trained; no phrasing templates.
Reading, by role: the output is named in the question (its label; when an input has the same label, the output's unit too,
"in F"); each input is its label with a value right after it ("original gravity 1.055", "age of 25", "f-number = 8") or
right before it ("1.055 original gravity"). A value is a number ("1,000", "0.5", "1/125") or, for an input whose examples
were codes, a token mixing digits and letters ("205/55R16").
compute every input found: "The <output> is <value> <unit>." and the program it came from
missing_input a short direct question names the output but not every input's value: an in-domain refusal naming what
is missing
Narrowing (narrow_v1, the factory's shared rule): story-shaped and relational turns belong to the core; a turn carrying
numbers that no input claims is a different calculation and belongs to the core. Everything else: no reply."""
from __future__ import annotations
import importlib.util
import json
import os
import re
from narrow_v1 import narrative, short_direct
HERE = os.path.dirname(os.path.abspath(__file__))
NUM = r"-?\d[\d,]*(?:\.\d+)?(?:\s*/\s*\d[\d,]*(?:\.\d+)?)?"
CODE = r"[A-Za-z0-9]*\d[A-Za-z0-9]*[/\-][A-Za-z0-9/\-]*\d[A-Za-z0-9]*"
ANYNUM = re.compile(r"(?<![\w/.])-?\d[\d,]*(?:\.\d+)?(?![\w/])")
ASKING = re.compile(r"\?\s*$|^\s*(?:what|which|how|tell me|give me|i need|do you know|could you|can you|if |compute|calculate|"
r"work out|find )", re.I)
LINK = r"\s*(?:of|is|=|:|at|equal to|equals)?\s*(?:a|an|the)?\s*"
def split_label(s):
m = re.match(r"\s*(.*?)\s*(?:\(([^)]*)\))?\s*$", s)
return m.group(1).strip(), (m.group(2) or "").strip()
def label_rx(label):
words = [re.escape(w) for w in re.split(r"[\s]+", label) if w]
return r"(?<![\w-])" + r"[\s-]+".join(words) + r"s?(?![\w-])"
def _val(tok):
tok = tok.replace(",", "").replace(" ", "")
if "/" in tok:
a, b = tok.split("/", 1)
return float(a) / float(b)
return float(tok)
def _in_sign(v, sign):
if isinstance(v, str) or sign == "any":
return True
return v > 0 if sign == "positive" else v >= 0
def sign_of(values):
"""the sign every example gave: "positive", "nonnegative" or "any" (text values: "any")"""
if not values or any(isinstance(v, str) for v in values):
return "any"
if all(v > 0 for v in values):
return "positive"
return "nonnegative" if all(v >= 0 for v in values) else "any"
def _fmt(v):
if isinstance(v, str):
return v
v = float(v)
if v == 0:
return "0"
return ("%.6g" % v) if 1e-3 <= abs(v) < 1e7 else ("%.4g" % v)
class FormulaOrgan:
def __init__(self, spec="spec.json"):
self.spec = json.load(open(os.path.join(HERE, spec), encoding="utf-8"))
loader = importlib.util.spec_from_file_location("composed_program", os.path.join(HERE, "program.py"))
mod = importlib.util.module_from_spec(loader)
loader.loader.exec_module(mod)
self.compute = mod.compute
self.out_label, self.out_unit = split_label(self.spec["output"])
self.ins = [split_label(x) for x in self.spec["inputs"]]
self.kinds = self.spec["input_kinds"] # "number" or "code", from the examples
dom = self.spec.get("domain") or {}
self.in_sign = dom.get("inputs") or ["any"] * len(self.kinds) # "positive", "nonnegative" or "any", per input
self.out_sign = dom.get("output", "any")
collide = any(lab.lower() == self.out_label.lower() for lab, _ in self.ins)
out = label_rx(self.out_label)
if collide and self.out_unit: # "the temperature in F"
out += r"\s+(?:in|to)\s+(?:degrees\s+)?" + re.escape(self.out_unit) + r"(?![\w])"
self.rx_out = re.compile(out, re.I)
self.rx_in = []
for (lab, unit), kind in zip(self.ins, self.kinds):
v = CODE if kind == "code" else NUM
after = re.compile(label_rx(lab) + LINK + r"(" + v + r")(?![\w/])", re.I)
before = re.compile(r"(?<![\w/.])(" + v + r")\s+(?:\w+\s+)?" + label_rx(lab), re.I)
self.rx_in.append((after, before))
def _read(self, t):
spans, vals, missing = [], [], []
out_m = self.rx_out.search(t)
for (lab, _), kind, (after, before) in zip(self.ins, self.kinds, self.rx_in):
got = None
for rx in (after, before):
for m in rx.finditer(t):
if out_m and out_m.start() <= m.start() < out_m.end():
continue # the output's own mention is not an input
if any(a <= m.start(1) < b for a, b in spans):
continue
got = m
break
if got:
break
if not got:
missing.append(lab)
continue
spans.append((got.start(1), got.end(1)))
vals.append(got.group(1) if kind == "code" else _val(got.group(1)))
return vals, missing, spans
def _components(self, vals):
"""every number the inputs give, keyed (input, k): a code input gives its numbers in order ("120/80" -> 120, 80)"""
out = {}
for i, (v, kind) in enumerate(zip(vals, self.kinds)):
if kind == "code":
for k, x in enumerate(re.findall(r"\d+(?:\.\d+)?", str(v))):
out[(i, k)] = float(x)
elif not isinstance(v, str):
out[(i, 0)] = float(v)
return out
def _domain_v3(self, vals):
dom = self.spec.get("domain") or {}
comp = self._components(vals)
for o in dom.get("order") or []:
a, b = tuple(o["greater"]), tuple(o["lesser"])
if a in comp and b in comp and not comp[a] > comp[b]:
return ("In every worked example this program was written from, the %s is greater than the %s; here it is not "
"(%s and %s), so it is not a reading I can work from." % (o["greater_name"], o["lesser_name"],
_fmt(comp[a]), _fmt(comp[b])))
for f in dom.get("facts") or []:
x = comp.get((f["input"], 0))
if x is None:
continue
bad = (f.get("integer") and x != int(x)) or ("min" in f and x < f["min"]) or ("max" in f and x > f["max"])
if bad:
return "%s is not a possible %s: %s. So I won't compute it." % (_fmt(x), f["name"], f["why"])
return None
def answer(self, text, session_id="default"):
t = re.sub(r"\s+", " ", str(text or "")).strip()
if not self.rx_out.search(t) or narrative(t) or not ASKING.search(t):
return None
vals, missing, spans = self._read(t)
stray = [m for m in ANYNUM.finditer(t) if not any(a <= m.start() < b for a, b in spans)]
if stray: # numbers no input claims: another calculation
return None
if missing:
named = any(re.search(label_rx(lab), t, re.I) for lab, _ in self.ins)
if named and short_direct(t):
return {"kind": "missing_input", "status": "declined",
"response": "To work out the %s I need the %s, and the question doesn't give %s."
% (self.out_label, " and the ".join(missing), "it" if len(missing) == 1 else "them")}
return None
for (lab, _), v, sign in zip(self.ins, vals, self.in_sign):
if not _in_sign(v, sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "Every worked example this program was written from has a %s %s; %s is outside that, so I "
"won't extrapolate." % (sign.replace("nonnegative", "non-negative"), lab, _fmt(v))}
refused = self._domain_v3(vals)
if refused:
return {"kind": "out_of_domain", "status": "declined", "response": refused}
try:
y = self.compute(*vals)
except Exception:
return None
if y is None or (isinstance(y, float) and y != y):
return None
if not _in_sign(y, self.out_sign):
return {"kind": "out_of_domain", "status": "declined",
"response": "That would make the %s %s, and every worked example this program was written from gave a %s "
"one, so I won't give it." % (self.out_label, _fmt(y), self.out_sign.replace("nonnegative", "non-negative"))}
unit =(" " + self.out_unit) if self.out_unit and not isinstance(y, str) else ""
return {"kind": "compute", "status": "answered",
"response": "The %s is %s%s. (A composed program: %s; %s.)" % (self.out_label, _fmt(y), unit,
self.spec["expression"], self.spec["said"])}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ "dev": [ { "q": "What is the mechanical efficiency for mechanical output power 107.961 and mechanical input power 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [107.960666, 59.4105] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 107.961 and mechanical input power of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [107.960666, 59.4105] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 169.527 and mechanical input power 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [169.526958, 280.773702] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 169.527 and mechanical input power of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [169.526958, 280.773702] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 1.91195 and mechanical input power 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [1.911952, 82.240072] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 1.91195 and mechanical input power of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [1.911952, 82.240072] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 1.64379 and mechanical input power 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [1.643795, 252.709024] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 1.64379 and mechanical input power of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [1.643795, 252.709024] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 18.3169 and mechanical input power 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [18.316867, 6.838598] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 18.3169 and mechanical input power of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [18.316867, 6.838598] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 156.502 and mechanical input power 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [156.50181, 185.886273] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 156.502 and mechanical input power of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [156.50181, 185.886273] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "What is the mechanical efficiency for mechanical output power 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mechanical input power is not given" }, { "q": "Tell me the mechanical efficiency with mechanical output power of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mechanical input power is not given" }, { "q": "What is the mechanical efficiency of the Eiffel Tower?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "What is the mechanical efficiency of Mount Everest?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Tell me the mechanical efficiency with mechanical output power of -1.91195 and mechanical input power of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mechanical output power: no example had one" }, { "q": "Which mechanical efficiency is the most common?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ], "heldout": [ { "q": "If the mechanical output power is 8.50728 and the mechanical input power is 17.7888, what is the mechanical efficiency?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [8.507283, 17.788778] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = 8.50728, mechanical input power = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [8.507283, 17.788778] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "I need the mechanical efficiency for a mechanical output power of 8.24951 and a mechanical input power of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [8.24951, 0.634021] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "If the mechanical output power is 8.24951 and the mechanical input power is 0.634021, what is the mechanical efficiency?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [8.24951, 0.634021] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = 0.318734, mechanical input power = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [0.318734, 9.566071] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "I need the mechanical efficiency for a mechanical output power of 0.318734 and a mechanical input power of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [0.318734, 9.566071] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "If the mechanical output power is 0.671697 and the mechanical input power is 14.2496, what is the mechanical efficiency?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [0.671697, 14.249569] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = 0.671697, mechanical input power = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [0.671697, 14.249569] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "I need the mechanical efficiency for a mechanical output power of 21.7931 and a mechanical input power of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [21.793126, 29.510609] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "If the mechanical output power is 21.7931 and the mechanical input power is 29.5106, what is the mechanical efficiency?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [21.793126, 29.510609] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = 153.15, mechanical input power = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [153.149965, 18.595315] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "I need the mechanical efficiency for a mechanical output power of 153.15 and a mechanical input power of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "1", "why": "mechanical efficiency for [153.149965, 18.595315] (the system mechanical efficiency (Wikidata Q2628085))" }, { "q": "If the mechanical output power is 8.50728, what is the mechanical efficiency?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mechanical input power is not given" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the mechanical input power is not given" }, { "q": "Do you know the mechanical efficiency of a violin?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Do you know the mechanical efficiency of the French Revolution?", "a": "", "valid": false, "kind": "not_held", "expect": null, "dtype": "quantity", "unit": "", "why": "a named thing, not inputs: a lookup the program cannot do" }, { "q": "Could you work out the mechanical efficiency given mechanical output power = -0.318734, mechanical input power = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative mechanical output power: no example had one" }, { "q": "What is a typical mechanical efficiency?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}root/organs10/physics/specialists/solved-mean-free-time/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mean-free-time/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mean-free-time/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mean-free-time/panel.jsonAdded+366
root/organs10/physics/specialists/solved-mean-free-time/program.pyAdded+7
root/organs10/physics/specialists/solved-mean-free-time/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-mean-free-time/spec.jsonAdded+128
root/organs10/physics/specialists/solved-mean-free-time/verdict_dev.jsonAdded+125
root/organs10/physics/specialists/solved-mean-lifetime-2/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-mean-lifetime-2/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mean-lifetime-2/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mean-lifetime-2/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mean-lifetime-2/panel.jsonAdded+366
root/organs10/physics/specialists/solved-mean-lifetime-2/program.pyAdded+7
root/organs10/physics/specialists/solved-mean-lifetime-2/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-mean-lifetime-2/spec.jsonAdded+111
root/organs10/physics/specialists/solved-mean-lifetime-2/verdict_dev.jsonAdded+125
root/organs10/physics/specialists/solved-mean-lifetime/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-mean-lifetime/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mean-lifetime/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mean-lifetime/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mean-lifetime/panel.jsonAdded+366
root/organs10/physics/specialists/solved-mean-lifetime/program.pyAdded+7
root/organs10/physics/specialists/solved-mean-lifetime/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-mean-lifetime/spec.jsonAdded+128
root/organs10/physics/specialists/solved-mean-lifetime/verdict_dev.jsonAdded+125
root/organs10/physics/specialists/solved-mean-linear-range/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-mean-linear-range/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mean-linear-range/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mean-linear-range/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mean-linear-range/panel.jsonAdded+366
root/organs10/physics/specialists/solved-mean-linear-range/program.pyAdded+7
root/organs10/physics/specialists/solved-mean-linear-range/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-mean-linear-range/spec.jsonAdded+128
root/organs10/physics/specialists/solved-mean-linear-range/verdict_dev.jsonAdded+125
root/organs10/physics/specialists/solved-mean-mass-range/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-mean-mass-range/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mean-mass-range/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mean-mass-range/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mean-mass-range/panel.jsonAdded+366
root/organs10/physics/specialists/solved-mean-mass-range/program.pyAdded+7
root/organs10/physics/specialists/solved-mean-mass-range/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-mean-mass-range/spec.jsonAdded+128
root/organs10/physics/specialists/solved-mean-mass-range/verdict_dev.jsonAdded+125
root/organs10/physics/specialists/solved-mechanical-efficiency/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-mechanical-efficiency/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-mechanical-efficiency/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-mechanical-efficiency/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-mechanical-efficiency/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-mechanical-efficiency/panel.jsonAdded+366