Talk:Unrestricted grammar

Latest comment: 1 year ago by Jochen Burghardt in topic Terminals only on left hand side not always allowed

Untitled edit

I believe the following is incorrect. Can someone confirm?

  is a set of production rules of the form   where   and   are in  

I say this because in this snippet:

If   appears at some position on the second tape, replace   by   at that point, possibly shifting the symbols on the tape left or right depending on the relative lengths of   and   (e.g. if   is longer than  , shift the tape symbols left).

... it looks like   and   are sequences, so not in  , but in the set of all finite sequences using letters from the alphabet   (I'm not sure the best way to notate this, maybe something from Sequence_space)

Pchiusano 02:49, 26 July 2006 (UTC)Reply

Yes, you're right; someone must have written without really thinking. Ruakh 13:10, 26 July 2006 (UTC)Reply

In the definition, I believe all the sets should be finite. I will change this soon unless I hear back otherwise. 129.15.139.171 (talk) 14:56, 27 March 2012 (UTC)Reply

Terminals only on left hand side not always allowed edit

@Jochen Burghardt:

  1. Could you please provide the section number for this cite? I can only access editions 2 and 3.
  2. Chomsky's Axiom 2 ("A∈VN if and only if there are φ,ψ,ω such that φAψ → φωψ"[1]: 141 ) excludes, among others, production rules of the form a→ω, where a is a non-terminal.

Paradoctor (talk) 00:42, 13 September 2018 (UTC)Reply

@Paradoctor: (User name inferred from history page)
  1. In the 1979 edition, chapter 9 (p.217-233) is named "The Chomsky hierarchy", its section 9.2 (p.220-223) is named "Unrestricted grammars", its section 9.3 (p.223-226) "Context-sensitive languages". It seems that in the later editions, these sections were omitted. The initial paragraph of section 9.2 reads:

    The largest family of grammars in the Chomsky hierarchy permits productions of the form  , where   and   are arbitrary strings of grammar symbols, with  . These grammars are known as semi-Thue, type 0, phrase structure or unrestricted grammars. We shall continue to use the 4-tuple notation   for unrestricted grammars. We say   whenever   is a production. As before,   stands for the reflexive and transitive closure of the relation   :  , exactly as for context-free grammars.

    After that, an example grammar for   follows; it actually uses only productions with nonterminals in the lhs. Then they construct in Thm. 9.3 a (nondeterministic) Turing machine for every unrestricted grammar, and in Thm. 9.4 an unrestricted grammar for every acceptor Turing machine. Again, the latter grammar has a nonterminal in each production's lhs. However, Thm 9.3 works also if no nonterminal is in a production's lhs. So, by applying Thm 9.3 and then 9.4, every unrestricted grammar can be transformed into a version having a nonterminal in each lhs.
  2. Maybe, Hopcroft/Ullman's definition deviates from Chomsky's original version in his 1959 paper cited by you. However, in that paper " " (also called "can be rewritten as") corresponds to " " in Hopcroft/Ullman's book, while the finite pair set (also called "rules") from Ax.4 corresponds to H/U's  . So it seems to me that in Ax.2 the "if" direction requires to stop further rewriting once all nonterminals have disappeared from the string (i.e. as long as there are nonterminals present in the string, terminal-only-lhs productions may well be applied to it). The "only if" direction seems to require that an applicable rule exists for every derivable string containing a nonterminal; e.g. the context-free grammar consisting of the single rule   wouldn't be admitted by that, whereas today we'd consider it as valid, and producing the empty language. This indicates to me that some details of Chomsky's initial definition are no longer in force today. Another example is  , contradicting Ax.1. - Jochen Burghardt (talk) 09:48, 13 September 2018 (UTC)Reply
(No need to ping, I'm watching) Sorry for the missing sig. Thanks for the quote. "Tbd"? Paradoctor (talk) 09:58, 13 September 2018 (UTC)Reply

You need one non-terminal on the left hand side, otherwise you get pathological cases where the union of two grammars produces more than the union of their languages. E.g. G1=(S1->a,b->c), G2=(S2->b), G = G1 + G2 = (S->S1,S->S2,S1->a,S2->b,b->c). Here we have L1={a}, L2={b}, but L={a,b,c}. The German Wikipedia got that right, see: https://de.wikipedia.org/w/index.php?title=Chomsky-Hierarchie&oldid=229255677#Typ-0-Grammatik_(allgemeine_Chomsky-Grammatik_oder_Phrasenstrukturgrammatik) Andreasabel (talk) 16:28, 22 February 2023 (UTC)Reply

I agree that the usual construction of a grammar for the union language wouldn't work any longer. However, other union constructions would still work, e.g. convert G1 and G2 to Turing machines, convert them back to grammars (with a nonterminal in every LHS), then apply your construction to them. - Jochen Burghardt (talk) 18:40, 22 February 2023 (UTC)Reply