查找相關知識與題目 →

第 21530 題:上下文無關文法

本頁導覽
  1. 原題與已知條件
  2. 定義與適用範圍
  3. 逐步推導
  4. 逐步反向核對
  5. 結論
  6. 本題覆核與來源綁定

返回所在分頁 108

← 逐題詳解目錄 · 原題批次

R0042-21530 · q-20261014-advance-20261109-r07-context-free-grammar-0030

原題與已知條件

finite disjoint nonterminals/terminals、start與complete production set。操作=cfg-derivation-audit;資料={"nonterminals":["S4","A4"],"terminals":["a4","b4"],"start":"S4","productions":[["S4",["a4","A4"]],["A4",["b4","A4"]],["A4",[]]],"allow_epsilon":true,"forms":[["S4"],["a4","A4"],["a4","b4","A4"],["a4","b4","b4","A4"],["a4","b4","b4","b4","A4"],["a4","b4","b4","b4","b4","A4"],["a4","b4","b4","b4","b4"]]}。請依 exact_ordered_tuple_declared_by_interface 欄序回答。

  • G001 — finite disjoint nonterminals/terminals、start與complete production set。操作=cfg-derivation-audit;資料={"nonterminals":["S4","A4"],"terminals":["a4","b4"],"start":"S4","productions":[["S4",["a4","A4"]],["A4",["b4","A4"]],["A4",[]]],"allow_epsilon":true,"forms":[["S4"],["a4","A4"],["a4","b4","A4"],["a4","b4","b4","A4"],["a4","b4","b4","b4","A4"],["a4","b4","b4","b4","b4","A4"],["a4","b4","b4","b4","b4"]]}。請依 exact_ordered_tuple_declared_by_interface 欄序回答。

定義與適用範圍

沿用原題明示的論域、假設與來源 MKO 定義。本題已完成第二對話數理與中英語義覆核,並由原始參數逐題獨立重算模型、答案與每個算術步驟;原題仍為 candidate。

逐步推導

S001 · implies

操作前

source operation=cfg-derivation-audit;original snapshot and mathematics retained

操作後

explicit ordered source output fields=[forms, step_witnesses, valid_derivation, final_form_terminal_only, certificate]

條件:無

原題歷史介面標記保留,本頁直接列來源有序欄位,不需JavaScript。tag不是額外證據,固定No保留其原聲稱範圍。

步驟識別與依賴

規則:source_ordered_interface_explicit_without_javascript · 依賴:G001

S002 · implies

操作前

ORIGINAL production index=0;lhs=S4,rhs=[a4, A4];N=[S4, A4],T=[a4, b4],allow_epsilon=是

操作後

lhs is ONE declared nonterminal;every rhs symbol legal;empty rhs accepted ONLY under the explicit epsilon convention;original production position retained

條件:無

每條production左邊只有一個非終結符;右邊逐symbol核合法,空右邊依明示epsilon慣例。重複production位置可存在,不能排序改變首witness索引。

步驟識別與依賴

規則:cfg_each_original_production_single_nonterminal_legal_rhs · 依賴:G001, S001

S003 · implies

操作前

ORIGINAL production index=1;lhs=A4,rhs=[b4, A4];N=[S4, A4],T=[a4, b4],allow_epsilon=是

操作後

lhs is ONE declared nonterminal;every rhs symbol legal;empty rhs accepted ONLY under the explicit epsilon convention;original production position retained

條件:無

每條production左邊只有一個非終結符;右邊逐symbol核合法,空右邊依明示epsilon慣例。重複production位置可存在,不能排序改變首witness索引。

步驟識別與依賴

規則:cfg_each_original_production_single_nonterminal_legal_rhs · 依賴:G001, S002

S004 · implies

操作前

ORIGINAL production index=2;lhs=A4,rhs=[];N=[S4, A4],T=[a4, b4],allow_epsilon=是

操作後

lhs is ONE declared nonterminal;every rhs symbol legal;empty rhs accepted ONLY under the explicit epsilon convention;original production position retained

條件:無

每條production左邊只有一個非終結符;右邊逐symbol核合法,空右邊依明示epsilon慣例。重複production位置可存在,不能排序改變首witness索引。

步驟識別與依賴

規則:cfg_each_original_production_single_nonterminal_legal_rhs · 依賴:G001, S003

S005 · implies

操作前

ORIGINAL unique disjoint N=[S4, A4],T=[a4, b4];start=S4;complete productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]];allow_epsilon=是

操作後

start belongs to nonterminals;finite grammar qualified;NO derivation,membership,regularity,unambiguity or PDA equivalence inferred

條件:無

定義合格只是文法的資格,不自動有某個word的推導,也不推regular、unambiguous等額外性質。非終結符/終結符順序保原輸入。

步驟識別與依賴

規則:cfg_qualified_alphabets_start_not_language_property · 依賴:G001, S004

S006 · implies

操作前

ORIGINAL forms=[[S4], [a4, A4], [a4, b4, A4], [a4, b4, b4, A4], [a4, b4, b4, b4, A4], [a4, b4, b4, b4, b4, A4], [a4, b4, b4, b4, b4]];actual grammar start=S4

操作後

first form exactly [start]=是;empty forms or wrong start fail even if the last form is terminal

條件:無

推導必須真從[start]開始;單看末項是終結字串不足。空forms不是epsilon推導;epsilon是實際空字串形式[],仍需要合法production鏈。

步驟識別與依賴

規則:cfg_derivation_actual_start_required · 依賴:G001, S005

S007 · implies

操作前

ORIGINAL transition index=0;from=[S4];to=[a4, A4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[0, 0, S4, [a4, A4]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S006

S008 · implies

操作前

ORIGINAL transition index=1;from=[a4, A4];to=[a4, b4, A4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[1, 1, A4, [b4, A4]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S007

S009 · implies

操作前

ORIGINAL transition index=2;from=[a4, b4, A4];to=[a4, b4, b4, A4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[2, 1, A4, [b4, A4]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S008

S010 · implies

操作前

ORIGINAL transition index=3;from=[a4, b4, b4, A4];to=[a4, b4, b4, b4, A4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[3, 1, A4, [b4, A4]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S009

S011 · implies

操作前

ORIGINAL transition index=4;from=[a4, b4, b4, b4, A4];to=[a4, b4, b4, b4, b4, A4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[4, 1, A4, [b4, A4]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S010

S012 · implies

操作前

ORIGINAL transition index=5;from=[a4, b4, b4, b4, b4, A4];to=[a4, b4, b4, b4, b4];original productions=[[S4, [a4, A4]], [A4, [b4, A4]], [A4, []]]

操作後

FIRST matching [position,production_index,lhs,rhs]=[5, 2, A4, []];replace EXACTLY ONE occurrence,retaining both surrounding substrings

條件:無

按原位置、再原production順序找第一個真替換witness;只換一個lhs occurrence,兩側字串保持。不把一次換全部同名symbol當一步;找不到就保先前partial witnesses並停止。

步驟識別與依賴

規則:cfg_each_transition_first_position_then_original_production · 依賴:G001, S011

S013 · implies

操作前

ORIGINAL actual forms=[[S4], [a4, A4], [a4, b4, A4], [a4, b4, b4, A4], [a4, b4, b4, b4, A4], [a4, b4, b4, b4, b4, A4], [a4, b4, b4, b4, b4]];accepted prior witnesses=[[0, 0, S4, [a4, A4]], [1, 1, A4, [b4, A4]], [2, 1, A4, [b4, A4]], [3, 1, A4, [b4, A4]], [4, 1, A4, [b4, A4]], [5, 2, A4, []]]

操作後

valid_derivation=是;this is separate from whether the actual final form contains only terminals

條件:無

合法性核完整從start的鏈;錯誤處後面出現terminal字串不能修補前面的錯誤。零步[start]可以合法,但通常尚非terminal word。

步驟識別與依賴

規則:cfg_partial_trace_validity_not_final_terminal_flag · 依賴:G001, S012

S014 · implies

操作前

ORIGINAL actual final form=[a4, b4, b4, b4, b4];terminals=[a4, b4]

操作後

final_form_terminal_only=是;valid_derivation remains=是

條件:無

末形式空字串時逐symbol條件vacuous True,但仍須另核整段推導;forms全空則沒有末形式而是False。

步驟識別與依賴

規則:cfg_final_terminal_only_audited_separately · 依賴:G001, S013

逐步反向核對

  • S014 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S013 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S012 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S011 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S010 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S009 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S008 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S007 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S006 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S005 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S004 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S003 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S002 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。
  • S001 · premise_and_result_audit — 回到原始資料與本步條件核對,不把單向推論誤稱等價。

結論

([[S4], [a4, A4], [a4, b4, A4], [a4, b4, b4, A4], [a4, b4, b4, b4, A4], [a4, b4, b4, b4, b4, A4], [a4, b4, b4, b4, b4]], [[0, 0, S4, [a4, A4]], [1, 1, A4, [b4, A4]], [2, 1, A4, [b4, A4]], [3, 1, A4, [b4, A4]], [4, 1, A4, [b4, A4]], [5, 2, A4, []]], 是, 是, finite_production_sequence)

依上列完整代值及條件核對得到原題答案;原題編號、格式與狀態保持不變。

本題覆核與來源綁定

覆核日期:2026-10-26

原題、答案、步驟表達式、數值 AST 與既有歷史保持原樣;原來的候選狀態屬於來源歷史,不覆寫為形式化證明。

來源雜湊與覆核憑證
  • input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
  • original question SHA-256: 0b8ea2f7f073a879f20e46d9a82c2ede71f6e376e2678f25691c87715aaf1a81
  • candidate record SHA-256: ce3a6f46cf7105aa3c7f919c8d6109ceeefac0dcbf350ba3d67be3c70b6cbede
  • semantic review receipt SHA-256: dd44555041dfbb6fe9936aa00b9a5f8c5982c2784ef61dd0cbd5d1a303a49c1a
  • question-first witness SHA-256: 9a6011263f6ac53b9a1fd57addf2f3e2f6088b54802c539f332d689480dc2d17
  • Lean: NOT_RUN · human review: NOT_PERFORMED
同源完整 JSON