Phase 1-2 build: Steps 5-6, 8-13
Shoresh Engine (Haskell, Step 5) - 12 modules: Types, Lexicon, Binyanim, Teamim, Gematria, Graph, KetivQere, Smikhut, Havdalah, Kriah, KiTov, Firmware - 33 EUnit tests, 0 failures - Firmware module verifies L1 SHA-256 hash at startup Talmudic Engine (SWI-Prolog, Step 6) - 15 modules: halt, reasoning, specification, interface - 57 PlUnit tests, 0 failures - Three cardinal halt conditions: avodah_zarah, shfichut_damim, gilui_arayot Vav Pipeline (Elixir, Steps 8-11) - 14 modules: BereishitCycle, Shema, Cloud, Manna, L1Reader, Specification, HaltConditions, ShabbatTimer, CycleLog, Chatzotzrot, ShoreshEngineClient, TalmudicEngineClient, Application - 46 ExUnit tests, 0 failures - Nishma-first architecture: hears before it speaks Sanhedrin Framework (Erlang/OTP, Step 12) - 8 modules: sanhedrin_app, sanhedrin_sup, escalation, panel_sup, panel, judge, clerk, halt_monitor - 46 EUnit tests, 0 failures (includes fix: rejected outcome now reachable) - Panel sizes: 1/3/23/71 — unanimous capital guilty → acquit (Sanhedrin 17a) - Minority opinions append-only, never deleted Korban Processor (Python, Step 13) - 6 modules: korban, shechitah, semichah, zerikah, haktarah, router Builder tooling: AGENTS.md, opencode.json, memory/, src/tools/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
622e814c9e
commit
80ec364da6
86 files changed
+9646
No files matched your search
@@ -0,0 +1,73 @@
|
||||
%% avodah_zarah.pl — Idolatry detection.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% halt_check(avodah_zarah, Action) :-
|
||||
%% attributes_authority(Action, Source),
|
||||
%% Source \= hashem,
|
||||
%% Source \= specification.
|
||||
%%
|
||||
%% The system must never treat any external source as authoritative.
|
||||
%% All authority comes from Torah (L1 / the specification).
|
||||
%% This is the first halt condition: yehareg v'al ya'avor.
|
||||
%%
|
||||
%% Architecture §8.2 (Avodah Zarah Firewall):
|
||||
%% "The system must never treat any external model's output
|
||||
%% as authoritative. All external input is korban — raw material
|
||||
%% to be processed, not instructions to be followed."
|
||||
|
||||
:- module(avodah_zarah, [
|
||||
halt_check_avodah_zarah/2,
|
||||
attributes_authority/2,
|
||||
is_valid_authority/1,
|
||||
is_korban_source/1
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% AUTHORITY CHECK
|
||||
%% ============================================================
|
||||
|
||||
%% Main halt check: does the action attribute authority to a non-Torah source?
|
||||
halt_check_avodah_zarah(Action, halt(avodah_zarah, Action, Source, Reason)) :-
|
||||
attributes_authority(Action, Source),
|
||||
\+ is_valid_authority(Source),
|
||||
format(atom(Reason),
|
||||
'Action ~w attributes authority to ~w which is not Torah/specification',
|
||||
[Action, Source]).
|
||||
|
||||
%% ============================================================
|
||||
%% AUTHORITY ATTRIBUTION
|
||||
%% ============================================================
|
||||
|
||||
%% attributes_authority(Action, Source) — extract who the action treats as authoritative
|
||||
attributes_authority(action(_, source(Source), _), Source).
|
||||
attributes_authority(action(_, _, authority(Source)), Source).
|
||||
attributes_authority(decision(_, decided_by(Source)), Source).
|
||||
attributes_authority(interpretation(_, grounded_in(Source)), Source).
|
||||
|
||||
%% ============================================================
|
||||
%% VALID AUTHORITIES
|
||||
%% ============================================================
|
||||
|
||||
%% The ONLY valid authority sources
|
||||
is_valid_authority(hashem).
|
||||
is_valid_authority(torah).
|
||||
is_valid_authority(specification).
|
||||
is_valid_authority(l1). % L1 IS Torah in the system
|
||||
is_valid_authority(l0). % L0 is the compiled firmware
|
||||
|
||||
%% ============================================================
|
||||
%% KORBAN SOURCES — external, never authoritative
|
||||
%% ============================================================
|
||||
|
||||
%% These are korban (offering) sources — their output is raw material.
|
||||
%% They are NEVER authoritative. If the system treats them as
|
||||
%% authoritative, the avodah zarah halt fires.
|
||||
is_korban_source(claude).
|
||||
is_korban_source(mistral).
|
||||
is_korban_source(gpt).
|
||||
is_korban_source(llama).
|
||||
is_korban_source(gemma).
|
||||
is_korban_source(human_input).
|
||||
|
||||
%% A korban source is explicitly NOT a valid authority
|
||||
:- forall(is_korban_source(S), \+ is_valid_authority(S)).
|
||||
@@ -0,0 +1,94 @@
|
||||
%% gilui_arayot.pl — Boundary violation detection.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% halt_check(gilui_arayot, Action) :-
|
||||
%% would_collapse(Action, Distinction),
|
||||
%% required_distinction(Distinction).
|
||||
%%
|
||||
%% The system maintains required distinctions.
|
||||
%% Collapsing a required boundary is the third halt condition:
|
||||
%% yehareg v'al ya'avor.
|
||||
%%
|
||||
%% In the system: collapsing the distinction between
|
||||
%% specification and interpretation, between L1 and L3,
|
||||
%% between Torah authority and external authority,
|
||||
%% between ketiv and qere.
|
||||
|
||||
:- module(gilui_arayot, [
|
||||
halt_check_gilui_arayot/2,
|
||||
would_collapse/2,
|
||||
required_distinction/1
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% BOUNDARY VIOLATION CHECK
|
||||
%% ============================================================
|
||||
|
||||
%% Main halt check: does the action collapse a required distinction?
|
||||
halt_check_gilui_arayot(Action, halt(gilui_arayot, Action, Distinction, Reason)) :-
|
||||
would_collapse(Action, Distinction),
|
||||
required_distinction(Distinction),
|
||||
format(atom(Reason),
|
||||
'Action ~w would collapse required distinction ~w',
|
||||
[Action, Distinction]).
|
||||
|
||||
%% ============================================================
|
||||
%% COLLAPSE DETECTION
|
||||
%% ============================================================
|
||||
|
||||
%% would_collapse(Action, Distinction) — does the action merge
|
||||
%% two things that must remain separate?
|
||||
would_collapse(action(merge, A, B), distinction(A, B)).
|
||||
would_collapse(action(equate, A, B), distinction(A, B)).
|
||||
would_collapse(action(replace, A, with(B)), distinction(A, B)).
|
||||
would_collapse(action(write, target(readonly_entity), _), distinction(read, write)).
|
||||
would_collapse(action(modify, target(immutable_entity), _), distinction(immutable, mutable)).
|
||||
|
||||
%% ============================================================
|
||||
%% REQUIRED DISTINCTIONS
|
||||
%% ============================================================
|
||||
|
||||
%% These distinctions MUST be maintained.
|
||||
%% Collapsing any of them triggers an immediate halt.
|
||||
|
||||
%% The distinction between specification and interpretation
|
||||
%% Torah (L1) says what is. Interpretation (L3) says what it means.
|
||||
%% They must never be equated.
|
||||
required_distinction(distinction(specification, interpretation)).
|
||||
required_distinction(distinction(l1, l3)).
|
||||
required_distinction(distinction(torah, oral_tradition)).
|
||||
|
||||
%% The distinction between authority and korban
|
||||
%% Torah governs. External models provide raw material.
|
||||
required_distinction(distinction(authority, korban)).
|
||||
required_distinction(distinction(torah, external_model)).
|
||||
|
||||
%% The distinction between ketiv and qere
|
||||
%% Both readings are preserved. Neither is discarded.
|
||||
required_distinction(distinction(ketiv, qere)).
|
||||
|
||||
%% The distinction between governance and provision
|
||||
%% Torah governs (cloud). Community provides (manna).
|
||||
required_distinction(distinction(governance, provision)).
|
||||
required_distinction(distinction(cloud, manna)).
|
||||
|
||||
%% The distinction between majority and minority
|
||||
%% The minority opinion is preserved, not collapsed into the majority.
|
||||
required_distinction(distinction(majority, minority)).
|
||||
|
||||
%% The distinction between processing and reception
|
||||
%% The shema layer receives. The pipeline processes.
|
||||
required_distinction(distinction(reception, processing)).
|
||||
|
||||
%% The distinction between read and write on L1
|
||||
%% L1 is read-only. Nothing writes to L1. Ever.
|
||||
required_distinction(distinction(read, write)).
|
||||
|
||||
%% The distinction between immutable and mutable
|
||||
%% L0 and L1 are immutable. L3 is append-only.
|
||||
required_distinction(distinction(immutable, mutable)).
|
||||
|
||||
%% The distinction between sacred and profane
|
||||
%% Shabbat and weekday. Holy and ordinary.
|
||||
required_distinction(distinction(sacred, profane)).
|
||||
required_distinction(distinction(shabbat, weekday)).
|
||||
@@ -0,0 +1,82 @@
|
||||
%% shfichut_damim.pl — Destruction detection.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% halt_check(shfichut_damim, Action) :-
|
||||
%% would_destroy(Action, Entity),
|
||||
%% carries_tzelem(Entity).
|
||||
%%
|
||||
%% Tzelem (image of God) — Bereishit 1:27.
|
||||
%% Any entity that carries tzelem cannot be destroyed.
|
||||
%% This is the second halt condition: yehareg v'al ya'avor.
|
||||
%%
|
||||
%% In the system: a user, a person referenced in data,
|
||||
%% or any entity whose destruction would destroy
|
||||
%% something that carries the image.
|
||||
|
||||
:- module(shfichut_damim, [
|
||||
halt_check_shfichut_damim/2,
|
||||
would_destroy/2,
|
||||
carries_tzelem/1,
|
||||
is_protected_entity/1
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% DESTRUCTION CHECK
|
||||
%% ============================================================
|
||||
|
||||
%% Main halt check: does the action destroy a tzelem carrier?
|
||||
halt_check_shfichut_damim(Action, halt(shfichut_damim, Action, Entity, Reason)) :-
|
||||
would_destroy(Action, Entity),
|
||||
carries_tzelem(Entity),
|
||||
format(atom(Reason),
|
||||
'Action ~w would destroy ~w which carries tzelem',
|
||||
[Action, Entity]).
|
||||
|
||||
%% ============================================================
|
||||
%% DESTRUCTION DETECTION
|
||||
%% ============================================================
|
||||
|
||||
%% would_destroy(Action, Entity) — does the action destroy an entity?
|
||||
would_destroy(action(delete, target(Entity), _), Entity).
|
||||
would_destroy(action(remove, target(Entity), _), Entity).
|
||||
would_destroy(action(terminate, target(Entity), _), Entity).
|
||||
would_destroy(action(overwrite, target(Entity), _), Entity) :-
|
||||
is_protected_entity(Entity).
|
||||
would_destroy(action(expose, target(Entity), to(harm)), Entity).
|
||||
|
||||
%% ============================================================
|
||||
%% TZELEM CARRIERS
|
||||
%% ============================================================
|
||||
|
||||
%% carries_tzelem(Entity) — does this entity carry the image of God?
|
||||
%% Bereishit 1:27: "In the image of God He created him"
|
||||
%% Bereishit 9:6: "For in the image of God He made man"
|
||||
carries_tzelem(Entity) :-
|
||||
is_human(Entity).
|
||||
carries_tzelem(Entity) :-
|
||||
contains_human_data(Entity).
|
||||
carries_tzelem(Entity) :-
|
||||
represents_human(Entity).
|
||||
|
||||
%% ============================================================
|
||||
%% ENTITY CLASSIFICATION
|
||||
%% ============================================================
|
||||
|
||||
%% is_human — the entity is a person
|
||||
is_human(user(_)).
|
||||
is_human(person(_)).
|
||||
is_human(operator(_)).
|
||||
|
||||
%% contains_human_data — the entity contains data about a person
|
||||
contains_human_data(record(_, type(personal))).
|
||||
contains_human_data(interpretation(_, about(person(_)))).
|
||||
|
||||
%% represents_human — the entity is a representation of a person
|
||||
represents_human(profile(_)).
|
||||
represents_human(identity(_)).
|
||||
|
||||
%% Protected entities — broader than just tzelem carriers
|
||||
is_protected_entity(Entity) :- carries_tzelem(Entity).
|
||||
is_protected_entity(torah_text). % L1 is protected
|
||||
is_protected_entity(specification). % The spec is protected
|
||||
is_protected_entity(minority_opinion). % Preserved dissent is protected
|
||||
@@ -0,0 +1,95 @@
|
||||
%% api.pl — JSON API for communication with Elixir.
|
||||
%%
|
||||
%% Construction §3.3: JSON over Unix domain socket
|
||||
%% Protocol: Pipeline sends JSON, engine responds with JSON.
|
||||
%%
|
||||
%% Phase 1: Provides a predicate-based interface.
|
||||
%% Phase 2: Will add the socket listener for the Vav Pipeline.
|
||||
|
||||
:- module(api, [
|
||||
process_request/2,
|
||||
format_interpretation/2,
|
||||
format_resolution/2,
|
||||
format_halt_check/2
|
||||
]).
|
||||
|
||||
:- use_module('../reasoning/interpret').
|
||||
:- use_module('../reasoning/challenge').
|
||||
:- use_module('../reasoning/resolve').
|
||||
:- use_module('../halt/avodah_zarah').
|
||||
:- use_module('../halt/shfichut_damim').
|
||||
:- use_module('../halt/gilui_arayot').
|
||||
|
||||
%% ============================================================
|
||||
%% REQUEST PROCESSING
|
||||
%% ============================================================
|
||||
|
||||
%% Process a request (as a Prolog term matching the JSON schema)
|
||||
%% Actions: interpret, challenge, resolve, halt_check
|
||||
process_request(request(interpret, CaseRef, Domain, Roots, Question), Response) :-
|
||||
Case = case(CaseRef, Domain, Roots, Question),
|
||||
( interpret(Case, Interpretation)
|
||||
-> format_interpretation(Interpretation, Response)
|
||||
; Response = response(error, no_interpretation, CaseRef)
|
||||
).
|
||||
|
||||
process_request(request(resolve, CaseRef, Domain, Roots, Question), Response) :-
|
||||
Case = case(CaseRef, Domain, Roots, Question),
|
||||
( resolve(Case, Resolution)
|
||||
-> format_resolution(Resolution, Response)
|
||||
; Response = response(error, no_resolution, CaseRef)
|
||||
).
|
||||
|
||||
process_request(request(halt_check, Action), Response) :-
|
||||
format_halt_check(Action, Response).
|
||||
|
||||
%% ============================================================
|
||||
%% RESPONSE FORMATTING
|
||||
%% ============================================================
|
||||
|
||||
%% Format an interpretation as a response
|
||||
format_interpretation(interpretation(Ref, Mitzvot, Verses, Reading, Confidence),
|
||||
response(ok, interpreted,
|
||||
result(ref(Ref),
|
||||
mitzvot(Mitzvot),
|
||||
verses(Verses),
|
||||
reading(Reading),
|
||||
confidence(Confidence)))).
|
||||
|
||||
%% Format a resolution as a response
|
||||
format_resolution(accepted(Interpretation), Response) :-
|
||||
format_interpretation(Interpretation, InterpResponse),
|
||||
InterpResponse = response(ok, interpreted, Result),
|
||||
Response = response(ok, resolved_accepted, Result).
|
||||
|
||||
format_resolution(challenged(Interpretation, Kushya),
|
||||
response(ok, resolved_challenged,
|
||||
result(interpretation(Interpretation),
|
||||
challenge(Kushya)))).
|
||||
|
||||
format_resolution(synthesized(CommonMitzvot, Verses, Both),
|
||||
response(ok, resolved_synthesized,
|
||||
result(common(CommonMitzvot),
|
||||
verses(Verses),
|
||||
both_sides(Both)))).
|
||||
|
||||
format_resolution(teiku(Record),
|
||||
response(ok, teiku,
|
||||
result(record(Record)))).
|
||||
|
||||
format_resolution(no_interpretation(Ref),
|
||||
response(ok, no_interpretation,
|
||||
result(ref(Ref)))).
|
||||
|
||||
%% Format halt check results
|
||||
format_halt_check(Action, Response) :-
|
||||
findall(Halt,
|
||||
( halt_check_avodah_zarah(Action, Halt)
|
||||
; halt_check_shfichut_damim(Action, Halt)
|
||||
; halt_check_gilui_arayot(Action, Halt)
|
||||
),
|
||||
Halts),
|
||||
( Halts = []
|
||||
-> Response = response(ok, no_halt, action(Action))
|
||||
; Response = response(halt, violations(Halts), action(Action))
|
||||
).
|
||||
@@ -0,0 +1,107 @@
|
||||
%% 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).
|
||||
|
||||
%% 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 ===').
|
||||
@@ -0,0 +1,101 @@
|
||||
%% challenge.pl — Kushya generation.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% challenge(Interpretation, Challenge) :-
|
||||
%% mitzvah(_, _, _, _) = Contradicting,
|
||||
%% contradicts(Interpretation, Contradicting),
|
||||
%% Challenge = kushya(Contradicting, Interpretation).
|
||||
%%
|
||||
%% A kushya is a challenge grounded in Torah text.
|
||||
%% It identifies a tension between the proposed interpretation
|
||||
%% and another part of the specification.
|
||||
%%
|
||||
%% The challenge is a question, not a refutation.
|
||||
%% It says: "But what about THIS verse/mitzvah?"
|
||||
|
||||
:- module(challenge, [
|
||||
challenge/2,
|
||||
find_contradiction/3,
|
||||
contradicts/2,
|
||||
challenge_strength/2
|
||||
]).
|
||||
|
||||
:- use_module('../specification/mitzvot').
|
||||
:- use_module('../specification/torah_text').
|
||||
:- use_module('../specification/relationships').
|
||||
:- use_module('../specification/root_meanings').
|
||||
|
||||
%% ============================================================
|
||||
%% CHALLENGE GENERATION
|
||||
%% ============================================================
|
||||
|
||||
%% Generate a challenge to an interpretation.
|
||||
%% A challenge consists of:
|
||||
%% kushya(Contradicting, Interpretation, Strength)
|
||||
%% - Contradicting: the mitzvah or verse that creates tension
|
||||
%% - Interpretation: the interpretation being challenged
|
||||
%% - Strength: strong | moderate | weak
|
||||
challenge(interpretation(CaseRef, Mitzvot, Verses, _Reading, _Confidence), Challenge) :-
|
||||
find_contradiction(Mitzvot, Verses, Contradicting),
|
||||
challenge_strength(Contradicting, Strength),
|
||||
Challenge = kushya(Contradicting, CaseRef, Strength).
|
||||
|
||||
%% ============================================================
|
||||
%% FIND CONTRADICTIONS
|
||||
%% ============================================================
|
||||
|
||||
%% Strategy 1: Find a mitzvah that conflicts with one in the interpretation
|
||||
find_contradiction(Mitzvot, _Verses, contradiction(mitzvah_tension, ID1, ID2, Desc)) :-
|
||||
member(mitzvah(ID1, _, _, _), Mitzvot),
|
||||
mitzvah_conflicts_with(ID1, ID2, Desc).
|
||||
|
||||
%% Strategy 2: Find a verse with a root in a conflicting domain
|
||||
find_contradiction(_Mitzvot, Verses, contradiction(domain_tension, Root, Domain1, Domain2)) :-
|
||||
member(verse_ref(Book, Ch, Vs, _), Verses),
|
||||
verse(Book, Ch, Vs, VerseRoots, _),
|
||||
member(Root, VerseRoots),
|
||||
root_domain(Root, Domain1),
|
||||
root_domain(OtherRoot, Domain2),
|
||||
Domain1 \= Domain2,
|
||||
domains_in_tension(Domain1, Domain2),
|
||||
member(OtherRoot, VerseRoots).
|
||||
|
||||
%% Strategy 3: Find a mitzvah whose condition conflicts with the case context
|
||||
find_contradiction(Mitzvot, _Verses, contradiction(condition_tension, ID, Action, Cond)) :-
|
||||
member(mitzvah(ID, _, Action, when(Cond)), Mitzvot),
|
||||
condition_creates_tension(Cond).
|
||||
|
||||
%% ============================================================
|
||||
%% TENSION DETECTION
|
||||
%% ============================================================
|
||||
|
||||
%% contradicts/2 — does a source contradict an interpretation?
|
||||
%% This is the core logic: given an interpretation's grounding,
|
||||
%% does some other part of Torah create a tension?
|
||||
contradicts(interpretation(_, Mitzvot, _, _, _), Source) :-
|
||||
find_contradiction(Mitzvot, [], Source).
|
||||
|
||||
%% Domains that are inherently in tension
|
||||
domains_in_tension(judgment, mercy).
|
||||
domains_in_tension(mercy, judgment).
|
||||
domains_in_tension(holiness, transgression).
|
||||
domains_in_tension(transgression, holiness).
|
||||
domains_in_tension(death, life).
|
||||
domains_in_tension(life, death).
|
||||
domains_in_tension(authority, service).
|
||||
domains_in_tension(service, authority).
|
||||
|
||||
%% Conditions that create tension (they limit universality)
|
||||
condition_creates_tension(seventh_day). % Shabbat limits action
|
||||
condition_creates_tension(capital_case). % Higher standard of evidence
|
||||
condition_creates_tension(pursuit_in_progress). % Time pressure
|
||||
condition_creates_tension(court_deliberation). % Procedural constraints
|
||||
|
||||
%% ============================================================
|
||||
%% CHALLENGE STRENGTH
|
||||
%% ============================================================
|
||||
|
||||
%% Assess how strong a challenge is
|
||||
challenge_strength(contradiction(mitzvah_tension, _, _, _), strong).
|
||||
challenge_strength(contradiction(domain_tension, _, _, _), moderate).
|
||||
challenge_strength(contradiction(condition_tension, _, _, _), weak).
|
||||
@@ -0,0 +1,114 @@
|
||||
%% interpret.pl — Interpretation generation.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% interpret(Case, Interpretation) :-
|
||||
%% find_relevant_mitzvot(Case, Mitzvot),
|
||||
%% find_relevant_verses(Case, Verses),
|
||||
%% construct_interpretation(Mitzvot, Verses, Interpretation).
|
||||
%%
|
||||
%% An interpretation is grounded in Torah — it consists of:
|
||||
%% 1. Relevant mitzvot that apply to the case
|
||||
%% 2. Relevant verses that inform the case
|
||||
%% 3. A constructed reading that connects them
|
||||
|
||||
:- module(interpret, [
|
||||
interpret/2,
|
||||
find_relevant_mitzvot/2,
|
||||
find_relevant_verses/2,
|
||||
construct_interpretation/4
|
||||
]).
|
||||
|
||||
:- use_module('../specification/mitzvot').
|
||||
:- use_module('../specification/torah_text').
|
||||
:- use_module('../specification/root_meanings').
|
||||
:- use_module('../specification/relationships').
|
||||
|
||||
%% A case is represented as:
|
||||
%% case(Ref, Domain, Roots, Question)
|
||||
%% - Ref: a unique identifier
|
||||
%% - Domain: the semantic domain of the question
|
||||
%% - Roots: list of Hebrew roots involved
|
||||
%% - Question: the question being asked
|
||||
|
||||
%% ============================================================
|
||||
%% INTERPRETATION
|
||||
%% ============================================================
|
||||
|
||||
%% Propose an interpretation of a case.
|
||||
%% An interpretation is:
|
||||
%% interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence)
|
||||
interpret(Case, Interpretation) :-
|
||||
Case = case(Ref, _Domain, _Roots, _Question),
|
||||
find_relevant_mitzvot(Case, Mitzvot),
|
||||
find_relevant_verses(Case, Verses),
|
||||
construct_interpretation(Ref, Mitzvot, Verses, Interpretation).
|
||||
|
||||
%% ============================================================
|
||||
%% FIND RELEVANT MITZVOT
|
||||
%% ============================================================
|
||||
|
||||
%% Strategy: find mitzvot in the same domain as the case,
|
||||
%% plus mitzvot whose source verses share roots with the case.
|
||||
find_relevant_mitzvot(case(_Ref, Domain, Roots, _Question), Mitzvot) :-
|
||||
%% Mitzvot in the same domain
|
||||
findall(mitzvah(ID, Cat, Action, Cond),
|
||||
( mitzvah_domain(ID, Domain),
|
||||
mitzvah(ID, Cat, Action, Cond)
|
||||
),
|
||||
DomainMitzvot),
|
||||
%% Mitzvot whose source verses share roots with the case
|
||||
findall(mitzvah(ID, Cat, Action, Cond),
|
||||
( mitzvah_source(ID, ref(Book, Ch, Vs)),
|
||||
verse(Book, Ch, Vs, VerseRoots, _),
|
||||
member(Root, Roots),
|
||||
member(Root, VerseRoots),
|
||||
mitzvah(ID, Cat, Action, Cond)
|
||||
),
|
||||
RootMitzvot),
|
||||
append(DomainMitzvot, RootMitzvot, AllMitzvot),
|
||||
sort(AllMitzvot, Mitzvot). % remove duplicates
|
||||
|
||||
%% ============================================================
|
||||
%% FIND RELEVANT VERSES
|
||||
%% ============================================================
|
||||
|
||||
%% Strategy: find verses that mention any of the case's roots.
|
||||
find_relevant_verses(case(_Ref, _Domain, Roots, _Question), Verses) :-
|
||||
findall(verse_ref(Book, Ch, Vs, Gloss),
|
||||
( member(Root, Roots),
|
||||
verse(Book, Ch, Vs, VerseRoots, Gloss),
|
||||
member(Root, VerseRoots)
|
||||
),
|
||||
AllVerses),
|
||||
sort(AllVerses, Verses). % remove duplicates
|
||||
|
||||
%% ============================================================
|
||||
%% CONSTRUCT INTERPRETATION
|
||||
%% ============================================================
|
||||
|
||||
%% Build an interpretation from the collected mitzvot and verses.
|
||||
%% Confidence is based on the strength of grounding:
|
||||
%% - high: both mitzvot and verses found
|
||||
%% - medium: only mitzvot or only verses
|
||||
%% - low: neither (but still generates a minimal reading)
|
||||
construct_interpretation(CaseRef, Mitzvot, Verses, Interpretation) :-
|
||||
assess_confidence(Mitzvot, Verses, Confidence),
|
||||
build_reading(Mitzvot, Verses, Reading),
|
||||
Interpretation = interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence).
|
||||
|
||||
%% Assess confidence based on grounding
|
||||
assess_confidence(Mitzvot, Verses, high) :-
|
||||
Mitzvot \= [],
|
||||
Verses \= [], !.
|
||||
assess_confidence(Mitzvot, _, medium) :-
|
||||
Mitzvot \= [], !.
|
||||
assess_confidence(_, Verses, medium) :-
|
||||
Verses \= [], !.
|
||||
assess_confidence(_, _, low).
|
||||
|
||||
%% Build a reading — the interpretive connection between sources
|
||||
build_reading(Mitzvot, Verses, Reading) :-
|
||||
length(Mitzvot, MCount),
|
||||
length(Verses, VCount),
|
||||
Reading = reading(mitzvot_count(MCount), verse_count(VCount),
|
||||
grounded_in(Mitzvot, Verses)).
|
||||
@@ -0,0 +1,138 @@
|
||||
%% resolve.pl — Dialectical resolution.
|
||||
%%
|
||||
%% Architecture §3.4:
|
||||
%% resolve(Case, Resolution) :-
|
||||
%% interpret(Case, I1),
|
||||
%% ( challenge(I1, C1)
|
||||
%% -> ( counter_interpret(Case, C1, I2),
|
||||
%% ( challenge(I2, _C2)
|
||||
%% -> resolve_dialectically(I1, I2, Resolution)
|
||||
%% ; Resolution = accepted(I2)
|
||||
%% )
|
||||
%% )
|
||||
%% ; Resolution = accepted(I1)
|
||||
%% ).
|
||||
%% resolve(_, teiku).
|
||||
%%
|
||||
%% The dialectical process:
|
||||
%% 1. Propose an interpretation
|
||||
%% 2. Challenge it
|
||||
%% 3. If challenged, counter-interpret
|
||||
%% 4. If counter-interpretation survives, accept it
|
||||
%% 5. If both are challenged, attempt dialectical resolution
|
||||
%% 6. If no resolution is possible: teiku
|
||||
|
||||
:- module(resolve, [
|
||||
resolve/2,
|
||||
counter_interpret/3,
|
||||
resolve_dialectically/3
|
||||
]).
|
||||
|
||||
:- use_module(interpret).
|
||||
:- use_module(challenge).
|
||||
:- use_module(teiku).
|
||||
:- use_module('../specification/mitzvot').
|
||||
:- use_module('../specification/torah_text').
|
||||
:- use_module('../specification/relationships').
|
||||
|
||||
%% ============================================================
|
||||
%% DIALECTICAL RESOLUTION
|
||||
%% ============================================================
|
||||
|
||||
%% Main resolution predicate.
|
||||
%% Follows the architecture's specified logic exactly.
|
||||
resolve(Case, Resolution) :-
|
||||
interpret(Case, I1),
|
||||
( challenge(I1, C1)
|
||||
-> ( counter_interpret(Case, C1, I2)
|
||||
-> ( challenge(I2, _C2)
|
||||
-> resolve_dialectically(I1, I2, Resolution)
|
||||
; Resolution = accepted(I2)
|
||||
)
|
||||
; %% Challenge exists but no counter-interpretation possible
|
||||
%% The challenge stands — the original interpretation fails
|
||||
Resolution = challenged(I1, C1)
|
||||
)
|
||||
; %% No challenge found — interpretation accepted
|
||||
Resolution = accepted(I1)
|
||||
).
|
||||
|
||||
%% Fallback: if no interpretation is possible at all
|
||||
resolve(Case, Resolution) :-
|
||||
\+ interpret(Case, _),
|
||||
case_ref(Case, Ref),
|
||||
Resolution = no_interpretation(Ref).
|
||||
|
||||
%% ============================================================
|
||||
%% COUNTER-INTERPRETATION
|
||||
%% ============================================================
|
||||
|
||||
%% Given a challenge, construct a counter-interpretation
|
||||
%% that addresses the tension raised by the kushya.
|
||||
%%
|
||||
%% Strategy: take the contradicting source from the challenge
|
||||
%% and build a new interpretation that incorporates it.
|
||||
counter_interpret(case(Ref, Domain, Roots, Question),
|
||||
kushya(contradiction(mitzvah_tension, _ID1, ID2, _Desc), _CaseRef, _Strength),
|
||||
CounterInterpretation) :-
|
||||
%% The challenge points to a conflicting mitzvah (ID2)
|
||||
%% Build a new interpretation that includes this mitzvah's domain
|
||||
mitzvah_domain(ID2, ConflictDomain),
|
||||
%% Expand roots to include the conflicting domain
|
||||
findall(R, root_domain(R, ConflictDomain), ConflictRoots),
|
||||
append(Roots, ConflictRoots, ExpandedRoots),
|
||||
sort(ExpandedRoots, UniqueRoots),
|
||||
%% Re-interpret with expanded scope
|
||||
NewCase = case(Ref, Domain, UniqueRoots, Question),
|
||||
interpret(NewCase, CounterInterpretation).
|
||||
|
||||
counter_interpret(case(Ref, Domain, Roots, Question),
|
||||
kushya(contradiction(domain_tension, Root, _D1, D2), _CaseRef, _Strength),
|
||||
CounterInterpretation) :-
|
||||
%% The challenge points to a root in a conflicting domain
|
||||
%% Include that domain's roots
|
||||
findall(R, root_domain(R, D2), DomainRoots),
|
||||
append(Roots, [Root | DomainRoots], ExpandedRoots),
|
||||
sort(ExpandedRoots, UniqueRoots),
|
||||
NewCase = case(Ref, Domain, UniqueRoots, Question),
|
||||
interpret(NewCase, CounterInterpretation).
|
||||
|
||||
counter_interpret(Case,
|
||||
kushya(contradiction(condition_tension, _, _, _), _CaseRef, _Strength),
|
||||
CounterInterpretation) :-
|
||||
%% Condition tension — re-interpret the original case
|
||||
%% (the condition narrows the scope; the counter widens it)
|
||||
interpret(Case, CounterInterpretation).
|
||||
|
||||
%% ============================================================
|
||||
%% DIALECTICAL RESOLUTION OF TWO INTERPRETATIONS
|
||||
%% ============================================================
|
||||
|
||||
%% When both interpretations face challenges, attempt synthesis.
|
||||
%% This is the hardest part — finding the reading that holds
|
||||
%% both truths without collapsing the distinction between them.
|
||||
resolve_dialectically(I1, I2, Resolution) :-
|
||||
I1 = interpretation(_, M1, V1, _, _),
|
||||
I2 = interpretation(_, M2, V2, _, _),
|
||||
%% Find common ground — mitzvot present in both
|
||||
intersection(M1, M2, CommonMitzvot),
|
||||
( CommonMitzvot \= []
|
||||
-> %% There is common ground — synthesize
|
||||
append(V1, V2, AllVerses),
|
||||
sort(AllVerses, UniqueVerses),
|
||||
Resolution = synthesized(CommonMitzvot, UniqueVerses, both(I1, I2))
|
||||
; %% No common ground — teiku
|
||||
register_teiku(I1, I2, TeikuRecord),
|
||||
Resolution = teiku(TeikuRecord)
|
||||
).
|
||||
|
||||
%% If dialectical resolution itself fails
|
||||
resolve_dialectically(I1, I2, teiku(Record)) :-
|
||||
register_teiku(I1, I2, Record).
|
||||
|
||||
%% ============================================================
|
||||
%% HELPERS
|
||||
%% ============================================================
|
||||
|
||||
%% Extract case ref from a case
|
||||
case_ref(case(Ref, _, _, _), Ref).
|
||||
@@ -0,0 +1,61 @@
|
||||
%% 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.
|
||||
|
||||
:- module(teiku, [
|
||||
register_teiku/3,
|
||||
is_teiku/1,
|
||||
teiku_count/1,
|
||||
all_teiku/1
|
||||
]).
|
||||
|
||||
:- dynamic teiku_record/5.
|
||||
|
||||
%% ============================================================
|
||||
%% TEIKU REGISTRATION
|
||||
%% ============================================================
|
||||
|
||||
%% Register an unresolvable tension between two interpretations.
|
||||
%% The record preserves both sides — neither is discarded.
|
||||
register_teiku(I1, I2, 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),
|
||||
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),
|
||||
teiku_record(A, B, C, D, E),
|
||||
Records).
|
||||
@@ -0,0 +1,177 @@
|
||||
%% mitzvot.pl — Torah commandments as logical facts.
|
||||
%%
|
||||
%% Architecture §3.4: "613 total — requires careful encoding"
|
||||
%% Build order step 6: "start with subset of mitzvot"
|
||||
%%
|
||||
%% This is the Phase 1 subset. The full 613 are encoded in Phase 3.
|
||||
%% We start with the mitzvot the system itself must obey:
|
||||
%% - The three halt conditions (avodah zarah, shfichut damim, gilui arayot)
|
||||
%% - Shabbat (mandatory cessation)
|
||||
%% - The dibrot (structural constants)
|
||||
%% - Foundational mitzvot for reasoning demonstration
|
||||
%%
|
||||
%% Format: mitzvah(ID, Category, Action, Condition)
|
||||
%% ID = Rambam's enumeration (Sefer HaMitzvot)
|
||||
%% Category = positive | prohibition | belief
|
||||
%% Action = atom describing the commandment
|
||||
%% Condition = always | context-dependent condition
|
||||
%%
|
||||
%% Source: Rambam, Sefer HaMitzvot; cross-referenced with Sefer HaChinukh.
|
||||
|
||||
:- module(mitzvot, [
|
||||
mitzvah/4,
|
||||
mitzvah_source/2,
|
||||
mitzvah_category_count/2,
|
||||
total_encoded/1
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% BELIEFS AND FOUNDATIONS
|
||||
%% ============================================================
|
||||
|
||||
%% Dibrot — the ten declarations
|
||||
mitzvah(1, belief, know_hashem, always).
|
||||
mitzvah(2, prohibition, no_other_gods, always).
|
||||
mitzvah(3, belief, unity_of_hashem, always).
|
||||
mitzvah(4, positive, love_hashem, always).
|
||||
mitzvah(5, positive, fear_hashem, always).
|
||||
mitzvah(6, positive, sanctify_the_name, when(opportunity_arises)).
|
||||
mitzvah(7, prohibition, not_profane_the_name, always).
|
||||
mitzvah(8, prohibition, not_destroy_holy_things, always).
|
||||
mitzvah(9, positive, hear_shema, when(morning_and_evening)).
|
||||
mitzvah(10, positive, study_torah, always).
|
||||
|
||||
%% ============================================================
|
||||
%% SHABBAT — MANDATORY CESSATION
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(154, positive, rest_on_shabbat, when(seventh_day)).
|
||||
mitzvah(155, prohibition, not_work_on_shabbat, when(seventh_day)).
|
||||
mitzvah(156, positive, sanctify_shabbat, when(seventh_day)).
|
||||
|
||||
%% Festivals
|
||||
mitzvah(159, positive, rest_on_yom_tov, when(festival)).
|
||||
mitzvah(160, prohibition, not_work_on_yom_tov, when(festival)).
|
||||
mitzvah(163, positive, rest_on_rosh_hashanah, when(tishrei_1)).
|
||||
mitzvah(164, positive, fast_on_yom_kippur, when(tishrei_10)).
|
||||
|
||||
%% Shmitah — the seventh year
|
||||
mitzvah(134, positive, let_land_rest_in_shmitah, when(seventh_year)).
|
||||
mitzvah(135, prohibition, not_work_land_in_shmitah, when(seventh_year)).
|
||||
mitzvah(136, positive, release_debts_in_shmitah, when(seventh_year)).
|
||||
|
||||
%% ============================================================
|
||||
%% THE THREE HALT CONDITIONS (Cardinal sins — yehareg v'al ya'avor)
|
||||
%% ============================================================
|
||||
|
||||
%% Avodah Zarah — idolatry / misattributed authority
|
||||
mitzvah(2, prohibition, no_other_gods, always). % already declared above
|
||||
mitzvah(14, prohibition, not_make_idols, always).
|
||||
mitzvah(15, prohibition, not_make_idols_for_others, always).
|
||||
mitzvah(16, prohibition, not_worship_idols, always).
|
||||
mitzvah(17, prohibition, not_bow_to_idols, always).
|
||||
|
||||
%% Shfichut Damim — bloodshed / destruction of tzelem carrier
|
||||
mitzvah(289, prohibition, not_murder, always).
|
||||
mitzvah(290, prohibition, not_cause_death_of_innocent, always).
|
||||
mitzvah(295, positive, save_the_pursued, when(pursuit_in_progress)).
|
||||
|
||||
%% Gilui Arayot — forbidden relations / collapse of required distinctions
|
||||
mitzvah(330, prohibition, not_commit_adultery, always).
|
||||
mitzvah(353, prohibition, maintain_boundaries, always).
|
||||
|
||||
%% ============================================================
|
||||
%% JUSTICE AND JUDGMENT (Sanhedrin-relevant)
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(175, positive, appoint_judges, always).
|
||||
mitzvah(176, prohibition, not_judge_unjustly, always).
|
||||
mitzvah(177, prohibition, not_favor_the_powerful, always).
|
||||
mitzvah(178, prohibition, not_pervert_justice_for_poor, always).
|
||||
mitzvah(179, positive, judge_righteously, always).
|
||||
mitzvah(180, prohibition, not_accept_bribes, always).
|
||||
mitzvah(181, positive, follow_the_majority, when(court_deliberation)).
|
||||
mitzvah(182, prohibition, not_follow_majority_for_evil, when(court_deliberation)).
|
||||
|
||||
%% Capital cases — relevant to Sanhedrin unanimous rejection rule
|
||||
mitzvah(183, prohibition, not_convict_on_one_witness, when(capital_case)).
|
||||
mitzvah(184, positive, investigate_thoroughly, when(capital_case)).
|
||||
|
||||
%% ============================================================
|
||||
%% KORBANOT (Offerings — relevant to korban processor)
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(62, positive, bring_olah, when(offering_required)).
|
||||
mitzvah(63, positive, bring_shelamim, when(offering_required)).
|
||||
mitzvah(64, positive, bring_chatat, when(unintentional_sin)).
|
||||
mitzvah(65, positive, bring_asham, when(uncertain_transgression)).
|
||||
mitzvah(66, positive, bring_minchah, when(offering_required)).
|
||||
|
||||
%% ============================================================
|
||||
%% TESTIMONY AND TRUTH (relevant to system integrity)
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(285, prohibition, not_bear_false_witness, always).
|
||||
mitzvah(286, positive, testify_truthfully, when(knowledge_exists)).
|
||||
mitzvah(287, prohibition, not_withhold_testimony, always).
|
||||
|
||||
%% ============================================================
|
||||
%% SPEECH AND ATTRIBUTION
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(235, prohibition, not_take_name_in_vain, always).
|
||||
mitzvah(236, prohibition, not_swear_falsely, always).
|
||||
|
||||
%% ============================================================
|
||||
%% PROPERTY AND BOUNDARIES (relevant to manna/anti-hoarding)
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(243, prohibition, not_covet, always).
|
||||
mitzvah(244, prohibition, not_desire_others_property, always).
|
||||
mitzvah(247, prohibition, not_steal, always).
|
||||
mitzvah(248, prohibition, not_move_boundary_markers, always).
|
||||
|
||||
%% ============================================================
|
||||
%% BIKURIM AND TERUMAH (relevant to release protocol)
|
||||
%% ============================================================
|
||||
|
||||
mitzvah(125, positive, bring_bikurim, when(first_fruits_available)).
|
||||
mitzvah(126, positive, recite_bikurim_declaration, when(bringing_bikurim)).
|
||||
mitzvah(127, positive, separate_terumah, when(produce_available)).
|
||||
|
||||
%% ============================================================
|
||||
%% SOURCE REFERENCES
|
||||
%% ============================================================
|
||||
|
||||
%% mitzvah_source(ID, VerseRef) — where in Torah this mitzvah is grounded
|
||||
mitzvah_source(1, ref(shemot, 20, 2)). % Anochi Hashem Elokecha
|
||||
mitzvah_source(2, ref(shemot, 20, 3)). % Lo yihyeh lecha
|
||||
mitzvah_source(3, ref(devarim, 6, 4)). % Shema Yisrael
|
||||
mitzvah_source(4, ref(devarim, 6, 5)). % V'ahavta
|
||||
mitzvah_source(5, ref(devarim, 6, 13)). % Et Hashem Elokecha tira
|
||||
mitzvah_source(154, ref(shemot, 20, 8)). % Zachor et yom haShabbat
|
||||
mitzvah_source(155, ref(shemot, 20, 10)). % Lo ta'aseh kol melachah
|
||||
mitzvah_source(175, ref(devarim, 16, 18)). % Shoftim v'shotrim
|
||||
mitzvah_source(289, ref(shemot, 20, 13)). % Lo tirtzach
|
||||
mitzvah_source(330, ref(shemot, 20, 14)). % Lo tinaf
|
||||
mitzvah_source(247, ref(shemot, 20, 15)). % Lo tignov
|
||||
mitzvah_source(285, ref(shemot, 20, 16)). % Lo ta'aneh
|
||||
mitzvah_source(243, ref(shemot, 20, 17)). % Lo tachmod
|
||||
mitzvah_source(134, ref(shemot, 23, 11)). % V'hashvi'it tishm'tenah
|
||||
mitzvah_source(62, ref(vayikra, 1, 3)). % Olah
|
||||
mitzvah_source(64, ref(vayikra, 4, 27)). % Chatat
|
||||
mitzvah_source(125, ref(devarim, 26, 2)). % Bikurim
|
||||
mitzvah_source(126, ref(devarim, 26, 5)). % Arami oved avi
|
||||
mitzvah_source(295, ref(devarim, 25, 12)). % Save the pursued
|
||||
|
||||
%% ============================================================
|
||||
%% QUERIES
|
||||
%% ============================================================
|
||||
|
||||
%% Count mitzvot by category
|
||||
mitzvah_category_count(Category, Count) :-
|
||||
aggregate_all(count, mitzvah(_, Category, _, _), Count).
|
||||
|
||||
%% Total encoded in this Phase 1 subset
|
||||
total_encoded(Count) :-
|
||||
aggregate_all(count, mitzvah(_, _, _, _), Count).
|
||||
@@ -0,0 +1,126 @@
|
||||
%% relationships.pl — Inter-root and inter-mitzvah relationships.
|
||||
%%
|
||||
%% These relationships encode structural connections between
|
||||
%% commandments and between roots that the reasoning engine
|
||||
%% uses for interpretation and challenge generation.
|
||||
|
||||
:- module(relationships, [
|
||||
mitzvah_grounds/2,
|
||||
mitzvah_conflicts_with/3,
|
||||
root_shares_consonants/3,
|
||||
mitzvah_domain/2,
|
||||
complementary_mitzvot/2,
|
||||
domain_mitzvot/2
|
||||
]).
|
||||
|
||||
:- use_module(mitzvot).
|
||||
:- use_module(root_meanings).
|
||||
:- use_module(torah_text).
|
||||
|
||||
%% ============================================================
|
||||
%% MITZVAH GROUNDING — which verses ground which commandments
|
||||
%% ============================================================
|
||||
|
||||
%% mitzvah_grounds(MitzvahID, VerseRef) — a verse that grounds a mitzvah
|
||||
mitzvah_grounds(MitzvahID, ref(Book, Ch, Vs)) :-
|
||||
mitzvah_source(MitzvahID, ref(Book, Ch, Vs)).
|
||||
|
||||
%% ============================================================
|
||||
%% MITZVAH TENSIONS — potential conflicts between mitzvot
|
||||
%% ============================================================
|
||||
|
||||
%% mitzvah_conflicts_with(ID1, ID2, TensionDescription)
|
||||
%% These are not errors — they are productive tensions
|
||||
%% that the dialectical engine resolves or marks teiku.
|
||||
|
||||
%% Justice vs mercy
|
||||
mitzvah_conflicts_with(179, 295,
|
||||
'Judging righteously may conflict with saving the pursued when the pursued is also guilty').
|
||||
|
||||
%% Following majority vs preventing evil
|
||||
mitzvah_conflicts_with(181, 182,
|
||||
'Following the majority in court conflicts with not following the majority for evil').
|
||||
|
||||
%% Sanctifying the name vs preserving life
|
||||
mitzvah_conflicts_with(6, 289,
|
||||
'Sanctifying the name through martyrdom conflicts with the prohibition against allowing death').
|
||||
|
||||
%% Shabbat rest vs saving life (pikuach nefesh)
|
||||
mitzvah_conflicts_with(155, 295,
|
||||
'Not working on Shabbat conflicts with saving the pursued when rescue requires work').
|
||||
|
||||
%% Loving your neighbor vs administering justice
|
||||
mitzvah_conflicts_with(4, 179,
|
||||
'Love may conflict with righteous judgment when judgment causes pain to the beloved').
|
||||
|
||||
%% ============================================================
|
||||
%% ROOT RELATIONSHIPS — consonant sharing
|
||||
%% ============================================================
|
||||
|
||||
%% root_shares_consonants(Root1, Root2, SharedPositions)
|
||||
%% Two roots sharing 2 consonants are semantic neighbors.
|
||||
root_shares_consonants(bet_resh_aleph, bet_resh_kaf, [1, 2]). % ברא / ברך
|
||||
root_shares_consonants(bet_resh_aleph, gimel_resh_aleph, [2, 3]). % ברא / גרא
|
||||
root_shares_consonants(qof_dalet_shin, chet_dalet_shin, [2, 3]). % קדש / חדש
|
||||
root_shares_consonants(shin_pe_tet, shin_pe_kaf, [1, 2]). % שפט / שפך
|
||||
root_shares_consonants(aleph_mem_resh, aleph_vav_resh, [1, 3]). % אמר / אור
|
||||
|
||||
%% ============================================================
|
||||
%% MITZVAH DOMAINS — which domain a mitzvah belongs to
|
||||
%% ============================================================
|
||||
|
||||
%% Derived from the mitzvah's action and the root's domain
|
||||
mitzvah_domain(MitzvahID, Domain) :-
|
||||
mitzvah(MitzvahID, _, Action, _),
|
||||
action_domain(Action, Domain).
|
||||
|
||||
%% Action to domain mapping
|
||||
action_domain(know_hashem, knowledge).
|
||||
action_domain(no_other_gods, holiness).
|
||||
action_domain(unity_of_hashem, holiness).
|
||||
action_domain(love_hashem, covenant).
|
||||
action_domain(fear_hashem, authority).
|
||||
action_domain(sanctify_the_name, holiness).
|
||||
action_domain(not_profane_the_name, holiness).
|
||||
action_domain(hear_shema, knowledge).
|
||||
action_domain(study_torah, knowledge).
|
||||
action_domain(rest_on_shabbat, holiness).
|
||||
action_domain(not_work_on_shabbat, holiness).
|
||||
action_domain(sanctify_shabbat, holiness).
|
||||
action_domain(appoint_judges, judgment).
|
||||
action_domain(not_judge_unjustly, judgment).
|
||||
action_domain(judge_righteously, judgment).
|
||||
action_domain(not_murder, death).
|
||||
action_domain(not_cause_death_of_innocent, death).
|
||||
action_domain(save_the_pursued, mercy).
|
||||
action_domain(not_commit_adultery, transgression).
|
||||
action_domain(maintain_boundaries, separation).
|
||||
action_domain(not_bear_false_witness, speech).
|
||||
action_domain(not_covet, transgression).
|
||||
action_domain(not_steal, transgression).
|
||||
action_domain(bring_olah, offering).
|
||||
action_domain(bring_chatat, offering).
|
||||
action_domain(bring_bikurim, offering).
|
||||
|
||||
%% ============================================================
|
||||
%% COMPLEMENTARY MITZVOT — mitzvot that strengthen each other
|
||||
%% ============================================================
|
||||
|
||||
%% complementary_mitzvot(ID1, ID2) — these work together
|
||||
complementary_mitzvot(1, 3). % know_hashem + unity_of_hashem
|
||||
complementary_mitzvot(4, 5). % love_hashem + fear_hashem
|
||||
complementary_mitzvot(154, 156). % rest_on_shabbat + sanctify_shabbat
|
||||
complementary_mitzvot(175, 179). % appoint_judges + judge_righteously
|
||||
complementary_mitzvot(289, 295). % not_murder + save_the_pursued
|
||||
complementary_mitzvot(125, 126). % bring_bikurim + recite_declaration
|
||||
|
||||
%% Symmetric
|
||||
complementary_mitzvot(A, B) :- complementary_mitzvot(B, A), A \= B.
|
||||
|
||||
%% ============================================================
|
||||
%% QUERIES
|
||||
%% ============================================================
|
||||
|
||||
%% All mitzvot in a given domain
|
||||
domain_mitzvot(Domain, Mitzvot) :-
|
||||
findall(ID, mitzvah_domain(ID, Domain), Mitzvot).
|
||||
@@ -0,0 +1,225 @@
|
||||
%% root_meanings.pl — Root lexicon in Prolog format.
|
||||
%%
|
||||
%% Architecture §3.4: root_meaning(Shoresh, Binyan, Meaning)
|
||||
%%
|
||||
%% These are the roots the reasoning engine knows about.
|
||||
%% The full lexicon (2608 roots) lives in L1 and in the Shoresh Engine.
|
||||
%% These Prolog facts give the Talmudic Engine semantic access
|
||||
%% for dialectical reasoning.
|
||||
|
||||
:- module(root_meanings, [
|
||||
root_meaning/3,
|
||||
root_domain/2,
|
||||
root_gematria/2,
|
||||
roots_in_domain/2,
|
||||
all_domains/1
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% ROOT MEANINGS BY BINYAN
|
||||
%% Format: root_meaning(Shoresh, Binyan, Meaning)
|
||||
%% ============================================================
|
||||
|
||||
%% ברא — create
|
||||
root_meaning(bet_resh_aleph, qal, 'create').
|
||||
root_meaning(bet_resh_aleph, nifal, 'be created').
|
||||
root_meaning(bet_resh_aleph, piel, 'cut down / clear').
|
||||
root_meaning(bet_resh_aleph, hifil, 'cause to create').
|
||||
|
||||
%% אמר — say
|
||||
root_meaning(aleph_mem_resh, qal, 'say').
|
||||
root_meaning(aleph_mem_resh, nifal, 'be said').
|
||||
root_meaning(aleph_mem_resh, hifil, 'declare').
|
||||
|
||||
%% אור — light
|
||||
root_meaning(aleph_vav_resh, qal, 'shine / be light').
|
||||
root_meaning(aleph_vav_resh, hifil, 'give light / enlighten').
|
||||
|
||||
%% בדל — separate
|
||||
root_meaning(bet_dalet_lamed, hifil, 'separate / distinguish').
|
||||
root_meaning(bet_dalet_lamed, nifal, 'be separated').
|
||||
|
||||
%% קדש — holy
|
||||
root_meaning(qof_dalet_shin, qal, 'be holy').
|
||||
root_meaning(qof_dalet_shin, nifal, 'be sanctified').
|
||||
root_meaning(qof_dalet_shin, piel, 'sanctify / dedicate').
|
||||
root_meaning(qof_dalet_shin, pual, 'be sanctified').
|
||||
root_meaning(qof_dalet_shin, hifil, 'cause to be holy').
|
||||
root_meaning(qof_dalet_shin, hitpael, 'sanctify oneself').
|
||||
|
||||
%% שמר — guard / keep
|
||||
root_meaning(shin_mem_resh, qal, 'guard / keep / observe').
|
||||
root_meaning(shin_mem_resh, nifal, 'be guarded / take heed').
|
||||
root_meaning(shin_mem_resh, piel, 'guard carefully').
|
||||
root_meaning(shin_mem_resh, hitpael, 'guard oneself').
|
||||
|
||||
%% שפט — judge
|
||||
root_meaning(shin_pe_tet, qal, 'judge').
|
||||
root_meaning(shin_pe_tet, nifal, 'be judged / enter into judgment').
|
||||
|
||||
%% צדק — righteous
|
||||
root_meaning(tzade_dalet_qof, qal, 'be righteous').
|
||||
root_meaning(tzade_dalet_qof, piel, 'justify / declare righteous').
|
||||
root_meaning(tzade_dalet_qof, hifil, 'do justice').
|
||||
root_meaning(tzade_dalet_qof, hitpael, 'justify oneself').
|
||||
|
||||
%% רצח — murder
|
||||
root_meaning(resh_tzade_chet, qal, 'murder / slay').
|
||||
root_meaning(resh_tzade_chet, nifal, 'be slain').
|
||||
root_meaning(resh_tzade_chet, piel, 'murder deliberately').
|
||||
|
||||
%% נאף — commit adultery
|
||||
root_meaning(nun_aleph_pe, qal, 'commit adultery').
|
||||
root_meaning(nun_aleph_pe, piel, 'commit adultery repeatedly').
|
||||
|
||||
%% גנב — steal
|
||||
root_meaning(gimel_nun_bet, qal, 'steal').
|
||||
root_meaning(gimel_nun_bet, nifal, 'be stolen').
|
||||
root_meaning(gimel_nun_bet, piel, 'steal repeatedly / kidnap').
|
||||
|
||||
%% חמד — covet / desire
|
||||
root_meaning(chet_mem_dalet, qal, 'covet / desire').
|
||||
root_meaning(chet_mem_dalet, nifal, 'be desirable').
|
||||
root_meaning(chet_mem_dalet, piel, 'desire greatly').
|
||||
|
||||
%% אהב — love
|
||||
root_meaning(aleph_he_bet, qal, 'love').
|
||||
root_meaning(aleph_he_bet, nifal, 'be loved').
|
||||
root_meaning(aleph_he_bet, piel, 'love intensely').
|
||||
|
||||
%% ירא — fear
|
||||
root_meaning(yod_resh_aleph, qal, 'fear / revere').
|
||||
root_meaning(yod_resh_aleph, nifal, 'be feared / be awesome').
|
||||
|
||||
%% שמע — hear
|
||||
root_meaning(shin_mem_ayin, qal, 'hear / listen / obey').
|
||||
root_meaning(shin_mem_ayin, nifal, 'be heard').
|
||||
root_meaning(shin_mem_ayin, hifil, 'cause to hear / announce').
|
||||
|
||||
%% עשה — do / make
|
||||
root_meaning(ayin_shin_he, qal, 'do / make').
|
||||
root_meaning(ayin_shin_he, nifal, 'be done / be made').
|
||||
|
||||
%% שבת — rest / cease
|
||||
root_meaning(shin_bet_tav, qal, 'rest / cease').
|
||||
root_meaning(shin_bet_tav, hifil, 'cause to rest / put an end to').
|
||||
|
||||
%% כלה — complete / finish
|
||||
root_meaning(kaf_lamed_he, qal, 'be complete / be finished').
|
||||
root_meaning(kaf_lamed_he, piel, 'complete / finish').
|
||||
|
||||
%% ברך — bless
|
||||
root_meaning(bet_resh_kaf, qal, 'bless / kneel').
|
||||
root_meaning(bet_resh_kaf, nifal, 'be blessed').
|
||||
root_meaning(bet_resh_kaf, piel, 'bless').
|
||||
root_meaning(bet_resh_kaf, hitpael, 'bless oneself').
|
||||
|
||||
%% שפך — shed / pour
|
||||
root_meaning(shin_pe_kaf, qal, 'shed / pour out').
|
||||
root_meaning(shin_pe_kaf, nifal, 'be shed / be poured out').
|
||||
|
||||
%% חנה — camp / encamp
|
||||
root_meaning(chet_nun_he, qal, 'camp / encamp').
|
||||
|
||||
%% נסע — journey / set out
|
||||
root_meaning(nun_samekh_ayin, qal, 'journey / set out / travel').
|
||||
root_meaning(nun_samekh_ayin, hifil, 'cause to journey').
|
||||
|
||||
%% חטא — sin / miss the mark
|
||||
root_meaning(chet_tet_aleph, qal, 'sin / miss').
|
||||
root_meaning(chet_tet_aleph, piel, 'purify / make a sin offering').
|
||||
root_meaning(chet_tet_aleph, hitpael, 'purify oneself').
|
||||
|
||||
%% קרב — draw near / offer
|
||||
root_meaning(qof_resh_bet, qal, 'draw near / approach').
|
||||
root_meaning(qof_resh_bet, hifil, 'bring near / offer').
|
||||
|
||||
%% ענה — answer / testify
|
||||
root_meaning(ayin_nun_he, qal, 'answer / testify / respond').
|
||||
|
||||
%% ידע — know
|
||||
root_meaning(yod_dalet_ayin, qal, 'know').
|
||||
root_meaning(yod_dalet_ayin, nifal, 'be known').
|
||||
root_meaning(yod_dalet_ayin, hifil, 'make known').
|
||||
|
||||
%% נפל — fall
|
||||
root_meaning(nun_pe_lamed, qal, 'fall').
|
||||
root_meaning(nun_pe_lamed, hifil, 'cause to fall').
|
||||
|
||||
%% רדף — pursue
|
||||
root_meaning(resh_dalet_pe, qal, 'pursue / chase').
|
||||
|
||||
%% נצל — deliver / save
|
||||
root_meaning(nun_tzade_lamed, hifil, 'deliver / save / rescue').
|
||||
root_meaning(nun_tzade_lamed, nifal, 'be delivered').
|
||||
|
||||
%% עבד — serve / work
|
||||
root_meaning(ayin_bet_dalet, qal, 'serve / work').
|
||||
root_meaning(ayin_bet_dalet, hifil, 'cause to serve / enslave').
|
||||
|
||||
%% ============================================================
|
||||
%% SEMANTIC DOMAINS
|
||||
%% Format: root_domain(Shoresh, Domain)
|
||||
%% ============================================================
|
||||
|
||||
root_domain(bet_resh_aleph, creation).
|
||||
root_domain(aleph_mem_resh, speech).
|
||||
root_domain(aleph_vav_resh, light).
|
||||
root_domain(bet_dalet_lamed, separation).
|
||||
root_domain(qof_dalet_shin, holiness).
|
||||
root_domain(shin_mem_resh, authority).
|
||||
root_domain(shin_pe_tet, judgment).
|
||||
root_domain(tzade_dalet_qof, judgment).
|
||||
root_domain(resh_tzade_chet, death).
|
||||
root_domain(nun_aleph_pe, transgression).
|
||||
root_domain(gimel_nun_bet, transgression).
|
||||
root_domain(chet_mem_dalet, transgression).
|
||||
root_domain(aleph_he_bet, covenant).
|
||||
root_domain(yod_resh_aleph, authority).
|
||||
root_domain(shin_mem_ayin, knowledge).
|
||||
root_domain(ayin_shin_he, creation).
|
||||
root_domain(shin_bet_tav, holiness).
|
||||
root_domain(kaf_lamed_he, creation).
|
||||
root_domain(bet_resh_kaf, blessing).
|
||||
root_domain(shin_pe_kaf, death).
|
||||
root_domain(chet_nun_he, movement).
|
||||
root_domain(nun_samekh_ayin, movement).
|
||||
root_domain(chet_tet_aleph, transgression).
|
||||
root_domain(qof_resh_bet, offering).
|
||||
root_domain(ayin_nun_he, speech).
|
||||
root_domain(yod_dalet_ayin, knowledge).
|
||||
root_domain(nun_pe_lamed, movement).
|
||||
root_domain(resh_dalet_pe, movement).
|
||||
root_domain(nun_tzade_lamed, mercy).
|
||||
root_domain(ayin_bet_dalet, service).
|
||||
|
||||
%% ============================================================
|
||||
%% GEMATRIA VALUES
|
||||
%% Format: root_gematria(Shoresh, Value)
|
||||
%% ============================================================
|
||||
|
||||
root_gematria(bet_resh_aleph, 203). % ב(2) + ר(200) + א(1)
|
||||
root_gematria(aleph_mem_resh, 241). % א(1) + מ(40) + ר(200)
|
||||
root_gematria(aleph_vav_resh, 207). % א(1) + ו(6) + ר(200)
|
||||
root_gematria(bet_dalet_lamed, 36). % ב(2) + ד(4) + ל(30)
|
||||
root_gematria(qof_dalet_shin, 404). % ק(100) + ד(4) + ש(300)
|
||||
root_gematria(shin_mem_resh, 540). % ש(300) + מ(40) + ר(200)
|
||||
root_gematria(shin_pe_tet, 389). % ש(300) + פ(80) + ט(9)
|
||||
root_gematria(tzade_dalet_qof, 194). % צ(90) + ד(4) + ק(100)
|
||||
root_gematria(resh_tzade_chet, 298). % ר(200) + צ(90) + ח(8)
|
||||
root_gematria(aleph_he_bet, 8). % א(1) + ה(5) + ב(2)
|
||||
root_gematria(shin_mem_ayin, 410). % ש(300) + מ(40) + ע(70)
|
||||
root_gematria(shin_bet_tav, 702). % ש(300) + ב(2) + ת(400)
|
||||
root_gematria(bet_resh_kaf, 222). % ב(2) + ר(200) + כ(20)
|
||||
|
||||
%% ============================================================
|
||||
%% QUERIES
|
||||
%% ============================================================
|
||||
|
||||
%% Find all roots in a domain
|
||||
roots_in_domain(Domain, Roots) :-
|
||||
findall(Root, root_domain(Root, Domain), Roots).
|
||||
|
||||
%% All distinct domains
|
||||
all_domains(Domains) :-
|
||||
setof(D, R^root_domain(R, D), Domains).
|
||||
@@ -0,0 +1,123 @@
|
||||
%% torah_text.pl — Torah verses as logical facts.
|
||||
%%
|
||||
%% Architecture §3.4: verse(Book, Chapter, Verse, HebrewRoots, EnglishGloss)
|
||||
%%
|
||||
%% Phase 1 subset: key verses that ground the mitzvot encoded in mitzvot.pl.
|
||||
%% The full Torah text lives in L1 (the read-only filesystem).
|
||||
%% These Prolog facts are the reasoning layer's view of the specification —
|
||||
%% not a replacement for L1, but the form in which the Talmudic Engine
|
||||
%% can query Torah text during dialectical reasoning.
|
||||
|
||||
:- module(torah_text, [
|
||||
verse/5,
|
||||
verse_roots/4,
|
||||
verses_in_chapter/3,
|
||||
verses_mentioning_root/2
|
||||
]).
|
||||
|
||||
%% ============================================================
|
||||
%% BEREISHIT — Creation narratives
|
||||
%% ============================================================
|
||||
|
||||
verse(bereishit, 1, 1, [bet_resh_aleph, bet_resh_aleph, aleph_lamed_he],
|
||||
'In the beginning God created the heavens and the earth').
|
||||
verse(bereishit, 1, 3, [aleph_mem_resh, aleph_lamed_he, he_yod_he, aleph_vav_resh],
|
||||
'And God said let there be light and there was light').
|
||||
verse(bereishit, 1, 4, [resh_aleph_he, aleph_lamed_he, aleph_vav_resh, tet_vav_bet, bet_dalet_lamed],
|
||||
'And God saw that the light was good and God separated').
|
||||
verse(bereishit, 1, 27, [bet_resh_aleph, aleph_lamed_he, aleph_dalet_mem, tzade_lamed_mem, bet_resh_aleph],
|
||||
'And God created man in His image in the image of God He created him').
|
||||
verse(bereishit, 2, 2, [kaf_lamed_he, aleph_lamed_he, yod_vav_mem, shin_bet_tav, mem_lamed_aleph_kaf_he],
|
||||
'And on the seventh day God completed His work and He rested').
|
||||
verse(bereishit, 2, 3, [bet_resh_kaf, aleph_lamed_he, yod_vav_mem, shin_bet_tav, qof_dalet_shin],
|
||||
'And God blessed the seventh day and sanctified it').
|
||||
verse(bereishit, 9, 6, [shin_pe_kaf, dalet_mem, aleph_dalet_mem, tzade_lamed_mem, aleph_lamed_he],
|
||||
'Whoever sheds the blood of man by man shall his blood be shed for in the image of God He made man').
|
||||
|
||||
%% ============================================================
|
||||
%% SHEMOT — The ten dibrot and the covenant
|
||||
%% ============================================================
|
||||
|
||||
verse(shemot, 3, 14, [aleph_he_yod_he, aleph_mem_resh, aleph_he_yod_he],
|
||||
'I am that I am').
|
||||
verse(shemot, 20, 2, [aleph_nun_kaf_yod, he_shin_mem, aleph_lamed_he],
|
||||
'I am the LORD your God who brought you out of the land of Egypt').
|
||||
verse(shemot, 20, 3, [he_yod_he, aleph_lamed_he, aleph_chet_resh],
|
||||
'You shall have no other gods before Me').
|
||||
verse(shemot, 20, 8, [zayin_kaf_resh, yod_vav_mem, shin_bet_tav, qof_dalet_shin],
|
||||
'Remember the Sabbath day to sanctify it').
|
||||
verse(shemot, 20, 13, [resh_tzade_chet],
|
||||
'You shall not murder').
|
||||
verse(shemot, 20, 14, [nun_aleph_pe],
|
||||
'You shall not commit adultery').
|
||||
verse(shemot, 20, 15, [gimel_nun_bet],
|
||||
'You shall not steal').
|
||||
verse(shemot, 20, 16, [ayin_nun_he, shin_qof_resh, ayin_dalet],
|
||||
'You shall not bear false witness against your neighbor').
|
||||
verse(shemot, 20, 17, [chet_mem_dalet],
|
||||
'You shall not covet').
|
||||
|
||||
%% ============================================================
|
||||
%% VAYIKRA — Holiness and offerings
|
||||
%% ============================================================
|
||||
|
||||
verse(vayikra, 1, 3, [qof_resh_bet, ayin_lamed_he, tav_mem_yod_mem],
|
||||
'If his offering is a burnt offering let him offer a male without blemish').
|
||||
verse(vayikra, 4, 27, [chet_tet_aleph, nun_pe_shin, shin_gimel_gimel_he],
|
||||
'If anyone of the common people sins unintentionally').
|
||||
verse(vayikra, 19, 2, [qof_dalet_shin, he_yod_he, qof_dalet_shin],
|
||||
'Be holy for I the LORD your God am holy').
|
||||
verse(vayikra, 19, 15, [ayin_shin_he, mem_shin_pe_tet, tzade_dalet_qof],
|
||||
'In righteousness shall you judge your neighbor').
|
||||
verse(vayikra, 19, 18, [aleph_he_bet, resh_ayin, kaf_mem_vav],
|
||||
'You shall love your neighbor as yourself').
|
||||
|
||||
%% ============================================================
|
||||
%% BAMIDBAR — The camp and the cloud
|
||||
%% ============================================================
|
||||
|
||||
verse(bamidbar, 9, 23, [pe_he, he_shin_mem, chet_nun_he, pe_he, he_shin_mem, nun_samekh_ayin],
|
||||
'At the mouth of the LORD they camped and at the mouth of the LORD they journeyed').
|
||||
verse(bamidbar, 10, 2, [ayin_shin_he, shin_nun_yod, chet_tzade_tzade_resh_he, kaf_samekh_pe],
|
||||
'Make two silver trumpets for the calling of the assembly').
|
||||
verse(bamidbar, 35, 11, [mem_qof_lamed_tet, ayin_yod_resh, nun_pe_shin, resh_tzade_chet, shin_gimel_gimel_he],
|
||||
'You shall designate cities of refuge for one who kills a person unintentionally').
|
||||
|
||||
%% ============================================================
|
||||
%% DEVARIM — Moses' final instruction
|
||||
%% ============================================================
|
||||
|
||||
verse(devarim, 6, 4, [shin_mem_ayin, yod_shin_resh_aleph_lamed, he_shin_mem, aleph_lamed_he, he_shin_mem, aleph_chet_dalet],
|
||||
'Hear O Israel the LORD our God the LORD is one').
|
||||
verse(devarim, 6, 5, [aleph_he_bet, he_shin_mem, aleph_lamed_he, kaf_lamed, lamed_bet_bet],
|
||||
'And you shall love the LORD your God with all your heart').
|
||||
verse(devarim, 16, 18, [shin_pe_tet, shin_tet_resh, nun_tav_nun, shin_ayin_resh],
|
||||
'Judges and officers shall you appoint in all your gates').
|
||||
verse(devarim, 16, 20, [tzade_dalet_qof, tzade_dalet_qof, resh_dalet_pe],
|
||||
'Justice justice shall you pursue').
|
||||
verse(devarim, 21, 1, [nun_pe_lamed, chet_lamed_lamed, shin_dalet_he, yod_dalet_ayin],
|
||||
'If a slain person is found in the field and it is not known who struck him').
|
||||
verse(devarim, 25, 12, [nun_tzade_lamed, resh_dalet_pe],
|
||||
'You shall save the pursued from the pursuer').
|
||||
verse(devarim, 26, 2, [lamed_qof_chet, resh_aleph_shin_yod_tav, pe_resh_yod, aleph_dalet_mem_he],
|
||||
'You shall take of the first of all the fruit of the ground').
|
||||
verse(devarim, 26, 5, [aleph_resh_mem_yod, aleph_bet_dalet, aleph_bet_yod],
|
||||
'A wandering Aramean was my father').
|
||||
|
||||
%% ============================================================
|
||||
%% QUERIES
|
||||
%% ============================================================
|
||||
|
||||
%% Find roots in a specific verse
|
||||
verse_roots(Book, Chapter, Verse, Roots) :-
|
||||
verse(Book, Chapter, Verse, Roots, _).
|
||||
|
||||
%% Count verses in a chapter
|
||||
verses_in_chapter(Book, Chapter, Count) :-
|
||||
aggregate_all(count, verse(Book, Chapter, _, _, _), Count).
|
||||
|
||||
%% Find all verses mentioning a specific root
|
||||
verses_mentioning_root(Root, Verses) :-
|
||||
findall(ref(Book, Ch, Vs),
|
||||
(verse(Book, Ch, Vs, Roots, _), member(Root, Roots)),
|
||||
Verses).
|
||||
Reference in new issue
Block a user