(* 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. *) 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 the end of row 25 and start of row 26. I recommend using StixGeneral for symbols. See http://olegueret.googlepages.com/stixfonts-ttf This is the default for the symbol font if you have it installed. *) (* 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. \ \ \ \ \ \ \ \ \ *) (* 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. *) term "a\<^bsub>longsub\<^esub>" term "b\<^bsup>longsuper\<^esup>" term "\<^bbold>Bold text \\\\ \ \\<^ebold>" term "\<^bitalic>Italic text \\\\ \\\<^eitalic>" term "\<^bsans>Sans serif text \\\\\\\<^esans>" term "\<^bscript>Script \\\\\\\<^escript>" term "\<^bfrakt>Frakt \\\\ \\\<^efrakt>" term "\<^bserif>Roman \\\\ \\\<^eserif>" (* 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 -> ... *) (* NB: below here cannot be processed: just in terms to check with string font for terms. *) term "a\<^sub>b" (* NB: here and below cannot be processed *) term "a\<^sup>b" term "a\<^isub>b" term "a\<^isup>b" term "\<^loc>a" term "\<^bold>b" term "\<^italic>b" (* 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 will produce wrong result for above: default token without variant is produced! *) (* More esoteric stuff *) term "\<^bbig>large text \ \ \\<^ebig>" term "\<^bsmall>small\<^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>" end