{
  "schema_version": "ocme-derivation-reader-v1",
  "guide_id": "derivation-mko-turing-machine-decision-model-01",
  "mko_id": "mko-turing-machine-decision-model",
  "title": {
    "zh-Hant": "二元字串偶數1的scan decider",
    "en": "A scan decider for an even number of ones"
  },
  "contract": {
    "schema_version": "ocme-derivation-guide-v0.1",
    "guide_id": "derivation-mko-turing-machine-decision-model-01",
    "source": {
      "mko_id": "mko-turing-machine-decision-model",
      "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
      "sha256": "9fc9700d03f68194f76ce7dec138e0b7fcac9e14deae2adf44f6dba00627308c",
      "english_sha256": "899d905d1fa2bb187a389fe647567c10b147f2cfd5df11725e625c35475d16e3"
    },
    "mode": "algorithm_trace",
    "audience_prerequisites": [
      "work"
    ],
    "goal": {
      "zh-Hant": "完整machine、trace、ranking與全input正確性。",
      "en": "Give the complete machine, trace, ranking and all-input correctness."
    },
    "givens": [
      {
        "id": "G1",
        "statement": {
          "zh-Hant": "Q={E,O,A,R}，input alphabet{0,1}，tape alphabet{0,1,_}，blank=_，start E，accept A，reject R，head初始0。輸入w長m置cells0≤j<m，其餘blank。",
          "en": "Q={E,O,A,R}, input alphabet{0,1}, tape alphabet{0,1,_}, blank_, start E, accept A, reject R, initial head0. Input w of length m occupies cells0≤j<m; all other cells are blank."
        }
      },
      {
        "id": "G2",
        "statement": {
          "zh-Hant": "完整非halt轉移：[E,0,E,0,R]、[E,1,O,1,R]、[O,0,O,0,R]、[O,1,E,1,R]、[E,_,A,_,S]、[O,_,R,_,S]；halt states A、R沒有outgoing。tuple末位R指right，不是reject state。",
          "en": "The complete nonhalt transitions are[E,0,E,0,R],[E,1,O,1,R],[O,0,O,0,R],[O,1,E,1,R],[E,_,A,_,S],[O,_,R,_,S]; halt states A,R have no outgoing transitions. Final-position R means right, not reject state."
        }
      }
    ],
    "steps": [
      {
        "id": "S01",
        "uses": [
          "G1",
          "G2",
          "work"
        ],
        "before_tex": "\\{E,O\\}\\times\\{0,1,\\_\\}",
        "after_tex": "6\\text{ deterministic transitions; A,R terminal}",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "兩個非halt state各三個read symbol全列且single-valued。",
          "en": "Every nonhalt state has one transition for each of three read symbols."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "work"
          ],
          "explanation": {
            "zh-Hant": "無缺transition，也無同pair兩個後繼。",
            "en": "No transition pair is missing or multivalued."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S02",
        "uses": [
          "G1",
          "G2",
          "S01",
          "work"
        ],
        "before_tex": "w=101,\\quad C_0=[E,0,\\{0:1,1:0,2:1\\}]",
        "after_tex": "C_1=[O,1,\\{0:1,1:0,2:1\\}]",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "在cell0讀1，切O並向右，tape不改。",
          "en": "Read1 at cell0, switch to O and move right without changing tape."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S01",
            "work"
          ],
          "explanation": {
            "zh-Hant": "sparse tape未列cells都blank。",
            "en": "All unlisted sparse-tape cells are blank."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S03",
        "uses": [
          "G1",
          "G2",
          "S02",
          "work"
        ],
        "before_tex": "C_1=[O,1,\\{0:1,1:0,2:1\\}]",
        "after_tex": "C_2=[O,2,\\{0:1,1:0,2:1\\}]",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀0不改parity，head到2。",
          "en": "Reading0 preserves parity and moves the head to 2."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S02",
            "work"
          ],
          "explanation": {
            "zh-Hant": "0也是nonblank tape symbol，仍保留於sparse table。",
            "en": "Zero is a nonblank tape symbol and remains in the sparse table."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S04",
        "uses": [
          "G1",
          "G2",
          "S03",
          "work"
        ],
        "before_tex": "C_2=[O,2,\\{0:1,1:0,2:1\\}]",
        "after_tex": "C_3=[E,3,\\{0:1,1:0,2:1\\}]",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "第二個1把parity切回E，head到第一blank。",
          "en": "The second1 switches parity back to E and moves to the first blank."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S03",
            "work"
          ],
          "explanation": {
            "zh-Hant": "原input長度3，cell3確實blank。",
            "en": "The input length is 3, so cell3 is blank."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S05",
        "uses": [
          "G1",
          "G2",
          "S04",
          "work"
        ],
        "before_tex": "C_3=[E,3,T]",
        "after_tex": "C_4=[A,3,T]\\quad\\text{accept}",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "E讀blank時stay並accept，這條trace共4步。",
          "en": "E reading blank stays and accepts; this trace has four steps."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S04",
            "work"
          ],
          "explanation": {
            "zh-Hant": "此trace只證101，尚須全input義務。",
            "en": "This trace proves only 101; all-input obligations remain."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S06",
        "uses": [
          "G1",
          "G2",
          "S05",
          "work"
        ],
        "before_tex": "h\\text{ input cells scanned}",
        "after_tex": "q=E\\iff\\#\\{j<h:w_j=1\\}\\text{ even};\\quad q=O\\iff\\text{odd}",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "空prefix為E；讀0不變、讀1切換，依h歸納證完整parity invariant。",
          "en": "The empty prefix is E;0 preserves parity and 1 toggles it, proving the invariant by induction on h."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S05",
            "work"
          ],
          "explanation": {
            "zh-Hant": "state只記已掃prefix，不偷看未讀suffix。",
            "en": "The state tracks the scanned prefix only, not unread suffix."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S07",
        "uses": [
          "G1",
          "G2",
          "S06",
          "work"
        ],
        "before_tex": "\\rho=m-h+1\\text{ in scan states},\\quad\\rho=0\\text{ in A,R}",
        "after_tex": "\\rho\\in\\mathbb N_0,\\quad\\rho\\text{ strictly decreases at each step}",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀bit令h加一；blank時從1降0，所以任意input最多m+1步halt。",
          "en": "Reading a bit increments h; blank changes rank1 to 0, so every input halts within m+1 steps."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S06",
            "work"
          ],
          "explanation": {
            "zh-Hant": "只能在可達scan態0≤h≤m使用此ranking。",
            "en": "Use this ranking on reachable scan states0≤h≤m."
          }
        },
        "leaf_basis": "work"
      },
      {
        "id": "S08",
        "uses": [
          "G1",
          "G2",
          "S07",
          "work"
        ],
        "before_tex": "h=m,\\quad q=E\\text{ iff total ones even}",
        "after_tex": "\\text{accept iff }w\\text{ has even ones; reject otherwise}",
        "relation": "implies",
        "rule": "work",
        "conditions": [],
        "explanation": {
          "zh-Hant": "第一blank時invariant已涵蓋全word，兩blank轉移給正確答案與total termination。",
          "en": "At the first blank the invariant covers the whole word; the two blank transitions give correct answers and total termination."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "G2",
            "S07",
            "work"
          ],
          "explanation": {
            "zh-Hant": "empty word m=0在一步accept；bounded timeout不是reject證書。",
            "en": "The empty word accepts in one step; a bounded timeout is not a rejection certificate."
          }
        },
        "leaf_basis": "work"
      }
    ],
    "result": {
      "zh-Hant": "此機器對所有二元words在m+1步內決定1的個數是否偶數；101於4步accept。",
      "en": "The machine decides even-one parity for every binary word within m+1 steps;101 accepts in four steps."
    },
    "negative_controls": [
      {
        "claim": {
          "zh-Hant": "一條101 halt trace就證所有input halt。",
          "en": "One101 halting trace proves halting on every input."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "全input termination另由ranking證明。",
          "en": "All-input termination requires the separate ranking argument."
        }
      },
      {
        "claim": {
          "zh-Hant": "m步未halt就可reject。",
          "en": "Failure to halt in m steps proves rejection."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "此正確機器需要m+1步讀末blank。",
          "en": "This correct machine needs m+1 steps to read the final blank."
        }
      },
      {
        "claim": {
          "zh-Hant": "empty input不在decider範圍。",
          "en": "Empty input is outside the decider's domain."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "初始即讀blank，由E在一步accept，零個1為偶數。",
          "en": "Initially reading blank in E accepts in one step; zero ones is even."
        }
      }
    ],
    "status": "candidate",
    "gaps": [],
    "verification": {
      "structure": "checked_local_script",
      "mathematics": "candidate_argument",
      "formalization": "not_formalized"
    },
    "rule_glossary": [
      {
        "id": "mko_definition",
        "kind": "cited",
        "statement": {
          "zh-Hant": "machine明示finite states、input alphabet、tape alphabet、blank、start、accept、reject及deterministic transition [state,read,next,write,move]，tape未列cells皆為blank。configuration固定[state,head,sparse nonblank tape]。exact step與finite trace只證指定input。全域decider certificate須提供對所有input成立且每步嚴格下降的ranking或明示step bound，並同時有answer correctness。recognizer可在nonmember上loop；bounded simulation failure不證rejection或nontermination，單一halting trace也不證全域decider。",
          "en": "Specify finite states, input/tape alphabets, blank, start, accept, reject and deterministic transitions [state,read,next,write,move]. Unlisted tape cells are blank, and configurations are [state,head,sparse nonblank tape]. Exact steps and finite traces concern their supplied input only. A global decider certificate needs an all-input strictly decreasing ranking or explicit step bound and answer correctness. A recognizer may loop on nonmembers. Bounded simulation failure proves neither rejection nor nontermination, and one halting trace does not certify a global decider."
        },
        "source": {
          "mko_id": "mko-turing-machine-decision-model",
          "sha256": "9fc9700d03f68194f76ce7dec138e0b7fcac9e14deae2adf44f6dba00627308c",
          "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f"
        }
      },
      {
        "id": "work",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "deterministic TM一步語義、有限word按head順序掃描、prefix parity歸納、非負整數嚴格下降ranking保證termination。",
          "en": "Deterministic TM step semantics, scanning a finite word in head order, prefix-parity induction, and termination from a strictly decreasing nonnegative-integer ranking."
        }
      }
    ],
    "revision_log": [],
    "numeric_checks": [
      {
        "id": "N01",
        "lhs": "3+1",
        "rhs": "4"
      },
      {
        "id": "N02",
        "lhs": "2%2",
        "rhs": "0"
      },
      {
        "id": "N03",
        "lhs": "0+1",
        "rhs": "1"
      }
    ]
  },
  "presentation": {
    "md_scope": {
      "zh-Hant": "single-tape deterministic scan schema，不由一條halt trace證total。",
      "en": "A deterministic single-tape scan schema, not totality inferred from one halting trace."
    },
    "md_symbols": [
      [
        "C=[q,h,T]",
        "state、head、sparse tape",
        "state, head and sparse tape"
      ],
      [
        "ρ",
        "全input下降ranking",
        "all-input decreasing ranking"
      ]
    ],
    "md_error_controls": [
      {
        "title": "R角色 / R roles",
        "zh": "tuple 的第 1、3 個 state slot 中，R 可表示 reject state；第 5 個 move slot 中的 R 只表示向右。",
        "en": "R in a state slot may mean reject; R in the move slot means right."
      },
      {
        "title": "全稱證書 / Universal certificate",
        "zh": "parity invariant給答案，ranking給termination，兩者都不可漏。",
        "en": "Parity invariance gives the answer and ranking termination; retain both."
      }
    ],
    "md_open_items": []
  },
  "revision": {
    "id": "ocme-new142-reader-adoption-20261021",
    "collection": "coverage-20261021",
    "source_commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
    "adopted_source_sha256": "77d53abdd344aeaf85e19bd50d683bd23ec41515448ac822ac05edcccf7c7a30",
    "original_source_sha256": "6afbbbf8fb1498115567f484c8776ccf5f2728c23bb439f5feb63e33c9327cd6",
    "owner_adopted": true,
    "bilingual_sync": "complete_source_bound",
    "formal_Lean": "NOT_RUN",
    "reader_review": "142_of_142_source_bound",
    "wording_review": "original_Lead_decisions_resolved",
    "glossary_reader_paraphrases": [],
    "independent_AI_concurrence": "SCOPED_LEAD_AND_BILINGUAL_CONTEXT_REVIEW",
    "issue_ids": [
      "BR142-P063",
      "BR142-S192",
      "BR142-S193",
      "BR142-S194",
      "BR142-S195",
      "BR142-S196"
    ],
    "parent_manifest_sha256": "d29f4cae8229ebd24f60d496cb1d3cd4ad8c0a4dca9d44daab0c3245c544283a",
    "scope": "Owner-adopted reader revision. Lead and bilingual review concern the recorded text and premises; no new universal or Lean proof, canonical promotion or historical-label rewrite."
  }
}
