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

Error message in Isabelle/HOL
What happens during function proofs
Inner syntax error when using `o` as a variable/function name
Constraining type variables in locales
Defining Primtive Recursion for multiplication in Isabelle
Is there a lemma like “∃x. a^x = b” proved in Isabelle?
Given a theorem “P(t) ⟶ (∃x . P(x))” with an object logic implication, why is the proof goal “P(t) ⟹ (∃x . P(x))” given with meta-logic implication?
Lists and simplification rules: More difficult when using # rather than #?
Isabelle's Simplifier: How does it choose which rules to apply? [Specific Example]
Proof by induction with three base cases (Isabelle)
Limit of c^n (with ¦c¦<1) is 0 (Isabelle)
Why won't the 'linordered_field_class.frac_le' rule work? (Isabelle)
Usage of “also have…finally have” in Isabelle
Free type variables in proof by induction
Very simple lemma in Isabelle
Definition of Prime in Isabelle

Categories

HOME
maven
ibm-bluemix
log4j
reflection
mediawiki
mockito
fme
cplex
rsyslog
getelementsbytagname
yarn
cakephp-2.5
ip
echarts
datastax-java-driver
constraint-programming
directx
autotools
iggrid
volttron
modelica
static-libraries
fallback
progressive-web-apps
beyondcompare
contextmenu
viewport
visjs
object-detection
clickonce
ehcache
excel-2007
mmap
format-specifiers
microsoft-r
h2db
internet-explorer-9
publish
gitignore
instant-messaging
javascriptcore
create-table
jspresso
catch-all
webtest
mozilla
jmonkeyengine
android-ble
appfabric
disassembling
serverside-rendering
sharefile
vapor
hue
azure-ml
ensembles
eclipse-scout
g-code
arena-simulation
turbogears
businessworks
qwt
alphabet
typescript1.8
git-diff
svmlight
drupal-6
carrot
diagnostics
query-performance
migradoc
word-vba-mac
wdf
url-masking
xml-attribute
qpid
firebaseui
jwplayer7
sigabrt
qgraphicsview
dlna
javax.sound.midi
wso2cloud
mono-embedding
createprocessasuser
vstest.console.exe
unity3d-gui
remobjects
pretty-print
device-orientation
bigbluebutton
android-radiobutton
braille
undefined-reference
typo3-neos
blending
odata4j
ruby-datamapper
ora-00911
shellexecute
gwt-rpc
angularjs-controller
sublist
mt
word-processor
venn-diagram
tridion-worldserver
ticoredatasync
postgresql-performance
semantic-diff
gnustep
gcj
mongomapper
subviews
wise
multi-tier
backcolor
avatar

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App