Files
bikoret/shoresh-engine/src/Shoresh/KetivQere.hs
T
Scott KarpandClaude Sonnet 4.6 80ec364da6 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>
2026-02-26 14:02:34 -05:00

51 lines
1.5 KiB
Haskell

{-# LANGUAGE OverloadedStrings #-}
-- | Ketiv/Qere — the dual reading.
--
-- Architecture §3.1:
-- "A specification position that holds two authoritative values."
-- Ketiv = what is written (stored form).
-- Qere = what is read (executed form).
--
-- At no point in the processing chain should a dual reading
-- collapse to a single value. Both readings are preserved.
module Shoresh.KetivQere
( DualReading(..)
, SpecValue(..)
, bothReadings
, isDual
, hasDualReadings
) where
import Shoresh.Types (Reference)
import Data.Text (Text)
-- | A position in the specification that holds two authoritative values.
data DualReading = DualReading
{ ketiv :: !Text -- ^ What is written (stored form)
, qere :: !Text -- ^ What is read (executed form)
, drRef :: !Reference -- ^ Where in Torah this occurs
} deriving (Eq, Show)
-- | A specification value: either single or dual.
data SpecValue
= Single !Text
| DualVal !DualReading
deriving (Show)
-- | Retrieve both readings without collapsing.
-- Single values return the same text for both.
-- Dual values return (ketiv, qere).
bothReadings :: SpecValue -> (Text, Text)
bothReadings (Single t) = (t, t)
bothReadings (DualVal dr) = (ketiv dr, qere dr)
-- | Check if a SpecValue is a dual reading.
isDual :: SpecValue -> Bool
isDual (Single _) = False
isDual (DualVal _) = True
-- | Check if a list of spec values contains any dual readings.
hasDualReadings :: [SpecValue] -> Bool
hasDualReadings = any isDual