Find a CFG for $0^n|v| where |v| = n$

40 Views Asked by At

I am looking for a CFG of given language but I can not be sure about the correctness of my CFG.

Given language is $0^n|v|, |v|=n$

I find this CFG which I belive it solves it.

$S -> 0SX$

$X-> 0|1$

I tried some strings and my CFG works well but it seems too simple for this language so maybe I missed some part.

I have two questions. 1) Does my CFG is correct for a given language?

2) How can I prove the correctness of my CFG?