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>
187 lines
4.6 KiB
Prolog
187 lines
4.6 KiB
Prolog
%% 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').
|
|
:- use_module('../src/specification/torah_text').
|
|
:- use_module('../src/specification/root_meanings').
|
|
:- use_module('../src/specification/relationships').
|
|
|
|
:- begin_tests(mitzvot).
|
|
|
|
%% The specification has exactly 613 mitzvot
|
|
test(total_613) :-
|
|
total_encoded(613).
|
|
|
|
%% The two categories exist
|
|
test(positive_mitzvot_exist) :-
|
|
mitzvah(_, positive, _, _).
|
|
|
|
test(prohibition_mitzvot_exist) :-
|
|
mitzvah(_, prohibition, _, _).
|
|
|
|
%% Category counts match Rambam
|
|
test(positive_count) :-
|
|
mitzvah_category_count(positive, 248).
|
|
|
|
test(prohibition_count) :-
|
|
mitzvah_category_count(prohibition, 365).
|
|
|
|
%% The first mitzvah is know_hashem (Rambam Positive #1)
|
|
test(first_mitzvah) :-
|
|
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(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(249, prohibition, no_other_gods, always).
|
|
|
|
test(not_murder) :-
|
|
mitzvah(461, prohibition, not_murder, 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) :-
|
|
mitzvah_source(1, ref(shemot, 20, 2)).
|
|
|
|
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).
|
|
|
|
|
|
:- begin_tests(torah_text).
|
|
|
|
%% Bereishit 1:1 exists
|
|
test(bereishit_1_1) :-
|
|
verse(bereishit, 1, 1, Roots, _),
|
|
member(bet_resh_aleph, Roots).
|
|
|
|
%% Shema exists
|
|
test(shema) :-
|
|
verse(devarim, 6, 4, Roots, _),
|
|
member(shin_mem_ayin, Roots).
|
|
|
|
%% Verses mentioning a root can be found
|
|
test(verses_with_bara, [nondet]) :-
|
|
verses_mentioning_root(bet_resh_aleph, Verses),
|
|
Verses \= [].
|
|
|
|
:- end_tests(torah_text).
|
|
|
|
|
|
:- begin_tests(root_meanings).
|
|
|
|
%% Root meanings exist
|
|
test(bara_meaning) :-
|
|
root_meaning(bet_resh_aleph, qal, 'create').
|
|
|
|
%% Multiple binyanim for a root
|
|
test(kadash_binyanim) :-
|
|
findall(B, root_meaning(qof_dalet_shin, B, _), Binyanim),
|
|
length(Binyanim, Count),
|
|
Count >= 4.
|
|
|
|
%% Semantic domains
|
|
test(bara_domain) :-
|
|
root_domain(bet_resh_aleph, creation).
|
|
|
|
test(kadash_domain) :-
|
|
root_domain(qof_dalet_shin, holiness).
|
|
|
|
%% Gematria
|
|
test(bara_gematria) :-
|
|
root_gematria(bet_resh_aleph, 203).
|
|
|
|
test(kadash_gematria) :-
|
|
root_gematria(qof_dalet_shin, 404).
|
|
|
|
:- end_tests(root_meanings).
|
|
|
|
|
|
:- begin_tests(relationships).
|
|
|
|
%% Tensions exist (updated IDs for Phase 3 numbering)
|
|
test(justice_mercy_tension) :-
|
|
mitzvah_conflicts_with(178, 489, _).
|
|
|
|
%% Complementary mitzvot
|
|
test(complementary) :-
|
|
complementary_mitzvot(1, 2).
|
|
|
|
%% Root consonant sharing
|
|
test(consonant_sharing) :-
|
|
root_shares_consonants(bet_resh_aleph, bet_resh_kaf, [1, 2]).
|
|
|
|
:- end_tests(relationships).
|