src/Doc/JEdit/JEdit.thy
author wenzelm
Sun, 29 Sep 2013 12:49:47 +0200
changeset 55119 f0ee92285221
parent 55118 1f4d6870b7b2
child 55174 ab77ec347220
permissions -rw-r--r--
tuned;
     1 (*:wrap=hard:maxLineLen=78:*)
     2 
     3 theory JEdit
     4 imports Base
     5 begin
     6 
     7 chapter {* Introduction *}
     8 
     9 section {* Concepts and terminology *}
    10 
    11 text {* FIXME
    12 
    13 parallel proof checking \cite{Wenzel:2009} \cite{Wenzel:2013:ITP}
    14 
    15 asynchronous user interaction \cite{Wenzel:2010},
    16 \cite{Wenzel:2012:UITP-EPTCS}
    17 
    18 document-oriented proof processing and Prover IDE \cite{Wenzel:2011:CICM}
    19 \cite{Wenzel:2012}
    20 
    21 \begin{description}
    22 
    23 \item [PIDE] is a general framework for Prover IDEs based on the
    24 Isabelle/Scala. It is built around a concept of \emph{asynchronous document
    25 processing}, which is supported natively by the \emph{parallel proof engine}
    26 that is implemented in Isabelle/ML.
    27 
    28 \item [jEdit] is a sophisticated text editor \url{http://www.jedit.org}
    29 implemented in Java. It is easily extensible by plugins written in any
    30 language that works on the JVM, e.g.\ Scala.
    31 
    32 \item [Isabelle/jEdit] is the main example application of the PIDE framework
    33 and the default user-interface for Isabelle. It is targeted at beginners and
    34 experts alike.
    35 
    36 \end{description}
    37 *}
    38 
    39 
    40 section {* The Isabelle/jEdit Prover IDE *}
    41 
    42 text {*
    43   \includegraphics[width=\textwidth]{isabelle-jedit}
    44 
    45   Isabelle/jEdit consists of some plugins for the well-known jEdit text
    46   editor \url{http://www.jedit.org}, according to the following
    47   principles.
    48 
    49   \begin{itemize}
    50 
    51   \item The original jEdit look-and-feel is generally preserved, although
    52   some default properties have been changed to accommodate Isabelle (e.g.\
    53   the text area font).
    54 
    55   \item Formal Isabelle/Isar text is checked asynchronously while editing.
    56   The user is in full command of the editor, and the prover refrains from
    57   locking portions of the buffer.
    58 
    59   \item Prover feedback works via colors, boxes, squiggly underline,
    60   hyperlinks, popup windows, icons, clickable output, all based on semantic
    61   markup produced by Isabelle in the background.
    62 
    63   \item Using the mouse together with the modifier key @{verbatim CONTROL}
    64   (Linux, Windows) or @{verbatim COMMAND} (Mac OS X) exposes additional
    65   formal content via tooltips and/or hyperlinks.
    66 
    67   \item Dockable panels (e.g. \emph{Output}, \emph{Symbols}) are managed as
    68   independent windows by jEdit, which also allows multiple instances.
    69 
    70   \item Formal output (in popups etc.) may be explored recursively, using
    71   the same techniques as in the editor source buffer.
    72 
    73   \item The prover process and source files are managed on the editor side.
    74   The prover operates on timeless and stateless document content via
    75   Isabelle/Scala.
    76 
    77   \item Plugin options of jEdit (for the \emph{Isabelle} plugin) give access
    78   to a selection of Isabelle/Scala options and its persistence preferences,
    79   usually with immediate effect on the prover back-end or editor front-end.
    80 
    81   \item The logic image of the prover session may be specified within
    82   Isabelle/jEdit, but this requires restart. The new image is provided
    83   automatically by the Isabelle build process.
    84 
    85   \end{itemize}
    86 *}
    87 
    88 
    89 chapter {* Prover IDE functionality *}
    90 
    91 section {* Isabelle symbols and fonts *}
    92 
    93 text {*
    94   Isabelle supports infinitely many symbols:
    95 
    96   \medskip
    97   \begin{tabular}{l}
    98     @{text "\<alpha>"}, @{text "\<beta>"}, @{text "\<gamma>"}, @{text "\<dots>"} \\
    99     @{text "\<forall>"}, @{text "\<exists>"}, @{text "\<or>"}, @{text "\<and>"}, @{text "\<longrightarrow>"}, @{text "\<longleftrightarrow>"}, @{text "\<dots>"} \\
   100     @{text "\<le>"}, @{text "\<ge>"}, @{text "\<sqinter>"}, @{text "\<squnion>"}, @{text "\<dots>"} \\
   101     @{text "\<aleph>"}, @{text "\<triangle>"}, @{text "\<nabla>"}, @{text "\<dots>"} \\
   102     @{verbatim "\<foo>"}, @{verbatim "\<bar>"}, @{verbatim "\<baz>"}, @{text "\<dots>"} \\
   103   \end{tabular}
   104   \medskip
   105 
   106   A default mapping relates some Isabelle symbols to Unicode points (see
   107   @{file "$ISABELLE_HOME/etc/symbols"} and @{verbatim
   108   "$ISABELLE_HOME_USER/etc/symbols"}.
   109 
   110   The \emph{IsabelleText} font ensures that Unicode points are actually seen
   111   on the screen (or printer).
   112 
   113   \medskip
   114   Input methods:
   115   \begin{enumerate}
   116   \item use the \emph{Symbols} dockable window
   117   \item copy/paste from decoded source files
   118   \item copy/paste from prover output
   119   \item completion provided by Isabelle plugin, e.g.\
   120 
   121   \medskip
   122   \begin{tabular}{lll}
   123     \textbf{symbol} & \textbf{abbreviation} & \textbf{backslash escape} \\[1ex]
   124 
   125     @{text "\<lambda>"}   & @{verbatim "%"}     &  @{verbatim "\\lambda"}         \\
   126     @{text "\<Rightarrow>"}  & @{verbatim "=>"}    &  @{verbatim "\\Rightarrow"}     \\
   127     @{text "\<Longrightarrow>"} & @{verbatim "==>"}   &  @{verbatim "\\Longrightarrow"} \\
   128 
   129     @{text "\<And>"}  & @{verbatim "!!"}    &  @{verbatim "\\And"}            \\
   130     @{text "\<equiv>"}  & @{verbatim "=="}    &  @{verbatim "\\equiv"}          \\
   131 
   132     @{text "\<forall>"}   & @{verbatim "!"}     &  @{verbatim "\\forall"}         \\
   133     @{text "\<exists>"}   & @{verbatim "?"}     &  @{verbatim "\\exists"}         \\
   134     @{text "\<longrightarrow>"} & @{verbatim "-->"}   &  @{verbatim "\\longrightarrow"} \\
   135     @{text "\<and>"}   & @{verbatim "&"}     &  @{verbatim "\\and"}            \\
   136     @{text "\<or>"}   & @{verbatim "|"}     &  @{verbatim "\\or"}             \\
   137     @{text "\<not>"}   & @{verbatim "~"}     &  @{verbatim "\\not"}            \\
   138     @{text "\<noteq>"}   & @{verbatim "~="}    &  @{verbatim "\\noteq"}          \\
   139     @{text "\<in>"}   & @{verbatim ":"}     &  @{verbatim "\\in"}             \\
   140     @{text "\<notin>"}   & @{verbatim "~:"}    &  @{verbatim "\\notin"}          \\
   141   \end{tabular}
   142 
   143   \end{enumerate}
   144 
   145   \paragraph{Notes:}
   146   \begin{itemize}
   147 
   148   \item The above abbreviations refer to the input method. The logical
   149   notation provides ASCII alternatives that often coincide, but deviate
   150   occasionally.
   151 
   152   \item Generic jEdit abbreviations or plugins perform similar source
   153   replacement operations; this works for Isabelle as long as the Unicode
   154   sequences coincide with the symbol mapping.
   155 
   156   \item Raw Unicode characters within prover source files should be
   157   restricted to informal parts, e.g.\ to write text in non-latin alphabets.
   158   Mathematical symbols should be defined via the official rendering tables.
   159 
   160   \end{itemize}
   161 
   162   \paragraph{Control symbols.} There are some special control symbols to
   163   modify the style of a \emph{single} symbol (without nesting). Control
   164   symbols may be applied to a region of selected text, either using the
   165   \emph{Symbols} dockable window or keyboard shortcuts.
   166 
   167   \medskip
   168   \begin{tabular}{lll}
   169     \textbf{symbol}      & style       & keyboard shortcure \\
   170     @{verbatim "\<sup>"} & superscript & @{verbatim "C+e UP"} \\
   171     @{verbatim "\<sub>"} & subscript   & @{verbatim "C+e DOWN"} \\
   172     @{verbatim "\<bold>"} & bold face  & @{verbatim "C+e RIGHT"} \\
   173                           & reset      & @{verbatim "C+e LEFT"} \\
   174   \end{tabular}
   175 *}
   176 
   177 
   178 section {* Text completion *}
   179 
   180 text {*
   181   Text completion works via some light-weight GUI popup, which is triggered by
   182   keyboard events during the normal editing process in the main jEdit text
   183   area and a few additional text fields. The popup interprets special keys:
   184   @{verbatim TAB}, @{verbatim ESCAPE}, @{verbatim UP}, @{verbatim DOWN},
   185   @{verbatim PAGE_UP}, @{verbatim PAGE_DOWN}. All other key events are passed
   186   to the jEdit text area --- this allows to ignore unwanted completions most
   187   of the time and continue typing quickly.
   188 
   189   Various Isabelle plugin options control the popup behavior and immediate
   190   insertion into buffer.
   191 
   192   Isabelle Symbols are completed in backslashed forms, e.g. @{verbatim
   193   "\\"}@{verbatim "forall"} or @{verbatim "\<forall>"} that both produce the Isabelle
   194   symbol @{text "\<forall>"} in its Unicode rendering. Alternatively, symbol
   195   abbreviations may be used as specified in @{file
   196   "$ISABELLE_HOME/etc/symbols"}.
   197 
   198   \emph{Explicit completion} works via standard jEdit shortcut @{verbatim
   199   "C+b"}, which is remapped to action @{verbatim "isabelle.complete"}, with a
   200   fall-back on regular @{verbatim "complete-word"} for non-Isabelle buffers.
   201 
   202   \emph{Implicit completion} works via keyboard input on text area, with popup
   203   or immediate insertion into buffer. Plain words require at least 3
   204   characters to be completed.
   205 
   206   \emph{Immediate completion} means the (unique) replacement text is inserted
   207   into the buffer without popup. This mode ignores plain words and requires
   208   more than one characters for symbol abbreviations. Otherwise it falls back
   209   on completion popup.
   210 *}
   211 
   212 
   213 chapter {* Known problems and workarounds *}
   214 
   215 text {*
   216   \begin{itemize}
   217 
   218   \item \textbf{Problem:} Keyboard shortcuts @{verbatim "C+PLUS"} and
   219   @{verbatim "C+MINUS"} for adjusting the editor font size depend on
   220   platform details and national keyboards.
   221 
   222   \textbf{Workaround:} Use numeric keypad or rebind keys in the
   223   jEdit Shortcuts options dialog.
   224 
   225   \item \textbf{Problem:} Lack of dependency management for auxiliary files
   226   that contribute to a theory (e.g.\ @{command ML_file}).
   227 
   228   \textbf{Workaround:} Re-load files manually within the prover.
   229 
   230   \item \textbf{Problem:} Odd behavior of some diagnostic commands with
   231   global side-effects, like writing a physical file.
   232 
   233   \textbf{Workaround:} Avoid such commands.
   234 
   235   \item \textbf{Problem:} No way to delete document nodes from the overall
   236   collection of theories.
   237 
   238   \textbf{Workaround:} Restart whole Isabelle/jEdit session in worst-case
   239   situation.
   240 
   241   \item \textbf{Problem:} Linux: some desktop environments with extreme
   242   animation effects may disrupt Java 7 window placement and/or keyboard
   243   focus.
   244 
   245   \textbf{Workaround:} Disable such effects.
   246 
   247   \item \textbf{Problem:} Linux: some X11 window managers that are not
   248   ``re-parenting'' cause problems with additional windows opened by the Java
   249   VM. This affects either historic or neo-minimalistic window managers like
   250   ``@{verbatim awesome}'' or ``@{verbatim xmonad}''.
   251 
   252   \textbf{Workaround:} Use regular re-parenting window manager.
   253 
   254   \item \textbf{Problem:} The Mac OS X keyboard shortcut @{verbatim
   255   "COMMAND+COMMA"} for Preferences is in conflict with the jEdit default
   256   binding for @{verbatim "quick-search"}.
   257 
   258   \textbf{Workaround:} Remap in jEdit manually according to national
   259   keyboard, e.g.\ @{verbatim "COMMAND+SLASH"} on English ones.
   260 
   261   \item \textbf{Problem:} Mac OS X: Java 7 is officially supported on Lion
   262   and Mountain Lion, but not Snow Leopard. It usually works on the latter,
   263   although with a small risk of instabilities.
   264 
   265   \textbf{Workaround:} Update to OS X Mountain Lion, or later.
   266 
   267   \end{itemize}
   268 *}
   269 
   270 end