Tell me more ×
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

An ambiguous Language is a formal language for which there exists a string that can have more than one meaning (several possible meanings or interpretations). Multiple synthesis structures for a string.

[Question]
Are Roman numbers an example of an ambiguous language?

Because there can be more then one representation for some number such as 1999, which can be written as MDCCCCLXXXXVIIII, MCMXCIX, or MIM.

I am confused. Sometimes I feel not, some time yes!

EDIT
[ANSWER]

Although there can be more than one representation of same magnitude in Roman Number System. That is basically Non-Positional Number System. But its possible to write Unambiguous Grammar for that can generate all possible/valid pattern in Roman Number System.

Here is again a beautiful link that describe symbol table, rule , Grammar for Roman number.

I am not sure about this but some authors says that: "Roman numbers can be recognized by a regular expression, so you don't really need a context-free grammar." and a regular language can't be ambiguous.

share|improve this question

migrated from cstheory.stackexchange.com Jan 5 at 7:47

4 Answers

A grammar (not a language!) is ambiguous if there is a word with two "essentially different" parses. Roman numerals are unambiguous - given a roman numeral, it has an unambiguous numerical value. The fact that this correspondence is not one-to-one is beside the point.

share|improve this answer
This is the way I think :) .. and it should be correct too! – Grijesh Chauhan Jan 5 at 8:38
6  
This assumes that you call strings such as IXM invalid, and not Roman numerals. (I have seen IIX = 8 used historically, as well as VIII = 8, but I am fairly sure nobody ever used IXM.) – Peter Shor Jan 5 at 13:38

You fell into the trap of thinking that formal language theory deals with meaning. It doesn't.

In formal language theory, a context-free language is ambiguous if some context-free grammar generates exactly that language, while none of them do so in such a way that each string in the language has only a single parse tree.

The language of Roman numerals isn't completely standard, but I believe all versions have the property of being finite: I don't think 5000 can be represented, let alone a million. Every finite language is unambiguous: it can be generated by a grammar that directly produces each member string from the start symbol.

(UPDATE: Peter Shor's comments make it clear that this wasn't the case: apparently it was quite common to surround numbers with C Ͻ or | | to multiply them by 1000. When this can be applied arbitrarily often, the language is no longer finite; when it can be done in arbitrary ways, it still doesn't become ambiguous when only C Ͻ is used; when | | is used, the interpretation may become ambiguous, but I still don't think the language becomes ambiguous in the formal, syntactic sense.)

share|improve this answer
5000 = (V) or MMMMM. – Peter Shor Jan 6 at 18:21
So what is 50000? – reinierpost Jan 7 at 19:08
(L), of course. Actually, the Romans would have written it more like ϹLϽ (with the two Ϲ's symmetric). Enclosing things in parentheses multiplies them by 1000. If you allow multiple parentheses (I'm not sure whether the Romans used this; it certainly seems to have been rare), you can get any number. – Peter Shor Jan 7 at 19:47
2  
The idea that the Romans, who successfully managed an empire with millions of people in it, couldn't count beyond 5000 is totally absurd. It does seem that the system for representing numbers above 5000 changed during the Roman empire, so the exact notation they used may have depended on the time period. It is also likely that there were times when two or more different notations were used. However, having two or three different notations for 1,000,000 (or do I mean 10^6?) should not cause a problem. – Peter Shor Jan 9 at 17:41
1  
It's possible to count much higher than one's notation for numbers reaches by mixing in names for numbers ("50 thousand") or units ("3 days, 17 hours, 4 minutes and 6 seconds"). – reinierpost Jan 10 at 18:12
show 1 more comment

The translation from Arabic numbers to Roman numbers is very straight forward and absolute not 'unambiguous'.

You can translate each Arabic digit to exact one Roman representation.

Arabic:    1    2    3    4    5    6    7    8    9
Roman:     I   II  III   IV    V   VI  VII VIII   IX

Arabic:   10   20   30   40   50   60   70   80   90
Roman:     X   XX  XXX   XL    L   LX  LXX LXXX   XC

Arabic:  100  200  300  400  500  600  700  800  900
Roman:     C   CC  CCC   CD    D   DC  DCC DCCC   CM

Arabic: 1000 2000 3000  
Roman:     M   MM  MMM 

Combine a number from the highest to the lowest digit.

E.g.
1999 is (with space) M CM XC IX and together MCMXCIX.

share|improve this answer
5  
This is indeed the modern formula, but it wasn't the only way the Romans did it. At some point, somebody decided that there should only be one Roman number for positive each integer, and come up with this system. MIM would have been perfectly acceptable to the Romans. – Peter Shor Jan 6 at 18:19
@petershor, can you cite some research that demonstrates this assertion? I don't disbelieve you, just want to know what has been done to discover this. – Nicholas Jan 24 at 11:11
Look in the lower right corner of this picture from the Arch of Augustus. You should see DCXXXIIX. And here is DCCCCXVII from this website. – Peter Shor Jan 24 at 11:58

Its not ambiguous.

Note that if you are writing a smaller digit before a larger one, obviously that means you are subtracting. But notice that those digits must be comparable. I would come before V and X only. X would come before L and C only. C before D and M.

Break the number and then combine their roman correspondents.

49 is 40+9. We dont write it as IL. We first convert 40, then 9 so its XLIX.

99 is not IC. Its 90 (XC) + 9 (IX) ie XCIX.

499 is not ID. Its 400 (CD) + 90 (XC) + 9 (IX) ie CDXCIX.

999 is not IM. Its 900 (CM) + 90 (XC) + 9 (IX) ie CMXCIX.

So, according to this

1999 should be MCMXCIX. 1000 (M) + 900 (CM) + 90 (XC) + 9 (IX).

And also MDCCCCLXXXXVIIII is an invalid representation. You can't have 4 consecutive same letters. Instead you convert it.

M*DCCCC*LXXXXVIIII $\rightarrow$ M*CM*LXXXXVIIII

MCM*LXXXX*VIIII $\rightarrow$ MCM*X*VIIII

MCMXC*VIIII* $\rightarrow$ MCMXC*IX*

This online conversion tool might be helpful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.