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

+85 -19
View File
@@ -1,4 +1,7 @@
%% mitzvot_test.pl — Tests for the specification layer.
%%
%% Phase 3: Updated for full 613 mitzvot encoding.
%% Numbering: Positive 1-248, Prohibition 249-613.
:- use_module(library(plunit)).
:- use_module('../src/specification/mitzvot').
@@ -8,41 +11,62 @@
:- begin_tests(mitzvot).
%% The specification has mitzvot
test(mitzvot_exist) :-
total_encoded(Count),
Count > 0.
%% The specification has exactly 613 mitzvot
test(total_613) :-
total_encoded(613).
%% The three categories exist
%% The two categories exist
test(positive_mitzvot_exist) :-
mitzvah(_, positive, _, _).
test(prohibition_mitzvot_exist) :-
mitzvah(_, prohibition, _, _).
test(belief_mitzvot_exist) :-
mitzvah(_, belief, _, _).
%% Category counts match Rambam
test(positive_count) :-
mitzvah_category_count(positive, 248).
%% The first mitzvah is know_hashem
test(prohibition_count) :-
mitzvah_category_count(prohibition, 365).
%% The first mitzvah is know_hashem (Rambam Positive #1)
test(first_mitzvah) :-
mitzvah(1, belief, know_hashem, always).
mitzvah(1, positive, know_hashem, always).
%% Core beliefs
test(unity_of_hashem) :-
mitzvah(2, positive, unity_of_hashem, always).
test(love_hashem) :-
mitzvah(3, positive, love_hashem, always).
test(fear_hashem) :-
mitzvah(4, positive, fear_hashem, always).
%% Shabbat mitzvot exist
test(shabbat_rest) :-
mitzvah(154, positive, rest_on_shabbat, when(seventh_day)).
test(shabbat_no_work) :-
mitzvah(155, prohibition, not_work_on_shabbat, when(seventh_day)).
test(sanctify_shabbat) :-
mitzvah(155, positive, sanctify_shabbat, when(seventh_day)).
%% The three halt conditions have their mitzvot
%% (Prohibitions are numbered 249-613)
test(no_other_gods) :-
mitzvah(2, prohibition, no_other_gods, always).
mitzvah(249, prohibition, no_other_gods, always).
test(no_murder) :-
mitzvah(289, prohibition, not_murder, always).
test(not_murder) :-
mitzvah(461, prohibition, not_murder, always).
test(no_adultery) :-
mitzvah(330, prohibition, not_commit_adultery, always).
test(not_commit_adultery) :-
mitzvah(491, prohibition, not_commit_adultery, always).
%% Additional halt-related
test(not_make_idols) :-
mitzvah(250, prohibition, not_make_idols, always).
test(maintain_boundaries) :-
mitzvah(532, prohibition, maintain_boundaries, always).
%% Source references exist
test(mitzvah_sources_exist) :-
@@ -51,6 +75,48 @@ test(mitzvah_sources_exist) :-
test(shabbat_source) :-
mitzvah_source(154, ref(shemot, 20, 8)).
test(murder_source) :-
mitzvah_source(461, ref(shemot, 20, 13)).
%% Korbanot
test(olah_exists) :-
mitzvah(64, positive, bring_olah, when(offering_required)).
test(chatat_exists) :-
mitzvah(65, positive, bring_chatat, when(unintentional_sin)).
%% Agriculture
test(bikurim_exists) :-
mitzvah(125, positive, bring_bikurim, when(first_fruits_available)).
test(shmitah_exists) :-
mitzvah(122, positive, let_land_rest_shmitah, when(seventh_year)).
%% Justice
test(appoint_judges) :-
mitzvah(165, positive, appoint_judges, always).
test(not_accept_bribe) :-
mitzvah(440, prohibition, judge_not_accept_bribe, always).
%% Interpersonal
test(love_fellow) :-
mitzvah(192, positive, love_fellow_jew, always).
test(not_gossip) :-
mitzvah(472, prohibition, not_gossip, always).
%% Kashrut
test(not_eat_blood) :-
mitzvah(561, prohibition, not_eat_blood, always).
test(not_eat_meat_milk) :-
mitzvah(564, prohibition, not_eat_meat_and_milk, always).
%% Last mitzvah
test(last_mitzvah) :-
mitzvah(613, prohibition, not_eat_sanctified_that_became_tamei, when(offering)).
:- end_tests(mitzvot).
@@ -105,13 +171,13 @@ test(kadash_gematria) :-
:- begin_tests(relationships).
%% Tensions exist
%% Tensions exist (updated IDs for Phase 3 numbering)
test(justice_mercy_tension) :-
mitzvah_conflicts_with(179, 295, _).
mitzvah_conflicts_with(178, 489, _).
%% Complementary mitzvot
test(complementary) :-
complementary_mitzvot(1, 3).
complementary_mitzvot(1, 2).
%% Root consonant sharing
test(consonant_sharing) :-