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 12)
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-impact-speed-2/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-impact-speed-2/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-impact-speed-2/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-impact-speed-2/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-impact-speed-2/program.pyAdded+7
- root/organs10/physics/specialists/solved-impact-speed-2/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-impact-speed-2/spec.jsonAdded+119
- root/organs10/physics/specialists/solved-impact-speed-2/verdict_dev.jsonAdded+32
- root/organs10/physics/specialists/solved-impact-speed-2/verdict_heldout.jsonAdded+33
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/program.pyAdded+7
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-incident-radiant-flux-2/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/program.pyAdded+7
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-incident-radiant-flux-3/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-incident-radiant-flux/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-incident-radiant-flux/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-incident-radiant-flux/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-incident-radiant-flux/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-incident-radiant-flux/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-incident-radiant-flux/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-incident-radiant-flux/program.pyAdded+7
- root/organs10/physics/specialists/solved-incident-radiant-flux/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-incident-radiant-flux/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-incident-radiant-flux/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-incident-radiant-flux/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-inductance/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-inductance/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-inductance/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-inductance/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-inductance/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-inductance/program.pyAdded+7
- root/organs10/physics/specialists/solved-inductance/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-inductance/spec.jsonAdded+128
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 impact speed for fall time 107.961?", "a": "1058.732464149796", "valid": true, "kind": "compute", "expect": 1058.732464149796, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [107.960666] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 107.961.", "a": "1058.732464149796", "valid": true, "kind": "compute", "expect": 1058.732464149796, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [107.960666] (the system Free fall)" }, { "q": "What is the impact speed for fall time 6.34623?", "a": "62.235213240556966", "valid": true, "kind": "compute", "expect": 62.235213240556966, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [6.346226] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 6.34623.", "a": "62.235213240556966", "valid": true, "kind": "compute", "expect": 62.235213240556966, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [6.346226] (the system Free fall)" }, { "q": "What is the impact speed for fall time 0.551236?", "a": "5.405777063355242", "valid": true, "kind": "compute", "expect": 5.405777063355242, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.551236] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 0.551236.", "a": "5.405777063355242", "valid": true, "kind": "compute", "expect": 5.405777063355242, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.551236] (the system Free fall)" }, { "q": "What is the impact speed for fall time 186.27?", "a": "1826.6852560600696", "valid": true, "kind": "compute", "expect": 1826.6852560600696, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [186.270057] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 186.27.", "a": "1826.6852560600696", "valid": true, "kind": "compute", "expect": 1826.6852560600696, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [186.270057] (the system Free fall)" }, { "q": "What is the impact speed for fall time 0.710236?", "a": "6.965039042499072", "valid": true, "kind": "compute", "expect": 6.965039042499072, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.710236] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 0.710236.", "a": "6.965039042499072", "valid": true, "kind": "compute", "expect": 6.965039042499072, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.710236] (the system Free fall)" }, { "q": "What is the impact speed for fall time 79.8435?", "a": "782.9976284045038", "valid": true, "kind": "compute", "expect": 782.9976284045038, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [79.843538] (the system Free fall)" }, { "q": "Tell me the impact speed with fall time of 79.8435.", "a": "782.9976284045038", "valid": true, "kind": "compute", "expect": 782.9976284045038, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [79.843538] (the system Free fall)" }, { "q": "What is the impact speed?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the fall time is not given" }, { "q": "Could you work out the impact speed, please?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the fall time is not given" }, { "q": "What is the impact speed 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 impact speed 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 impact speed with fall time of -0.551236.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative fall time: no example had one" }, { "q": "Which impact speed 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 fall time is 58.5346, what is the impact speed?", "a": "574.0282789827824", "valid": true, "kind": "compute", "expect": 574.0282789827824, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [58.534594] (the system Free fall)" }, { "q": "Could you work out the impact speed given fall time = 58.5346?", "a": "574.0282789827824", "valid": true, "kind": "compute", "expect": 574.0282789827824, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [58.534594] (the system Free fall)" }, { "q": "I need the impact speed for a fall time of 31.9492, please.", "a": "313.31434492634656", "valid": true, "kind": "compute", "expect": 313.31434492634656, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [31.949172] (the system Free fall)" }, { "q": "If the fall time is 31.9492, what is the impact speed?", "a": "313.31434492634656", "valid": true, "kind": "compute", "expect": 313.31434492634656, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [31.949172] (the system Free fall)" }, { "q": "Could you work out the impact speed given fall time = 6.8386?", "a": "67.06373767906294", "valid": true, "kind": "compute", "expect": 67.06373767906294, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [6.838598] (the system Free fall)" }, { "q": "I need the impact speed for a fall time of 6.8386, please.", "a": "67.06373767906294", "valid": true, "kind": "compute", "expect": 67.06373767906294, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [6.838598] (the system Free fall)" }, { "q": "If the fall time is 17.3414, what is the impact speed?", "a": "170.0613834781648", "valid": true, "kind": "compute", "expect": 170.0613834781648, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [17.341435] (the system Free fall)" }, { "q": "Could you work out the impact speed given fall time = 17.3414?", "a": "170.0613834781648", "valid": true, "kind": "compute", "expect": 170.0613834781648, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [17.341435] (the system Free fall)" }, { "q": "I need the impact speed for a fall time of 0.380269, please.", "a": "3.7291603636697994", "valid": true, "kind": "compute", "expect": 3.7291603636697994, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.380269] (the system Free fall)" }, { "q": "If the fall time is 0.380269, what is the impact speed?", "a": "3.7291603636697994", "valid": true, "kind": "compute", "expect": 3.7291603636697994, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [0.380269] (the system Free fall)" }, { "q": "Could you work out the impact speed given fall time = 291.545?", "a": "2859.078776895802", "valid": true, "kind": "compute", "expect": 2859.078776895802, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [291.544898] (the system Free fall)" }, { "q": "I need the impact speed for a fall time of 291.545, please.", "a": "2859.078776895802", "valid": true, "kind": "compute", "expect": 2859.078776895802, "dtype": "quantity", "unit": "m/s", "why": "impact speed for [291.544898] (the system Free fall)" }, { "q": "I need the impact speed, please.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the fall time is not given" }, { "q": "Can you tell me the impact speed?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the fall time is not given" }, { "q": "Do you know the impact speed 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 impact speed 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 impact speed given fall time = -6.8386?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative fall time: no example had one" }, { "q": "What is a typical impact speed?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""impact speed from fall time (Free fall)The maths organ (systems.py): solved from the system h = g*t**2/2; v = g*t; checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(fall_time): return 9.80665*fall_time12345678910111213141516171819202122232425262728293031"""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, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119{ "title": "impact speed from fall time (Free fall)", "inputs": [ "fall time (s)" ], "output": "impact speed (m/s)", "input_kinds": [ "number" ], "expression": "9.80665*t", "expression_x": null, "said": "solved from the system h = g*t**2/2; v = g*t; checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "h = g*t**2/2", "v = g*t" ], "constants": { "g": [ "standard gravity", 9.80665, "m/s^2" ] }, "quantities": { "h": "drop height (m)", "t": "fall time (s)", "v": "impact speed (m/s)" }, "symbols": [ "t" ], "out_symbol": "v" }, "points": [ { "in": [ 107.960666 ], "out": 1058.732464149796 }, { "in": [ 58.534594 ], "out": 574.0282789827824 }, { "in": [ 6.346226 ], "out": 62.235213240556966 }, { "in": [ 31.949172 ], "out": 313.31434492634656 }, { "in": [ 0.551236 ], "out": 5.405777063355242 }, { "in": [ 6.838598 ], "out": 67.06373767906294 }, { "in": [ 186.270057 ], "out": 1826.6852560600696 }, { "in": [ 17.341435 ], "out": 170.0613834781648 }, { "in": [ 0.710236 ], "out": 6.965039042499072 }, { "in": [ 0.380269 ], "out": 3.7291603636697994 }, { "in": [ 79.843538 ], "out": 782.9976284045038 }, { "in": [ 291.544898 ], "out": 2859.078776895802 } ], "domain": { "inputs": [ "positive" ], "output": "positive", "order": [], "facts": [] }}1234567891011121314151617181920212223242526272829303132{ "id": "solved-impact-speed-2", "split": "dev", "decision": "WOULD PASS", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "bfb724a5bb546f379c1ec863e97b114834b65b7db6ab9fa4fdb5a915d86af310", "panel_sha": "0a16fc515eb74dcf6a7df46a7624fa5045cca4eabe109b168f17b2935a8618b2", "time": "2026-10-24T00:22:02Z", "core_head": "oracle_release_runtime_w571"}123456789101112131415161718192021222324252627282930313233{ "id": "solved-impact-speed-2", "split": "heldout", "decision": "ADMIT", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "bfb724a5bb546f379c1ec863e97b114834b65b7db6ab9fa4fdb5a915d86af310", "panel_sha": "f3f0263101f6c20c4165412696d0294738d517473f5055a86c0dc7444be6f6f8", "time": "2026-10-24T00:22:05Z", "core_head": "oracle_release_runtime_w571", "memory": "written to your group's memory"}1{"t": "2026-10-25T01:19:45Z", "heldout_sha": "3610a1f84c7113f17722d5353d1968ddf21cb3e3fe2fa8aa4564ff050e206bc2", "files_sha": "03cee4c2643e993f68182c6dd83ad2f7b81ac0c77f3cb6785291bc9d6636fc79"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-incident-radiant-flux-2", "name": "Solved: incident radiant flux from absorbed radiant flux, absorptance (absorptance (Wikidata Q16635541))", "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": "\\bincident\\ radiant\\ flux\\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 absorptance (Wikidata Q16635541): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the incident radiant flux for absorbed radiant flux and absorptance?" ], "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 incident radiant flux for absorbed radiant flux 107.961 and absorptance 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 107.961 and absorptance of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 169.527 and absorptance 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 169.527 and absorptance of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 1.91195 and absorptance 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 1.91195 and absorptance of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 1.64379 and absorptance 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 1.64379 and absorptance of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 18.3169 and absorptance 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 18.3169 and absorptance of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 156.502 and absorptance 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system absorptance (Wikidata Q16635541))" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 156.502 and absorptance of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system absorptance (Wikidata Q16635541))" }, { "q": "What is the incident radiant flux for absorbed radiant flux 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the absorptance is not given" }, { "q": "Tell me the incident radiant flux with absorbed radiant flux of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the absorptance is not given" }, { "q": "What is the incident radiant flux 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 incident radiant flux 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 incident radiant flux with absorbed radiant flux of -1.91195 and absorptance of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative absorbed radiant flux: no example had one" }, { "q": "Which incident radiant flux 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 absorbed radiant flux is 8.50728 and the absorptance is 17.7888, what is the incident radiant flux?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system absorptance (Wikidata Q16635541))" }, { "q": "Could you work out the incident radiant flux given absorbed radiant flux = 8.50728, absorptance = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system absorptance (Wikidata Q16635541))" }, { "q": "I need the incident radiant flux for an absorbed radiant flux of 8.24951 and an absorptance of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system absorptance (Wikidata Q16635541))" }, { "q": "If the absorbed radiant flux is 8.24951 and the absorptance is 0.634021, what is the incident radiant flux?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system absorptance (Wikidata Q16635541))" }, { "q": "Could you work out the incident radiant flux given absorbed radiant flux = 0.318734, absorptance = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system absorptance (Wikidata Q16635541))" }, { "q": "I need the incident radiant flux for an absorbed radiant flux of 0.318734 and an absorptance of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system absorptance (Wikidata Q16635541))" }, { "q": "If the absorbed radiant flux is 0.671697 and the absorptance is 14.2496, what is the incident radiant flux?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system absorptance (Wikidata Q16635541))" }, { "q": "Could you work out the incident radiant flux given absorbed radiant flux = 0.671697, absorptance = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system absorptance (Wikidata Q16635541))" }, { "q": "I need the incident radiant flux for an absorbed radiant flux of 21.7931 and an absorptance of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system absorptance (Wikidata Q16635541))" }, { "q": "If the absorbed radiant flux is 21.7931 and the absorptance is 29.5106, what is the incident radiant flux?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system absorptance (Wikidata Q16635541))" }, { "q": "Could you work out the incident radiant flux given absorbed radiant flux = 153.15, absorptance = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system absorptance (Wikidata Q16635541))" }, { "q": "I need the incident radiant flux for an absorbed radiant flux of 153.15 and an absorptance of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system absorptance (Wikidata Q16635541))" }, { "q": "If the absorbed radiant flux is 8.50728, what is the incident radiant flux?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the absorptance is not given" }, { "q": "Could you work out the incident radiant flux given absorbed radiant flux = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the absorptance is not given" }, { "q": "Do you know the incident radiant flux 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 incident radiant flux 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 incident radiant flux given absorbed radiant flux = -0.318734, absorptance = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative absorbed radiant flux: no example had one" }, { "q": "What is a typical incident radiant flux?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""incident radiant flux from absorbed radiant flux, absorptance (absorptance (Wikidata Q16635541))The maths organ (systems.py): solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(absorbed_radiant_flux, absorptance): return 1.0*absorbed_radiant_flux/absorptance12345678910111213141516171819202122232425262728293031"""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": "incident radiant flux from absorbed radiant flux, absorptance (absorptance (Wikidata Q16635541))", "inputs": [ "absorbed radiant flux (W)", "absorptance (1)" ], "output": "incident radiant flux (W)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0/q2", "expression_x": null, "said": "solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q2 = ((q0)/(q1))" ], "constants": {}, "quantities": { "q0": "absorbed radiant flux (W)", "q1": "incident radiant flux (W)", "q2": "absorptance (1)" }, "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": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-incident-radiant-flux-2", "split": "dev", "decision": "WOULD PASS", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "03cee4c2643e993f68182c6dd83ad2f7b81ac0c77f3cb6785291bc9d6636fc79", "panel_sha": "0026e359a41c9122bc779bed31f660e7d44ce12c7cb73c5fea7faec6260d0861", "time": "2026-10-25T01:19:45Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-incident-radiant-flux-2", "split": "heldout", "decision": "ADMIT", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "03cee4c2643e993f68182c6dd83ad2f7b81ac0c77f3cb6785291bc9d6636fc79", "panel_sha": "3610a1f84c7113f17722d5353d1968ddf21cb3e3fe2fa8aa4564ff050e206bc2", "time": "2026-10-25T01:19:45Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }, "memory": "written to your group's memory"}1{"t": "2026-10-25T01:21:31Z", "heldout_sha": "bf7e6392bb0b0c4eed7e7acea1a4ec9312edb3f20666aa80d1fea8d7f9950591", "files_sha": "c2a71152c11356b8c263672f884a186a956c35c94b03c3160c5ef9ce645509e6"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-incident-radiant-flux-3", "name": "Solved: incident radiant flux from reflected radiant flux, reflectance (reflectance (Wikidata Q663650))", "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": "\\bincident\\ radiant\\ flux\\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 reflectance (Wikidata Q663650): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the incident radiant flux for reflected radiant flux and reflectance?" ], "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 incident radiant flux for reflected radiant flux 107.961 and reflectance 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 107.961 and reflectance of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 169.527 and reflectance 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 169.527 and reflectance of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 1.91195 and reflectance 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 1.91195 and reflectance of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 1.64379 and reflectance 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 1.64379 and reflectance of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 18.3169 and reflectance 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 18.3169 and reflectance of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 156.502 and reflectance 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system reflectance (Wikidata Q663650))" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 156.502 and reflectance of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system reflectance (Wikidata Q663650))" }, { "q": "What is the incident radiant flux for reflected radiant flux 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the reflectance is not given" }, { "q": "Tell me the incident radiant flux with reflected radiant flux of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the reflectance is not given" }, { "q": "What is the incident radiant flux 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 incident radiant flux 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 incident radiant flux with reflected radiant flux of -1.91195 and reflectance of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative reflected radiant flux: no example had one" }, { "q": "Which incident radiant flux 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 reflected radiant flux is 8.50728 and the reflectance is 17.7888, what is the incident radiant flux?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system reflectance (Wikidata Q663650))" }, { "q": "Could you work out the incident radiant flux given reflected radiant flux = 8.50728, reflectance = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system reflectance (Wikidata Q663650))" }, { "q": "I need the incident radiant flux for a reflected radiant flux of 8.24951 and a reflectance of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system reflectance (Wikidata Q663650))" }, { "q": "If the reflected radiant flux is 8.24951 and the reflectance is 0.634021, what is the incident radiant flux?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system reflectance (Wikidata Q663650))" }, { "q": "Could you work out the incident radiant flux given reflected radiant flux = 0.318734, reflectance = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system reflectance (Wikidata Q663650))" }, { "q": "I need the incident radiant flux for a reflected radiant flux of 0.318734 and a reflectance of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system reflectance (Wikidata Q663650))" }, { "q": "If the reflected radiant flux is 0.671697 and the reflectance is 14.2496, what is the incident radiant flux?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system reflectance (Wikidata Q663650))" }, { "q": "Could you work out the incident radiant flux given reflected radiant flux = 0.671697, reflectance = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system reflectance (Wikidata Q663650))" }, { "q": "I need the incident radiant flux for a reflected radiant flux of 21.7931 and a reflectance of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system reflectance (Wikidata Q663650))" }, { "q": "If the reflected radiant flux is 21.7931 and the reflectance is 29.5106, what is the incident radiant flux?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system reflectance (Wikidata Q663650))" }, { "q": "Could you work out the incident radiant flux given reflected radiant flux = 153.15, reflectance = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system reflectance (Wikidata Q663650))" }, { "q": "I need the incident radiant flux for a reflected radiant flux of 153.15 and a reflectance of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system reflectance (Wikidata Q663650))" }, { "q": "If the reflected radiant flux is 8.50728, what is the incident radiant flux?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the reflectance is not given" }, { "q": "Could you work out the incident radiant flux given reflected radiant flux = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the reflectance is not given" }, { "q": "Do you know the incident radiant flux 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 incident radiant flux 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 incident radiant flux given reflected radiant flux = -0.318734, reflectance = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative reflected radiant flux: no example had one" }, { "q": "What is a typical incident radiant flux?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""incident radiant flux from reflected radiant flux, reflectance (reflectance (Wikidata Q663650))The maths organ (systems.py): solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(reflected_radiant_flux, reflectance): return 1.0*reflected_radiant_flux/reflectance12345678910111213141516171819202122232425262728293031"""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": "incident radiant flux from reflected radiant flux, reflectance (reflectance (Wikidata Q663650))", "inputs": [ "reflected radiant flux (W)", "reflectance (1)" ], "output": "incident radiant flux (W)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0/q2", "expression_x": null, "said": "solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q2 = ((q0)/(q1))" ], "constants": {}, "quantities": { "q0": "reflected radiant flux (W)", "q1": "incident radiant flux (W)", "q2": "reflectance (1)" }, "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": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-incident-radiant-flux-3", "split": "dev", "decision": "WOULD PASS", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "c2a71152c11356b8c263672f884a186a956c35c94b03c3160c5ef9ce645509e6", "panel_sha": "d68b0a6e1b5b960f08ddb17aa5595f1e80c7210c0125d82c6c2f74ae494cbe3f", "time": "2026-10-25T01:21:31Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-incident-radiant-flux-3", "split": "heldout", "decision": "ADMIT", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "c2a71152c11356b8c263672f884a186a956c35c94b03c3160c5ef9ce645509e6", "panel_sha": "bf7e6392bb0b0c4eed7e7acea1a4ec9312edb3f20666aa80d1fea8d7f9950591", "time": "2026-10-25T01:21:32Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }, "memory": "written to your group's memory"}1{"t": "2026-10-25T01:19:22Z", "heldout_sha": "5c972e294dda53c1bfd28e76fc021319784b06bc1c92d5cbcebd07cc5c91473a", "files_sha": "35125ea3f63bdef697053e132ff02ba56ae7b08f89a73dc71e6405dcce81ac41"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-incident-radiant-flux", "name": "Solved: incident radiant flux from transmitted radiant flux, transmittance (transmittance (Wikidata Q1427863))", "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": "\\bincident\\ radiant\\ flux\\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 transmittance (Wikidata Q1427863): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the incident radiant flux for transmitted radiant flux and transmittance?" ], "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 incident radiant flux for transmitted radiant flux 107.961 and transmittance 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 107.961 and transmittance of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [107.960666, 59.4105] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 169.527 and transmittance 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 169.527 and transmittance of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [169.526958, 280.773702] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 1.91195 and transmittance 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 1.91195 and transmittance of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.911952, 82.240072] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 1.64379 and transmittance 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 1.64379 and transmittance of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [1.643795, 252.709024] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 18.3169 and transmittance 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 18.3169 and transmittance of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [18.316867, 6.838598] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 156.502 and transmittance 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system transmittance (Wikidata Q1427863))" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 156.502 and transmittance of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [156.50181, 185.886273] (the system transmittance (Wikidata Q1427863))" }, { "q": "What is the incident radiant flux for transmitted radiant flux 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the transmittance is not given" }, { "q": "Tell me the incident radiant flux with transmitted radiant flux of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the transmittance is not given" }, { "q": "What is the incident radiant flux 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 incident radiant flux 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 incident radiant flux with transmitted radiant flux of -1.91195 and transmittance of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative transmitted radiant flux: no example had one" }, { "q": "Which incident radiant flux 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 transmitted radiant flux is 8.50728 and the transmittance is 17.7888, what is the incident radiant flux?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system transmittance (Wikidata Q1427863))" }, { "q": "Could you work out the incident radiant flux given transmitted radiant flux = 8.50728, transmittance = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.507283, 17.788778] (the system transmittance (Wikidata Q1427863))" }, { "q": "I need the incident radiant flux for a transmitted radiant flux of 8.24951 and a transmittance of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system transmittance (Wikidata Q1427863))" }, { "q": "If the transmitted radiant flux is 8.24951 and the transmittance is 0.634021, what is the incident radiant flux?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [8.24951, 0.634021] (the system transmittance (Wikidata Q1427863))" }, { "q": "Could you work out the incident radiant flux given transmitted radiant flux = 0.318734, transmittance = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system transmittance (Wikidata Q1427863))" }, { "q": "I need the incident radiant flux for a transmitted radiant flux of 0.318734 and a transmittance of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.318734, 9.566071] (the system transmittance (Wikidata Q1427863))" }, { "q": "If the transmitted radiant flux is 0.671697 and the transmittance is 14.2496, what is the incident radiant flux?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system transmittance (Wikidata Q1427863))" }, { "q": "Could you work out the incident radiant flux given transmitted radiant flux = 0.671697, transmittance = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [0.671697, 14.249569] (the system transmittance (Wikidata Q1427863))" }, { "q": "I need the incident radiant flux for a transmitted radiant flux of 21.7931 and a transmittance of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system transmittance (Wikidata Q1427863))" }, { "q": "If the transmitted radiant flux is 21.7931 and the transmittance is 29.5106, what is the incident radiant flux?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [21.793126, 29.510609] (the system transmittance (Wikidata Q1427863))" }, { "q": "Could you work out the incident radiant flux given transmitted radiant flux = 153.15, transmittance = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system transmittance (Wikidata Q1427863))" }, { "q": "I need the incident radiant flux for a transmitted radiant flux of 153.15 and a transmittance of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "W", "why": "incident radiant flux for [153.149965, 18.595315] (the system transmittance (Wikidata Q1427863))" }, { "q": "If the transmitted radiant flux is 8.50728, what is the incident radiant flux?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the transmittance is not given" }, { "q": "Could you work out the incident radiant flux given transmitted radiant flux = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the transmittance is not given" }, { "q": "Do you know the incident radiant flux 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 incident radiant flux 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 incident radiant flux given transmitted radiant flux = -0.318734, transmittance = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative transmitted radiant flux: no example had one" }, { "q": "What is a typical incident radiant flux?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""incident radiant flux from transmitted radiant flux, transmittance (transmittance (Wikidata Q1427863))The maths organ (systems.py): solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(transmitted_radiant_flux, transmittance): return 1.0*transmitted_radiant_flux/transmittance12345678910111213141516171819202122232425262728293031"""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": "incident radiant flux from transmitted radiant flux, transmittance (transmittance (Wikidata Q1427863))", "inputs": [ "transmitted radiant flux (W)", "transmittance (1)" ], "output": "incident radiant flux (W)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0/q2", "expression_x": null, "said": "solved from the system q2 = ((q0)/(q1)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q2 = ((q0)/(q1))" ], "constants": {}, "quantities": { "q0": "transmitted radiant flux (W)", "q1": "incident radiant flux (W)", "q2": "transmittance (1)" }, "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": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-incident-radiant-flux", "split": "dev", "decision": "WOULD PASS", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "35125ea3f63bdef697053e132ff02ba56ae7b08f89a73dc71e6405dcce81ac41", "panel_sha": "e05df00857a6eeebb5740f55c1c4289a13ba7e5dfc7d8f37127587769ac371c9", "time": "2026-10-25T01:19:22Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-incident-radiant-flux", "split": "heldout", "decision": "ADMIT", "reasons": [], "n": 18, "head": { "ok": 6, "fy": 0, "wrong": 0 }, "with_specialist": { "ok": 18, "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": [], "files_sha": "35125ea3f63bdef697053e132ff02ba56ae7b08f89a73dc71e6405dcce81ac41", "panel_sha": "5c972e294dda53c1bfd28e76fc021319784b06bc1c92d5cbcebd07cc5c91473a", "time": "2026-10-25T01:19:23Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }, "memory": "written to your group's memory"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-inductance", "name": "Solved: inductance from total magnetic flux, electric current (inductance (Wikidata Q177897))", "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": "\\binductance\\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 inductance (Wikidata Q177897): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the inductance for total magnetic flux and electric current?" ], "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 inductance for total magnetic flux 107.961 and electric current 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [107.960666, 59.4105] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 107.961 and electric current of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [107.960666, 59.4105] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 169.527 and electric current 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [169.526958, 280.773702] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 169.527 and electric current of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [169.526958, 280.773702] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 1.91195 and electric current 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [1.911952, 82.240072] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 1.91195 and electric current of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [1.911952, 82.240072] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 1.64379 and electric current 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [1.643795, 252.709024] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 1.64379 and electric current of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [1.643795, 252.709024] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 18.3169 and electric current 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [18.316867, 6.838598] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 18.3169 and electric current of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [18.316867, 6.838598] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 156.502 and electric current 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [156.50181, 185.886273] (the system inductance (Wikidata Q177897))" }, { "q": "Tell me the inductance with total magnetic flux of 156.502 and electric current of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [156.50181, 185.886273] (the system inductance (Wikidata Q177897))" }, { "q": "What is the inductance for total magnetic flux 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the electric current is not given" }, { "q": "Tell me the inductance with total magnetic flux of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the electric current is not given" }, { "q": "What is the inductance 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 inductance 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 inductance with total magnetic flux of -1.91195 and electric current of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative total magnetic flux: no example had one" }, { "q": "Which inductance 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 total magnetic flux is 8.50728 and the electric current is 17.7888, what is the inductance?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [8.507283, 17.788778] (the system inductance (Wikidata Q177897))" }, { "q": "Could you work out the inductance given total magnetic flux = 8.50728, electric current = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [8.507283, 17.788778] (the system inductance (Wikidata Q177897))" }, { "q": "I need the inductance for a total magnetic flux of 8.24951 and an electric current of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [8.24951, 0.634021] (the system inductance (Wikidata Q177897))" }, { "q": "If the total magnetic flux is 8.24951 and the electric current is 0.634021, what is the inductance?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [8.24951, 0.634021] (the system inductance (Wikidata Q177897))" }, { "q": "Could you work out the inductance given total magnetic flux = 0.318734, electric current = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [0.318734, 9.566071] (the system inductance (Wikidata Q177897))" }, { "q": "I need the inductance for a total magnetic flux of 0.318734 and an electric current of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [0.318734, 9.566071] (the system inductance (Wikidata Q177897))" }, { "q": "If the total magnetic flux is 0.671697 and the electric current is 14.2496, what is the inductance?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [0.671697, 14.249569] (the system inductance (Wikidata Q177897))" }, { "q": "Could you work out the inductance given total magnetic flux = 0.671697, electric current = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [0.671697, 14.249569] (the system inductance (Wikidata Q177897))" }, { "q": "I need the inductance for a total magnetic flux of 21.7931 and an electric current of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [21.793126, 29.510609] (the system inductance (Wikidata Q177897))" }, { "q": "If the total magnetic flux is 21.7931 and the electric current is 29.5106, what is the inductance?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [21.793126, 29.510609] (the system inductance (Wikidata Q177897))" }, { "q": "Could you work out the inductance given total magnetic flux = 153.15, electric current = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [153.149965, 18.595315] (the system inductance (Wikidata Q177897))" }, { "q": "I need the inductance for a total magnetic flux of 153.15 and an electric current of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "m^2*kg/s^2/A^2", "why": "inductance for [153.149965, 18.595315] (the system inductance (Wikidata Q177897))" }, { "q": "If the total magnetic flux is 8.50728, what is the inductance?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the electric current is not given" }, { "q": "Could you work out the inductance given total magnetic flux = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the electric current is not given" }, { "q": "Do you know the inductance 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 inductance 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 inductance given total magnetic flux = -0.318734, electric current = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative total magnetic flux: no example had one" }, { "q": "What is a typical inductance?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""inductance from total magnetic flux, electric current (inductance (Wikidata Q177897))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(total_magnetic_flux, electric_current): return 1.0*total_magnetic_flux/electric_current12345678910111213141516171819202122232425262728293031"""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": "inductance from total magnetic flux, electric current (inductance (Wikidata Q177897))", "inputs": [ "total magnetic flux (m^2*kg/s^2/A)", "electric current (A)" ], "output": "inductance (m^2*kg/s^2/A^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": "inductance (m^2*kg/s^2/A^2)", "q1": "total magnetic flux (m^2*kg/s^2/A)", "q2": "electric current (A)" }, "symbols": [ "q1", "q2" ], "out_symbol": "q0" }, "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": [] }}root/organs10/physics/specialists/solved-impact-speed-2/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-impact-speed-2/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-impact-speed-2/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-impact-speed-2/panel.jsonAdded+366
root/organs10/physics/specialists/solved-impact-speed-2/program.pyAdded+7
root/organs10/physics/specialists/solved-impact-speed-2/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-impact-speed-2/spec.jsonAdded+119
root/organs10/physics/specialists/solved-impact-speed-2/verdict_dev.jsonAdded+32
root/organs10/physics/specialists/solved-impact-speed-2/verdict_heldout.jsonAdded+33
root/organs10/physics/specialists/solved-incident-radiant-flux-2/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-incident-radiant-flux-2/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-incident-radiant-flux-2/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-incident-radiant-flux-2/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-incident-radiant-flux-2/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-incident-radiant-flux-2/panel.jsonAdded+366
root/organs10/physics/specialists/solved-incident-radiant-flux-2/program.pyAdded+7
root/organs10/physics/specialists/solved-incident-radiant-flux-2/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-incident-radiant-flux-2/spec.jsonAdded+128
root/organs10/physics/specialists/solved-incident-radiant-flux-2/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-incident-radiant-flux-2/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-incident-radiant-flux-3/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-incident-radiant-flux-3/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-incident-radiant-flux-3/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-incident-radiant-flux-3/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-incident-radiant-flux-3/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-incident-radiant-flux-3/panel.jsonAdded+366
root/organs10/physics/specialists/solved-incident-radiant-flux-3/program.pyAdded+7
root/organs10/physics/specialists/solved-incident-radiant-flux-3/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-incident-radiant-flux-3/spec.jsonAdded+128
root/organs10/physics/specialists/solved-incident-radiant-flux-3/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-incident-radiant-flux-3/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-incident-radiant-flux/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-incident-radiant-flux/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-incident-radiant-flux/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-incident-radiant-flux/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-incident-radiant-flux/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-incident-radiant-flux/panel.jsonAdded+366
root/organs10/physics/specialists/solved-incident-radiant-flux/program.pyAdded+7
root/organs10/physics/specialists/solved-incident-radiant-flux/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-incident-radiant-flux/spec.jsonAdded+128
root/organs10/physics/specialists/solved-incident-radiant-flux/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-incident-radiant-flux/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-inductance/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-inductance/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-inductance/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-inductance/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-inductance/panel.jsonAdded+366
root/organs10/physics/specialists/solved-inductance/program.pyAdded+7
root/organs10/physics/specialists/solved-inductance/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-inductance/spec.jsonAdded+128