%% 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 ===').