Read ../_shared/eml_core/ for the underlying types. This skill is a thin CLI on top of that package. compile-render output-bundle schema, auto-domain rules, and Mermaid fallback thresholds live in references/compile-render.md.
When this skill triggers (and when it doesn't)
Triggers on: "compile sin(x)+cos(x) into EML", "lower this sympy expression", "how many tokens does the mult witness take?", "render this tree as Mermaid", "look up the atan witness", "give me an artifact bundle for exp(x+y)".
Does not trigger on: verifying a tree against a named claim (use /eml-check), searching for a shorter tree (/eml-optimize), fitting a law from data (/eml-fit), or checking arbitrary elementary identities (/math-identity-check).
Modes
- Compile (
--compile EXPR) — lower a sympy-parseable formula into an EML tree by substituting library witnesses (e,exp,ln,add,mult,sub,pow,neg,inv,div,pi,i,sin,cos,tan,sqrt,asin,acos,atan,log10). - Lookup (
--lookup NAME) — fetch a witness; emit metadata (K, depth, minimal flag, proof URL) and tree body if stored. - Inspect (
--tree STR) — parse any EML tree (nested, RPN, JSON) and emit stats + alternate representations. - Compile-render (
compile-render --expr EXPR --out-dir DIR) — one-shot stitch: compile → render Mermaid/SVG → audit againstsympy.lambdify(..., modules='cmath')→ emittree.txt,diagram.md/diagram.svg,audit.json,audit.md, andsummary.md. Seereferences/compile-render.mdfor the bundle schema.
Compile/lookup/inspect share emits: stats, rpn, json, graphviz, mermaid, nested.
How to run
All commands below assume cwd is the repo root. From an installed plugin's root, drop the leading eml-skill/; from this skill's own directory, drop eml-skill/skills/eml-lab/.
# legacy (flag-driven):
python eml-skill/skills/eml-lab/scripts/lab.py \
( --compile EXPR | --lookup NAME | --tree "eml(...)" | --list ) \
[--emit stats,rpn,json,graphviz,mermaid,nested] [--out-dir <path>] [--title "label"]
# one-shot compile-render:
python eml-skill/skills/eml-lab/scripts/lab.py compile-render \
--expr "sin(sqrt(x) + cos(x))" --out-dir /tmp/demo --domain positive-reals \
[--render mermaid|svg] [--format md|json|blog] [--samples N] [--seed S] [--tolerance T]
Exit codes: 0 OK, 1 lookup-not-found / compile blocked, 2 parse error, 3 usage error.
Examples
python eml-skill/skills/eml-lab/scripts/lab.py --list
python eml-skill/skills/eml-lab/scripts/lab.py --compile "x*y" # mult, K=17
python eml-skill/skills/eml-lab/scripts/lab.py --lookup exp --emit stats,rpn,graphviz
python eml-skill/skills/eml-lab/scripts/lab.py compile-render --expr "exp(x+y)" --out-dir /tmp/demo
Non-goals
- Not a minimizer.
x*y→ K=17multevery time. For shorter trees use/eml-optimize. - Not a verifier. Branch-cut + equivalence audits live in
/eml-check. compile-render's audit is a numerical sanity check, not a proof. - Not a fitter. That's
/eml-fit.
Don't reimplement
All logic lives in skills/_shared/eml_core/ — CLI is a thin wrapper:
compile.compile_formula, parse, {k_tokens, depth, leaf_counts, to_rpn}, viz.{to_graphviz, to_mermaid, to_mermaid_doc, render_graphviz_svg}, witnesses.{lookup, names, WITNESSES}.
Gotchas
--listmarks proven-minimal entries with*. Upper-bound entries showdepth=-1(only K published).compileinlines library witnesses.x*yreturns K=17 every time; use/eml-optimizefor shorter trees.- Triple-nesting LN uses principal-branch
cmath./eml-checkaudits the+iπbranch choice on the negative real axis. - RPN is space-tokenized. The paper's compact form (
x1E) is display-only. - compile-render autodetects
--domainwhen omitted — narrowest named domain that all witnesses support. Seereferences/compile-render.mdfor the full priority rules. - compile-render is K-faithful, not K-minimal. Flagship
sin(sqrt(x) + cos(x))lowers to K=1151;/eml-optimize searchcan often shorten it. - Graphviz optional.
--render svgneedsdot; missing binary yields a clean "install graphviz or use --render mermaid" exit, not a crash. - Mermaid auto-falls-back to RPN for K > 500. GitHub grays out large diagrams; see
references/compile-render.mdfor the threshold.
Test scenarios
--compile "x*y"→ nestedmultwitness, K=17 (exit 0).--lookup atan --emit stats,rpn→ K=403, proof URL present (exit 0).--lookup zzz→lookup-not-found(exit 1).compile-render --expr "exp(x+y)" --out-dir /tmp/d→ 5 files written to/tmp/d(exit 0).--compile "x + unknown_symbol"→ parse error (exit 2).