<p>Rules in a grammar and inference rules in logic can both be thought of as production rules which gives us "new stuff" from "known stuff". Just as there may be many ways to produce (or parse) a word with respect to a grammar, so may there be many ways to produce (or prove) a logical formula. This analogy can be drawn further. For example, certain logical systems admit normal forms of proofs. Likewise, certain grammars admit canonical parse trees.</p>

<p>So I'd say your examples from logic are going in the wrong direction. The correct analogy is</p>

<blockquote>
  <p>"parse tree" : "word" = "proof" : "logical formula"</p>
</blockquote>

<p>In fact, a sufficiently general kind of grammar will be able to express typical inference rules of logic, so that the grammatically correct words will be precisely the provable formulas. In this case the parse trees will actually <em>be</em> the proofs.</p>

<p>In the opposite direction, if we are willing to think of very general inference rules (which do not necessarily have a traditional logical flavor), then every grammar will be expressible as a system of axioms (terminals) and inference rules (productions). And once again we will see that a proof is the same thing as a parse tree.</p>

CC BY-SA 2.5
2011-03-31T14:46:49.277Z
I did not really thought about proofs. I am more used to (finite) model theory. We care about figuring out which sets are models of a formula, and which set are not. (Especially, for a formula, what is the complexity of finding if a set is a model or not, and for provable formula, hence tautologies, the complexity is O(1) since every sets are models). But thank you a lot for your answer.
Arthur MILCHIOR
CC BY-SA 2.5
2011-03-31T21:43:12.477Z
Well, to add analogy: model theory is to logic what semantics is to languages. Model theory assigns meaning to logical theories, while semantics assigns meaning to languages. Sometimes it is best not to mix apples and oranges, even if you're used to it.
Andrej Bauer
CC BY-SA 2.5
2011-03-31T11:22:33.773Z
2011-03-31T11:22:33.773Z
Andrej Bauer
<p>Just two remarks. I hope they help. </p>

<p>The standard definitions of semantics of a logic and of truth follow Tarski's presentation, proceeding by induction on formula structure. Another possibility is to give game-based semantics as suggested by Hintikka. Truth and satisfiability are all defined in terms of strategies in a game. For first order formulae, one can prove that a formula is true under Tarski's notion if and only if there exists a winning strategy in the Hintikka game.</p>

<p>Towards formalising your question, one can ask if the game admits multiple strategies. There is also the interesting question about whether the strategies should be deterministic. Hintikka required them to be deterministic. The proof that Hintikka's original and Tarski's  semantics are equivalent requires the Axiom of Choice. One can also formalise truth in terms of games with non-deterministic strategies with fewer complications.</p>

<p>Your language theory example brought to mind determinism, simulation relations and language acceptance. A simulation relation between automata implies language inclusion between their languages though the converse is not true. For deterministic automata the two notions coincide. One can ask if it is possible to extend simulation relations in a 'smooth' manner to capture language equivalence for non-deterministic automata. Kousha Etessami has a really nice paper showing how to do this using k-simulations (<a href="http://homepages.inf.ed.ac.uk/kousha/final_concur2002.ps" rel="nofollow">A Hierarchy of Polynomial-Time Computable Simulations for Automata</a>). Intuitively, the 'k' reflects the degree of non-determinism the simulation relation can capture. When 'k' equals the level of non-determinism in the automaton, simulation and language equivalence coincide. That paper also gives a logical characterisation of k-simulations in terms of polyadic modal logic and a bounded variable fragment of first-order logic. You get language inclusion, determinism, games, modal logic and first order logic, all in one  bumper package. </p>

CC BY-SA 2.5
2011-03-31T01:32:08.433Z
2011-03-31T01:32:08.433Z
Vijay D
<p>This started as a comment under Andrej Bauer's answer, but it got too big.</p>

<p>I think an obvious definition of ambiguity from a Finite Model Theory point of view would be:
$ambiguous(\phi) \implies \exists M_1,M_2  |  M_1 \vDash \phi \wedge M_2 \vDash \phi \wedge M_1 \vDash \psi \wedge M_2 \nvDash \psi$</p>

<p>In words, there exist distinct models of your grammar encoded as a formula $\phi$ that can be distinguished by some formula $\psi$, perhaps a sub-formula of $\phi$.</p>

<p>You can connect this to Andrej's response about proofs through Descriptive Complexity. 
 The combination of the existence of an encoding of a particular model plus its acceptance by an appropriate TM as a model of a given formula IS a proof that the axioms and inferences (and hence an equivalent grammar) encoded in that formula are consistent. </p>

<p>To make this fully compatible with Andrej's answer, you would have to say that the model is "generated" by the formula acting as a filter on the space of all possible finite models (or something like that), with the encoding and action of filtering on the input model as the "proof".  The distinct proofs then witness the ambiguity.</p>

<p>This may not be a popular sentiment, but I tend to think of finite model theory and proof theory as the same thing seen from different angles. ;-)</p>

CC BY-SA 2.5
2011-03-31T21:18:10.140Z
"Of your grammar encoded a formula $\phi$", I beg your pardon, I do not understand. Do you mean "as a formula". As far as I can tell, you can always distinguish two different finite models.
Arthur MILCHIOR
CC BY-SA 2.5
2011-04-01T01:04:55.047Z
Yes, that should have been "as a formula".  I've fixed it.  As for distinguishing finite models, the other situation is that there is only one accepted finite model for your language (possibly up to some notion of isomorphism).  That is the opposite of ambiguity.
Marc Hamann
CC BY-SA 2.5
2011-04-01T18:10:58.673Z
I guess that would indeed be "ambiguity". I just did not thought about it like this. Mostly because as far as language are concerned this would not really be interesting. But from a logical point-of-vue if makes sens
Arthur MILCHIOR
CC BY-SA 2.5
2011-04-01T19:06:48.557Z
I'm not sure that the language part has to be be boring. I have more ideas about this, but I think it would takes us beyond the scope of this forum. ;-)
Marc Hamann
CC BY-SA 2.5
2011-03-31T19:13:28.413Z
2011-04-01T01:04:15.327Z
2011-04-01T01:04:15.327Z
Marc Hamann
<p>I (also) agree with Anrej.</p>

<p>I think descriptive complexity is a <em>computation-less</em> characterization (which makes it interesting in its own way) and therefore the computational ambiguity examples from formal languages theory (automata/grammars/...) that you gave look to be in a quite different domain. 
In descriptive complexity languages correspond to complexity classes and queries (in a language) correspond to computational problems (not algorithms). There is no intended way of checking/computing a query AFAIK, so if you are not looking for computational ambiguity IMHO those examples are misleading.</p>

CC BY-SA 2.5
2011-04-01T14:56:38.820Z
Kaveh, I'm not sure that I agree that the computation-less  characterization of descriptive complexity is 100% right.  The computational details are very important to understanding how a particular logic captures a complexity class.  The advantage is that, once you have done your proofs and understand how it works, you can set the computation aside, and focus on the logical details using standard logical methods.
Marc Hamann
CC BY-SA 2.5
2011-04-01T18:09:07.413Z
Same remark à Mark. Descriptive complexity is also known as database theory, a vocabulary beeing a structure of a database, and the models of the theory beeing the content of the database. Hence it's happy that we can compute and figure out if a database respect a formula.
Arthur MILCHIOR
CC BY-SA 2.5
2011-04-01T20:35:05.477Z
@Marc, but there is no intended way of computation, it is a purely *descriptive* characterization. Of course you can connect it to algorithms (and their computations) in other settings, but that is secondary to its nature. As I said, complexity classes (e.g. $\mathbf{AC^0}$) correspond to descriptive languages (e.g. $\mathbf{FO}$), computational problems correspond to queries, but AFAIK there is not anything corresponding to algorithms or computations in descriptive complexity (which is not surprising considering it is also part of model theory).
Kaveh
CC BY-SA 2.5
2011-04-01T21:05:02.587Z
@Kaveh, I'm making a slightly subtle point, but one that I think is important, since it seems to be frequently misunderstood (for example by failed P=NP? attempts). There _is_ an underlying, fairly brute-force algorithm that underlies the correspondence of a logical language and a complexity class.  Working with the logic allows you not to have to think about the details of this algorithm every second, but the beauty and genius of the proofs by Fagin, Immerman, Vardi and others lies exactly in describing these algorithms.  People who lose sight of them completely generally end up in trouble.
Marc Hamann
CC BY-SA 2.5
2011-04-01T21:15:05.127Z
@Marc, I am in full agreement with your comment, but I still hold my original position that the algorithms/computations are secondary to the nature of descriptive complexity. The results that you refer to are not brute-force algorithms, they are quite intelligent. The fact that there are nice descriptive (no algorithms/computation) characterization of many complexity classes is really amazing for me. :)
Kaveh
CC BY-SA 2.5
2011-04-01T22:32:36.663Z
@Kaveh, I think we understand each other, and share our respect for the field.  "Brute-force" was not intended as a slight on the underlying algorithms, just making clear that we are talking about something slightly more abstract than what someone who does, say, algorithmic optimization work might think of as an algorithm.
Marc Hamann
CC BY-SA 2.5
2011-04-01T01:48:49.423Z
2011-04-01T01:48:49.423Z
Kaveh
<p>Not sure about the question applied to CS, but try searching for the term Vagueness and logic. In philosophy of logic, ambiguity is usually made distinct from vagueness (see <a href="http://plato.stanford.edu/entries/vagueness/#2" rel="nofollow">here</a> for instance), and I think what you are after is vagueness (as vagueness is defined as terms where there are borderline cases). The major book in this area is Timothy Williamson's Vagueness (but also see the bibliography on the Stanford site above).</p>

CC BY-SA 2.5
2011-03-31T21:12:17.023Z
Thank you for your answer. But as you tell, I do not really see relation with computer science. Especially, an universe is or is not a model of a formula, there are not really any vagueness here.  Instead, over automata, ambiguity is something that is well-defined, and there are known algorithm to decide if an automaton is abiguous, k-ambiguous or unambiguous. (only over some kind of automaton)
Arthur MILCHIOR
CC BY-SA 2.5
2011-04-02T04:05:42.047Z
You are quite right, I probably shouldn't have jumped in on this question and stuck to lurking. I'm only a noob at CS (about to finish my undergrad in logic/philosophy of science and pure math). Thanks for the information though.
DanielC
CC BY-SA 2.5
2011-03-31T02:32:52.687Z
2011-03-31T02:32:52.687Z
DanielC
<p>In automata theory (finite automata, pushdown automata, ...) and in complexity, there is a notion of "ambiguity". An automaton is ambiguous if there is a word $w$ with at least two distinct accepting runs. A machine is $k$-ambiguous if for every word $w$ accepted by the machine there are at most $k$ distinct runs to accept $w$.</p>

<p>This notion is also defined over context-free grammars: a grammar is ambiguous if there exists a word that can be derived in two different ways.</p>

<p>It is also known that many languages have a nice logical characterization over finite models. (If a language $L$ is regular, there exists a monadic second-order formula $\phi$ over words such that every word $w$ of $L$ is a model of $\phi$, similarly NP if equivalent to the Second order formulae where every 2nd order quantifiers are existential.)</p>

<p>Hence, my question is at the edges of the two domains: is there any result, or even a canonical definition, of "ambiguity" of formulae of a given logic?</p>

<p>I can imagine a few definitions:  </p>

<ul>
<li>$\exists x \phi(x)$ is non ambiguous if there exists at most one $x$ such that $\phi(x)$ holds and that $\phi(x)$ is non-ambiguous.  </li>
<li>$\phi_0\lor\phi_1$ would be ambiguous if there exists a model of both $\phi_0$ and $\phi_1$, or if $\phi_i$ is ambiguous.  </li>
<li>A SAT formula would be non-ambiguous iff there is at most one correct assignation.</li>
</ul>

<p>Hence, I wonder if it is a well-known notion, else it may be interesting to try to do research on this topic. If the notion is known, could anyone give me keywords I could use to search for information on the matter (because "logic ambiguity" gives a lot of unrelated results), or a book/pdf/article  references?</p>

<lo.logic><automata-theory><regular-language><nondeterminism><finite-model-theory>
Ambiguity and Logic
Arthur MILCHIOR
# Ambiguity and Logic

(Asked by: username_0 on 2011-03-30)

In automata theory (finite automata, pushdown automata, ...) and in complexity, there is a notion of "ambiguity". An automaton is ambiguous if there is a word $w$ with at least two distinct accepting runs. A machine is $k$-ambiguous if for every word $w$ accepted by the machine there are at most $k$ distinct runs to accept $w$.

This notion is also defined over context-free grammars: a grammar is ambiguous if there exists a word that can be derived in two different ways.

It is also known that many languages have a nice logical characterization over finite models. (If a language $L$ is regular, there exists a monadic second-order formula $\phi$ over words such that every word $w$ of $L$ is a model of $\phi$, similarly NP if equivalent to the Second order formulae where every 2nd order quantifiers are existential.)

Hence, my question is at the edges of the two domains: is there any result, or even a canonical definition, of "ambiguity" of formulae of a given logic?

I can imagine a few definitions:

* $\exists x \phi(x)$ is non ambiguous if there exists at most one $x$ such that $\phi(x)$ holds and that $\phi(x)$ is non-ambiguous.
* $\phi\_0\lor\phi\_1$ would be ambiguous if there exists a model of both $\phi\_0$ and $\phi\_1$, or if $\phi\_i$ is ambiguous.
* A SAT formula would be non-ambiguous iff there is at most one correct assignation.

Hence, I wonder if it is a well-known notion, else it may be interesting to try to do research on this topic. If the notion is known, could anyone give me keywords I could use to search for information on the matter (because "logic ambiguity" gives a lot of unrelated results), or a book/pdf/article references?

**Tags:** lo.logic, automata-theory, regular-language, nondeterminism, finite-model-theory

---

## 5 answers

### Answer by username_1 on 2011-03-31. Score: 11

Rules in a grammar and inference rules in logic can both be thought of as production rules which gives us "new stuff" from "known stuff". Just as there may be many ways to produce (or parse) a word with respect to a grammar, so may there be many ways to produce (or prove) a logical formula. This analogy can be drawn further. For example, certain logical systems admit normal forms of proofs. Likewise, certain grammars admit canonical parse trees.

So I'd say your examples from logic are going in the wrong direction. The correct analogy is

> "parse tree" : "word" = "proof" : "logical formula"

In fact, a sufficiently general kind of grammar will be able to express typical inference rules of logic, so that the grammatically correct words will be precisely the provable formulas. In this case the parse trees will actually *be* the proofs.

In the opposite direction, if we are willing to think of very general inference rules (which do not necessarily have a traditional logical flavor), then every grammar will be expressible as a system of axioms (terminals) and inference rules (productions). And once again we will see that a proof is the same thing as a parse tree.

> **Comments:**
> **username_0**: I did not really thought about proofs. I am more used to (finite) model theory. We care about figuring out which sets are models of a formula, and which set are not. (Especially, for a formula, what is the complexity of finding if a set is a model or not, and for provable formula, hence tautologies, the complexity is O(1) since every sets are models). But thank you a lot for your answer.  
> **username_1**: Well, to add analogy: model theory is to logic what semantics is to languages. Model theory assigns meaning to logical theories, while semantics assigns meaning to languages. Sometimes it is best not to mix apples and oranges, even if you're used to it.  

---

### Answer by username_2 on 2011-03-31. Score: 7

Just two remarks. I hope they help.

The standard definitions of semantics of a logic and of truth follow Tarski's presentation, proceeding by induction on formula structure. Another possibility is to give game-based semantics as suggested by Hintikka. Truth and satisfiability are all defined in terms of strategies in a game. For first order formulae, one can prove that a formula is true under Tarski's notion if and only if there exists a winning strategy in the Hintikka game.

Towards formalising your question, one can ask if the game admits multiple strategies. There is also the interesting question about whether the strategies should be deterministic. Hintikka required them to be deterministic. The proof that Hintikka's original and Tarski's semantics are equivalent requires the Axiom of Choice. One can also formalise truth in terms of games with non-deterministic strategies with fewer complications.

Your language theory example brought to mind determinism, simulation relations and language acceptance. A simulation relation between automata implies language inclusion between their languages though the converse is not true. For deterministic automata the two notions coincide. One can ask if it is possible to extend simulation relations in a 'smooth' manner to capture language equivalence for non-deterministic automata. Kousha Etessami has a really nice paper showing how to do this using k-simulations ([A Hierarchy of Polynomial-Time Computable Simulations for Automata](http://homepages.inf.ed.ac.uk/kousha/final_concur2002.ps)). Intuitively, the 'k' reflects the degree of non-determinism the simulation relation can capture. When 'k' equals the level of non-determinism in the automaton, simulation and language equivalence coincide. That paper also gives a logical characterisation of k-simulations in terms of polyadic modal logic and a bounded variable fragment of first-order logic. You get language inclusion, determinism, games, modal logic and first order logic, all in one bumper package.


---

### Answer by username_3 on 2011-03-31. Score: 4

This started as a comment under Andrej Bauer's answer, but it got too big.

I think an obvious definition of ambiguity from a Finite Model Theory point of view would be:
$ambiguous(\phi) \implies \exists M\_1,M\_2 | M\_1 \vDash \phi \wedge M\_2 \vDash \phi \wedge M\_1 \vDash \psi \wedge M\_2 \nvDash \psi$

In words, there exist distinct models of your grammar encoded as a formula $\phi$ that can be distinguished by some formula $\psi$, perhaps a sub-formula of $\phi$.

You can connect this to Andrej's response about proofs through Descriptive Complexity.
The combination of the existence of an encoding of a particular model plus its acceptance by an appropriate TM as a model of a given formula IS a proof that the axioms and inferences (and hence an equivalent grammar) encoded in that formula are consistent.

To make this fully compatible with Andrej's answer, you would have to say that the model is "generated" by the formula acting as a filter on the space of all possible finite models (or something like that), with the encoding and action of filtering on the input model as the "proof". The distinct proofs then witness the ambiguity.

This may not be a popular sentiment, but I tend to think of finite model theory and proof theory as the same thing seen from different angles. ;-)

> **Comments:**
> **username_0**: "Of your grammar encoded a formula $\phi$", I beg your pardon, I do not understand. Do you mean "as a formula". As far as I can tell, you can always distinguish two different finite models.  
> **username_3**: Yes, that should have been "as a formula".  I've fixed it.  As for distinguishing finite models, the other situation is that there is only one accepted finite model for your language (possibly up to some notion of isomorphism).  That is the opposite of ambiguity.  
> **username_0**: I guess that would indeed be "ambiguity". I just did not thought about it like this. Mostly because as far as language are concerned this would not really be interesting. But from a logical point-of-vue if makes sens  
> **username_3**: I'm not sure that the language part has to be be boring. I have more ideas about this, but I think it would takes us beyond the scope of this forum. ;-)  

---

### Answer by username_4 on 2011-04-01. Score: 0

I (also) agree with Anrej.

I think descriptive complexity is a *computation-less* characterization (which makes it interesting in its own way) and therefore the computational ambiguity examples from formal languages theory (automata/grammars/...) that you gave look to be in a quite different domain.
In descriptive complexity languages correspond to complexity classes and queries (in a language) correspond to computational problems (not algorithms). There is no intended way of checking/computing a query AFAIK, so if you are not looking for computational ambiguity IMHO those examples are misleading.

> **Comments:**
> **username_3**: Kaveh, I'm not sure that I agree that the computation-less  characterization of descriptive complexity is 100% right.  The computational details are very important to understanding how a particular logic captures a complexity class.  The advantage is that, once you have done your proofs and understand how it works, you can set the computation aside, and focus on the logical details using standard logical methods.  
> **username_0**: Same remark à Mark. Descriptive complexity is also known as database theory, a vocabulary beeing a structure of a database, and the models of the theory beeing the content of the database. Hence it's happy that we can compute and figure out if a database respect a formula.  
> **username_4**: @Marc, but there is no intended way of computation, it is a purely *descriptive* characterization. Of course you can connect it to algorithms (and their computations) in other settings, but that is secondary to its nature. As I said, complexity classes (e.g. $\mathbf{AC^0}$) correspond to descriptive languages (e.g. $\mathbf{FO}$), computational problems correspond to queries, but AFAIK there is not anything corresponding to algorithms or computations in descriptive complexity (which is not surprising considering it is also part of model theory).  
> **username_3**: @Kaveh, I'm making a slightly subtle point, but one that I think is important, since it seems to be frequently misunderstood (for example by failed P=NP? attempts). There _is_ an underlying, fairly brute-force algorithm that underlies the correspondence of a logical language and a complexity class.  Working with the logic allows you not to have to think about the details of this algorithm every second, but the beauty and genius of the proofs by Fagin, Immerman, Vardi and others lies exactly in describing these algorithms.  People who lose sight of them completely generally end up in trouble.  
> **username_4**: @Marc, I am in full agreement with your comment, but I still hold my original position that the algorithms/computations are secondary to the nature of descriptive complexity. The results that you refer to are not brute-force algorithms, they are quite intelligent. The fact that there are nice descriptive (no algorithms/computation) characterization of many complexity classes is really amazing for me. :)  
> **username_3**: @Kaveh, I think we understand each other, and share our respect for the field.  "Brute-force" was not intended as a slight on the underlying algorithms, just making clear that we are talking about something slightly more abstract than what someone who does, say, algorithmic optimization work might think of as an algorithm.  

---

### Answer by username_5 on 2011-03-31. Score: 0

Not sure about the question applied to CS, but try searching for the term Vagueness and logic. In philosophy of logic, ambiguity is usually made distinct from vagueness (see [here](http://plato.stanford.edu/entries/vagueness/#2) for instance), and I think what you are after is vagueness (as vagueness is defined as terms where there are borderline cases). The major book in this area is Timothy Williamson's Vagueness (but also see the bibliography on the Stanford site above).

> **Comments:**
> **username_0**: Thank you for your answer. But as you tell, I do not really see relation with computer science. Especially, an universe is or is not a model of a formula, there are not really any vagueness here.  Instead, over automata, ambiguity is something that is well-defined, and there are known algorithm to decide if an automaton is abiguous, k-ambiguous or unambiguous. (only over some kind of automaton)  
> **username_5**: You are quite right, I probably shouldn't have jumped in on this question and stuck to lurking. I'm only a noob at CS (about to finish my undergrad in logic/philosophy of science and pure math). Thanks for the information though.  

---

