Files
bikoret/talmudic_engine/src/reasoning/teiku.pl
T
Scott KarpandClaude Opus 4.6 adc3e41679 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>
2026-03-16 13:25:26 -04:00

78 lines
2.6 KiB
Prolog

%% teiku.pl — Unresolved tension handling.
%%
%% Architecture §3.4: resolve(_, teiku).
%%
%% Teiku (תיקו) — "let it stand." The question is unresolvable
%% from the current specification. It is not an error. It is
%% the system's honest acknowledgment that Torah does not
%% collapse every tension into a single answer.
%%
%% Talmudic tradition: Tishbi Yetaretz Kushyot V'Abayot —
%% "Elijah will resolve difficulties and problems."
%% Until then, the tension stands. Both readings are preserved.
%%
%% eish_zarah_reading.md §5.4: The teiku record now includes
%% the challenge sequence that led to the impasse — not just
%% the verdict, but the diagnostic trail. Why did resolution fail?
%% What was the path from interpretation to unresolvable tension?
:- module(teiku, [
register_teiku/3,
register_teiku/4,
is_teiku/1,
teiku_count/1,
all_teiku/1
]).
:- dynamic teiku_record/6.
%% ============================================================
%% TEIKU REGISTRATION
%% ============================================================
%% Register an unresolvable tension between two interpretations.
%% The record preserves both sides — neither is discarded.
%% Arity-3: no challenge sequence (backward compatible)
register_teiku(I1, I2, Record) :-
register_teiku(I1, I2, no_challenges, Record).
%% Arity-4: with challenge sequence
%% ChallengeSeq is a list of kushya terms that led to the teiku,
%% or 'no_challenges' if unknown (backward compatibility).
register_teiku(I1, I2, ChallengeSeq, Record) :-
I1 = interpretation(CaseRef1, M1, V1, _, _, _),
I2 = interpretation(CaseRef2, M2, V2, _, _, _),
Record = teiku_record(CaseRef1, CaseRef2,
side_a(M1, V1), side_b(M2, V2),
unresolved, challenge_sequence(ChallengeSeq)),
assert_teiku_if_new(Record).
%% Only assert if not already registered
assert_teiku_if_new(Record) :-
Record = teiku_record(Ref1, Ref2, _, _, _, _),
( teiku_record(Ref1, Ref2, _, _, _, _)
-> true % already registered
; assertz(Record)
).
%% ============================================================
%% QUERIES
%% ============================================================
%% Check if a case resulted in teiku
is_teiku(CaseRef) :-
teiku_record(CaseRef, _, _, _, unresolved, _).
is_teiku(CaseRef) :-
teiku_record(_, CaseRef, _, _, unresolved, _).
%% Count total teiku records
teiku_count(Count) :-
aggregate_all(count, teiku_record(_, _, _, _, unresolved, _), Count).
%% Retrieve all teiku records
all_teiku(Records) :-
findall(teiku_record(A, B, C, D, E, F),
teiku_record(A, B, C, D, E, F),
Records).