Formal definition of â$Rightarrow$â relation (derivation relation) for context-free grammars
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
This is probably more of a logic question.
I'm looking for formal definition of derivation relation for context-free grammars (CFGs). The books on subject tend to define derivation relation for CFGs in two ways (here I'm using "$rightarrow$" for material implication, "$mapsto$" for production relation and "$Rightarrow$" for derivation relation):
- Let G(V, T, P, S) be a CFG, then:
$$forall alpha (forall beta (forall gamma (forall A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V rightarrow quad ([A mapsto gamma] in P rightarrow [alpha A beta Rightarrow alpha gamma beta]) quad )))) $$ - Let G(V, T, P, S) be a CFG, then:
$$forall eta (forall phi(eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (exists alpha (exists beta (exists gamma (exists A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V quad land [A mapsto gamma] in P land eta=alpha A beta landphi=alpha gamma beta))))) quad ))$$
The second definition is from Wikipedia (written in more cumbersome notation).Then there is a definition of reflexive transitive closure of =>:
Let G(V, T, P, S) be a CFG, then
- $forall alpha(alpha in (V cup T)^* rightarrow [alpha Rightarrow ^* alpha] )$
- $forall alpha(forall beta( forall gamma ( alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* rightarrow quad ([alpha Rightarrow ^* beta] land [beta Rightarrow gamma] rightarrow [alpha Rightarrow ^* gamma]) quad )))$
Now, in proofs regarding CFGs (for example, proof that if there is a derivation tree in G for $w$, then $S Rightarrow ^* w$) we use the following theorem:
Let G(V, T, P, S) be a CFG, then
$$forall eta (forall phi ( eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (forall alpha (forall beta (alpha in (V cup T)^* land beta in (V cup T)^* rightarrow [alpha eta beta Rightarrow alpha phi beta])) ) quad ))$$
This theorem, as I understand it, describes the essence of "context-freeness": if we can derive one string from another, then we can perform such derivation in any surrounding context.
Now, to prove this last theorem, both definitions of => relation are used. I've tried to derive one definition from another, but failed.
The question is: are these two definitions equivalent, or the correct definition is actually a conjunction of these two?
Remark:
I've tried using mace4 to find counterexample and succeeded. Here are the definitions I used:
formulas(assumptions).
% string axioms
exists x (symbol(x)).
string(e).
all x (symbol(x) -> string(x)).
all x (all y (string(x) & string(y) -> string(x + y))).
all x (string(x) -> x = x).
all x (string(x) -> x = x + e).
all x (string(x) -> x = e + x).
all x (
all y (
string(x) & string(y) -> (
x = y -> (
exists s (
exists w (
symbol(s) & string(w) & x = s + w & y = s + w
)
)
)
)
)
).
end_of_list.
formulas(assumptions).
exists s ( exists w (symbol(s) & string(w) & production(s, w))).
all x (
all y (
string(x) & string(y) & derivation(x, y) -> (
exists s (
exists w (
exists a (
exists b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) & x = (a + s) + b & y = (a + w) + b
)
)
)
)
)
)
).
end_of_list.
formulas(goals).
all s (
all w (
all a (
all b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) -> (
derivation((a + s) + b, (a + w) + b)
)
)
)
)
).
end_of_list.
Thank you for your time.
logic predicate-logic context-free-grammar
add a comment |Â
up vote
1
down vote
favorite
This is probably more of a logic question.
I'm looking for formal definition of derivation relation for context-free grammars (CFGs). The books on subject tend to define derivation relation for CFGs in two ways (here I'm using "$rightarrow$" for material implication, "$mapsto$" for production relation and "$Rightarrow$" for derivation relation):
- Let G(V, T, P, S) be a CFG, then:
$$forall alpha (forall beta (forall gamma (forall A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V rightarrow quad ([A mapsto gamma] in P rightarrow [alpha A beta Rightarrow alpha gamma beta]) quad )))) $$ - Let G(V, T, P, S) be a CFG, then:
$$forall eta (forall phi(eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (exists alpha (exists beta (exists gamma (exists A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V quad land [A mapsto gamma] in P land eta=alpha A beta landphi=alpha gamma beta))))) quad ))$$
The second definition is from Wikipedia (written in more cumbersome notation).Then there is a definition of reflexive transitive closure of =>:
Let G(V, T, P, S) be a CFG, then
- $forall alpha(alpha in (V cup T)^* rightarrow [alpha Rightarrow ^* alpha] )$
- $forall alpha(forall beta( forall gamma ( alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* rightarrow quad ([alpha Rightarrow ^* beta] land [beta Rightarrow gamma] rightarrow [alpha Rightarrow ^* gamma]) quad )))$
Now, in proofs regarding CFGs (for example, proof that if there is a derivation tree in G for $w$, then $S Rightarrow ^* w$) we use the following theorem:
Let G(V, T, P, S) be a CFG, then
$$forall eta (forall phi ( eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (forall alpha (forall beta (alpha in (V cup T)^* land beta in (V cup T)^* rightarrow [alpha eta beta Rightarrow alpha phi beta])) ) quad ))$$
This theorem, as I understand it, describes the essence of "context-freeness": if we can derive one string from another, then we can perform such derivation in any surrounding context.
Now, to prove this last theorem, both definitions of => relation are used. I've tried to derive one definition from another, but failed.
The question is: are these two definitions equivalent, or the correct definition is actually a conjunction of these two?
Remark:
I've tried using mace4 to find counterexample and succeeded. Here are the definitions I used:
formulas(assumptions).
% string axioms
exists x (symbol(x)).
string(e).
all x (symbol(x) -> string(x)).
all x (all y (string(x) & string(y) -> string(x + y))).
all x (string(x) -> x = x).
all x (string(x) -> x = x + e).
all x (string(x) -> x = e + x).
all x (
all y (
string(x) & string(y) -> (
x = y -> (
exists s (
exists w (
symbol(s) & string(w) & x = s + w & y = s + w
)
)
)
)
)
).
end_of_list.
formulas(assumptions).
exists s ( exists w (symbol(s) & string(w) & production(s, w))).
all x (
all y (
string(x) & string(y) & derivation(x, y) -> (
exists s (
exists w (
exists a (
exists b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) & x = (a + s) + b & y = (a + w) + b
)
)
)
)
)
)
).
end_of_list.
formulas(goals).
all s (
all w (
all a (
all b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) -> (
derivation((a + s) + b, (a + w) + b)
)
)
)
)
).
end_of_list.
Thank you for your time.
logic predicate-logic context-free-grammar
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This is probably more of a logic question.
I'm looking for formal definition of derivation relation for context-free grammars (CFGs). The books on subject tend to define derivation relation for CFGs in two ways (here I'm using "$rightarrow$" for material implication, "$mapsto$" for production relation and "$Rightarrow$" for derivation relation):
- Let G(V, T, P, S) be a CFG, then:
$$forall alpha (forall beta (forall gamma (forall A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V rightarrow quad ([A mapsto gamma] in P rightarrow [alpha A beta Rightarrow alpha gamma beta]) quad )))) $$ - Let G(V, T, P, S) be a CFG, then:
$$forall eta (forall phi(eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (exists alpha (exists beta (exists gamma (exists A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V quad land [A mapsto gamma] in P land eta=alpha A beta landphi=alpha gamma beta))))) quad ))$$
The second definition is from Wikipedia (written in more cumbersome notation).Then there is a definition of reflexive transitive closure of =>:
Let G(V, T, P, S) be a CFG, then
- $forall alpha(alpha in (V cup T)^* rightarrow [alpha Rightarrow ^* alpha] )$
- $forall alpha(forall beta( forall gamma ( alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* rightarrow quad ([alpha Rightarrow ^* beta] land [beta Rightarrow gamma] rightarrow [alpha Rightarrow ^* gamma]) quad )))$
Now, in proofs regarding CFGs (for example, proof that if there is a derivation tree in G for $w$, then $S Rightarrow ^* w$) we use the following theorem:
Let G(V, T, P, S) be a CFG, then
$$forall eta (forall phi ( eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (forall alpha (forall beta (alpha in (V cup T)^* land beta in (V cup T)^* rightarrow [alpha eta beta Rightarrow alpha phi beta])) ) quad ))$$
This theorem, as I understand it, describes the essence of "context-freeness": if we can derive one string from another, then we can perform such derivation in any surrounding context.
Now, to prove this last theorem, both definitions of => relation are used. I've tried to derive one definition from another, but failed.
The question is: are these two definitions equivalent, or the correct definition is actually a conjunction of these two?
Remark:
I've tried using mace4 to find counterexample and succeeded. Here are the definitions I used:
formulas(assumptions).
% string axioms
exists x (symbol(x)).
string(e).
all x (symbol(x) -> string(x)).
all x (all y (string(x) & string(y) -> string(x + y))).
all x (string(x) -> x = x).
all x (string(x) -> x = x + e).
all x (string(x) -> x = e + x).
all x (
all y (
string(x) & string(y) -> (
x = y -> (
exists s (
exists w (
symbol(s) & string(w) & x = s + w & y = s + w
)
)
)
)
)
).
end_of_list.
formulas(assumptions).
exists s ( exists w (symbol(s) & string(w) & production(s, w))).
all x (
all y (
string(x) & string(y) & derivation(x, y) -> (
exists s (
exists w (
exists a (
exists b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) & x = (a + s) + b & y = (a + w) + b
)
)
)
)
)
)
).
end_of_list.
formulas(goals).
all s (
all w (
all a (
all b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) -> (
derivation((a + s) + b, (a + w) + b)
)
)
)
)
).
end_of_list.
Thank you for your time.
logic predicate-logic context-free-grammar
This is probably more of a logic question.
I'm looking for formal definition of derivation relation for context-free grammars (CFGs). The books on subject tend to define derivation relation for CFGs in two ways (here I'm using "$rightarrow$" for material implication, "$mapsto$" for production relation and "$Rightarrow$" for derivation relation):
- Let G(V, T, P, S) be a CFG, then:
$$forall alpha (forall beta (forall gamma (forall A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V rightarrow quad ([A mapsto gamma] in P rightarrow [alpha A beta Rightarrow alpha gamma beta]) quad )))) $$ - Let G(V, T, P, S) be a CFG, then:
$$forall eta (forall phi(eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (exists alpha (exists beta (exists gamma (exists A (alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* land A in V quad land [A mapsto gamma] in P land eta=alpha A beta landphi=alpha gamma beta))))) quad ))$$
The second definition is from Wikipedia (written in more cumbersome notation).Then there is a definition of reflexive transitive closure of =>:
Let G(V, T, P, S) be a CFG, then
- $forall alpha(alpha in (V cup T)^* rightarrow [alpha Rightarrow ^* alpha] )$
- $forall alpha(forall beta( forall gamma ( alpha in (V cup T)^* land beta in (V cup T)^* land gamma in (V cup T)^* rightarrow quad ([alpha Rightarrow ^* beta] land [beta Rightarrow gamma] rightarrow [alpha Rightarrow ^* gamma]) quad )))$
Now, in proofs regarding CFGs (for example, proof that if there is a derivation tree in G for $w$, then $S Rightarrow ^* w$) we use the following theorem:
Let G(V, T, P, S) be a CFG, then
$$forall eta (forall phi ( eta in (V cup T)^* land phi in (V cup T)^* land [eta Rightarrow phi] rightarrow quad (forall alpha (forall beta (alpha in (V cup T)^* land beta in (V cup T)^* rightarrow [alpha eta beta Rightarrow alpha phi beta])) ) quad ))$$
This theorem, as I understand it, describes the essence of "context-freeness": if we can derive one string from another, then we can perform such derivation in any surrounding context.
Now, to prove this last theorem, both definitions of => relation are used. I've tried to derive one definition from another, but failed.
The question is: are these two definitions equivalent, or the correct definition is actually a conjunction of these two?
Remark:
I've tried using mace4 to find counterexample and succeeded. Here are the definitions I used:
formulas(assumptions).
% string axioms
exists x (symbol(x)).
string(e).
all x (symbol(x) -> string(x)).
all x (all y (string(x) & string(y) -> string(x + y))).
all x (string(x) -> x = x).
all x (string(x) -> x = x + e).
all x (string(x) -> x = e + x).
all x (
all y (
string(x) & string(y) -> (
x = y -> (
exists s (
exists w (
symbol(s) & string(w) & x = s + w & y = s + w
)
)
)
)
)
).
end_of_list.
formulas(assumptions).
exists s ( exists w (symbol(s) & string(w) & production(s, w))).
all x (
all y (
string(x) & string(y) & derivation(x, y) -> (
exists s (
exists w (
exists a (
exists b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) & x = (a + s) + b & y = (a + w) + b
)
)
)
)
)
)
).
end_of_list.
formulas(goals).
all s (
all w (
all a (
all b (
symbol(s) & string(w) & string(a) & string(b) & production(s, w) -> (
derivation((a + s) + b, (a + w) + b)
)
)
)
)
).
end_of_list.
Thank you for your time.
logic predicate-logic context-free-grammar
logic predicate-logic context-free-grammar
edited Sep 10 at 19:03
Mauro ALLEGRANZA
61.6k447106
61.6k447106
asked Sep 10 at 18:44
Everard
82
82
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52
add a comment |Â
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
It is like the relation between an inference rule and the derivation concept in math logic.
An inference rule, like e.g. modus ponens is a single elementary inferential step.
The derivability relation holds between a formula $varphi$ and a set of formulas $Gamma$ (in symbols : $Gamma vdash varphi$) iiff we have a "chain" of elementary inferential steps (i.e. applications of the rules of inference) starting from the formulas in $Gamma$ (the assumptions or axioms) and ending with $varphi$.
In the field of Context-free grammar we have production rules :
a single elementary "transformational" step that licenses the transformation (replacement) of string $alpha$ with string $beta$.
In this case, we say that $alpha$ directly yields $beta$; in symbols :
$alpha Rightarrow beta$ (or, according to you : $alpha ⦠beta$).
And we have the repetitive application of production rules : $alpha Rightarrow^* beta$, meaning that there is a chain of applications of production rules starting with $alpha$ and ending with $beta$.
Having said that, a formal definition must be inductive :
$alpha Rightarrow^* beta$ iff :
either (i) there is a production rule $R$ such that $(alpha, beta) in R$, i.e. $alpha Rightarrow beta$,
or (ii) there is a string $gamma$ and a production rule $R$ such that :
$alpha Rightarrow^* gamma$ and $gamma Rightarrow beta$.
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
It is like the relation between an inference rule and the derivation concept in math logic.
An inference rule, like e.g. modus ponens is a single elementary inferential step.
The derivability relation holds between a formula $varphi$ and a set of formulas $Gamma$ (in symbols : $Gamma vdash varphi$) iiff we have a "chain" of elementary inferential steps (i.e. applications of the rules of inference) starting from the formulas in $Gamma$ (the assumptions or axioms) and ending with $varphi$.
In the field of Context-free grammar we have production rules :
a single elementary "transformational" step that licenses the transformation (replacement) of string $alpha$ with string $beta$.
In this case, we say that $alpha$ directly yields $beta$; in symbols :
$alpha Rightarrow beta$ (or, according to you : $alpha ⦠beta$).
And we have the repetitive application of production rules : $alpha Rightarrow^* beta$, meaning that there is a chain of applications of production rules starting with $alpha$ and ending with $beta$.
Having said that, a formal definition must be inductive :
$alpha Rightarrow^* beta$ iff :
either (i) there is a production rule $R$ such that $(alpha, beta) in R$, i.e. $alpha Rightarrow beta$,
or (ii) there is a string $gamma$ and a production rule $R$ such that :
$alpha Rightarrow^* gamma$ and $gamma Rightarrow beta$.
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
add a comment |Â
up vote
0
down vote
accepted
It is like the relation between an inference rule and the derivation concept in math logic.
An inference rule, like e.g. modus ponens is a single elementary inferential step.
The derivability relation holds between a formula $varphi$ and a set of formulas $Gamma$ (in symbols : $Gamma vdash varphi$) iiff we have a "chain" of elementary inferential steps (i.e. applications of the rules of inference) starting from the formulas in $Gamma$ (the assumptions or axioms) and ending with $varphi$.
In the field of Context-free grammar we have production rules :
a single elementary "transformational" step that licenses the transformation (replacement) of string $alpha$ with string $beta$.
In this case, we say that $alpha$ directly yields $beta$; in symbols :
$alpha Rightarrow beta$ (or, according to you : $alpha ⦠beta$).
And we have the repetitive application of production rules : $alpha Rightarrow^* beta$, meaning that there is a chain of applications of production rules starting with $alpha$ and ending with $beta$.
Having said that, a formal definition must be inductive :
$alpha Rightarrow^* beta$ iff :
either (i) there is a production rule $R$ such that $(alpha, beta) in R$, i.e. $alpha Rightarrow beta$,
or (ii) there is a string $gamma$ and a production rule $R$ such that :
$alpha Rightarrow^* gamma$ and $gamma Rightarrow beta$.
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
It is like the relation between an inference rule and the derivation concept in math logic.
An inference rule, like e.g. modus ponens is a single elementary inferential step.
The derivability relation holds between a formula $varphi$ and a set of formulas $Gamma$ (in symbols : $Gamma vdash varphi$) iiff we have a "chain" of elementary inferential steps (i.e. applications of the rules of inference) starting from the formulas in $Gamma$ (the assumptions or axioms) and ending with $varphi$.
In the field of Context-free grammar we have production rules :
a single elementary "transformational" step that licenses the transformation (replacement) of string $alpha$ with string $beta$.
In this case, we say that $alpha$ directly yields $beta$; in symbols :
$alpha Rightarrow beta$ (or, according to you : $alpha ⦠beta$).
And we have the repetitive application of production rules : $alpha Rightarrow^* beta$, meaning that there is a chain of applications of production rules starting with $alpha$ and ending with $beta$.
Having said that, a formal definition must be inductive :
$alpha Rightarrow^* beta$ iff :
either (i) there is a production rule $R$ such that $(alpha, beta) in R$, i.e. $alpha Rightarrow beta$,
or (ii) there is a string $gamma$ and a production rule $R$ such that :
$alpha Rightarrow^* gamma$ and $gamma Rightarrow beta$.
It is like the relation between an inference rule and the derivation concept in math logic.
An inference rule, like e.g. modus ponens is a single elementary inferential step.
The derivability relation holds between a formula $varphi$ and a set of formulas $Gamma$ (in symbols : $Gamma vdash varphi$) iiff we have a "chain" of elementary inferential steps (i.e. applications of the rules of inference) starting from the formulas in $Gamma$ (the assumptions or axioms) and ending with $varphi$.
In the field of Context-free grammar we have production rules :
a single elementary "transformational" step that licenses the transformation (replacement) of string $alpha$ with string $beta$.
In this case, we say that $alpha$ directly yields $beta$; in symbols :
$alpha Rightarrow beta$ (or, according to you : $alpha ⦠beta$).
And we have the repetitive application of production rules : $alpha Rightarrow^* beta$, meaning that there is a chain of applications of production rules starting with $alpha$ and ending with $beta$.
Having said that, a formal definition must be inductive :
$alpha Rightarrow^* beta$ iff :
either (i) there is a production rule $R$ such that $(alpha, beta) in R$, i.e. $alpha Rightarrow beta$,
or (ii) there is a string $gamma$ and a production rule $R$ such that :
$alpha Rightarrow^* gamma$ and $gamma Rightarrow beta$.
edited Sep 10 at 19:07
answered Sep 10 at 18:56
Mauro ALLEGRANZA
61.6k447106
61.6k447106
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
add a comment |Â
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
I guess I've presented my question in the wrong form. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:45
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
If it is like modus ponens, then these two definitions have to be in conjuction: in one direction, if there is a production, then we can add any context and get derivation; in the other direction, if there is derivation, then there has to be a production. So both books and Wikipedia give incomplete definitions for derivation relation. Thank you.
â Everard
Sep 10 at 19:48
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2912217%2fformal-definition-of-rightarrow-relation-derivation-relation-for-context%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
It is generally the case in rewrite systems that $etarightsquigarrowphi$ implies $alphaetabetarightsquigarrowalphaphibeta$; that is not specific to context-free grammars. What is specific to "context free" is that the string on the left-hand-side of a primitive rewriting is a single symbol -- which means that the possible fates of a symbol you find in one of the intermediate strings depends only on the symbol itself, and not of which context you find that symbol in.
â Henning Makholm
Sep 10 at 19:05
For example, a grammar that is not context-free might contain rules such as $ABC ::= ADEC$ where a $B$ can turn to $DE$ but only if there's an $A$ to the left and a $C$ to the right. (Allowing such rules makes general grammars Turing-complete, so it is not decidable wheter a given grammar can generate a given string).
â Henning Makholm
Sep 10 at 19:05
I understand. What I'm trying to ask here is whether one definition follows from the other. The first definition basically says that if there is a production [A -> w], then for all a, b: [aAn => awb]. This definition is presented in "Introduction to Automata Theory, Languages, and Computation". But can one logically infer from such definition the following (which is the second definition): if for two strings w0, w1 relation holds ([w0 => w1]), then there have to be strings a, b and a production [A -> w], such that w0 = aAb and w1 = awb?
â Everard
Sep 10 at 19:33
OK, after contemplating a bit more, I decided that indeed both definitions should be in conjunction. Thank you!
â Everard
Sep 10 at 19:52