(* Some acid tests for token modes in Isabelle David Aspinall, 2008-9. $Id$ Note: Unicode Tokens mode works much better in Emacs 23 than 22. jEdit properties :tabSize=8:indentSize=8:noTabs=false: *) theory TokensAcid imports Main begin (* Symbols. Here's a table of all the standardly defined tokens for symbols, produced by menu command Tokens -> List Tokens You should see glyphs in all positions except the whitespace tokens at positions 208, 262 and 263. I recommend using StixGeneral for symbols. See http://www.stixfonts.org/ To install on Ubuntu, try: sudo apt-get install fonts-stix Other good choices are: Lucida Grande, Lucida Sans Unicode, or DejaVuLGC Sans Mono. Unfortunately 1. \ \ \ \ \ \ \ \ \ \ 2. \ \ \ \ \ \ \ \ \ \ 3. \ \ \ \ \ \ \ \ \ \ 4. \ \ \ \ \ \ \ \ \ \ 5. \ \ \ \ \ \ \ \ \ \ 6. \ \ \ \ \ \ \ \ \ \ 7. \ \ \ \ \ \ \ \ \ \ 8. \ \ \ \ \ \ \ \ \ \ 9. \ \ \ \ \ \ \ \ \ \ 10. \ \ \ \ \ \ \ \ \ \ 11. \ \ \ \ \ \ \ \ \ \ 12. \ \ \ \ \ \ \ \ \ \
13. \ \ \ \ \ \ \ \ \ \ 14. \ \ \ \ \ \ \ \ \ \ 15. \ \ \ \ \ \ \ \ \ \ 16. \ \ \ \ \ \ \ \ \ \ 17. \ \ \ \ \ \ \ \ \ \ 18. \ \ \ \ \ \ \
\ \ \ 19. \ \ \ \ \ \ \ \ \ \ 20. \ \ \ \ \ \ \ \ \ \ 21. \ \ \ \ \ \ \ \ \ \ 22. \ \ \ \ \ \ \ \ \ \ 23. \ \ \ \ \ \ \ \ \ \ 24. \ \ \ \ \ \ \ \ \ \ 25. \ \ \ \ \ \ \ \ \ \ 26. \ \ \ \ \ \ \ \ \ \ 27. \ \ \ \ \ \ \ \ \ \ 28. \ \ \ \ \ \ \ \ \ \ 29. \ \ \ \ \ \ \ \ \ \ 30. \ \ \ \ \ \ \ \ \ \ 31. \ \ \ \ \ \ \ \ \ \ 32. \ \ \ \ \ \ \ \ \ \ 33. \ \ \ \ \ \ \

\ \ \ \ \ \ \ 37. \ \ \ \ \ \ \

\ \ \ 38. \ \ \ \ \ \ \ \ \ \ 39. \ \ \ \ \ \ \ \ \ \ 40. \ \ \
\ \ \ \ \ \ \ 41. \ \ \ \ \ \ \ \ \ \ 42. \ \ \ \ \ *) (* Tokens controlling layout and fonts: regions. Token region convention in Isabelle is \<^bFOO>... \<^eFOO> The \<^bserif>font\<^eserif> and \<^bbold>bold\<^ebold>/\<^bitalic>italic\<^eitalic> controls are non-standard and may not be supported by other interfaces. Convenience functions: Select a region, use Tokens -> Format Region -> Bold, etc Editing can be a bit fiddly, use C-c C-t C-t to show or hide the control tokens to help. *) (* Introduce uninterpreted term syntax using these features, to check behaviour in locked/unlocked regions. *) consts longsub :: "['a,'a]\'a" ("_\<^bsub>_\<^esub>") consts longsup :: "['a,'a]\'a" ("_\<^bsup>_\<^esup>") consts bold :: "'a\'a" ("\<^bbold>_\<^ebold>") consts italic :: "'a\'a" ("\<^bitalic>_\<^eitalic>") consts sans :: "'a\'a" ("\<^bsans>_\<^esans>") consts script :: "'a\'a" ("\<^bscript>_\<^escript>") consts frakt :: "'a\'a" ("\<^bfrakt>_\<^efrakt>") consts serif :: "'a\'a" ("\<^bserif>_\<^eserif>") term "a\<^bsub>longsub\<^esub>" term "b\<^bsup>longsuper\<^esup>" term "\<^bbold>Bold text\<^ebold>" term "\<^bitalic>Italic text \ \\<^eitalic>" term "\<^bsans>Sans \\<^esans>" term "\<^bscript>Script text\<^escript>" term "\<^bfrakt>Frakt stuff\<^efrakt>" term "\<^bserif>Roman stuff\<^eserif>" lemma "\ \<^bbold>(Bold text)\<^ebold>; Q \ \ Q" by auto (* Tokens controlling layout and fonts: next character. These are tokens that affect the following character/identifier only. Similar to previous case. See Tokens -> Format Char -> ... *) consts shortsub :: "['a,'a]\'a" ("_\<^sub>_") consts shortsup :: "['a,'a]\'a" ("_\<^sup>_") consts charloc :: "['a,'a]\'a" ("\<^loc>_") consts charbold :: "['a,'a]\'a" ("\<^bold>_") consts charitalic :: "['a,'a]\'a" ("\<^italic>_") term "a\<^sub>b" term "a\<^sup>b" term "\<^loc>a" term "\<^bold>b" term "\<^italic>b" (* Further examples *) term "a\<^isub>\\" (* subscripted gamma *) term "a\<^isub>def" (* no subscript on ef *) term "a\<^isub>x\<^isub>y" (* x and y subscripted individually *) term "a\<^isub>xabc\<^isub>y" (* x and y should be subscripted, but not ab *) (* Variants on token names: different token names, same appearance. Simulated overloading, \<^bitalic>much\<^eitalic> simpler to do this in the UI than mess with type classes, etc, in the logical framework! Demonstration: let's take back \ from the meta-level. NB: the token scheme mechanism here is a PG convenience, in other frontends you may have to define \ < AndX> to appear in the same way as \ < And> individually. Similarly for LaTeX output. Use C-c C-t C-z to toggle the display of tokens. *) consts andprops :: "bool set \ bool" andpreds :: "('a \ bool) set \ bool" notation (xsymbols) andprops ("\") and (* token , hover to see this *) andpreds ("\") (* token , hover to see this *) term "\ {True, False}" term "\ {\ x. True, \ y. False}" (* Note: of course, copy and paste using Unicode to another application (Tokens \ Copy As Unicode) and then re-reading in Isabelle using another interface will probably produce the wrong result. But copy-pasting within Proof General Emacs is fine since the underlying token text is copied, not the presentation. What happens is that the text properties are "sticky" and copied as well, so you see them even in non-Unicode Tokens buffers. But if you save and revisit, you'll see the real text. *) (* More esoteric non-standard stuff: unlikely in other interfaces *) consts shout :: "'a \ 'a" whisper :: "'a \ 'a" underline :: "'a \ 'a" overline :: "'a \ 'a" notation (xsymbols) shout ("\<^bbig>_\<^ebig>") and whisper ("\<^bsmall>_\<^esmall>") and underline ("\<^bunderline>_\<^eunderline>") and overline ("\<^boverline>_\<^eoverline>") term "\<^bbig>large text \ \ \ \\<^ebig>" term "\<^bsmall>smaller text ((\ \ \) \ \) \<^esmall>" term "\<^bunderline>underlined\<^eunderline>" term "\<^boverline>overlined\<^eoverline>" (* Bold and italic combinations for regions *) term "\<^bbold>Bold and (\<^bitalic>italic\<^eitalic>)\<^ebold>" term "\<^bitalic>Italic and \<^bbold>bold\<^ebold>\<^eitalic>" (* Font and weight/shape changes for regions *) term "\<^bbold>Bold and \<^bscript>script\<^escript>\<^ebold>" term "\<^bserif>Roman and \<^bitalic>italic\<^eitalic> and \<^bbold>bold\<^ebold> \<^eserif>" term "\<^bfrakt>Frakt and \<^bitalic>italic\<^eitalic> and \<^bbold>bold\<^ebold> \<^efrakt>" (* Spanning identifier supers/subs: not included in standard Isabelle lexer/latex *) (* term "a\<^bisup>bcd\<^eisup>" term "a\<^bisub>bcd\<^eisub>" *) end

\ \ \ 34. \ \ \ \ \ \ \ \ \ \ 35. \ \ \ \ \ \ \ \ \ \ 36. \ \ \