(* 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 positions 208, 262 and 263. 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. Other good choices are: Lucida Grande, Lucida Sans Unicode, or DejaVuLGC Sans Mono. 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]\'a" ("\<^bbold>_ _\<^ebold>") consts italic :: "['a,'a,'a,'a]\'a" ("\<^bitalic>_ _ _ _\<^eitalic>") consts sans :: "['a,'a]\'a" ("\<^bsans>_ _\<^esans>") consts script :: "['a,'a]\'a" ("\<^bscript>_ _\<^escript>") consts frakt :: "['a,'a]\'a" ("\<^bfrakt>_ _\<^efrakt>") consts serif :: "['a,'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 -> ... *) (* NB: below here cannot be processed: just in terms to check with string font for terms. *) 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 *) (* Spanning identifier supers/subs: to be added to Isabelle lexer/latex *) term "a\<^bisup>bcd\<^eisup>" term "a\<^bisub>bcd\<^eisub>" (* 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

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