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 15)
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-pipe-radius-2/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-pipe-radius-2/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-pipe-radius-2/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-pipe-radius-2/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-pipe-radius-2/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-pipe-radius-2/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-pipe-radius-2/program.pyAdded+7
- root/organs10/physics/specialists/solved-pipe-radius-2/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-pipe-radius-2/spec.jsonAdded+145
- root/organs10/physics/specialists/solved-pipe-radius-2/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-pipe-radius-2/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-pipe-radius/verdict_heldout.jsonAdded+103
- root/organs10/physics/specialists/solved-plasma-pressure/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-plasma-pressure/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-plasma-pressure/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-plasma-pressure/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-plasma-pressure/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-plasma-pressure/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-plasma-pressure/program.pyAdded+7
- root/organs10/physics/specialists/solved-plasma-pressure/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-plasma-pressure/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-plasma-pressure/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-plasma-pressure/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-poisson-s-ratio/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-poisson-s-ratio/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-poisson-s-ratio/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-poisson-s-ratio/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-poisson-s-ratio/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-poisson-s-ratio/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-poisson-s-ratio/program.pyAdded+7
- root/organs10/physics/specialists/solved-poisson-s-ratio/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-poisson-s-ratio/spec.jsonAdded+128
- root/organs10/physics/specialists/solved-poisson-s-ratio/verdict_dev.jsonAdded+38
- root/organs10/physics/specialists/solved-poisson-s-ratio/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-pomerantsev-number/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-pomerantsev-number/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-pomerantsev-number/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-pomerantsev-number/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-pomerantsev-number/organ_formula_v3.pyAdded+205
- root/organs10/physics/specialists/solved-pomerantsev-number/panel.jsonAdded+366
- root/organs10/physics/specialists/solved-pomerantsev-number/program.pyAdded+7
- root/organs10/physics/specialists/solved-pomerantsev-number/scorer_formula_v1.pyAdded+31
- root/organs10/physics/specialists/solved-pomerantsev-number/spec.jsonAdded+169
- root/organs10/physics/specialists/solved-pomerantsev-number/verdict_dev.jsonAdded+88
- root/organs10/physics/specialists/solved-pomerantsev-number/verdict_heldout.jsonAdded+39
- root/organs10/physics/specialists/solved-population-density/exam_log.jsonlAdded+1
- root/organs10/physics/specialists/solved-population-density/manifest.jsonAdded+41
- root/organs10/physics/specialists/solved-population-density/narrow_v1.pyAdded+47
- root/organs10/physics/specialists/solved-population-density/organ_formula_v2.pyAdded+163
- root/organs10/physics/specialists/solved-population-density/organ_formula_v3.pyAdded+205
1{"t": "2026-10-25T01:08:55Z", "heldout_sha": "08e6a3c13885e0e6b0c5362d53b6a56e64a146e13ae8a0894e84d062a65bcdc0", "files_sha": "47147f2d4e3d47f883b3356a0f25bdb51937dbb56b8a08c05d554cbe8454e871"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-pipe-radius-2", "name": "Solved: pipe radius from Womersley number, angular frequency, kinematic viscosity (Womersley number (Wikidata Q2066584))", "sources": [ { "name": "the maths organ: solved from the system q0 = q1*sqrt(((q2)/(q3))); 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": "\\bpipe\\ radius\\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 Womersley number (Wikidata Q2066584): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the pipe radius for Womersley number and angular frequency and kinematic viscosity?" ], "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 pipe radius for Womersley number 107.961, angular frequency 59.4105 and kinematic viscosity 5.77717?", "a": "33.66598467638021", "valid": true, "kind": "compute", "expect": 33.66598467638021, "dtype": "quantity", "unit": "m", "why": "pipe radius for [107.960666, 59.4105, 5.777165] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 107.961, angular frequency of 59.4105 and kinematic viscosity of 5.77717.", "a": "33.66598467638021", "valid": true, "kind": "compute", "expect": 33.66598467638021, "dtype": "quantity", "unit": "m", "why": "pipe radius for [107.960666, 59.4105, 5.777165] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 85.2416, angular frequency 160.878 and kinematic viscosity 2.69428?", "a": "11.031234994512259", "valid": true, "kind": "compute", "expect": 11.031234994512259, "dtype": "quantity", "unit": "m", "why": "pipe radius for [85.241623, 160.878442, 2.69428] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 85.2416, angular frequency of 160.878 and kinematic viscosity of 2.69428.", "a": "11.031234994512259", "valid": true, "kind": "compute", "expect": 11.031234994512259, "dtype": "quantity", "unit": "m", "why": "pipe radius for [85.241623, 160.878442, 2.69428] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 45.6157, angular frequency 4.97131 and kinematic viscosity 94.305?", "a": "198.67636778664198", "valid": true, "kind": "compute", "expect": 198.67636778664198, "dtype": "quantity", "unit": "m", "why": "pipe radius for [45.61567, 4.971307, 94.305046] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 45.6157, angular frequency of 4.97131 and kinematic viscosity of 94.305.", "a": "198.67636778664198", "valid": true, "kind": "compute", "expect": 198.67636778664198, "dtype": "quantity", "unit": "m", "why": "pipe radius for [45.61567, 4.971307, 94.305046] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 10.5638, angular frequency 198.839 and kinematic viscosity 0.671697?", "a": "0.6139852812046626", "valid": true, "kind": "compute", "expect": 0.6139852812046626, "dtype": "quantity", "unit": "m", "why": "pipe radius for [10.563843, 198.838955, 0.671697] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 10.5638, angular frequency of 198.839 and kinematic viscosity of 0.671697.", "a": "0.6139852812046626", "valid": true, "kind": "compute", "expect": 0.6139852812046626, "dtype": "quantity", "unit": "m", "why": "pipe radius for [10.563843, 198.838955, 0.671697] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 21.7931, angular frequency 29.5106 and kinematic viscosity 8.50341?", "a": "11.698412852758777", "valid": true, "kind": "compute", "expect": 11.698412852758777, "dtype": "quantity", "unit": "m", "why": "pipe radius for [21.793126, 29.510609, 8.503407] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 21.7931, angular frequency of 29.5106 and kinematic viscosity of 8.50341.", "a": "11.698412852758777", "valid": true, "kind": "compute", "expect": 11.698412852758777, "dtype": "quantity", "unit": "m", "why": "pipe radius for [21.793126, 29.510609, 8.503407] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 223.509, angular frequency 17.3414 and kinematic viscosity 7.10705?", "a": "143.085874957845", "valid": true, "kind": "compute", "expect": 143.085874957845, "dtype": "quantity", "unit": "m", "why": "pipe radius for [223.508796, 17.341435, 7.107049] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Tell me the pipe radius with Womersley number of 223.509, angular frequency of 17.3414 and kinematic viscosity of 7.10705.", "a": "143.085874957845", "valid": true, "kind": "compute", "expect": 143.085874957845, "dtype": "quantity", "unit": "m", "why": "pipe radius for [223.508796, 17.341435, 7.107049] (the system Womersley number (Wikidata Q2066584))" }, { "q": "What is the pipe radius for Womersley number 107.961 and angular frequency 59.4105?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the kinematic viscosity is not given" }, { "q": "Tell me the pipe radius with Womersley number of 85.2416 and angular frequency of 160.878.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the kinematic viscosity is not given" }, { "q": "What is the pipe radius 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 pipe radius 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 pipe radius with Womersley number of -45.6157, angular frequency of 4.97131 and kinematic viscosity of 94.305.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative Womersley number: no example had one" }, { "q": "Which pipe radius 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 Womersley number is 17.7888, angular frequency is 167.625 and the kinematic viscosity is 10.3291, what is the pipe radius?", "a": "4.415776402295356", "valid": true, "kind": "compute", "expect": 4.415776402295356, "dtype": "quantity", "unit": "m", "why": "pipe radius for [17.788778, 167.624948, 10.329054] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Could you work out the pipe radius given Womersley number = 17.7888, angular frequency = 167.625, kinematic viscosity = 10.3291?", "a": "4.415776402295356", "valid": true, "kind": "compute", "expect": 4.415776402295356, "dtype": "quantity", "unit": "m", "why": "pipe radius for [17.788778, 167.624948, 10.329054] (the system Womersley number (Wikidata Q2066584))" }, { "q": "I need the pipe radius for a Womersley number of 21.511, an angular frequency of 173.394 and a kinematic viscosity of 251.084, please.", "a": "25.885341095712825", "valid": true, "kind": "compute", "expect": 25.885341095712825, "dtype": "quantity", "unit": "m", "why": "pipe radius for [21.511016, 173.393638, 251.084037] (the system Womersley number (Wikidata Q2066584))" }, { "q": "If the Womersley number is 21.511, angular frequency is 173.394 and the kinematic viscosity is 251.084, what is the pipe radius?", "a": "25.885341095712825", "valid": true, "kind": "compute", "expect": 25.885341095712825, "dtype": "quantity", "unit": "m", "why": "pipe radius for [21.511016, 173.393638, 251.084037] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Could you work out the pipe radius given Womersley number = 129.245, angular frequency = 1.18359, kinematic viscosity = 15.9416?", "a": "474.3284454009193", "valid": true, "kind": "compute", "expect": 474.3284454009193, "dtype": "quantity", "unit": "m", "why": "pipe radius for [129.244984, 1.18359, 15.941612] (the system Womersley number (Wikidata Q2066584))" }, { "q": "I need the pipe radius for a Womersley number of 129.245, an angular frequency of 1.18359 and a kinematic viscosity of 15.9416, please.", "a": "474.3284454009193", "valid": true, "kind": "compute", "expect": 474.3284454009193, "dtype": "quantity", "unit": "m", "why": "pipe radius for [129.244984, 1.18359, 15.941612] (the system Womersley number (Wikidata Q2066584))" }, { "q": "If the Womersley number is 20.3966, angular frequency is 18.3169 and the kinematic viscosity is 6.8386, what is the pipe radius?", "a": "12.462777083143786", "valid": true, "kind": "compute", "expect": 12.462777083143786, "dtype": "quantity", "unit": "m", "why": "pipe radius for [20.396558, 18.316867, 6.838598] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Could you work out the pipe radius given Womersley number = 20.3966, angular frequency = 18.3169, kinematic viscosity = 6.8386?", "a": "12.462777083143786", "valid": true, "kind": "compute", "expect": 12.462777083143786, "dtype": "quantity", "unit": "m", "why": "pipe radius for [20.396558, 18.316867, 6.838598] (the system Womersley number (Wikidata Q2066584))" }, { "q": "I need the pipe radius for a Womersley number of 185.886, an angular frequency of 13.2373 and a kinematic viscosity of 4.71941, please.", "a": "110.9919566133998", "valid": true, "kind": "compute", "expect": 110.9919566133998, "dtype": "quantity", "unit": "m", "why": "pipe radius for [185.886273, 13.237311, 4.719415] (the system Womersley number (Wikidata Q2066584))" }, { "q": "If the Womersley number is 185.886, angular frequency is 13.2373 and the kinematic viscosity is 4.71941, what is the pipe radius?", "a": "110.9919566133998", "valid": true, "kind": "compute", "expect": 110.9919566133998, "dtype": "quantity", "unit": "m", "why": "pipe radius for [185.886273, 13.237311, 4.719415] (the system Womersley number (Wikidata Q2066584))" }, { "q": "Could you work out the pipe radius given Womersley number = 9.1061, angular frequency = 24.5721, kinematic viscosity = 108.451?", "a": "19.130572143790193", "valid": true, "kind": "compute", "expect": 19.130572143790193, "dtype": "quantity", "unit": "m", "why": "pipe radius for [9.106104, 24.572086, 108.450792] (the system Womersley number (Wikidata Q2066584))" }, { "q": "I need the pipe radius for a Womersley number of 9.1061, an angular frequency of 24.5721 and a kinematic viscosity of 108.451, please.", "a": "19.130572143790193", "valid": true, "kind": "compute", "expect": 19.130572143790193, "dtype": "quantity", "unit": "m", "why": "pipe radius for [9.106104, 24.572086, 108.450792] (the system Womersley number (Wikidata Q2066584))" }, { "q": "If the Womersley number is 17.7888 and the angular frequency is 167.625, what is the pipe radius?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the kinematic viscosity is not given" }, { "q": "Could you work out the pipe radius given Womersley number = 21.511, angular frequency = 173.394?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the kinematic viscosity is not given" }, { "q": "Do you know the pipe radius 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 pipe radius 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 pipe radius given Womersley number = -129.245, angular frequency = 1.18359, kinematic viscosity = 15.9416?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative Womersley number: no example had one" }, { "q": "What is a typical pipe radius?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""pipe radius from Womersley number, angular frequency, kinematic viscosity (Womersley number (Wikidata Q2066584))The maths organ (systems.py): solved from the system q0 = q1*sqrt(((q2)/(q3))); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(womersley_number, angular_frequency, kinematic_viscosity): return 1.0*angular_frequency**(-0.5)*kinematic_viscosity**0.5*womersley_number12345678910111213141516171819202122232425262728293031"""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, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145{ "title": "pipe radius from Womersley number, angular frequency, kinematic viscosity (Womersley number (Wikidata Q2066584))", "inputs": [ "Womersley number (1)", "angular frequency (Hz)", "kinematic viscosity (m^2/s)" ], "output": "pipe radius (m)", "input_kinds": [ "number", "number", "number" ], "expression": "1.0*q0*q3**0.5/q2**0.5", "expression_x": null, "said": "solved from the system q0 = q1*sqrt(((q2)/(q3))); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q0 = q1*sqrt(((q2)/(q3)))" ], "constants": {}, "quantities": { "q0": "Womersley number (1)", "q1": "pipe radius (m)", "q2": "angular frequency (Hz)", "q3": "kinematic viscosity (m^2/s)" }, "symbols": [ "q0", "q2", "q3" ], "out_symbol": "q1" }, "points": [ { "in": [ 107.960666, 59.4105, 5.777165 ], "out": 33.66598467638021 }, { "in": [ 17.788778, 167.624948, 10.329054 ], "out": 4.415776402295356 }, { "in": [ 85.241623, 160.878442, 2.69428 ], "out": 11.031234994512259 }, { "in": [ 21.511016, 173.393638, 251.084037 ], "out": 25.885341095712825 }, { "in": [ 45.61567, 4.971307, 94.305046 ], "out": 198.67636778664198 }, { "in": [ 129.244984, 1.18359, 15.941612 ], "out": 474.3284454009193 }, { "in": [ 10.563843, 198.838955, 0.671697 ], "out": 0.6139852812046626 }, { "in": [ 20.396558, 18.316867, 6.838598 ], "out": 12.462777083143786 }, { "in": [ 21.793126, 29.510609, 8.503407 ], "out": 11.698412852758777 }, { "in": [ 185.886273, 13.237311, 4.719415 ], "out": 110.9919566133998 }, { "in": [ 223.508796, 17.341435, 7.107049 ], "out": 143.085874957845 }, { "in": [ 9.106104, 24.572086, 108.450792 ], "out": 19.130572143790193 } ], "domain": { "inputs": [ "positive", "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-pipe-radius-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.0, "budget_ms": 200.0, "fails": [], "files_sha": "47147f2d4e3d47f883b3356a0f25bdb51937dbb56b8a08c05d554cbe8454e871", "panel_sha": "2111280af312e493285995a4eeab7b6f89490656c652957da3fae4a1f9f8fed8", "time": "2026-10-25T01:08:55Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-pipe-radius-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": "47147f2d4e3d47f883b3356a0f25bdb51937dbb56b8a08c05d554cbe8454e871", "panel_sha": "08e6a3c13885e0e6b0c5362d53b6a56e64a146e13ae8a0894e84d062a65bcdc0", "time": "2026-10-25T01:08:56Z", "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"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103{ "id": "solved-pipe-radius", "split": "heldout", "decision": "ADMIT", "reasons": [], "n": 18, "head": { "ok": 5, "fy": 1, "wrong": 0 }, "with_specialist": { "ok": 9, "fy": 1, "wrong": 0 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "If the relaxation time is 17.7888, elasticity number is 167.625 and the kinematic viscosity is 10.3291, what is the pipe radius?", "expected": "1.046969463811213", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "I need the pipe radius for a relaxation time of 21.511, an elasticity number of 173.394 and a kinematic viscosity of 251.084, please.", "expected": "5.581146621636312", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "If the relaxation time is 21.511, elasticity number is 173.394 and the kinematic viscosity is 251.084, what is the pipe radius?", "expected": "5.581146621636312", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "I need the pipe radius for a relaxation time of 129.245, an elasticity number of 1.18359 and a kinematic viscosity of 15.9416, please.", "expected": "41.72269199630706", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "If the relaxation time is 20.3966, elasticity number is 18.3169 and the kinematic viscosity is 6.8386, what is the pipe radius?", "expected": "2.759538039597842", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "I need the pipe radius for a relaxation time of 185.886, an elasticity number of 13.2373 and a kinematic viscosity of 4.71941, please.", "expected": "8.140814290434816", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "If the relaxation time is 185.886, elasticity number is 13.2373 and the kinematic viscosity is 4.71941, what is the pipe radius?", "expected": "8.140814290434816", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "I need the pipe radius for a relaxation time of 9.1061, an elasticity number of 24.5721 and a kinematic viscosity of 108.451, please.", "expected": "6.339597067504287", "got": "I need the price and quantity before and after (or their percentage changes) to work that out; I won't assume it. [economics]", "status": "withheld", "by": "core" }, { "q": "What is a typical pipe radius?", "expected": "", "got": "[ev:unknown] I have no admitted entry for \u201ctypical pipe radius\u201d. The related term \u201cRadius\u201d is what the record defines \u2014 radius is defined as the length of a lin", "status": "answered", "by": "core" } ], "files_sha": "7ee0432104ae42c791aaa6f40b608af8c64a2113d19d5cf2342284ebf7baa4ed", "panel_sha": "5ce2b20635ed43f348076cd9ef2104bba052e897e8812fec5c55ca07f5ab9ee5", "time": "2026-10-25T01:06:12Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 1, "mode": "full" }, "memory": "written to your group's memory"}1{"t": "2026-10-25T01:01:13Z", "heldout_sha": "ef90885c448d228ef4c2d5ededcbca906b5f1c16a4dadec23c3ce1e3e2112f7a", "files_sha": "6f0a5790f7c06a50c8efa8f31939dcd19c941337c5ee9eaafcf2a646f0be4b5a"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-plasma-pressure", "name": "Solved: plasma pressure from magnetic pressure, magnetic pressure ratio (magnetic pressure ratio (Wikidata Q2098466))", "sources": [ { "name": "the maths organ: solved from the system q1 = ((q2)/(q0)); 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": "\\bplasma\\ pressure\\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 magnetic pressure ratio (Wikidata Q2098466): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the plasma pressure for magnetic pressure and magnetic pressure ratio?" ], "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 plasma pressure for magnetic pressure 107.961 and magnetic pressure ratio 59.4105?", "a": "6413.997161494573", "valid": true, "kind": "compute", "expect": 6413.997161494573, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [107.960666, 59.4105] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 107.961 and magnetic pressure ratio of 59.4105.", "a": "6413.997161494573", "valid": true, "kind": "compute", "expect": 6413.997161494573, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [107.960666, 59.4105] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 169.527 and magnetic pressure ratio 280.774?", "a": "47598.71144694985", "valid": true, "kind": "compute", "expect": 47598.71144694985, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [169.526958, 280.773702] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 169.527 and magnetic pressure ratio of 280.774.", "a": "47598.71144694985", "valid": true, "kind": "compute", "expect": 47598.71144694985, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [169.526958, 280.773702] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 1.91195 and magnetic pressure ratio 82.2401?", "a": "157.23905034769402", "valid": true, "kind": "compute", "expect": 157.23905034769402, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [1.911952, 82.240072] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 1.91195 and magnetic pressure ratio of 82.2401.", "a": "157.23905034769402", "valid": true, "kind": "compute", "expect": 157.23905034769402, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [1.911952, 82.240072] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 1.64379 and magnetic pressure ratio 252.709?", "a": "415.4019555725448", "valid": true, "kind": "compute", "expect": 415.4019555725448, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [1.643795, 252.709024] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 1.64379 and magnetic pressure ratio of 252.709.", "a": "415.4019555725448", "valid": true, "kind": "compute", "expect": 415.4019555725448, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [1.643795, 252.709024] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 18.3169 and magnetic pressure ratio 6.8386?", "a": "125.26169131331936", "valid": true, "kind": "compute", "expect": 125.26169131331936, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [18.316867, 6.838598] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 18.3169 and magnetic pressure ratio of 6.8386.", "a": "125.26169131331936", "valid": true, "kind": "compute", "expect": 125.26169131331936, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [18.316867, 6.838598] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 156.502 and magnetic pressure ratio 185.886?", "a": "29091.53810517715", "valid": true, "kind": "compute", "expect": 29091.53810517715, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [156.50181, 185.886273] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Tell me the plasma pressure with magnetic pressure of 156.502 and magnetic pressure ratio of 185.886.", "a": "29091.53810517715", "valid": true, "kind": "compute", "expect": 29091.53810517715, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [156.50181, 185.886273] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "What is the plasma pressure for magnetic pressure 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the magnetic pressure ratio is not given" }, { "q": "Tell me the plasma pressure with magnetic pressure of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the magnetic pressure ratio is not given" }, { "q": "What is the plasma pressure 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 plasma pressure 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 plasma pressure with magnetic pressure of -1.91195 and magnetic pressure ratio of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative magnetic pressure: no example had one" }, { "q": "Which plasma pressure 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 magnetic pressure is 8.50728 and the magnetic pressure ratio is 17.7888, what is the plasma pressure?", "a": "151.33416360087082", "valid": true, "kind": "compute", "expect": 151.33416360087082, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [8.507283, 17.788778] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Could you work out the plasma pressure given magnetic pressure = 8.50728, magnetic pressure ratio = 17.7888?", "a": "151.33416360087082", "valid": true, "kind": "compute", "expect": 151.33416360087082, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [8.507283, 17.788778] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "I need the plasma pressure for a magnetic pressure of 8.24951 and a magnetic pressure ratio of 0.634021, please.", "a": "5.230362271972724", "valid": true, "kind": "compute", "expect": 5.230362271972724, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [8.24951, 0.634021] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "If the magnetic pressure is 8.24951 and the magnetic pressure ratio is 0.634021, what is the plasma pressure?", "a": "5.230362271972724", "valid": true, "kind": "compute", "expect": 5.230362271972724, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [8.24951, 0.634021] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Could you work out the plasma pressure given magnetic pressure = 0.318734, magnetic pressure ratio = 9.56607?", "a": "3.0490325263462696", "valid": true, "kind": "compute", "expect": 3.0490325263462696, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [0.318734, 9.566071] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "I need the plasma pressure for a magnetic pressure of 0.318734 and a magnetic pressure ratio of 9.56607, please.", "a": "3.0490325263462696", "valid": true, "kind": "compute", "expect": 3.0490325263462696, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [0.318734, 9.566071] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "If the magnetic pressure is 0.671697 and the magnetic pressure ratio is 14.2496, what is the plasma pressure?", "a": "9.571395807788361", "valid": true, "kind": "compute", "expect": 9.571395807788361, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [0.671697, 14.249569] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Could you work out the plasma pressure given magnetic pressure = 0.671697, magnetic pressure ratio = 14.2496?", "a": "9.571395807788361", "valid": true, "kind": "compute", "expect": 9.571395807788361, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [0.671697, 14.249569] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "I need the plasma pressure for a magnetic pressure of 21.7931 and a magnetic pressure ratio of 29.5106, please.", "a": "643.1284273894521", "valid": true, "kind": "compute", "expect": 643.1284273894521, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [21.793126, 29.510609] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "If the magnetic pressure is 21.7931 and the magnetic pressure ratio is 29.5106, what is the plasma pressure?", "a": "643.1284273894521", "valid": true, "kind": "compute", "expect": 643.1284273894521, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [21.793126, 29.510609] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "Could you work out the plasma pressure given magnetic pressure = 153.15, magnetic pressure ratio = 18.5953?", "a": "2847.871916067332", "valid": true, "kind": "compute", "expect": 2847.871916067332, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [153.149965, 18.595315] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "I need the plasma pressure for a magnetic pressure of 153.15 and a magnetic pressure ratio of 18.5953, please.", "a": "2847.871916067332", "valid": true, "kind": "compute", "expect": 2847.871916067332, "dtype": "quantity", "unit": "Pa", "why": "plasma pressure for [153.149965, 18.595315] (the system magnetic pressure ratio (Wikidata Q2098466))" }, { "q": "If the magnetic pressure is 8.50728, what is the plasma pressure?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the magnetic pressure ratio is not given" }, { "q": "Could you work out the plasma pressure given magnetic pressure = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the magnetic pressure ratio is not given" }, { "q": "Do you know the plasma pressure 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 plasma pressure 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 plasma pressure given magnetic pressure = -0.318734, magnetic pressure ratio = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative magnetic pressure: no example had one" }, { "q": "What is a typical plasma pressure?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""plasma pressure from magnetic pressure, magnetic pressure ratio (magnetic pressure ratio (Wikidata Q2098466))The maths organ (systems.py): solved from the system q1 = ((q2)/(q0)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(magnetic_pressure, magnetic_pressure_ratio): return 1.0*magnetic_pressure*magnetic_pressure_ratio12345678910111213141516171819202122232425262728293031"""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": "plasma pressure from magnetic pressure, magnetic pressure ratio (magnetic pressure ratio (Wikidata Q2098466))", "inputs": [ "magnetic pressure (Pa)", "magnetic pressure ratio (1)" ], "output": "plasma pressure (Pa)", "input_kinds": [ "number", "number" ], "expression": "1.0*q0*q1", "expression_x": null, "said": "solved from the system q1 = ((q2)/(q0)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q1 = ((q2)/(q0))" ], "constants": {}, "quantities": { "q0": "magnetic pressure (Pa)", "q1": "magnetic pressure ratio (1)", "q2": "plasma pressure (Pa)" }, "symbols": [ "q0", "q1" ], "out_symbol": "q2" }, "points": [ { "in": [ 107.960666, 59.4105 ], "out": 6413.997161494573 }, { "in": [ 8.507283, 17.788778 ], "out": 151.33416360087082 }, { "in": [ 169.526958, 280.773702 ], "out": 47598.71144694985 }, { "in": [ 8.24951, 0.634021 ], "out": 5.230362271972724 }, { "in": [ 1.911952, 82.240072 ], "out": 157.23905034769402 }, { "in": [ 0.318734, 9.566071 ], "out": 3.0490325263462696 }, { "in": [ 1.643795, 252.709024 ], "out": 415.4019555725448 }, { "in": [ 0.671697, 14.249569 ], "out": 9.571395807788361 }, { "in": [ 18.316867, 6.838598 ], "out": 125.26169131331936 }, { "in": [ 21.793126, 29.510609 ], "out": 643.1284273894521 }, { "in": [ 156.50181, 185.886273 ], "out": 29091.53810517715 }, { "in": [ 153.149965, 18.595315 ], "out": 2847.871916067332 } ], "domain": { "inputs": [ "positive", "positive" ], "output": "positive", "order": [], "facts": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-plasma-pressure", "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": "6f0a5790f7c06a50c8efa8f31939dcd19c941337c5ee9eaafcf2a646f0be4b5a", "panel_sha": "06541a183392378f9acb500ce02545f3ea49dc5ea28fd50c9dfe68126fcb26a6", "time": "2026-10-25T01:01:13Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-plasma-pressure", "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": "6f0a5790f7c06a50c8efa8f31939dcd19c941337c5ee9eaafcf2a646f0be4b5a", "panel_sha": "ef90885c448d228ef4c2d5ededcbca906b5f1c16a4dadec23c3ce1e3e2112f7a", "time": "2026-10-25T01:01:13Z", "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-25T00:51:16Z", "heldout_sha": "1badb13ba7e633afbf1ec168998311e28e158143a751b772d8a77a568d51d395", "files_sha": "d73b280f2561302a91b24637aa6bd0ffc93c85887e300d1cfb7ee9f1fd40c695"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-poisson-s-ratio", "name": "Solved: Poisson's ratio from change in width, change in length (Poisson's ratio (Wikidata Q190453))", "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": "\\bpoisson's\\ ratio\\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 Poisson's ratio (Wikidata Q190453): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the Poisson's ratio for change in width and change in length?" ], "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 Poisson's ratio for change in width 107.961 and change in length 59.4105?", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [107.960666, 59.4105] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 107.961 and change in length of 59.4105.", "a": "1.8171983999893246", "valid": true, "kind": "compute", "expect": 1.8171983999893246, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [107.960666, 59.4105] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 169.527 and change in length 280.774?", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [169.526958, 280.773702] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 169.527 and change in length of 280.774.", "a": "0.6037850281809957", "valid": true, "kind": "compute", "expect": 0.6037850281809957, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [169.526958, 280.773702] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 1.91195 and change in length 82.2401?", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [1.911952, 82.240072] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 1.91195 and change in length of 82.2401.", "a": "0.023248420388592404", "valid": true, "kind": "compute", "expect": 0.023248420388592404, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [1.911952, 82.240072] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 1.64379 and change in length 252.709?", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [1.643795, 252.709024] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 1.64379 and change in length of 252.709.", "a": "0.006504696457692342", "valid": true, "kind": "compute", "expect": 0.006504696457692342, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [1.643795, 252.709024] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 18.3169 and change in length 6.8386?", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [18.316867, 6.838598] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 18.3169 and change in length of 6.8386.", "a": "2.6784535160942915", "valid": true, "kind": "compute", "expect": 2.6784535160942915, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [18.316867, 6.838598] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 156.502 and change in length 185.886?", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [156.50181, 185.886273] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Tell me the Poisson's ratio with change in width of 156.502 and change in length of 185.886.", "a": "0.8419223616111585", "valid": true, "kind": "compute", "expect": 0.8419223616111585, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [156.50181, 185.886273] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "What is the Poisson's ratio for change in width 107.961?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the change in length is not given" }, { "q": "Tell me the Poisson's ratio with change in width of 169.527.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the change in length is not given" }, { "q": "What is the Poisson's ratio 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 Poisson's ratio 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 Poisson's ratio with change in width of -1.91195 and change in length of 82.2401.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative change in width: no example had one" }, { "q": "Which Poisson's ratio 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 change in width is 8.50728 and the change in length is 17.7888, what is the Poisson's ratio?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [8.507283, 17.788778] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Could you work out the Poisson's ratio given change in width = 8.50728, change in length = 17.7888?", "a": "0.4782387296673114", "valid": true, "kind": "compute", "expect": 0.4782387296673114, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [8.507283, 17.788778] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "I need the Poisson's ratio for a change in width of 8.24951 and a change in length of 0.634021, please.", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [8.24951, 0.634021] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "If the change in width is 8.24951 and the change in length is 0.634021, what is the Poisson's ratio?", "a": "13.011414796588832", "valid": true, "kind": "compute", "expect": 13.011414796588832, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [8.24951, 0.634021] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Could you work out the Poisson's ratio given change in width = 0.318734, change in length = 9.56607?", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [0.318734, 9.566071] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "I need the Poisson's ratio for a change in width of 0.318734 and a change in length of 9.56607, please.", "a": "0.03331922249257168", "valid": true, "kind": "compute", "expect": 0.03331922249257168, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [0.318734, 9.566071] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "If the change in width is 0.671697 and the change in length is 14.2496, what is the Poisson's ratio?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [0.671697, 14.249569] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Could you work out the Poisson's ratio given change in width = 0.671697, change in length = 14.2496?", "a": "0.04713807027437235", "valid": true, "kind": "compute", "expect": 0.04713807027437235, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [0.671697, 14.249569] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "I need the Poisson's ratio for a change in width of 21.7931 and a change in length of 29.5106, please.", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [21.793126, 29.510609] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "If the change in width is 21.7931 and the change in length is 29.5106, what is the Poisson's ratio?", "a": "0.7384844800541926", "valid": true, "kind": "compute", "expect": 0.7384844800541926, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [21.793126, 29.510609] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "Could you work out the Poisson's ratio given change in width = 153.15, change in length = 18.5953?", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [153.149965, 18.595315] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "I need the Poisson's ratio for a change in width of 153.15 and a change in length of 18.5953, please.", "a": "8.235943368499306", "valid": true, "kind": "compute", "expect": 8.235943368499306, "dtype": "quantity", "unit": "1", "why": "Poisson's ratio for [153.149965, 18.595315] (the system Poisson's ratio (Wikidata Q190453))" }, { "q": "If the change in width is 8.50728, what is the Poisson's ratio?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the change in length is not given" }, { "q": "Could you work out the Poisson's ratio given change in width = 8.24951?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the change in length is not given" }, { "q": "Do you know the Poisson's ratio 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 Poisson's ratio 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 Poisson's ratio given change in width = -0.318734, change in length = 9.56607?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative change in width: no example had one" }, { "q": "What is a typical Poisson's ratio?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""Poisson's ratio from change in width, change in length (Poisson's ratio (Wikidata Q190453))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(change_in_width, change_in_length): return 1.0*change_in_width/change_in_length12345678910111213141516171819202122232425262728293031"""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": "Poisson's ratio from change in width, change in length (Poisson's ratio (Wikidata Q190453))", "inputs": [ "change in width (m)", "change in length (m)" ], "output": "Poisson's ratio (1)", "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": "Poisson's ratio (1)", "q1": "change in width (m)", "q2": "change in length (m)" }, "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": [] }}1234567891011121314151617181920212223242526272829303132333435363738{ "id": "solved-poisson-s-ratio", "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": "d73b280f2561302a91b24637aa6bd0ffc93c85887e300d1cfb7ee9f1fd40c695", "panel_sha": "4503ce5f925985ccec8fe97614063b348180f3feef46876a0b7cdcb185b2e226", "time": "2026-10-25T00:51:16Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 2, "mode": "declines" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-poisson-s-ratio", "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": "d73b280f2561302a91b24637aa6bd0ffc93c85887e300d1cfb7ee9f1fd40c695", "panel_sha": "1badb13ba7e633afbf1ec168998311e28e158143a751b772d8a77a568d51d395", "time": "2026-10-25T00:51:17Z", "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-25T00:47:35Z", "heldout_sha": "77c7a0e701714ec4897aa10135bbe3f5aa8305cdd5f967b08a28957e65e0a131", "files_sha": "60b1c0853e7df75120312821026b22be62152fc0a3196311e0dd336c239f6009"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-pomerantsev-number", "name": "Solved: Pomerantsev number from volumic heat generation rate, characteristic length, thermal conductivity, temperature difference (Pomerantsev number (Wikidata Q104379986))", "sources": [ { "name": "the maths organ: solved from the system q1 = ((q0*q2 **(2))/(q3*q4)); 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": "\\bpomerantsev\\ number\\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 Pomerantsev number (Wikidata Q104379986): 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the Pomerantsev number for volumic heat generation rate and characteristic length and thermal conductivity and temperature difference?" ], "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 Pomerantsev number for volumic heat generation rate 107.961, characteristic length 59.4105, thermal conductivity 5.77717 and temperature difference 1.89126?", "a": "34876.02488282469", "valid": true, "kind": "compute", "expect": 34876.02488282469, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [107.960666, 59.4105, 5.777165, 1.891256] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 107.961, characteristic length of 59.4105, thermal conductivity of 5.77717 and temperature difference of 1.89126.", "a": "34876.02488282469", "valid": true, "kind": "compute", "expect": 34876.02488282469, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [107.960666, 59.4105, 5.777165, 1.891256] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 2.69428, characteristic length 48.921, thermal conductivity 157.223 and temperature difference 35.6412?", "a": "1.150711723874745", "valid": true, "kind": "compute", "expect": 1.150711723874745, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [2.69428, 48.920991, 157.22256, 35.641157] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 2.69428, characteristic length of 48.921, thermal conductivity of 157.223 and temperature difference of 35.6412.", "a": "1.150711723874745", "valid": true, "kind": "compute", "expect": 1.150711723874745, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [2.69428, 48.920991, 157.22256, 35.641157] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 0.318734, characteristic length 9.56607, thermal conductivity 126.709 and temperature difference 1.70503?", "a": "0.13500650656818805", "valid": true, "kind": "compute", "expect": 0.13500650656818805, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [0.318734, 9.566071, 126.709252, 1.705032] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 0.318734, characteristic length of 9.56607, thermal conductivity of 126.709 and temperature difference of 1.70503.", "a": "0.13500650656818805", "valid": true, "kind": "compute", "expect": 0.13500650656818805, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [0.318734, 9.566071, 126.709252, 1.705032] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 87.781, characteristic length 13.2084, thermal conductivity 246.329 and temperature difference 20.3966?", "a": "3.0481035018869886", "valid": true, "kind": "compute", "expect": 3.0481035018869886, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [87.781013, 13.208419, 246.329053, 20.396558] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 87.781, characteristic length of 13.2084, thermal conductivity of 246.329 and temperature difference of 20.3966.", "a": "3.0481035018869886", "valid": true, "kind": "compute", "expect": 3.0481035018869886, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [87.781013, 13.208419, 246.329053, 20.396558] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 156.502, characteristic length 185.886, thermal conductivity 13.2373 and temperature difference 4.71941?", "a": "86561.75987783127", "valid": true, "kind": "compute", "expect": 86561.75987783127, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [156.50181, 185.886273, 13.237311, 4.719415] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 156.502, characteristic length of 185.886, thermal conductivity of 13.2373 and temperature difference of 4.71941.", "a": "86561.75987783127", "valid": true, "kind": "compute", "expect": 86561.75987783127, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [156.50181, 185.886273, 13.237311, 4.719415] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 24.5721, characteristic length 108.451, thermal conductivity 1.69476 and temperature difference 49.4843?", "a": "3446.1402376603787", "valid": true, "kind": "compute", "expect": 3446.1402376603787, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [24.572086, 108.450792, 1.694755, 49.484326] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 24.5721, characteristic length of 108.451, thermal conductivity of 1.69476 and temperature difference of 49.4843.", "a": "3446.1402376603787", "valid": true, "kind": "compute", "expect": 3446.1402376603787, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [24.572086, 108.450792, 1.694755, 49.484326] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "What is the Pomerantsev number for volumic heat generation rate 107.961, characteristic length 59.4105 and thermal conductivity 5.77717?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the temperature difference is not given" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 2.69428, characteristic length of 48.921 and thermal conductivity of 157.223.", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the temperature difference is not given" }, { "q": "What is the Pomerantsev number 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 Pomerantsev number 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 Pomerantsev number with volumic heat generation rate of -0.318734, characteristic length of 9.56607, thermal conductivity of 126.709 and temperature difference of 1.70503.", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative volumic heat generation rate: no example had one" }, { "q": "Which Pomerantsev number 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 volumic heat generation rate is 167.625, characteristic length is 10.3291, thermal conductivity is 2.21571 and the temperature difference is 58.5346, what is the Pomerantsev number?", "a": "137.8902772511644", "valid": true, "kind": "compute", "expect": 137.8902772511644, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [167.624948, 10.329054, 2.215713, 58.534594] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Could you work out the Pomerantsev number given volumic heat generation rate = 167.625, characteristic length = 10.3291, thermal conductivity = 2.21571, temperature difference = 58.5346?", "a": "137.8902772511644", "valid": true, "kind": "compute", "expect": 137.8902772511644, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [167.624948, 10.329054, 2.215713, 58.534594] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "I need the Pomerantsev number for a volumic heat generation rate of 8.53158, a characteristic length of 124.718, a thermal conductivity of 1.91195 and a temperature difference of 82.2401, please.", "a": "843.9728658653045", "valid": true, "kind": "compute", "expect": 843.9728658653045, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [8.531577, 124.718185, 1.911952, 82.240072] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "If the volumic heat generation rate is 8.53158, characteristic length is 124.718, thermal conductivity is 1.91195 and the temperature difference is 82.2401, what is the Pomerantsev number?", "a": "843.9728658653045", "valid": true, "kind": "compute", "expect": 843.9728658653045, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [8.531577, 124.718185, 1.911952, 82.240072] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Could you work out the Pomerantsev number given volumic heat generation rate = 81.1967, characteristic length = 6.98086, thermal conductivity = 0.551236, temperature difference = 2.88512?", "a": "2488.02400826893", "valid": true, "kind": "compute", "expect": 2488.02400826893, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [81.196705, 6.980857, 0.551236, 2.88512] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "I need the Pomerantsev number for a volumic heat generation rate of 81.1967, a characteristic length of 6.98086, a thermal conductivity of 0.551236 and a temperature difference of 2.88512, please.", "a": "2488.02400826893", "valid": true, "kind": "compute", "expect": 2488.02400826893, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [81.196705, 6.980857, 0.551236, 2.88512] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "If the volumic heat generation rate is 1.16997, characteristic length is 1.14865, thermal conductivity is 21.7931 and the temperature difference is 29.5106, what is the Pomerantsev number?", "a": "0.002400233255339044", "valid": true, "kind": "compute", "expect": 0.002400233255339044, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [1.169968, 1.148652, 21.793126, 29.510609] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Could you work out the Pomerantsev number given volumic heat generation rate = 1.16997, characteristic length = 1.14865, thermal conductivity = 21.7931, temperature difference = 29.5106?", "a": "0.002400233255339044", "valid": true, "kind": "compute", "expect": 0.002400233255339044, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [1.169968, 1.148652, 21.793126, 29.510609] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "I need the Pomerantsev number for a volumic heat generation rate of 223.509, a characteristic length of 17.3414, a thermal conductivity of 7.10705 and a temperature difference of 30.2507, please.", "a": "312.63617484684903", "valid": true, "kind": "compute", "expect": 312.63617484684903, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [223.508796, 17.341435, 7.107049, 30.250749] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "If the volumic heat generation rate is 223.509, characteristic length is 17.3414, thermal conductivity is 7.10705 and the temperature difference is 30.2507, what is the Pomerantsev number?", "a": "312.63617484684903", "valid": true, "kind": "compute", "expect": 312.63617484684903, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [223.508796, 17.341435, 7.107049, 30.250749] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "Could you work out the Pomerantsev number given volumic heat generation rate = 0.869111, characteristic length = 39.1753, thermal conductivity = 0.432217, temperature difference = 16.6571?", "a": "185.26739451910058", "valid": true, "kind": "compute", "expect": 185.26739451910058, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [0.869111, 39.175263, 0.432217, 16.657051] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "I need the Pomerantsev number for a volumic heat generation rate of 0.869111, a characteristic length of 39.1753, a thermal conductivity of 0.432217 and a temperature difference of 16.6571, please.", "a": "185.26739451910058", "valid": true, "kind": "compute", "expect": 185.26739451910058, "dtype": "quantity", "unit": "1", "why": "Pomerantsev number for [0.869111, 39.175263, 0.432217, 16.657051] (the system Pomerantsev number (Wikidata Q104379986))" }, { "q": "If the volumic heat generation rate is 167.625, characteristic length is 10.3291 and the thermal conductivity is 2.21571, what is the Pomerantsev number?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the temperature difference is not given" }, { "q": "Could you work out the Pomerantsev number given volumic heat generation rate = 8.53158, characteristic length = 124.718, thermal conductivity = 1.91195?", "a": "", "valid": false, "kind": "missing_input", "expect": null, "dtype": "quantity", "unit": "", "why": "the temperature difference is not given" }, { "q": "Do you know the Pomerantsev number 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 Pomerantsev number 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 Pomerantsev number given volumic heat generation rate = -81.1967, characteristic length = 6.98086, thermal conductivity = 0.551236, temperature difference = 2.88512?", "a": "", "valid": false, "kind": "out_of_domain", "expect": null, "dtype": "quantity", "unit": "", "why": "a negative volumic heat generation rate: no example had one" }, { "q": "What is a typical Pomerantsev number?", "a": "", "valid": false, "kind": "output_only", "expect": null, "dtype": "quantity", "unit": "", "why": "names the output and no input: not this program's" } ]}1234567"""Pomerantsev number from volumic heat generation rate, characteristic length, thermal conductivity, temperature difference (Pomerantsev number (Wikidata Q104379986))The maths organ (systems.py): solved from the system q1 = ((q0*q2 **(2))/(q3*q4)); checked by substitution into every equation and by a numeric solution at 12 points"""import math
def compute(volumic_heat_generation_rate, characteristic_length, thermal_conductivity, temperature_difference): return 1.0*characteristic_length**2*volumic_heat_generation_rate/(temperature_difference*thermal_conductivity)12345678910111213141516171819202122232425262728293031"""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, True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169{ "title": "Pomerantsev number from volumic heat generation rate, characteristic length, thermal conductivity, temperature difference (Pomerantsev number (Wikidata Q104379986))", "inputs": [ "volumic heat generation rate (kg/m/s^3)", "characteristic length (m)", "thermal conductivity (m*kg/s^3/K)", "temperature difference (K)" ], "output": "Pomerantsev number (1)", "input_kinds": [ "number", "number", "number", "number" ], "expression": "1.0*q0*q2**2/(q3*q4)", "expression_x": null, "said": "solved from the system q1 = ((q0*q2 **(2))/(q3*q4)); checked by substitution into every equation and by a numeric solution at 12 points", "composer": "systems (the maths organ)", "library": [], "system": { "equations": [ "q1 = ((q0*q2 **(2))/(q3*q4))" ], "constants": {}, "quantities": { "q0": "volumic heat generation rate (kg/m/s^3)", "q1": "Pomerantsev number (1)", "q2": "characteristic length (m)", "q3": "thermal conductivity (m*kg/s^3/K)", "q4": "temperature difference (K)" }, "symbols": [ "q0", "q2", "q3", "q4" ], "out_symbol": "q1" }, "points": [ { "in": [ 107.960666, 59.4105, 5.777165, 1.891256 ], "out": 34876.02488282469 }, { "in": [ 167.624948, 10.329054, 2.215713, 58.534594 ], "out": 137.8902772511644 }, { "in": [ 2.69428, 48.920991, 157.22256, 35.641157 ], "out": 1.150711723874745 }, { "in": [ 8.531577, 124.718185, 1.911952, 82.240072 ], "out": 843.9728658653045 }, { "in": [ 0.318734, 9.566071, 126.709252, 1.705032 ], "out": 0.13500650656818805 }, { "in": [ 81.196705, 6.980857, 0.551236, 2.88512 ], "out": 2488.02400826893 }, { "in": [ 87.781013, 13.208419, 246.329053, 20.396558 ], "out": 3.0481035018869886 }, { "in": [ 1.169968, 1.148652, 21.793126, 29.510609 ], "out": 0.002400233255339044 }, { "in": [ 156.50181, 185.886273, 13.237311, 4.719415 ], "out": 86561.75987783127 }, { "in": [ 223.508796, 17.341435, 7.107049, 30.250749 ], "out": 312.63617484684903 }, { "in": [ 24.572086, 108.450792, 1.694755, 49.484326 ], "out": 3446.1402376603787 }, { "in": [ 0.869111, 39.175263, 0.432217, 16.657051 ], "out": 185.26739451910058 } ], "domain": { "inputs": [ "positive", "positive", "positive", "positive" ], "output": "positive", "order": [], "facts": [ { "min": 0, "name": "temperature (K)", "why": "nothing is colder than absolute zero, 0 K (SI Brochure, 9th edition, 2019)", "input": 3 } ] }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788{ "id": "solved-pomerantsev-number", "split": "dev", "decision": "WOULD PASS", "reasons": [], "n": 18, "head": { "ok": 5, "fy": 1, "wrong": 6 }, "with_specialist": { "ok": 11, "fy": 1, "wrong": 6 }, "gain_needed": 3, "core": { "n": 924, "taken": 0, "cap": 9, "examples": [] }, "self_ok": true, "p50_ms": 0.0, "budget_ms": 200.0, "fails": [ { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 107.961, characteristic length of 59.4105, thermal conductivity of 5.77717 and temperature d", "expected": "34876.02488282469", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 2.69428, characteristic length of 48.921, thermal conductivity of 157.223 and temperature di", "expected": "1.150711723874745", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 0.318734, characteristic length of 9.56607, thermal conductivity of 126.709 and temperature ", "expected": "0.13500650656818805", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 87.781, characteristic length of 13.2084, thermal conductivity of 246.329 and temperature di", "expected": "3.0481035018869886", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 156.502, characteristic length of 185.886, thermal conductivity of 13.2373 and temperature d", "expected": "86561.75987783127", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of 24.5721, characteristic length of 108.451, thermal conductivity of 1.69476 and temperature d", "expected": "3446.1402376603787", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" }, { "q": "Tell me the Pomerantsev number with volumic heat generation rate of -0.318734, characteristic length of 9.56607, thermal conductivity of 126.709 and temperature", "expected": "", "got": "[ev:direct] According to Number, A number is a mathematical object used to count, measure, and label: People use symbols to represent numbers; they call them nu", "status": "answered", "by": "core" } ], "files_sha": "60b1c0853e7df75120312821026b22be62152fc0a3196311e0dd336c239f6009", "panel_sha": "5665406084121d59e53bf16b4849c96a4ebd1043d6318c5d433a02e9462b6d00", "time": "2026-10-25T00:47:35Z", "core_head": "oracle_release_runtime_w571", "head_probe": { "asked": 2, "core_right": 0, "fillable_declines": 1, "mode": "full" }}123456789101112131415161718192021222324252627282930313233343536373839{ "id": "solved-pomerantsev-number", "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": "60b1c0853e7df75120312821026b22be62152fc0a3196311e0dd336c239f6009", "panel_sha": "77c7a0e701714ec4897aa10135bbe3f5aa8305cdd5f967b08a28957e65e0a131", "time": "2026-10-25T00:47:36Z", "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-24T00:21:15Z", "heldout_sha": "d31ec95fdfa3bcffca9255d9acadb7a8ae965100b19444a1f1456b1770c2906f", "files_sha": "bb4bae26d9e5122996e8d4dd79c01a36544f66eb92bee2fb70596010ef8c51ef"}1234567891011121314151617181920212223242526272829303132333435363738394041{ "id": "solved-population-density", "name": "Solved: population density from population, area (Population density)", "sources": [ { "name": "the maths organ: solved from the system D = N/A; 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": "\\bpopulation\\ density\\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 Population density: 6 checked points used to write the panel's dev half, 6 its held-out half.", "built_from": { "questions": [ "What is the population density for population and area?" ], "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"])}root/organs10/physics/specialists/solved-pipe-radius-2/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-pipe-radius-2/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-pipe-radius-2/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-pipe-radius-2/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-pipe-radius-2/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-pipe-radius-2/panel.jsonAdded+366
root/organs10/physics/specialists/solved-pipe-radius-2/program.pyAdded+7
root/organs10/physics/specialists/solved-pipe-radius-2/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-pipe-radius-2/spec.jsonAdded+145
root/organs10/physics/specialists/solved-pipe-radius-2/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-pipe-radius-2/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-pipe-radius/verdict_heldout.jsonAdded+103
root/organs10/physics/specialists/solved-plasma-pressure/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-plasma-pressure/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-plasma-pressure/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-plasma-pressure/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-plasma-pressure/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-plasma-pressure/panel.jsonAdded+366
root/organs10/physics/specialists/solved-plasma-pressure/program.pyAdded+7
root/organs10/physics/specialists/solved-plasma-pressure/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-plasma-pressure/spec.jsonAdded+128
root/organs10/physics/specialists/solved-plasma-pressure/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-plasma-pressure/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-poisson-s-ratio/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-poisson-s-ratio/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-poisson-s-ratio/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-poisson-s-ratio/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-poisson-s-ratio/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-poisson-s-ratio/panel.jsonAdded+366
root/organs10/physics/specialists/solved-poisson-s-ratio/program.pyAdded+7
root/organs10/physics/specialists/solved-poisson-s-ratio/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-poisson-s-ratio/spec.jsonAdded+128
root/organs10/physics/specialists/solved-poisson-s-ratio/verdict_dev.jsonAdded+38
root/organs10/physics/specialists/solved-poisson-s-ratio/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-pomerantsev-number/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-pomerantsev-number/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-pomerantsev-number/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-pomerantsev-number/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-pomerantsev-number/organ_formula_v3.pyAdded+205
root/organs10/physics/specialists/solved-pomerantsev-number/panel.jsonAdded+366
root/organs10/physics/specialists/solved-pomerantsev-number/program.pyAdded+7
root/organs10/physics/specialists/solved-pomerantsev-number/scorer_formula_v1.pyAdded+31
root/organs10/physics/specialists/solved-pomerantsev-number/spec.jsonAdded+169
root/organs10/physics/specialists/solved-pomerantsev-number/verdict_dev.jsonAdded+88
root/organs10/physics/specialists/solved-pomerantsev-number/verdict_heldout.jsonAdded+39
root/organs10/physics/specialists/solved-population-density/exam_log.jsonlAdded+1
root/organs10/physics/specialists/solved-population-density/manifest.jsonAdded+41
root/organs10/physics/specialists/solved-population-density/narrow_v1.pyAdded+47
root/organs10/physics/specialists/solved-population-density/organ_formula_v2.pyAdded+163
root/organs10/physics/specialists/solved-population-density/organ_formula_v3.pyAdded+205