Files
bikoret/talmudic_engine/src/main.pl
T
Scott KarpandClaude Fable 5.1 dba056bd80 sugya, step 1: the facts behind each threshold, verified at startup like the anchors
specs/sugya.md §IV–V step 1. talmudic_engine/src/halt/sugya.pl (a
Doorpost file beside anchors.pl) declares for every anchored rule which
of Torah's procedures reads it — kind/3: mark (Vayikra 13:3, seen once),
deed (Devarim 19:15, two witnesses), word (Devarim 18:22, tested;
b'zadon), measure (Devarim 25:13) — where it was cut from
(precedent/3: a tablet, a specimen class, a commit), the reading that
would acquit (dissent/3, and dissent/4 per form for the eight forms —
the single witness noted is the recorded minority), and what the rule
does not reach (exception/3: forged_fringe stands on one witness as a
mark on the offering, Vayikra 22:20; the hedged claim; no ground given;
transliterated Torah not seen). sugya_of/2 gathers one rule's record.

VavPipeline.Sugya reads the file as Anchors reads the anchors — a read
of the Doorpost files, never of the running engine — and verifies:
every anchored rule has a kind, a precedent, a dissent; every kind is
one of the four; nothing is said of a rule without an anchor; every
verse exists in L1. Doorpost.verify_identity chains it after
Anchors.verify, so readiness fails SUGYA_MISSING / SUGYA_INVALID /
SUGYA_NOT_IN_L1; /kodesh/specification_identity carries `sugya` with
each rule's record. Nothing on the verdict changes yet (step 3).

Every verse cited — 17 — read from L1 before this commit. Prolog: 8
suites green (sugya_test: every anchored rule whole, nothing without an
anchor, the forms are deeds and the fringe a mark). Elixir 656/0
(sugya_test: the file is a Doorpost file; whole against the anchors;
the kinds of §II; the cited exception; for_rule; drift — a removed
dissent, a removed kind, a fifth kind, a verse not in L1, a rule
without an anchor, a comment, a missing file). Doorpost pin → cb2f3135…
(31 files).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 20:43:31 +00:00

115 lines
3.8 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(halt/structure).
:- use_module(halt/lo_taaseh_lekha).
:- use_module(halt/mishkal).
:- use_module(halt/anchors).
:- use_module(halt/sugya).
:- 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 ===').