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