Inner syntax error when using `o` as a variable/function name
While playing around with Isabelle (version 2016-1), I encountered the following strange situation: I cannot use the letter o as a variable or function name in various (most/all?) contexts. The following examples all fail despite working for most (all?) other letters of the English alphabet: value o (* quoted version doesn't work either *) definition invert :: ‹bool ⇒ bool› where ‹invert o = (¬ o)› definition o :: ‹bool ⇒ bool› where ‹o a = (¬ a)› fun default_int :: ‹int option ⇒ int› where ‹default_int None = 0› | ‹default_int o = the o› fun default_int :: ‹int option ⇒ int› where ‹default_int None = 0› | ‹default_int (Some o) = o› fun o :: ‹int option ⇒ int› where ‹o None = 0› | ‹o (Some i) = i› I cannot seem to find any information documenting o being a reserved name, so is this a bug or is there some other usage of o that precludes it as a variable/function name? The error message for all cases is "Inner syntax error⌂ Failed to parse term", which is not very helpful other than noting that the error seems to be inner-syntax-related (the error messages for the third and last cases appear on the lines using o inside quotes rather than on the definition/fun lines, too).
o is the ASCII notation for the function composition operator ∘. You can see that the o is interpreted as syntax because it is printed in a kind of dark turquoise colour, whereas other identifiers are blue, black, green, or orange (depending on what they are precisely). You get the same thing with other pre-defined syntax like O, OO, powr, has_derivative, etc. You can disable that for your purposes using the command no_notation Fun.comp (infixl "o" 55) You should, however, only do this for experimentation; in production use, it would be considered bad to disable such a global pre-defined notation. I for one think that these days, these old ASCII notations are mostly unnecessary and, in case of o, actually harmful (e.g. how it confused you). I'll suggest removing this particular notation on the Isabelle mailing list.
Isabelle: linord proof
Outputting strings into a file from Isabelle/HOL
isabelle - Choose an arbitrary but fixed element
Associativity of word_cat from Word.thy
Isabelle - exI and refl behavior explanation needed
Well-definedness of function computing fixed point, in Isabelle
Isabelle - character and string literal support
Isabelle unification error
Isabelle auto prover works on lemma, hangs on special case of the lemma
CARD of typedef of 0 to 7 nat
Isabelle - Nitpick - using witness values automatically
Isabelle list lifter and compression
Isabelle - Nitpick counterexample usage
Isabelle failed to finish proof even though this is same as goal
What does depth refer to in Isar Virtual Machine output?