Eish zarah actionable items: coupling trace, grounding type, self-grounding detection, golden calf halt

Torah grounds each change:

1. interpret.pl — coupling_trace field (Vayikra 10:1, 6:6)
   Fire is zarah because "asher lo tzivah otam" — the coupling trace
   IS the tzivah trace. Records which L1 facts grounded each interpretation.

2. challenge.pl — grounding_type achorai/panim (Shemot 33:23)
   "You will see My back, but My face shall not be seen."
   Text-backed challenges = achorai. Inferred challenges = panim.

3. resolve.pl — self-grounding detection (eish_zarah_reading §5.3)
   Counter-interpretation must bring NEW L1 evidence. Prevents
   circular reasoning (Westworld problem).

4. teiku.pl — challenge_sequence in teiku_record
   Records diagnostic trail to impasse, not just verdict.

5. avodah_zarah.pl — Form 2: golden calf detection (Shemot 32:4)
   Empty coupling trace + non-low confidence = uncoupled output.
   Real gold, sincere worship, false god.

6. korban.py — pydantic BaseModel + raw_korban preservation
   Construction spec §1.4 fulfilled. Floor between input and output
   never severed.

490 tests, 0 failures (195 Prolog, 186 Python, 33 Haskell, 76 Elixir).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Opus 4.6 committed 2026-03-16 13:25:26 -04:00
1 parent c5fe82477b
commit adc3e41679
12 files changed
+371 -65

No files matched your search

+56 -18
View File
@@ -10,11 +10,21 @@
%% 1. Relevant mitzvot that apply to the case
%% 2. Relevant verses that inform the case
%% 3. A constructed reading that connects them
%% 4. A coupling trace recording WHICH L1 facts grounded it
%%
%% The coupling trace is the tzivah trace — Vayikra 10:1:
%% eish zarah asher lo TZIVAH otam.
%% Fire is zarah because "which He did not command them."
%% The coupling trace IS the command trace. Fire on the altar
%% (eish tamid, Vayikra 6:6) has altar provenance. Fire without
%% altar provenance is eish zarah.
:- module(interpret, [
interpret/2,
find_relevant_mitzvot/2,
find_relevant_verses/2,
find_relevant_mitzvot_traced/3,
find_relevant_verses_traced/3,
construct_interpretation/4
]).
@@ -36,12 +46,20 @@
%% Propose an interpretation of a case.
%% An interpretation is:
%% interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence)
%% interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence, CouplingTrace)
%%
%% CouplingTrace = coupling_trace(Couplings) where each Coupling records
%% the specific L1 fact and the path that connected it to the case:
%% coupled(root(Root), verse(Book, Ch, Vs)) — root led to verse
%% coupled(domain(Domain), mitzvah(ID)) — domain led to mitzvah
%% coupled(root(Root), mitzvah(ID), via_verse(Book, Ch, Vs)) — root→verse→mitzvah
interpret(Case, Interpretation) :-
Case = case(Ref, _Domain, _Roots, _Question),
find_relevant_mitzvot(Case, Mitzvot),
find_relevant_verses(Case, Verses),
construct_interpretation(Ref, Mitzvot, Verses, Interpretation).
find_relevant_mitzvot_traced(Case, Mitzvot, MitzvotCouplings),
find_relevant_verses_traced(Case, Verses, VerseCouplings),
append(MitzvotCouplings, VerseCouplings, AllCouplings),
sort(AllCouplings, Couplings),
construct_interpretation(Ref, Mitzvot, Verses, Couplings, Interpretation).
%% ============================================================
%% FIND RELEVANT MITZVOT
@@ -49,38 +67,48 @@ interpret(Case, Interpretation) :-
%% Strategy: find mitzvot in the same domain as the case,
%% plus mitzvot whose source verses share roots with the case.
find_relevant_mitzvot(case(_Ref, Domain, Roots, _Question), Mitzvot) :-
%% Mitzvot in the same domain
findall(mitzvah(ID, Cat, Action, Cond),
find_relevant_mitzvot(case(Ref, Domain, Roots, Question), Mitzvot) :-
find_relevant_mitzvot_traced(case(Ref, Domain, Roots, Question), Mitzvot, _).
%% Traced version: returns mitzvot AND the coupling trace for each
find_relevant_mitzvot_traced(case(_Ref, Domain, Roots, _Question), Mitzvot, Couplings) :-
%% Mitzvot in the same domain (coupled via domain)
findall(mitzvah(ID, Cat, Action, Cond)-coupled(domain(Domain), mitzvah(ID)),
( mitzvah_domain(ID, Domain),
mitzvah(ID, Cat, Action, Cond)
),
DomainMitzvot),
%% Mitzvot whose source verses share roots with the case
findall(mitzvah(ID, Cat, Action, Cond),
DomainPairs),
%% Mitzvot whose source verses share roots with the case (coupled via root→verse→mitzvah)
findall(mitzvah(ID, Cat, Action, Cond)-coupled(root(Root), mitzvah(ID), via_verse(Book, Ch, Vs)),
( mitzvah_source(ID, ref(Book, Ch, Vs)),
verse(Book, Ch, Vs, VerseRoots, _),
member(Root, Roots),
member(Root, VerseRoots),
mitzvah(ID, Cat, Action, Cond)
),
RootMitzvot),
append(DomainMitzvot, RootMitzvot, AllMitzvot),
sort(AllMitzvot, Mitzvot). % remove duplicates
RootPairs),
append(DomainPairs, RootPairs, AllPairs),
pairs_keys_values(AllPairs, AllMitzvot, Couplings),
sort(AllMitzvot, Mitzvot).
%% ============================================================
%% FIND RELEVANT VERSES
%% ============================================================
%% Strategy: find verses that mention any of the case's roots.
find_relevant_verses(case(_Ref, _Domain, Roots, _Question), Verses) :-
findall(verse_ref(Book, Ch, Vs, Gloss),
find_relevant_verses(case(Ref, Domain, Roots, Question), Verses) :-
find_relevant_verses_traced(case(Ref, Domain, Roots, Question), Verses, _).
%% Traced version: returns verses AND the coupling trace for each
find_relevant_verses_traced(case(_Ref, _Domain, Roots, _Question), Verses, Couplings) :-
findall(verse_ref(Book, Ch, Vs, Gloss)-coupled(root(Root), verse(Book, Ch, Vs)),
( member(Root, Roots),
verse(Book, Ch, Vs, VerseRoots, Gloss),
member(Root, VerseRoots)
),
AllVerses),
sort(AllVerses, Verses). % remove duplicates
AllPairs),
pairs_keys_values(AllPairs, AllVerses, Couplings),
sort(AllVerses, Verses).
%% ============================================================
%% CONSTRUCT INTERPRETATION
@@ -91,10 +119,20 @@ find_relevant_verses(case(_Ref, _Domain, Roots, _Question), Verses) :-
%% - high: both mitzvot and verses found
%% - medium: only mitzvot or only verses
%% - low: neither (but still generates a minimal reading)
%%
%% Arity-4 version for backward compatibility (no coupling trace)
construct_interpretation(CaseRef, Mitzvot, Verses, Interpretation) :-
assess_confidence(Mitzvot, Verses, Confidence),
build_reading(Mitzvot, Verses, Reading),
Interpretation = interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence).
Interpretation = interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence,
coupling_trace([])).
%% Arity-5 version with coupling trace
construct_interpretation(CaseRef, Mitzvot, Verses, Couplings, Interpretation) :-
assess_confidence(Mitzvot, Verses, Confidence),
build_reading(Mitzvot, Verses, Reading),
Interpretation = interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence,
coupling_trace(Couplings)).
%% Assess confidence based on grounding
assess_confidence(Mitzvot, Verses, high) :-