sugya, step 3: the case behind each threshold is carried on every verdict
specs/sugya.md §IV "carried on the verdict", §V step 3. Sugya.for_verdict/1
renders, for every rule that fired and every form that was noted: kind,
verse, precedent, the dissents and exceptions — each with `applied`,
read from the record and never guessed: the single witness noted (and
for which forms), the hedged claims left out of the trace, grounding
not assessed for want of ground, a forged fringe standing on one
witness. A dissent the record cannot speak to is carried applied:
false — considered, and the rule's verse decided. The minority is on
every record (Eduyot 1:5–6): to be relied on later, and to be located.
Carried as `sugya` on the bedikah response, the pair's two sides, and
the gate's `bikoret` object (pass and stream). The fringe is unchanged
— it is for the reader, who asks for the sugya by reading the record.
Tamid §1.1: the `sugya` field in the response and the paragraph "Every
rule carries its sugya"; Doorpost pin → 658005c9…. Elixir 664/0
(sugya_verdict_test: clean → {}; noted apology → two-witness dissent
applied for that form; forged fringe → the mark exception applied;
golden calf with and without a hedged claim; a rule the record cannot
speak to → considered, applied false).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ad2c3ec40
commit
dc6316f1d7
7 files changed
+149
-1
No files matched your search
@@ -941,6 +941,8 @@ defmodule VavPipeline.BigdeiKodesh.Router do
|
||||
verdict: Atom.to_string(result.verdict),
|
||||
violations: result.violations,
|
||||
anchors: VavPipeline.Anchors.for_violations(result.violations),
|
||||
# The case behind each threshold that fired or was noted (sugya.md §IV).
|
||||
sugya: VavPipeline.Sugya.for_verdict(result),
|
||||
checks: result.checks,
|
||||
examination: %{
|
||||
vital_content: result.examination["vital_content"],
|
||||
@@ -1023,6 +1025,8 @@ defmodule VavPipeline.BigdeiKodesh.Router do
|
||||
verdict: Atom.to_string(result.verdict),
|
||||
violations: result.violations,
|
||||
anchors: VavPipeline.Anchors.for_violations(result.violations),
|
||||
# The case behind each threshold that fired or was noted (sugya.md §IV).
|
||||
sugya: VavPipeline.Sugya.for_verdict(result),
|
||||
a: result.a,
|
||||
b: result.b,
|
||||
difference: result.difference,
|
||||
|
||||
@@ -182,7 +182,7 @@ defmodule VavPipeline.Doorpost do
|
||||
# changes; the update is a deliberate operator commit. A bare
|
||||
# hash-update commit (without a corresponding spec change in the
|
||||
# same commit) is itself a drift signal.
|
||||
@expected_hash "cb2f31358051acc19c36bb8dfa0a179a7d4845ac6acac7d8e2b7b1e17150b0c2"
|
||||
@expected_hash "658005c9323391e8c198c0cf23f91af0a2fdbdb20cac204eb60b58ac0c0bb318"
|
||||
|
||||
@doc "Return the list of files that constitute the category-grade specification."
|
||||
@spec files() :: [String.t()]
|
||||
|
||||
@@ -126,6 +126,7 @@ defmodule VavPipeline.Gate do
|
||||
violations: result.violations,
|
||||
anchors: anchors,
|
||||
fired: Shape.fired(result, anchors),
|
||||
sugya: VavPipeline.Sugya.for_verdict(result),
|
||||
checks: result.checks,
|
||||
sources: result.sources,
|
||||
model: Shape.reply_model(upstream, reply)
|
||||
|
||||
@@ -217,6 +217,7 @@ defmodule VavPipeline.Gate.Stream do
|
||||
violations: result.violations,
|
||||
anchors: anchors,
|
||||
fired: Shape.fired(result, anchors),
|
||||
sugya: VavPipeline.Sugya.for_verdict(result),
|
||||
sources: result.sources,
|
||||
model: state.model,
|
||||
streamed: true
|
||||
|
||||
@@ -198,6 +198,76 @@ defmodule VavPipeline.Sugya do
|
||||
end
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# The sugya on a verdict (sugya.md §IV, "carried on the verdict")
|
||||
# ------------------------------------------------------------
|
||||
|
||||
@doc """
|
||||
The sugya a verdict carries: one entry per rule that fired and per form
|
||||
that was noted — kind, verse, precedent, the dissents with `applied`
|
||||
marking the one that held, the exceptions with `applied` likewise.
|
||||
`applied` is read from the record, never guessed: the single witness
|
||||
noted (a form in `checks.frames.noted`), the hedged claims left out of
|
||||
the trace, grounding not assessed for want of ground, a forged fringe
|
||||
standing on one witness. A dissent the record cannot speak to is
|
||||
carried with `applied: false` — considered, and the rule's verse
|
||||
decided. The minority is thus on the record for every verdict (Eduyot
|
||||
1:5–6): to be relied on later, and to be located.
|
||||
"""
|
||||
@spec for_verdict(map()) :: map()
|
||||
def for_verdict(result) when is_map(result) do
|
||||
checks = Map.get(result, :checks) || %{}
|
||||
violations = Map.get(result, :violations) || []
|
||||
fired_rules = violations |> Enum.flat_map(&rule_of/1) |> Enum.uniq()
|
||||
frames = Map.get(checks, :frames) || %{}
|
||||
noted = (Map.get(frames, :noted) || %{}) |> Map.keys() |> Enum.map(&to_string/1)
|
||||
forms = Map.get(frames, :forms) || %{}
|
||||
forged_on_one = Enum.any?(forms, fn {_f, e} -> Map.get(e, :stands_on) == :forgery end)
|
||||
grounding = Map.get(checks, :grounding) || %{}
|
||||
claims = get_in(result, [:examination, "claims"]) || []
|
||||
hedged_out = Enum.any?(claims, &(&1["hedged"] == true))
|
||||
|
||||
rules = Enum.uniq(fired_rules ++ if(noted != [], do: ["lo_taaseh_lekha"], else: []))
|
||||
|
||||
Map.new(rules, fn rule ->
|
||||
base = for_rule(rule) || %{rule: rule, kind: nil, verse: nil, precedent: nil, dissent: [], exception: []}
|
||||
|
||||
dissent =
|
||||
Enum.map(base.dissent, fn d ->
|
||||
applied =
|
||||
case {rule, d.reading, d.form} do
|
||||
{"lo_taaseh_lekha", "single_witness_noted", _} -> noted != []
|
||||
{"golden_calf", "hedged", _} -> hedged_out
|
||||
_ -> false
|
||||
end
|
||||
|
||||
d |> Map.put(:applied, applied) |> then(fn m -> if rule == "lo_taaseh_lekha" and d.reading == "single_witness_noted", do: Map.put(m, :forms, noted), else: m end)
|
||||
end)
|
||||
|
||||
exception =
|
||||
Enum.map(base.exception, fn e ->
|
||||
applied =
|
||||
case {rule, e.condition} do
|
||||
{"lo_taaseh_lekha", "single_witness(forged_fringe)"} -> forged_on_one
|
||||
{"golden_calf", "no_ground_given"} -> Map.get(grounding, :assessed) == false and (Map.get(grounding, :reason) || "") =~ "no sources given"
|
||||
{"golden_calf", "hedged"} -> hedged_out
|
||||
_ -> false
|
||||
end
|
||||
|
||||
Map.put(e, :applied, applied)
|
||||
end)
|
||||
|
||||
{rule, %{base | dissent: dissent, exception: exception} |> Map.put(:fired, rule in fired_rules) |> Map.put(:noted, if(rule == "lo_taaseh_lekha", do: noted, else: []))}
|
||||
end)
|
||||
end
|
||||
|
||||
defp rule_of(violation) do
|
||||
case Regex.run(~r/^halt\(\s*(\w+)\s*,/, to_string(violation)) do
|
||||
[_, rule] -> [rule]
|
||||
_ -> []
|
||||
end
|
||||
end
|
||||
|
||||
@doc "A verse as a citation: \"Devarim 19:15\"."
|
||||
@spec cite(verse()) :: String.t()
|
||||
def cite(%{book: b, chapter: c, verse: v}), do: "#{String.capitalize(b)} #{c}:#{v}"
|
||||
|
||||
Reference in new issue
Block a user