{
  "schema_version": "ocme-derivation-reader-v1",
  "guide_id": "derivation-mko-pushdown-automaton-01",
  "mko_id": "mko-pushdown-automaton",
  "title": {
    "zh-Hant": "bottom-first PDA的aabb接受run",
    "en": "A bottom-first PDA run accepting aabb"
  },
  "contract": {
    "schema_version": "ocme-derivation-guide-v0.1",
    "guide_id": "derivation-mko-pushdown-automaton-01",
    "source": {
      "mko_id": "mko-pushdown-automaton",
      "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
      "sha256": "95321a6ccc573a74997a3ea1c00f5b63623fbe7f09a34e305b5357dfd4ce1ba7",
      "english_sha256": "6af04c57849b9bb696bff49fd70aea9cd365c9b7249350fce67f10053d0a967f"
    },
    "mode": "worked_example",
    "audience_prerequisites": [
      "calc"
    ],
    "goal": {
      "zh-Hant": "指定PDA有讀完aabb到final f的有限run，末stack仍為[Z]。",
      "en": "The specified PDA has a finite run consuming aabb and ending at final f with stack [Z]."
    },
    "givens": [
      {
        "id": "G1",
        "statement": {
          "zh-Hant": "Q={q,p,f}，Σ={a,b}，Γ={Z,A}三者不交；start q,bottom Z,finals{f}。transitions按[from,input或null,top,to,replacement bottom-to-top]為[q,a,Z,q,[Z,A]],[q,a,A,q,[A,A]],[q,b,A,p,[]],[p,b,A,p,[]],[p,null,Z,f,[Z]],[q,null,Z,f,[Z]]。word aabb。",
          "en": "Q={q,p,f}, input={a,b}, stack={Z,A}, all disjoint; start q,bottom Z,finals {f}. Transitions [from,input or null,top,to,replacement bottom-to-top] are [q,a,Z,q,[Z,A]],[q,a,A,q,[A,A]],[q,b,A,p,[]],[p,b,A,p,[]],[p,null,Z,f,[Z]],[q,null,Z,f,[Z]]. Word aabb."
        }
      }
    ],
    "steps": [
      {
        "id": "S01",
        "uses": [
          "G1"
        ],
        "before_tex": "Q=\\{q,p,f\\},\\quad\\Sigma=\\{a,b\\},\\quad\\Gamma=\\{Z,A\\}",
        "after_tex": "\\begin{array}{c|c|c|c|c}q&a&Z&q&[Z,A]\\\\q&a&A&q&[A,A]\\\\q&b&A&p&[]\\\\p&b&A&p&[]\\\\p&\\text{null}&Z&f&[Z]\\\\q&\\text{null}&Z&f&[Z]\\end{array}",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "完整六條relation皆合法；底Z只被換成以Z為底的[Z,A]或[Z]，不能underflow。",
          "en": "All six relation entries are valid; bottom Z is replaced only by bottom-preserving [Z,A] or [Z], preventing underflow."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1"
          ],
          "explanation": {
            "zh-Hant": "relation不要求total，replacement列bottom-to-top，[]只在top A時pop。",
            "en": "The relation need not be total; replacements are bottom-to-top, and [] pops only an A."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S02",
        "uses": [
          "G1",
          "S01"
        ],
        "before_tex": "w=aabb,\\quad |w|=4",
        "after_tex": "[q,0,[Z]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "初態位置0，stack底到頂只有Z。",
          "en": "Initialize at position zero with stack consisting only of bottom Z."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01"
          ],
          "explanation": {
            "zh-Hant": "configuration是[state,position,stack]，不可把位置當下一字元本身。",
            "en": "A configuration is [state,position,stack], not [state,next character,stack]."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S03",
        "uses": [
          "G1",
          "S01",
          "S02"
        ],
        "before_tex": "[q,0,[Z]]",
        "after_tex": "[q,1,[Z,A]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀第一a，以[q,a,Z,q,[Z,A]]替換top Z，保留底並push A。",
          "en": "Read the first a using [q,a,Z,q,[Z,A]], retaining the bottom and pushing A."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "replacement含原Z，若只寫[A]會丟失bottom。",
            "en": "The replacement includes Z; using [A] would lose the bottom."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S04",
        "uses": [
          "G1",
          "S01",
          "S03"
        ],
        "before_tex": "[q,1,[Z,A]]",
        "after_tex": "[q,2,[Z,A,A]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀第二a，原top A被[A,A]取代，原下方Z保留。",
          "en": "Read the second a, replacing the top A by [A,A] while retaining Z below."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S03"
          ],
          "explanation": {
            "zh-Hant": "stack右端是top，因此這步淨增一個A而非兩個。",
            "en": "The right end is top; the net increase is one A, not two."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S05",
        "uses": [
          "G1",
          "S01",
          "S04"
        ],
        "before_tex": "[q,2,[Z,A,A]]",
        "after_tex": "[p,3,[Z,A]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀第一b，以[q,b,A,p,[]]pop最右A並換state p。",
          "en": "Read the first b using [q,b,A,p,[]], popping the rightmost A and entering p."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S04"
          ],
          "explanation": {
            "zh-Hant": "只pop一個top，不清空整條stack。",
            "en": "Only one top is popped, not the whole stack."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S06",
        "uses": [
          "G1",
          "S01",
          "S05"
        ],
        "before_tex": "[p,3,[Z,A]]",
        "after_tex": "[p,4,[Z]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "讀末個b，以[p,b,A,p,[]]消去最後A，位置等於4。",
          "en": "Read the last b using [p,b,A,p,[]], removing the final A and reaching position 4."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S05"
          ],
          "explanation": {
            "zh-Hant": "input已讀完但p非final，仍須合法epsilon到final。",
            "en": "Input is consumed but p is not final, so a legal epsilon move remains necessary."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S07",
        "uses": [
          "G1",
          "S01",
          "S06"
        ],
        "before_tex": "[p,4,[Z]]",
        "after_tex": "[f,4,[Z]]",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "以[p,null,Z,f,[Z]]做epsilon，位置維持4，底仍存在。",
          "en": "Use [p,null,Z,f,[Z]] as an epsilon move, keeping position 4 and preserving bottom."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S06"
          ],
          "explanation": {
            "zh-Hant": "null不消耗輸入，也不能把Z換[]。",
            "en": "null consumes no input and cannot replace Z by []."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S08",
        "uses": [
          "G1",
          "S02",
          "S03",
          "S04",
          "S05",
          "S06",
          "S07"
        ],
        "before_tex": "[f,4,[Z]],\\quad f\\in F,\\quad4=|w|",
        "after_tex": "aabb\\text{ accepted by this finite run}",
        "relation": "implies",
        "rule": "mko_definition",
        "conditions": [],
        "explanation": {
          "zh-Hant": "全部輸入已讀且末態final，符合本稿接受慣例，非空stack不妨礙接受。",
          "en": "All input is consumed and the endpoint is final, meeting the stated convention despite a nonempty stack."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S02",
            "S03",
            "S04",
            "S05",
            "S06",
            "S07"
          ],
          "explanation": {
            "zh-Hant": "若在初態用q的epsilon先到f，位置仍0而非4，不能接受aabb。",
            "en": "Taking q's epsilon to f initially leaves position 0 rather than 4 and does not accept aabb."
          }
        },
        "leaf_basis": "mko_definition"
      }
    ],
    "result": {
      "zh-Hant": "指定PDA有讀完aabb到final f的有限run，末stack仍為[Z]。",
      "en": "The specified PDA has a finite run consuming aabb and ending at final f with stack [Z]."
    },
    "negative_controls": [
      {
        "claim": {
          "zh-Hant": "末stack需空才接受。",
          "en": "The terminal stack must be empty to accept."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "本慣例full input加final f；本run末[Z]仍接受。",
          "en": "The convention is full input plus final f; terminal [Z] is accepted."
        }
      },
      {
        "claim": {
          "zh-Hant": "null把位置4變5。",
          "en": "null changes position 4 to 5."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "epsilon不消耗輸入。",
          "en": "Epsilon consumes no input."
        }
      },
      {
        "claim": {
          "zh-Hant": "初態epsilon到f即可接受aabb。",
          "en": "The initial epsilon to f accepts aabb."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "尚未讀四個symbols，位置0不等長度4。",
          "en": "All four symbols remain unread; position 0 is not length 4."
        }
      }
    ],
    "status": "candidate",
    "gaps": [],
    "verification": {
      "structure": "checked_local_script",
      "mathematics": "candidate_argument",
      "formalization": "not_formalized"
    },
    "rule_glossary": [
      {
        "id": "calc",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "假設有限集合、有限字串與索引、逐步函數更新及自然數歸納；ε表示長度0字串。",
          "en": "Assume finite sets, finite strings and indices, stepwise function updates and induction on natural numbers; epsilon denotes the length-zero word."
        }
      },
      {
        "id": "mko_definition",
        "kind": "cited",
        "statement": {
          "zh-Hant": "PDA tuple含finite Q、input alphabet、stack alphabet、start q0、bottom Z、final states與transition relation。transition序列固定為[from_state,input_symbol_or_null,required_stack_top,to_state,replacement_stack_bottom_to_top]；null表示epsilon且不消耗input。stack序列bottom-first/top-last，bottom不可underflow。接受witness為有限run且讀完input到final state。不混用empty-stack acceptance；bounded search failure不證rejection，也不自動宣稱CFG equivalence或determinism。",
          "en": "The PDA tuple specifies finite states Q, input/stack alphabets, start q0, bottom Z, final states and a transition relation. Each transition is [from state,input symbol or null,required top,to state,replacement bottom-to-top]. null denotes epsilon and consumes no input. A stack is bottom-first/top-last and its bottom may not underflow. An acceptance witness is a finite run consuming all input and ending in a final state. Do not substitute empty-stack acceptance. Bounded-search failure does not prove rejection; neither CFG equivalence nor determinism follows automatically."
        },
        "source": {
          "mko_id": "mko-pushdown-automaton",
          "sha256": "95321a6ccc573a74997a3ea1c00f5b63623fbe7f09a34e305b5357dfd4ce1ba7",
          "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f"
        }
      }
    ],
    "revision_log": [],
    "numeric_checks": []
  },
  "presentation": {
    "md_scope": {
      "zh-Hant": "完整transition relation與bottom-first/top-last堆疊；final-state acceptance，不混空stack。",
      "en": "The full transition relation and bottom-first/top-last stack; final-state rather than empty-stack acceptance."
    },
    "md_symbols": [
      [
        "Z",
        "不可underflow的bottom",
        "bottom protected from underflow"
      ],
      [
        "null",
        "不耗input的epsilon",
        "input-free epsilon"
      ],
      [
        "i",
        "已讀input長度",
        "consumed input length"
      ]
    ],
    "md_error_controls": [
      {
        "title": "堆疊方向 / Stack direction",
        "zh": "stack bottom-first/top-last，pop與替換都針對右端。",
        "en": "The stack is bottom-first/top-last, with pop and replacement at the right end."
      },
      {
        "title": "兩接受門檻 / Two acceptance gates",
        "zh": "同時要求讀完input與final state，不以empty-stack取代。",
        "en": "Require both full input and a final state, not empty-stack acceptance."
      }
    ],
    "md_open_items": []
  },
  "revision": {
    "id": "ocme-new142-reader-adoption-20261021",
    "collection": "coverage-20261021",
    "source_commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
    "adopted_source_sha256": "4b91e5f3268836475349aa0a7814487dd2f540fb36c66fb88a2f29701b97f326",
    "original_source_sha256": "4b91e5f3268836475349aa0a7814487dd2f540fb36c66fb88a2f29701b97f326",
    "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": [],
    "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."
  }
}
