Skip to content

feat(ontology): encode YD 87:9 — chalav keivah (milk in abomasum) - #260

Merged
levi770 merged 2 commits into
mainfrom
session/RNekhoda/yd_87-9
Jun 5, 2026
Merged

feat(ontology): encode YD 87:9 — chalav keivah (milk in abomasum)#260
levi770 merged 2 commits into
mainfrom
session/RNekhoda/yd_87-9

Conversation

@levi770

@levi770 levi770 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Encoding Summary

  • Reference: SA Yoreh De'ah 87:9
  • Topic: חלב הנמצא בקיבה — milk found in the abomasum of a slaughtered animal
  • Rules: 7 encoded (3 Mechaber heter + 1 Rema karush heter + 3 Rema tzalul issur)
  • Worlds: mechaber, rema
  • Tests: 22 scenarios passing (3.86s)
  • Encoding Decisions: 4 total (4 definitive)

Key Rulings

Authority Karush (congealed) Tzalul (liquid)
Mechaber (Rif/Rambam) Mutar — pirsha Mutar — pirsha
Rema (Rabbenu Tam) Mutar — pirsha Issur d'oraita — chalav mamash
Rashi/Maharshal annotation only annotation only

Key principle: Rambam MT 9:15 — "חלב המכונס בה פירשא בעלמא" (the milk collected in it is merely secretion). Primary Talmudic source: Chullin 116b hilkheta.

Review Finding (HAL-2)

issur(hanaah, d_oraita) was missing for Rema/tzalul — added at review phase. If tzalul = chalav mamash, all three BB prohibitions apply (bishul + achiila + hanaah).

Schema Changes

  • 3 new food_category enum values: chalav_keivah, chalav_keivah_karush, chalav_keivah_tzalul
  • base.hll guard extension (ED-87-9-003): keivah milk isolated from mixture_has_chalav
  • 4 new predicates declared

Source Chain (18 sources)

Chullin 116b → Chullin 116a → Rif Chullin 38b → Rambam MT 9:15 → Tur YD 87 → SA YD 87:9 + Shach sk24/25, Taz sk7, AH 87:35/87:38, Kaf HaChayim 87:74-75, Rashi/Tosafot on Chullin 116a

Test Plan

  • python -m pytest .mistaber-artifacts/tests/test_yd_87_9.py — 22/22 pass
  • python -m pytest tests/engine/test_tech_health_yd_87_9.py — 4/4 pass
  • python -m pytest tests/engine/test_tech_health.py -m "not perf" — 19/19 pass
  • python -m mistaber.dsl.build — 0 warnings

Artifacts

Archived to mistaber/corpus/yoreh_deah/siman_87/seif_9/


Reviewed-by: RNekhoda

Generated by Mistaber Code — Computational Halacha Encoding Agent

Mistaber Code added 2 commits June 5, 2026 04:14
Encode Shulchan Aruch Yoreh Deah 87:9 (chalav ha'nimtza b'keivah).

Encoding Summary:
- 7 rules encoded (3 Mechaber heter + 1 Rema karush heter + 3 Rema tzalul issur)
- Worlds: mechaber, rema
- Machloket: Mechaber (pirsha — mutar) vs Rema/Rabbenu Tam (tzalul = chalav mamash — issur d_oraita)
- Tests: 22 scenarios (3.86s runtime)
- Encoding Decisions: 4 total (4 definitive / 0 probable / 0 debatable)

Key rulings:
- Mechaber (Rif/Rambam): chalav_keivah = pirsha — mutar bishul/achiila/hanaah (both states)
- Rema (Rabbenu Tam): karush = pirsha (mutar); tzalul = chalav mamash → issur d_oraita (all 3)
- Shach sk25: karush assur lchatchila (mara'it ayin), mutar bedieved
- Tzalul-she-nikrash = din tzalul (Rashba/Shach)

Sources:
- Primary: SA YD 87:9 (Mechaber + Rema gloss)
- Talmud: Chullin 116b (hilkheta: פירשא בעלמא), Chullin 116a, Chullin 109b
- Rishonim: Rif Chullin 38b, Rambam MT Maachalot Asurot 9:15, Tur YD 87
- Commentaries: Shach sk24/25, Taz sk7, AH 87:35/87:38, Kaf HaChayim 87:74-75
- Also: Rashi on Chullin 116a, Tosafot on Chullin 116a

Schema changes:
- 3 new food_category enum values: chalav_keivah, chalav_keivah_karush, chalav_keivah_tzalul
- base.hll guard extension (ED-87-9-003)
- 4 new predicates declared

Review finding (HAL-2): issur(hanaah, d_oraita) added for Rema/tzalul at review phase

Reviewed-by: RNekhoda
Corpus-artifact: corpus-sources-YD-87-9.yaml

Co-authored-by: Mistaber Code <code@mistaber.ai>
Co-authored-by: Mistaber Code <code@mistaber.ai>
Copilot AI review requested due to automatic review settings June 5, 2026 04:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Verdict: CHANGES REQUESTED
Counts: [CRITICAL] 4 · [IMPORTANT] 5 · [NIT] 1
Scope detected: encoding-session
Highlights:

  • Missing required per-phase validation reports in the YD 87:9 archive (corpus-prep / hll-encode / validate / commit).
  • encoding-decisions.yaml schema deviates from established prior seif format (missing per-decision reviewed_at, wrong alternatives shape, empty hll_refs).
  • scenario_{pos,neg}_87_9.hll missing required @show(holds/2) projection for reviewability.
  • Several archived “phase reports / mappings” still reflect the pre–HAL-2 state (rule-count and traceability drift).

This PR encodes SA YD 87:9 (“chalav keivah” — milk found in the abomasum), adding new food_category values and dedicated detection predicates, with Mechaber heter and Rema tzalul issur d’oraita modeled as separate world assertions. It also archives the corresponding corpus artifacts and adds a per-seif tech-health overlay test.

Changes:

  • Add new encoding for YD 87:9 (new HLL + compiled LP) and guard mixture_has_chalav so chalav_keivah doesn’t trigger the general BB machinery.
  • Extend schema/vocabulary with new food_category enum values and new derived predicates for chalav_keivah mixture detection.
  • Add archived corpus package for YD 87:9 (reports, QA set, tests) and update corpus manifest.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/engine/test_tech_health_yd_87_9.py Adds per-seif production “tech health” overlay checks for YD 87:9 artifacts.
mistaber/ontology/meta.lp Regenerates ontology meta to include new enum values and predicate metadata.
mistaber/ontology/corpus/yd_87/seif_9.lp Adds compiled LP output for the new seif_9 encoding.
mistaber/ontology/corpus/yd_87/base.lp Updates compiled base guard to exclude chalav_keivah types from mixture_has_chalav.
mistaber/dsl/vocabulary/base.yaml Registers new predicates and enum values in the generated vocabulary.
mistaber/dsl/schema/sorts.hll Extends food_category enum with chalav_keivah variants.
mistaber/dsl/corpus/yd_87/seif_9.hll Introduces the YD 87:9 encoding (rules, predicates, annotations, dispute facts).
mistaber/dsl/corpus/yd_87/base.hll Updates mixture_has_chalav guard to exclude chalav_keivah types.
mistaber/corpus/yoreh_deah/siman_87/seif_9/validation-report.md Archives validate-phase report (but missing other phase reports required for completeness).
mistaber/corpus/yoreh_deah/siman_87/seif_9/validation-report-review.md Archives review-phase validator report for the session checkpoint.
mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/test_yd_87_9.py Adds archived python tests validating detection + Mechaber/Rema outcomes for the new encoding.
mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/scenario_pos_87_9.hll Adds positive scenario fixture for tzalul case (needs @show(holds/2)).
mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/scenario_neg_87_9.hll Adds negative scenario fixture for karush case (needs @show(holds/2)).
mistaber/corpus/yoreh_deah/siman_87/seif_9/review-package.md Archives human review package for the seif.
mistaber/corpus/yoreh_deah/siman_87/seif_9/qa-set.yaml Archives QA set describing coverage intent and per-question scenarios.
mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-report.md Archives encoding report (currently inconsistent with final 7-rule state).
mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-mapping.yaml Archives statement→rule mapping (currently missing HAL-2 hanaah rule and updated counts).
mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-decisions.yaml Archives encoding decisions (schema/fields drift vs established format).
mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-report.md Archives corpus report (still contains stale [PENDING] markers).
mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-sources.yaml Archives fetched sources and commentary texts for the seif.
mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-chain.mermaid Adds mermaid graph for the seif’s source chain.
mistaber/corpus/corpus-manifest.yaml Registers YD 87:9 as complete and updates overall progress totals.
Comments suppressed due to low confidence (1)

mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/test_yd_87_9.py:249

  • [IMPORTANT] This seif introduces new production rule IDs, but the archived test suite does not include any engine.explain(...) assertions to capture derivation traces / makor evidence for the new holds(...) claims. The codebase already uses explain-based tests (e.g. YD 87:3) to pin rule provenance.

Concrete remediation: add at least one explain-based test (ideally covering both Mechaber heter and Rema tzalul issur) and assert that the derivation/tree includes the expected rule ID and a sa("yd:87:9") makor.

    def test_scenario_neg_inline(self, engine):
        """Negative scenario: karush + beheima — triggers karush mixture (inline facts)."""
        facts = (
            "food(bf_neg). food_type(bf_neg, beheima). "
            "food(ka_neg). food_type(ka_neg, chalav_keivah_karush). "
            "mixture(mk_neg). contains(mk_neg, bf_neg). contains(mk_neg, ka_neg)."
        )
        result = engine.analyze(facts, world="rema")
        atoms = [str(a) for a in result["atoms"]]
        assert any("is_chalav_keivah_karush_mixture(mk_neg)" in a for a in atoms), (
            f"Negative scenario must trigger is_chalav_keivah_karush_mixture."
        )

Comment on lines +1 to +5
---
phase: validate
passed: true
validated_at: "2026-06-04T06:30:00Z"
validator: "validate-skill-self-check"
Comment on lines +13 to +17
decisions:
- id: "ED-87-9-001"
type: event_identification
confidence: definitive
reviewed: true
Comment on lines +9 to +12
# NOTE: Sources Chullin 116a, Rashi on Chullin 116a, Tosafot on Chullin 116a,
# Rif on Chullin, and Kaf HaChayim on SA YD 87:74-75 are pending fetch
# due to Sefaria SSE session expiry. To be added before hll-encode phase.

Comment on lines +18 to +22
| `r_rema_keivah_karush_heter` | rema | heter | — | Rema: karush keivah milk = mutar (not chalav) |
| `r_rema_keivah_tzalul_issur_bishul` | rema | issur | d_oraita | Rema: tzalul keivah milk + beheima = issur bishul d'oraita |
| `r_rema_keivah_tzalul_issur_achiila` | rema | issur | d_oraita | Rema: tzalul keivah milk + beheima = issur achiila d'oraita |

**Total: 6 rules** (3 Mechaber heter + 1 Rema karush heter + 2 Rema tzalul issur)
Comment on lines +23 to +33
- statement_id: s3
type: ISSUR
rule_ids:
- r_rema_keivah_tzalul_issur_bishul
- r_rema_keivah_tzalul_issur_achiila
predicate: "issur"
world: rema
authority: "rema (Rabbenu Tam/Rosh)"
madrega: d_oraita
machloket: true
notes: "Rema: tzalul = chalav mamash → issur d'oraita with beheima. SA gloss: 'vechen nohagim'. Taz sk7 confirms Rema follows Rabbenu Tam."
Comment on lines +13 to +15
@show(is_chalav_keivah_tzalul_mixture/1)
@show(is_chalav_keivah_mixture/1)
@show(asserts/2)
Comment on lines +12 to +14
@show(is_chalav_keivah_karush_mixture/1)
@show(is_chalav_keivah_mixture/1)
@show(asserts/2)

@rule(r_keivah_mechaber_heter_achiila)
@makor([sa("yd:87:9"), tur("yd:87"), rif("chullin:38b"), rambam("maachalot:9:15"), bab("chullin:116b")])
@encoding_note("ED-87-9-001: Mechaber heter for achiila — derived from the not-chalav classification ('einо chalav'), not explicitly stated in the SA text (which mentions only bishul: 'mutar levashel bo basar'). If the substance is not halachic chalav at all, the achiila and hanaah prohibitions of basar bechalav do not arise.")
Comment on lines +66 to +86
```
Torah: Shemot 23:19 (lo tevashel gedi b'chalev imo)
Mishnah Chullin 8 (kol habasar — BB framework)
Gemara Chullin 109b:9 (baraita: keivah bishul b'chalavah)
↓ [PENDING: Chullin 116a full sugya]
Rif on Chullin [PENDING] | Rashi | Rabbenu Tam
↓ ↓ ↓
Rambam MT 9:15 both assur karush mutar
(pirsha — mutar) tzalul assur
Tur YD 87 (documents full 3-way machloket)
Beit Yosef YD 87 (rules like Rif)
SA YD 87:9 (Mechaber=Rif; Rema gloss=Rabbenu Tam)
Shach sk24/25, Taz sk7, Aruch HaShulchan 87:38
[PENDING: Kaf HaChayim 87:74-75]
```
@levi770
levi770 merged commit 01395d5 into main Jun 5, 2026
7 of 8 checks passed
levi770 added a commit that referenced this pull request Jun 5, 2026
Reverts squash-merge commit 01395d5 (PR #260) merged without explicit reviewer approval. Restores main to b36de4b (YD 87:8). NIT fixed: corpus-manifest.yaml next_targets label corrected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants