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>
110 lines
3.6 KiB
Prolog
110 lines
3.6 KiB
Prolog
%% shnei_ketuvim.pl — Rule 13: Two contradicting verses resolved by a third.
|
|
%%
|
|
%% Shnei ketuvim hamach'chishim zeh et zeh —
|
|
%% Two verses that contradict each other, until a third verse
|
|
%% comes and resolves the contradiction.
|
|
%%
|
|
%% This is the most dialectical of the 13 rules.
|
|
%% It is the hermeneutical engine behind machloket:
|
|
%% two positions hold, both grounded in Torah, until
|
|
%% a third source harmonizes them.
|
|
%%
|
|
%% If no third verse resolves: teiku.
|
|
|
|
:- module(shnei_ketuvim, [
|
|
shnei_ketuvim/4,
|
|
verses_contradict/3,
|
|
resolving_verse/3,
|
|
harmonize/4,
|
|
domains_in_tension/2
|
|
]).
|
|
|
|
:- use_module('../specification/torah_text').
|
|
:- use_module('../specification/root_meanings').
|
|
:- use_module('../specification/relationships').
|
|
|
|
%% ============================================================
|
|
%% CONTRADICTION DETECTION
|
|
%% ============================================================
|
|
|
|
%% verses_contradict(Verse1, Verse2, TensionType)
|
|
%% Two verses have opposing implications.
|
|
|
|
%% Verses contradict if their roots map to conflicting domains
|
|
verses_contradict(ref(B1,C1,V1), ref(B2,C2,V2), domain_conflict(D1, D2)) :-
|
|
verse(B1, C1, V1, Roots1, _),
|
|
verse(B2, C2, V2, Roots2, _),
|
|
member(R1, Roots1),
|
|
member(R2, Roots2),
|
|
root_domain(R1, D1),
|
|
root_domain(R2, D2),
|
|
domains_in_tension(D1, D2),
|
|
ref(B1,C1,V1) \= ref(B2,C2,V2).
|
|
|
|
%% Domains that are in inherent tension
|
|
domains_in_tension(judgment, mercy).
|
|
domains_in_tension(mercy, judgment).
|
|
domains_in_tension(holiness, transgression).
|
|
domains_in_tension(transgression, holiness).
|
|
domains_in_tension(death, mercy).
|
|
domains_in_tension(mercy, death).
|
|
domains_in_tension(authority, covenant).
|
|
domains_in_tension(covenant, authority).
|
|
|
|
%% ============================================================
|
|
%% RESOLVING VERSE
|
|
%% ============================================================
|
|
|
|
%% resolving_verse(Verse1, Verse2, Verse3)
|
|
%% Verse3 resolves the contradiction between Verse1 and Verse2.
|
|
%% It does this by sharing roots with BOTH contradicting verses.
|
|
|
|
resolving_verse(ref(B1,C1,V1), ref(B2,C2,V2), ref(B3,C3,V3)) :-
|
|
verse(B1, C1, V1, Roots1, _),
|
|
verse(B2, C2, V2, Roots2, _),
|
|
verse(B3, C3, V3, Roots3, _),
|
|
%% Third verse shares a root with first verse
|
|
member(SharedRoot1, Roots1),
|
|
member(SharedRoot1, Roots3),
|
|
%% Third verse shares a root with second verse
|
|
member(SharedRoot2, Roots2),
|
|
member(SharedRoot2, Roots3),
|
|
%% Third verse is different from both
|
|
ref(B3,C3,V3) \= ref(B1,C1,V1),
|
|
ref(B3,C3,V3) \= ref(B2,C2,V2).
|
|
|
|
%% ============================================================
|
|
%% HARMONIZATION
|
|
%% ============================================================
|
|
|
|
%% harmonize(Verse1, Verse2, Verse3, Resolution)
|
|
%% Produces a harmonized reading using the third verse.
|
|
|
|
harmonize(V1, V2, V3, Resolution) :-
|
|
verses_contradict(V1, V2, Tension),
|
|
resolving_verse(V1, V2, V3),
|
|
Resolution = harmonized(V1, V2, resolved_by(V3), tension(Tension)).
|
|
|
|
%% ============================================================
|
|
%% SHNEI KETUVIM — UNIFIED INTERFACE
|
|
%% ============================================================
|
|
|
|
%% shnei_ketuvim(Input, Output, Reasoning, ThirdVerse)
|
|
shnei_ketuvim(
|
|
contradicting(V1, V2),
|
|
harmonized_reading(V1, V2, V3),
|
|
reasoning(V1, contradicts(V2), resolved_by(V3)),
|
|
V3
|
|
) :-
|
|
harmonize(V1, V2, V3, _).
|
|
|
|
%% When no resolving verse exists: teiku
|
|
shnei_ketuvim(
|
|
contradicting(V1, V2),
|
|
teiku(V1, V2),
|
|
reasoning(V1, contradicts(V2), no_resolution_found),
|
|
none
|
|
) :-
|
|
verses_contradict(V1, V2, _),
|
|
\+ resolving_verse(V1, V2, _).
|