# Question 21554: A Valid Start-to-Terminal Derivation Proves Word Membership

[Return to catalogue page 108](https://ocme.evemisslab.com/en/questions/page/108/)

[← Question derivation index](https://ocme.evemisslab.com/en/questions/) · [Original question batch](https://ocme.evemisslab.com/en/practice/batch-20261014-advance-20261109-r07-context-free-grammar-foundations/#q-20261014-advance-20261109-r07-context-free-grammar-0054)

This teaching derivation has second-context AI mathematical and bilingual semantic review, limited to the model and assumptions stated in this question. It has no human review or new Lean proof and does not promote the original question or MKO to Canonical truth.

R0042-21554 · q-20261014-advance-20261109-r07-context-free-grammar-0054



## Original question and givens

Use the complete finite grammar: nonterminals=[S3, A3], terminals=[a3, b3], start=S3, productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]] and allow_epsilon=true. Alphabets must be unique and disjoint, the start belongs to nonterminals, and each production [lhs,rhs] has exactly one nonterminal lhs and a finite legal-symbol rhs. Empty rhs is permitted only under the explicit epsilon convention. Keep original symbol and production order. Candidate word=[a3, b3, b3, b3], supplied forms=[[S3], [a3, A3], [a3, b3, A3], [a3, b3, b3, A3], [a3, b3, b3, b3, A3], [a3, b3, b3, b3]]. Give (word, step_witnesses, valid_derivation, terminal_word, membership_certificate, certificate).


- G001 — Use the complete finite grammar: nonterminals=[S3, A3], terminals=[a3, b3], start=S3, productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]] and allow_epsilon=true. Alphabets must be unique and disjoint, the start belongs to nonterminals, and each production [lhs,rhs] has exactly one nonterminal lhs and a finite legal-symbol rhs. Empty rhs is permitted only under the explicit epsilon convention. Keep original symbol and production order. Candidate word=[a3, b3, b3, b3], supplied forms=[[S3], [a3, A3], [a3, b3, A3], [a3, b3, b3, A3], [a3, b3, b3, b3, A3], [a3, b3, b3, b3]]. Give (word, step_witnesses, valid_derivation, terminal_word, membership_certificate, certificate).





## Definition and scope

Use the original question domain, assumptions and cited MKO definitions. This item has second-context mathematical and bilingual review, with the model, answer and every arithmetic step independently recomputed from the original parameters; the source question remains a candidate.


- [mko-context-free-grammar](https://ocme.evemisslab.com/en/mko/mko-context-free-grammar/)





## Step-by-step derivation

S001 · impliesBefore

source operation=cfg-membership-witness;original snapshot and mathematics retained

After

explicit ordered source output fields=[word, step_witnesses, valid_derivation, terminal_word, membership_certificate, certificate]

Conditions: none

Keep the original historical interface marker while listing ordered source fields without JavaScript.Tags are not additional evidence;fixed No markers retain their source claim scope.

Step identifiers and dependenciesRule: source_ordered_interface_explicit_without_javascript · Uses: G001





S002 · impliesBefore

ORIGINAL production index=0;lhs=S3,rhs=[a3, A3];N=[S3, A3],T=[a3, b3],allow_epsilon=Yes

After

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

Conditions: none

Each production has one nonterminal on the left.Check every right-hand symbol and the explicit epsilon convention.Duplicate production positions may exist;sorting them would change first-witness indices.

Step identifiers and dependenciesRule: cfg_each_original_production_single_nonterminal_legal_rhs · Uses: G001, S001





S003 · impliesBefore

ORIGINAL production index=1;lhs=A3,rhs=[b3, A3];N=[S3, A3],T=[a3, b3],allow_epsilon=Yes

After

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

Conditions: none

Each production has one nonterminal on the left.Check every right-hand symbol and the explicit epsilon convention.Duplicate production positions may exist;sorting them would change first-witness indices.

Step identifiers and dependenciesRule: cfg_each_original_production_single_nonterminal_legal_rhs · Uses: G001, S002





S004 · impliesBefore

ORIGINAL production index=2;lhs=A3,rhs=[];N=[S3, A3],T=[a3, b3],allow_epsilon=Yes

After

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

Conditions: none

Each production has one nonterminal on the left.Check every right-hand symbol and the explicit epsilon convention.Duplicate production positions may exist;sorting them would change first-witness indices.

Step identifiers and dependenciesRule: cfg_each_original_production_single_nonterminal_legal_rhs · Uses: G001, S003





S005 · impliesBefore

ORIGINAL unique disjoint N=[S3, A3],T=[a3, b3];start=S3;complete productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]];allow_epsilon=Yes

After

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

Conditions: none

Grammar qualification alone supplies no derivation for a word and no regularity or unambiguity claim.Retain both alphabet orders.

Step identifiers and dependenciesRule: cfg_qualified_alphabets_start_not_language_property · Uses: G001, S004





S006 · impliesBefore

ORIGINAL forms=[[S3], [a3, A3], [a3, b3, A3], [a3, b3, b3, A3], [a3, b3, b3, b3, A3], [a3, b3, b3, b3]];actual grammar start=S3

After

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

Conditions: none

A derivation must actually start at[start];a terminal final form alone is insufficient.Empty forms are not an epsilon derivation:epsilon is an actual empty-string form[] requiring a legal chain.

Step identifiers and dependenciesRule: cfg_derivation_actual_start_required · Uses: G001, S005





S007 · impliesBefore

ORIGINAL transition index=0;from=[S3];to=[a3, A3];original productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]]

After

FIRST matching [position,production_index,lhs,rhs]=[0, 0, S3, [a3, A3]];replace EXACTLY ONE occurrence,retaining both surrounding substrings

Conditions: none

Scan original positions and then original production indices for the first actual replacement.Replace one occurrence and preserve both surrounding strings,not every matching symbol.On failure retain prior partial witnesses and stop.

Step identifiers and dependenciesRule: cfg_each_transition_first_position_then_original_production · Uses: G001, S006





S008 · impliesBefore

ORIGINAL transition index=1;from=[a3, A3];to=[a3, b3, A3];original productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]]

After

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

Conditions: none

Scan original positions and then original production indices for the first actual replacement.Replace one occurrence and preserve both surrounding strings,not every matching symbol.On failure retain prior partial witnesses and stop.

Step identifiers and dependenciesRule: cfg_each_transition_first_position_then_original_production · Uses: G001, S007





S009 · impliesBefore

ORIGINAL transition index=2;from=[a3, b3, A3];to=[a3, b3, b3, A3];original productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]]

After

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

Conditions: none

Scan original positions and then original production indices for the first actual replacement.Replace one occurrence and preserve both surrounding strings,not every matching symbol.On failure retain prior partial witnesses and stop.

Step identifiers and dependenciesRule: cfg_each_transition_first_position_then_original_production · Uses: G001, S008





S010 · impliesBefore

ORIGINAL transition index=3;from=[a3, b3, b3, A3];to=[a3, b3, b3, b3, A3];original productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]]

After

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

Conditions: none

Scan original positions and then original production indices for the first actual replacement.Replace one occurrence and preserve both surrounding strings,not every matching symbol.On failure retain prior partial witnesses and stop.

Step identifiers and dependenciesRule: cfg_each_transition_first_position_then_original_production · Uses: G001, S009





S011 · impliesBefore

ORIGINAL transition index=4;from=[a3, b3, b3, b3, A3];to=[a3, b3, b3, b3];original productions=[[S3, [a3, A3]], [A3, [b3, A3]], [A3, []]]

After

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

Conditions: none

Scan original positions and then original production indices for the first actual replacement.Replace one occurrence and preserve both surrounding strings,not every matching symbol.On failure retain prior partial witnesses and stop.

Step identifiers and dependenciesRule: cfg_each_transition_first_position_then_original_production · Uses: G001, S010





S012 · impliesBefore

ORIGINAL actual forms=[[S3], [a3, A3], [a3, b3, A3], [a3, b3, b3, A3], [a3, b3, b3, b3, A3], [a3, b3, b3, b3]];accepted prior witnesses=[[0, 0, S3, [a3, A3]], [1, 1, A3, [b3, A3]], [2, 1, A3, [b3, A3]], [3, 1, A3, [b3, A3]], [4, 2, A3, []]]

After

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

Conditions: none

Validity concerns the complete start-to-form chain.A terminal string after a failed step cannot repair it.A zero-step[start] derivation can be valid without being a terminal word.

Step identifiers and dependenciesRule: cfg_partial_trace_validity_not_final_terminal_flag · Uses: G001, S011





S013 · impliesBefore

ORIGINAL word=[a3, b3, b3, b3];actual last form=[a3, b3, b3, b3];valid chain=Yes

After

terminal_word=Yes;last equals original word=Yes;membership certificate=Yes

Conditions: none

Membership requires a valid chain from the start,a terminal-only word and exact final equality.An epsilon witness must actually derive[];an empty language is not a language containing epsilon.

Step identifiers and dependenciesRule: cfg_membership_three_obligations_actual_terminal_target · Uses: G001, S012









## Reverse checks


- S013 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S012 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S011 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S010 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S009 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S008 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S007 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S006 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S005 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S004 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S003 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S002 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S001 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.





## Result

([a3, b3, b3, b3], [[0, 0, S3, [a3, A3]], [1, 1, A3, [b3, A3]], [2, 1, A3, [b3, A3]], [3, 1, A3, [b3, A3]], [4, 2, A3, []]], Yes, Yes, Yes, derivation_from_start_to_terminal_only_word_proves_membership)

The full substitutions and premise checks give the original answer; source identity,format and status are unchanged.





## This question review and source binding

Review date: 2026-10-26

Original questions, answers, step expressions, numeric ASTs and historical records are retained. Source candidate labels remain historical and are not overwritten as formal proof.

Source hashes and review receipts
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: 4cc427244bafa1bd8a93c75d3024e479a1a6211af4ae5d7db80becb87c5a0581
- candidate record SHA-256: 39197bfecb8d2b7a332e3dca5343e41285e0a483c28aea833838d8b9c6de3c2b
- semantic review receipt SHA-256: dd44555041dfbb6fe9936aa00b9a5f8c5982c2784ef61dd0cbd5d1a303a49c1a
- question-first witness SHA-256: 9a6011263f6ac53b9a1fd57addf2f3e2f6088b54802c539f332d689480dc2d17
- Lean: NOT_RUN · human review: NOT_PERFORMED

[Same-source full JSON](https://ocme.evemisslab.com/data/question-derivations/questions/q-20261014-advance-20261109-r07-context-free-grammar-0054.json)




