Files
bikoret/talmudic_engine/test/sugya_test.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

37 lines
1.5 KiB
Prolog

%% sugya_test.pl — the case behind each threshold is whole (specs/sugya.md §IV).
:- use_module(library(plunit)).
:- use_module('../src/halt/anchors').
:- use_module('../src/halt/sugya').
:- begin_tests(sugya).
%% Every anchored rule has a kind, a precedent and at least one dissent.
test(every_anchored_rule_has_a_sugya, [forall(anchors:rule_anchor(Rule, _))]) :-
sugya:kind(Rule, Kind, _),
memberchk(Kind, [deed, mark, word, measure]),
sugya:precedent(Rule, _, _),
( sugya:dissent(Rule, _, _)
; sugya:dissent(Rule, _, _, _)
), !.
%% Nothing is said of a rule that has no anchor (Devarim 4:2).
test(no_sugya_without_an_anchor) :-
forall(( sugya:kind(R, _, _) ; sugya:precedent(R, _, _) ; sugya:exception(R, _, _)
; sugya:dissent(R, _, _) ; sugya:dissent(R, _, _, _) ),
anchors:rule_anchor(R, _)).
%% The kinds of sugya.md §II.
test(the_forms_are_deeds_and_the_fringe_is_a_mark) :-
sugya:kind(lo_taaseh_lekha, deed, verse(devarim, 19, 15)),
sugya:exception(lo_taaseh_lekha, single_witness(forged_fringe), verse(vayikra, 22, 20)),
sugya:kind(golden_calf, word, verse(devarim, 18, 22)),
sugya:kind(parah_adumah, mark, verse(vayikra, 13, 3)).
%% sugya_of/2 gathers one rule's record.
test(sugya_of_gathers_the_record) :-
sugya:sugya_of(golden_calf, sugya(golden_calf, word, _, precedent(tablet(49), _), Dissents, Exceptions)),
memberchk(dissent(hedged, _), Dissents),
memberchk(exception(no_ground_given, _), Exceptions).
:- end_tests(sugya).