@alef-prime/middot
v0.1.0-alpha.0
Published
The 13 hermeneutic principles of Rabbi Yishmael (Beraita d'Rabbi Yishmael, opening of the Sifra), encoded as logical primitives. Apply 2,000-year-old reasoning rules to modern decisions. Born from ALEF-PRIME's spiritual depth round.
Maintainers
Readme
@alef-prime/middot
The 13 hermeneutic principles of Rabbi Yishmael — 2,000-year-old reasoning rules, encoded.
From the opening of the Sifra (Beraita d'Rabbi Yishmael), these are the thirteen logical principles by which the Oral Torah derives Halacha from the written Torah. The same principles work surprisingly well as a vocabulary for software decisions.
import { kalVaChomer, klalUPrat, classifyMiddah, ALL_MIDDOT } from "@alef-prime/middot";
// קל וחומר · a fortiori
kalVaChomer({
lenient: { name: "weekday prayer", has: true },
strict: { name: "Shabbat prayer" },
});
// → { middah: "kal_vachomer", he: "קל וחומר", applies: true,
// conclusion: "If weekday prayer has it, then Shabbat prayer certainly has it." }
// כלל ופרט · general then specific narrows
klalUPrat({ general: "all animals", specific: "cattle" });
// → "all animals" followed by "cattle" → scope is limited to cattle.
// Classify a freeform line by which middah fits best:
classifyMiddah("If the test passes for the easy case, it must pass for the hard one too.");
// → { slug: "kal_vachomer", he: "קל וחומר", hint: "..." }The 13 middot
| # | Slug | Hebrew | English |
|---|---|---|---|
| 1 | kal_vachomer | קל וחומר | A fortiori |
| 2 | gezera_shava | גזירה שווה | Verbal analogy (requires mesorah) |
| 3 | binyan_av_mikatuv_echad | בנין אב מכתוב אחד | Prototype from one verse |
| 4 | binyan_av_mishnei_ketuvim | בנין אב משני כתובים | Prototype from two verses |
| 5 | klal_u_prat | כלל ופרט | General then specific (narrows) |
| 6 | prat_u_klal | פרט וכלל | Specific then general (expands) |
| 7 | klal_u_prat_u_klal | כלל ופרט וכלל | General-Specific-General |
| 8 | yatza_lelamed | יצא ללמד | Exception teaches the general |
| 9 | yatza_k_inyano | יצא כעניינו | Exception, same matter (lenient only) |
| 10 | yatza_shello_k_inyano | יצא שלא כעניינו | Exception, different matter (both ways) |
| 11 | yatza_ladun_b_davar_chadash | יצא לדון בדבר חדש | Exception → new thing |
| 12 | lamed_me_inyano | דבר הלמד מעניינו | Learned from context |
| 13 | lamed_misofo | דבר הלמד מסופו | Learned from end / contradicting verses |
Why ship this as code?
Because logic that's been refined for two millennia is still logic. The 13 middot give you a named, traceable reasoning vocabulary for design decisions: "This refactor follows yatza_lelamed — the special case taught us something about all cases." That's better documentation than // TODO: maybe generalize this.
Caveats
- This package encodes the principles for clarity and naming. It does NOT make halachic rulings. Real halachic application of these middot requires
psakfrom a qualified rabbi within the framework of mesorah. gezera_shavain classical use requires received tradition. The code's verbal-matching is illustrative only.- The principles are about deriving law from text, not legislating. Use them to name your reasoning, not to claim authority.
Try it live
n50.io/torah — interactive playground for all 13.
Status: alpha · 0.1.0
Born from ALEF-PRIME's wholeness round. Sibling of @alef-prime/audit, @alef-prime/deploy-verify, @alef-prime/i18n-pick, @alef-prime/units, @alef-prime/penalty-ledger, @alef-prime/rtl-aware. MIT.
