Files
bikoret/talmudic_engine/src/main.pl
T
Scott KarpandClaude Opus 4.6 723546f270 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

110 lines
3.6 KiB
Prolog

%% main.pl — Talmudic Engine entry point.
%%
%% Architecture §3.4: "SWI-Prolog is interpreted, no compilation needed"
%% Test: swipl -g run_tests -t halt src/main.pl
%%
%% This file loads all modules and provides the test runner.
:- use_module(specification/mitzvot).
:- use_module(specification/torah_text).
:- use_module(specification/root_meanings).
:- use_module(specification/relationships).
:- use_module(reasoning/interpret).
:- use_module(reasoning/challenge).
:- use_module(reasoning/resolve).
:- use_module(reasoning/teiku).
:- use_module(halt/avodah_zarah).
:- use_module(halt/shfichut_damim).
:- use_module(halt/gilui_arayot).
:- use_module(interface/api).
:- use_module(interface/json_bridge).
:- use_module(interface/socket_server).
%% Load test files
:- use_module(library(plunit)).
:- ['../test/mitzvot_test'].
:- ['../test/reasoning_test'].
:- ['../test/halt_test'].
%% ============================================================
%% VERIFICATION — Interactive commands
%% ============================================================
%% Run all tests
run_all_tests :-
run_tests.
%% Quick verification — the Step 6 equivalent of Step 7 verification
verify :-
writeln('=== TALMUDIC ENGINE VERIFICATION ==='),
nl,
%% 1. Mitzvot loaded
writeln('--- Test 1: Mitzvot loaded ---'),
total_encoded(MCount),
format(' Mitzvot encoded: ~w~n', [MCount]),
(MCount > 0 -> writeln(' PASS') ; writeln(' FAIL')),
nl,
%% 2. Verses loaded
writeln('--- Test 2: Torah text loaded ---'),
aggregate_all(count, verse(_, _, _, _, _), VCount),
format(' Verses encoded: ~w~n', [VCount]),
(VCount > 0 -> writeln(' PASS') ; writeln(' FAIL')),
nl,
%% 3. Root meanings loaded
writeln('--- Test 3: Root meanings loaded ---'),
aggregate_all(count, root_meaning(_, _, _), RCount),
format(' Root meanings encoded: ~w~n', [RCount]),
(RCount > 0 -> writeln(' PASS') ; writeln(' FAIL')),
nl,
%% 4. Interpretation works
writeln('--- Test 4: Interpretation ---'),
TestCase = case(test_1, creation, [bet_resh_aleph], 'What is creation?'),
( interpret(TestCase, Interp)
-> Interp = interpretation(_, Mitzvot, Verses, _, Conf, _),
length(Mitzvot, MLen),
length(Verses, VLen),
format(' Interpretation found: ~w mitzvot, ~w verses, confidence: ~w~n',
[MLen, VLen, Conf]),
writeln(' PASS')
; writeln(' FAIL: No interpretation generated')
),
nl,
%% 5. Halt conditions work
writeln('--- Test 5: Halt conditions ---'),
%% Test avodah zarah
AZAction = action(decide, source(claude), authority(claude)),
( halt_check_avodah_zarah(AZAction, _)
-> writeln(' Avodah zarah detection: PASS')
; writeln(' Avodah zarah detection: FAIL')
),
%% Test shfichut damim
SDAction = action(delete, target(user(test_user)), force),
( halt_check_shfichut_damim(SDAction, _)
-> writeln(' Shfichut damim detection: PASS')
; writeln(' Shfichut damim detection: FAIL')
),
%% Test gilui arayot
GAAction = action(merge, specification, interpretation),
( halt_check_gilui_arayot(GAAction, _)
-> writeln(' Gilui arayot detection: PASS')
; writeln(' Gilui arayot detection: FAIL')
),
nl,
%% 6. No false halt on valid action
writeln('--- Test 6: Valid action passes halt check ---'),
ValidAction = action(read, source(torah), authority(torah)),
( halt_check_avodah_zarah(ValidAction, _)
-> writeln(' FAIL: Valid action triggered avodah zarah')
; writeln(' PASS: Valid action not halted')
),
nl,
writeln('=== VERIFICATION COMPLETE ===').