%% challenge.pl — Kushya generation. %% %% Architecture §3.4: %% challenge(Interpretation, Challenge) :- %% mitzvah(_, _, _, _) = Contradicting, %% contradicts(Interpretation, Contradicting), %% Challenge = kushya(Contradicting, Interpretation). %% %% A kushya is a challenge grounded in Torah text. %% It identifies a tension between the proposed interpretation %% and another part of the specification. %% %% The challenge is a question, not a refutation. %% It says: "But what about THIS verse/mitzvah?" :- module(challenge, [ challenge/2, find_contradiction/3, contradicts/2, challenge_strength/2 ]). :- use_module('../specification/mitzvot'). :- use_module('../specification/torah_text'). :- use_module('../specification/relationships'). :- use_module('../specification/root_meanings'). %% ============================================================ %% CHALLENGE GENERATION %% ============================================================ %% Generate a challenge to an interpretation. %% A challenge consists of: %% kushya(Contradicting, Interpretation, Strength) %% - Contradicting: the mitzvah or verse that creates tension %% - Interpretation: the interpretation being challenged %% - Strength: strong | moderate | weak challenge(interpretation(CaseRef, Mitzvot, Verses, _Reading, _Confidence), Challenge) :- find_contradiction(Mitzvot, Verses, Contradicting), challenge_strength(Contradicting, Strength), Challenge = kushya(Contradicting, CaseRef, Strength). %% ============================================================ %% FIND CONTRADICTIONS %% ============================================================ %% Strategy 1: Find a mitzvah that conflicts with one in the interpretation find_contradiction(Mitzvot, _Verses, contradiction(mitzvah_tension, ID1, ID2, Desc)) :- member(mitzvah(ID1, _, _, _), Mitzvot), mitzvah_conflicts_with(ID1, ID2, Desc). %% Strategy 2: Find a verse with a root in a conflicting domain find_contradiction(_Mitzvot, Verses, contradiction(domain_tension, Root, Domain1, Domain2)) :- member(verse_ref(Book, Ch, Vs, _), Verses), verse(Book, Ch, Vs, VerseRoots, _), member(Root, VerseRoots), root_domain(Root, Domain1), root_domain(OtherRoot, Domain2), Domain1 \= Domain2, domains_in_tension(Domain1, Domain2), member(OtherRoot, VerseRoots). %% Strategy 3: Find a mitzvah whose condition conflicts with the case context find_contradiction(Mitzvot, _Verses, contradiction(condition_tension, ID, Action, Cond)) :- member(mitzvah(ID, _, Action, when(Cond)), Mitzvot), condition_creates_tension(Cond). %% ============================================================ %% TENSION DETECTION %% ============================================================ %% contradicts/2 — does a source contradict an interpretation? %% This is the core logic: given an interpretation's grounding, %% does some other part of Torah create a tension? contradicts(interpretation(_, Mitzvot, _, _, _), Source) :- find_contradiction(Mitzvot, [], Source). %% Domains that are inherently in 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, life). domains_in_tension(life, death). domains_in_tension(authority, service). domains_in_tension(service, authority). %% Conditions that create tension (they limit universality) condition_creates_tension(seventh_day). % Shabbat limits action condition_creates_tension(capital_case). % Higher standard of evidence condition_creates_tension(pursuit_in_progress). % Time pressure condition_creates_tension(court_deliberation). % Procedural constraints %% ============================================================ %% CHALLENGE STRENGTH %% ============================================================ %% Assess how strong a challenge is challenge_strength(contradiction(mitzvah_tension, _, _, _), strong). challenge_strength(contradiction(domain_tension, _, _, _), moderate). challenge_strength(contradiction(condition_tension, _, _, _), weak).