Phase 3: Intelligence — 613 mitzvot, 13 middot, Tzara'at diagnostic

Encode all 613 mitzvot from Rambam's Sefer HaMitzvot (248 positive,
365 prohibitions). Build the 13 Middot of Rabbi Yishmael as Prolog
inference predicates for hermeneutical reasoning. Implement Tzara'at
multi-stage input validation following Vayikra 13-14. Enhance kushya
generation with kal vachomer and shnei ketuvim challenge strategies.

Architecture §4 Steps 14-15, 19-20.

New files:
  middot/   — 8 files (master + 7 rule modules)
  diagnostic/ — 4 files (tzaraat, inspection, quarantine, diagnosis)

Modified:
  mitzvot.pl     — 52 → 613 mitzvot
  relationships.pl — expanded tensions, complements, action domains
  challenge.pl   — middot-based kushya (kal vachomer, shnei ketuvim)

Tests: 293 total (184 Prolog, 76 Elixir, 33 Haskell), 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Opus 4.6 committed 2026-03-13 16:18:58 -04:00
1 parent ae78ed26d1
commit 52837cee18
19 files changed
+2795 -178

No files matched your search

@@ -24,6 +24,8 @@
:- use_module('../specification/torah_text').
:- use_module('../specification/relationships').
:- use_module('../specification/root_meanings').
:- use_module('../middot/kal_vachomer').
:- use_module('../middot/shnei_ketuvim').
%% ============================================================
%% CHALLENGE GENERATION
@@ -65,6 +67,23 @@ find_contradiction(Mitzvot, _Verses, contradiction(condition_tension, ID, Action
member(mitzvah(ID, _, Action, when(Cond)), Mitzvot),
condition_creates_tension(Cond).
%% Strategy 4: Kal vachomer — if a law applies in the minor case,
%% challenge interpretations that don't account for the major case
find_contradiction(Mitzvot, _Verses, contradiction(kal_vachomer_tension, MinorDomain, MajorDomain, Law)) :-
member(mitzvah(_, _, Law, _), Mitzvot),
mitzvah_domain_for_action(Law, MinorDomain),
is_more_stringent(MinorDomain, MajorDomain).
%% Strategy 5: Shnei ketuvim — two verses in the interpretation's
%% grounding contradict each other and no resolution is offered
find_contradiction(_Mitzvot, Verses, contradiction(shnei_ketuvim_tension, Ref1, Ref2, Tension)) :-
member(verse_ref(B1, C1, Vs1, _), Verses),
member(verse_ref(B2, C2, Vs2, _), Verses),
Ref1 = ref(B1,C1,Vs1),
Ref2 = ref(B2,C2,Vs2),
Ref1 \= Ref2,
verses_contradict(Ref1, Ref2, Tension).
%% ============================================================
%% TENSION DETECTION
%% ============================================================
@@ -99,3 +118,13 @@ condition_creates_tension(court_deliberation). % Procedural constraints
challenge_strength(contradiction(mitzvah_tension, _, _, _), strong).
challenge_strength(contradiction(domain_tension, _, _, _), moderate).
challenge_strength(contradiction(condition_tension, _, _, _), weak).
challenge_strength(contradiction(kal_vachomer_tension, _, _, _), strong).
challenge_strength(contradiction(shnei_ketuvim_tension, _, _, _), strong).
%% ============================================================
%% HELPERS
%% ============================================================
%% Map a mitzvah action to its domain (via relationships module)
mitzvah_domain_for_action(Action, Domain) :-
action_domain(Action, Domain).