isabelle


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.

Related Links

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?
Isabelle/HOL foundations

Categories

HOME
vim
single-sign-on
google-play
raspberry-pi
google-docs
twitter-bootstrap-4
win32gui
indesign
windows-10-universal
vault
spring-kafka
correlation
jplayer
dynamics-crm-online
try-catch
windows-7-x64
normalizr
nodatime
cx-freeze
abi
vlsi
facet
strncpy
typo3-6.2.x
flink-streaming
nat
stormpath
functor
exuberant-ctags
oracle-fusion-middleware
catch-all
pim
wallpaper
hexo
catalog
android-ble
restlet
serve
hockeyapp
impersonation
jna
user-controls
optix
mapzen
google-closure
no-www
midl
node-sass
slick-3.0
multipeer-connectivity
jquery-nestable
paxos
return-value
sqlclient
color-profile
crosswalk-runtime
messenger
savon
measures
google-web-starter-kit
mathematica-frontend
nsviewcontroller
pagedlist
pickadate
captivenetwork
ptrace
vhd
lib.web.mvc
google-places
marching-cubes
django-unittest
pundit
browser-bugs
angular-local-storage
geonetwork
dia
offloading
knuth
android-imagebutton
asp.net-web-api-odata
xcode-6.2
neolane
openlaszlo
limejs
sublist
rdoc
word-processor
tridion-worldserver
buildr
imac
mongomapper
remember-me
photoshop-cs4
backcolor
privilege
premature-optimization

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App