# HG changeset patch
# User krauss
# Date 1378836661 -7200
# Node ID c9d6f6285e1dd0d14f3dbb953d25e5d4bdec93fe
# Parent 437c0a63bb16cbe390b2e913b66dde64859a96e4# Parent fa5b34ffe4a400a674ac5d89b98cb3b9b1fdc7da
merged
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/Linux/Isabelle
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/Linux/Isabelle Tue Sep 10 20:11:01 2013 +0200
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# Main Isabelle application wrapper.
+
+if [ -L "$0" ]; then
+ TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+ exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
+fi
+
+
+## settings
+
+PRG="$(basename "$0")"
+
+ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; pwd)"
+source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
+
+
+## main
+
+declare -a JAVA_ARGS
+JAVA_ARGS=({JAVA_ARGS})
+
+exec "$ISABELLE_HOME/bin/isabelle" java "${JAVA_ARGS[@]}" \
+ -classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" isabelle.Main "$@"
+
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App1/build
--- a/Admin/MacOS/App1/build Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/MacOS/App1/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Make Isabelle application bundle
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App1/script
--- a/Admin/MacOS/App1/script Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/MacOS/App1/script Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Author: Makarius
#
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App2/mk
--- a/Admin/MacOS/App2/mk Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/MacOS/App2/mk Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Make Isabelle/JVM application bundle
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App3/Info.plist
--- a/Admin/MacOS/App3/Info.plist Tue Sep 10 20:09:53 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-
-
-
-CFBundleDevelopmentRegion
-English
-CFBundleExecutable
-JavaAppLauncher
-CFBundleIconFile
-isabelle.icns
-CFBundleIdentifier
-de.tum.in.isabelle
-CFBundleDisplayName
-{ISABELLE_NAME}
-CFBundleInfoDictionaryVersion
-6.0
-CFBundleName
-{ISABELLE_NAME}
-CFBundlePackageType
-APPL
-CFBundleShortVersionString
-1.0
-CFBundleSignature
-????
-CFBundleVersion
-1
-NSHumanReadableCopyright
-
-LSApplicationCategoryType
-public.app-category.developer-tools
-JVMRuntime
-jdk
-JVMMainClassName
-isabelle.Main
-JVMOptions
-
--Dapple.laf.useScreenMenuBar=true -Xms128m -Xmx1024m -Xss2m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false
--Disabelle.home=$APP_ROOT/Contents/Resources/{ISABELLE_NAME}
-
-JVMArguments
-
-
-
-
-
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App3/Info.plist-part1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/MacOS/App3/Info.plist-part1 Tue Sep 10 20:11:01 2013 +0200
@@ -0,0 +1,36 @@
+
+
+
+
+CFBundleDevelopmentRegion
+English
+CFBundleExecutable
+JavaAppLauncher
+CFBundleIconFile
+isabelle.icns
+CFBundleIdentifier
+de.tum.in.isabelle
+CFBundleDisplayName
+{ISABELLE_NAME}
+CFBundleInfoDictionaryVersion
+6.0
+CFBundleName
+{ISABELLE_NAME}
+CFBundlePackageType
+APPL
+CFBundleShortVersionString
+1.0
+CFBundleSignature
+????
+CFBundleVersion
+1
+NSHumanReadableCopyright
+
+LSApplicationCategoryType
+public.app-category.developer-tools
+JVMRuntime
+jdk
+JVMMainClassName
+isabelle.Main
+JVMOptions
+
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/MacOS/App3/Info.plist-part2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/MacOS/App3/Info.plist-part2 Tue Sep 10 20:11:01 2013 +0200
@@ -0,0 +1,7 @@
+-Disabelle.home=$APP_ROOT/Contents/Resources/{ISABELLE_NAME}
+
+JVMArguments
+
+
+
+
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/PIDE/convert
--- a/Admin/PIDE/convert Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/PIDE/convert Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
THIS="$(cd "$(dirname "$0")"; pwd)"
SUPER="$(cd "$THIS/.."; pwd)"
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/Windows/WinRun4J/Isabelle.ini
--- a/Admin/Windows/WinRun4J/Isabelle.ini Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/Windows/WinRun4J/Isabelle.ini Tue Sep 10 20:11:01 2013 +0200
@@ -7,13 +7,5 @@
classpath.6=lib\classes\ext\scala-reflect.jar
classpath.7=src\Tools\jEdit\dist\jedit.jar
vm.location=contrib\jdk\x86-cygwin\jre\bin\server\jvm.dll
-vmarg.1=-Dfile.encoding=UTF-8
-vmarg.2=-server
-vmarg.3=-Xms128m
-vmarg.4=-Xmx1024m
-vmarg.5=-Xss2m
-vmarg.6=-Dactors.corePoolSize=4
-vmarg.7=-Dactors.enableForkJoin=false
-vmarg.8=-Disabelle.home=%INI_DIR%
splash.image=lib\logo\isabelle.bmp
-
+vmarg.1=-Disabelle.home=%INI_DIR%
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/isatest/settings/at64-poly
--- a/Admin/isatest/settings/at64-poly Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/isatest/settings/at64-poly Tue Sep 10 20:11:01 2013 +0200
@@ -2,11 +2,11 @@
init_components /home/isabelle/contrib "$HOME/admin/components/main"
- POLYML_HOME="/home/polyml/polyml-5.4.1"
- ML_SYSTEM="polyml-5.4.1"
+ POLYML_HOME="/home/polyml/polyml-svn"
+ ML_SYSTEM="polyml-5.5.1"
ML_PLATFORM="x86_64-linux"
ML_HOME="$POLYML_HOME/$ML_PLATFORM"
- ML_OPTIONS="-H 1000"
+ ML_OPTIONS="-H 1000 --gcthreads 1"
ISABELLE_HOME_USER=~/isabelle-at64-poly
diff -r 437c0a63bb16 -r c9d6f6285e1d Admin/lib/Tools/makedist_bundle
--- a/Admin/lib/Tools/makedist_bundle Tue Sep 10 20:09:53 2013 +0200
+++ b/Admin/lib/Tools/makedist_bundle Tue Sep 10 20:11:01 2013 +0200
@@ -53,6 +53,8 @@
# bundled components
+init_component "$JEDIT_HOME"
+
mkdir -p "$ARCHIVE_DIR/contrib"
echo "#bundled components" >> "$ISABELLE_TARGET/etc/components"
@@ -121,19 +123,14 @@
}
-# platform-specific patches
+# platform-specific setup (inside archive)
case "$PLATFORM_FAMILY" in
linux)
purge_contrib '-name "x86*-darwin" -o -name "x86*-cygwin" -o -name "x86*-windows"'
- cat > "$ISABELLE_TARGET/$ISABELLE_NAME" < "$ISABELLE_TARGET/$ISABELLE_NAME"
chmod +x "$ISABELLE_TARGET/$ISABELLE_NAME"
;;
macos)
@@ -152,8 +149,19 @@
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \
"$ISABELLE_TARGET/src/Tools/jEdit/dist/properties/jEdit.props"
+ (
+ cat "$ISABELLE_HOME/Admin/Windows/WinRun4J/Isabelle.ini"
+ declare -a JAVA_ARGS=()
+ eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
+ A=2
+ for ARG in "${JAVA_ARGS[@]}"
+ do
+ echo -e "vmarg.$A=$ARG\r"
+ A=$[ $A + 1 ]
+ done
+ ) > "$ISABELLE_TARGET/${ISABELLE_NAME}.ini"
+
cp "$TMP/windows_app/Isabelle.exe" "$ISABELLE_TARGET/${ISABELLE_NAME}.exe"
- cp "$ISABELLE_HOME/Admin/Windows/WinRun4J/Isabelle.ini" "$ISABELLE_TARGET/${ISABELLE_NAME}.ini"
cp "$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Setup.bat" \
"$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Latex-Setup.bat" \
"$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Terminal.bat" "$ISABELLE_TARGET"
@@ -193,7 +201,7 @@
tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME" || exit 2
-# application
+# platform-specific setup (outside archive)
if [ "$ISABELLE_PLATFORM_FAMILY" = linux -a "$PLATFORM_FAMILY" != macos -o "$ISABELLE_PLATFORM_FAMILY" = macos ]
then
@@ -211,8 +219,19 @@
mkdir -p "$APP/Contents/$NAME"
done
- cat "$APP_TEMPLATE/Info.plist" | \
- perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;" > "$APP/Contents/Info.plist"
+ (
+ cat "$APP_TEMPLATE/Info.plist-part1"
+
+ declare -a OPTIONS=()
+ eval "OPTIONS=($ISABELLE_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
+ for OPT in "${OPTIONS[@]}"
+ do
+ echo "$OPT"
+ done
+ echo "-Dapple.awt.application.name={ISABELLE_NAME}"
+
+ cat "$APP_TEMPLATE/Info.plist-part2"
+ ) | perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;" > "$APP/Contents/Info.plist"
for NAME in Pure.jar scala-compiler.jar scala-library.jar scala-swing.jar scala-actors.jar scala-reflect.jar
do
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Classes/document/build
--- a/src/Doc/Classes/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Classes/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Codegen/document/build
--- a/src/Doc/Codegen/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Codegen/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Datatypes/Datatypes.thy
--- a/src/Doc/Datatypes/Datatypes.thy Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Datatypes/Datatypes.thy Tue Sep 10 20:11:01 2013 +0200
@@ -6,24 +6,8 @@
theory Datatypes
imports Setup
-keywords
- "primrec_new_notyet" :: thy_decl and
- "primcorec_notyet" :: thy_decl
begin
-(*<*)
-(* FIXME: Evil setup until "primrec_new" and "primcorec" are bug-free. *)
-ML_command {*
-fun add_dummy_cmd _ _ lthy = lthy;
-
-val _ = Outer_Syntax.local_theory @{command_spec "primrec_new_notyet"} ""
- (Parse.fixes -- Parse_Spec.where_alt_specs >> uncurry add_dummy_cmd);
-
-val _ = Outer_Syntax.local_theory @{command_spec "primcorec_notyet"} ""
- (Parse.fixes -- Parse_Spec.where_alt_specs >> uncurry add_dummy_cmd);
-*}
-(*>*)
-
section {* Introduction
\label{sec:introduction} *}
@@ -182,6 +166,7 @@
*}
+
section {* Defining Datatypes
\label{sec:defining-datatypes} *}
@@ -200,7 +185,7 @@
text {*
Datatypes are introduced by specifying the desired names and argument types for
-their constructors. \emph{Enumeration types} are the simplest form of datatype:
+their constructors. \emph{Enumeration} types are the simplest form of datatype.
All their constructors are nullary:
*}
@@ -208,7 +193,7 @@
text {*
\noindent
-All three constructors have the type @{typ trool}.
+Here, @{const Truue}, @{const Faalse}, and @{const Perhaaps} have the type @{typ trool}.
Polymorphic types are possible, such as the following option type, modeled after
its homologue from the @{theory Option} theory:
@@ -221,8 +206,8 @@
text {*
\noindent
-The constructors are @{term "None :: 'a option"} and
-@{term "Some :: 'a \ 'a option"}.
+The constructors are @{text "None :: 'a option"} and
+@{text "Some :: 'a \ 'a option"}.
The next example has three type parameters:
*}
@@ -232,7 +217,7 @@
text {*
\noindent
The constructor is
-@{term "Triple :: 'a \ 'b \ 'c \ ('a, 'b, 'c) triple"}.
+@{text "Triple :: 'a \ 'b \ 'c \ ('a, 'b, 'c) triple"}.
Unlike in Standard ML, curried constructors are supported. The uncurried variant
is also possible:
*}
@@ -243,7 +228,7 @@
subsubsection {* Simple Recursion *}
text {*
-simplest recursive type: copy of the natural numbers:
+Natural numbers are the simplest example of a recursive type:
*}
datatype_new nat = Zero | Suc nat
@@ -253,30 +238,41 @@
(*>*)
text {*
-lists were shown in the introduction; terminated lists are a variant:
+\noindent
+Lists were shown in the introduction. Terminated lists are a variant:
*}
+(*<*)
+ locale dummy_tlist
+ begin
+(*>*)
datatype_new ('a, 'b) tlist = TNil 'b | TCons 'a "('a, 'b) tlist"
+(*<*)
+ end
+(*>*)
text {*
-On the right-hand side of the equal sign, the usual Isabelle conventions apply:
-Nonatomic types must be enclosed in double quotes.
+\noindent
+Nonatomic types must be enclosed in double quotes on the right-hand side of the
+equal sign, as is customary in Isabelle.
*}
subsubsection {* Mutual Recursion *}
text {*
-Mutual recursion = Define several types simultaneously, referring to each other.
-
-Simple example: distinction between even and odd natural numbers:
+\emph{Mutually recursive} types are introduced simultaneously and may refer to each
+other. The example below introduces a pair of types for even and odd natural
+numbers:
*}
datatype_new enat = EZero | ESuc onat
and onat = OSuc enat
text {*
-More complex, and more realistic, example:
+\noindent
+Arithmetic expressions are defined via terms, terms via factors, and factors via
+expressions:
*}
datatype_new ('a, 'b) exp =
@@ -290,67 +286,81 @@
subsubsection {* Nested Recursion *}
text {*
-Nested recursion = Have recursion through a type constructor.
-
-The introduction showed some examples of trees with nesting through lists.
-
-More complex example, which reuses our option type:
+\emph{Nested recursion} occurs when recursive occurrences of a type appear under
+a type constructor. The introduction showed some examples of trees with nesting
+through lists. A more complex example, that reuses our @{text option} type,
+follows:
*}
datatype_new 'a btree =
BNode 'a "'a btree option" "'a btree option"
text {*
-Recursion may not be arbitrary; e.g. impossible to define
+\noindent
+Not all nestings are admissible. For example, this command will fail:
*}
- datatype_new 'a evil = Evil (*<*)'a
- typ (*>*)"'a evil \ 'a evil"
+ datatype_new 'a wrong = Wrong (*<*)'a
+ typ (*>*)"'a wrong \ 'a wrong"
text {*
-Issue: => allows recursion only on its right-hand side.
-This issue is inherited by polymorphic datatypes (and codatatypes)
-defined in terms of =>.
-In general, type constructors "('a1, ..., 'an) k" allow recursion on a subset
-of their type arguments.
+\noindent
+The issue is that the function arrow @{text "\"} allows recursion
+only through its right-hand side. This issue is inherited by polymorphic
+datatypes defined in terms of~@{text "\"}:
+*}
+
+ datatype_new ('a, 'b) fn = Fn "'a \ 'b"
+ datatype_new 'a also_wrong = Also_Wrong (*<*)'a
+ typ (*>*)"('a also_wrong, 'a also_wrong) fn"
+
+text {*
+\noindent
+In general, type constructors @{text "('a\<^sub>1, \, 'a\<^sub>m) t"}
+allow recursion on a subset of their type arguments @{text 'a\<^sub>1}, \ldots,
+@{text 'a\<^sub>m}. These type arguments are called \emph{live}; the remaining
+type arguments are called \emph{dead}. In @{typ "'a \ 'b"} and
+@{typ "('a, 'b) fn"}, the type variable @{typ 'a} is dead and @{typ 'b} is live.
*}
subsubsection {* Auxiliary Constants and Syntaxes *}
text {*
-The @{command datatype_new} command introduces various constants in addition to the
-constructors. Given a type @{text "('a1,\,'aM) t"} with constructors
-@{text "t.C\<^sub>1"}, \ldots, @{text "t.C\<^sub>m"}, the following auxiliary
-constants are introduced (among others):
+The @{command datatype_new} command introduces various constants in addition to
+the constructors. Given a type @{text "('a\<^sub>1, \, 'a\<^sub>m) t"}
+with $m > 0$ live type variables and $n$ constructors
+@{text "t.C\<^sub>1"}, \ldots, @{text "t.C\<^sub>n"}, the
+following auxiliary constants are introduced (among others):
\begin{itemize}
\setlength{\itemsep}{0pt}
-\item \emph{Set functions} (\emph{natural transformations}):
-@{text t_set1}, \ldots, @{text t_setM}
+\item \relax{Set functions} (or \relax{natural transformations}):
+@{text t_set1}, \ldots, @{text t_setm}
-\item \emph{Map function} (\emph{functorial action}): @{text t_map}
+\item \relax{Map function} (or \relax{functorial action}): @{text t_map}
-\item \emph{Relator}: @{text t_rel}
+\item \relax{Relator}: @{text t_rel}
-\item \emph{Iterator}: @{text t_fold}
+\item \relax{Iterator}: @{text t_fold}
-\item \emph{Recursor}: @{text t_rec}
+\item \relax{Recursor}: @{text t_rec}
+
+\item \relax{Discriminators}: @{text "t.is_C\<^sub>1"}, \ldots,
+@{text "t.is_C\<^sub>n"}
-\item \emph{Discriminators}: @{text "t.is_C\<^sub>1"}, \ldots,
-@{text "t.is_C\<^sub>m"}
-
-\item \emph{Selectors}:
-@{text t.un_C}$_{11}$, \ldots, @{text t.un_C}$_{1n_1}$, \ldots,
-@{text t.un_C}$_{m1}$, \ldots, @{text t.un_C}$_{mn_m}$
+\item \relax{Selectors}:
+@{text t.un_C11}$, \ldots, @{text t.un_C1k\<^sub>1}, \\
+\phantom{\relax{Selectors:}} \quad\vdots \\
+\phantom{\relax{Selectors:}} @{text t.un_Cn1}$, \ldots, @{text t.un_Cnk\<^sub>n}.
\end{itemize}
+\noindent
The discriminators and selectors are collectively called \emph{destructors}. The
-@{text "t."} prefix is an optional component of the name and is normally hidden.
-
-The set functions, map function, relator, discriminators, and selectors can be
-given custom names, as in the example below:
+prefix ``@{text "t."}'' is an optional component of the name and is normally
+hidden. The set functions, map function, relator, discriminators, and selectors
+can be given custom names, as in the example below:
*}
(*<*)
@@ -380,26 +390,26 @@
\qquad @{thm list.collapse(2)[of xs, no_vars]}\]
%
For two-constructor datatypes, a single discriminator constant suffices. The
-discriminator associated with @{const Cons} is simply @{text "\ null"}.
+discriminator associated with @{const Cons} is simply
+@{term "\xs. \ null xs"}.
-The \keyw{defaults} keyword following the @{const Nil} constructor specifies a
-default value for selectors associated with other constructors. Here, it is
-used to specify that the tail of the empty list is the empty list (instead of
-being unspecified).
+The @{text "defaults"} keyword following the @{const Nil} constructor specifies
+a default value for selectors associated with other constructors. Here, it is
+used to ensure that the tail of the empty list is the empty list (instead of
+being left unspecified).
-Because @{const Nil} is a nullary constructor, it is also possible to use @{text
-"= Nil"} as a discriminator. This is specified by specifying @{text "="} instead
-of the identifier @{const null} in the declaration above. Although this may look
-appealing, the mixture of constructors and selectors in the resulting
-characteristic theorems can lead Isabelle's automation to switch between the
-constructor and the destructor view in surprising ways.
+Because @{const Nil} is a nullary constructor, it is also possible to use
+@{term "\xs. xs = Nil"} as a discriminator. This is specified by
+entering ``@{text "="}'' instead of the identifier @{const null} in the
+declaration above. Although this may look appealing, the mixture of constructors
+and selectors in the resulting characteristic theorems can lead Isabelle's
+automation to switch between the constructor and the destructor view in
+surprising ways.
*}
text {*
-The usual mixfix syntaxes are available for both types and constructors. For example:
-
-%%% FIXME: remove trailing underscore and use locale trick instead once this is
-%%% supported.
+The usual mixfix syntaxes are available for both types and constructors. For
+example:
*}
(*<*)
@@ -645,9 +655,16 @@
Zero \ a
| Suc j' \ at as j')"
+(*<*)
+ context dummy_tlist
+ begin
+(*>*)
primrec_new tfold :: "('a \ 'b \ 'b) \ ('a, 'b) tlist \ 'b" where
"tfold _ (TNil b) = b" |
"tfold f (TCons a as) = f a (tfold f as)"
+(*<*)
+ end
+(*>*)
text {*
Show one example where fun is needed.
@@ -855,14 +872,14 @@
consts termi\<^sub>0 :: 'a
- datatype_new ('a, 'b) tlist_ =
+ datatype_new ('a, 'b) tlist =
TNil (termi: 'b) (defaults ttl: TNil)
- | TCons (thd: 'a) (ttl : "('a, 'b) tlist_") (defaults termi: "\_ xs. termi\<^sub>0 xs")
+ | TCons (thd: 'a) (ttl : "('a, 'b) tlist") (defaults termi: "\_ xs. termi\<^sub>0 xs")
overloading
- termi\<^sub>0 \ "termi\<^sub>0 \ ('a, 'b) tlist_ \ 'b"
+ termi\<^sub>0 \ "termi\<^sub>0 \ ('a, 'b) tlist \ 'b"
begin
- primrec_new termi\<^sub>0 :: "('a, 'b) tlist_ \ 'b" where
+ primrec_new termi\<^sub>0 :: "('a, 'b) tlist \ 'b" where
"termi\<^sub>0 (TNil y) = y" |
"termi\<^sub>0 (TCons x xs) = termi\<^sub>0 xs"
end
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Datatypes/document/build
--- a/src/Doc/Datatypes/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Datatypes/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Datatypes/document/root.tex
--- a/src/Doc/Datatypes/document/root.tex Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Datatypes/document/root.tex Tue Sep 10 20:11:01 2013 +0200
@@ -19,7 +19,9 @@
\newcommand{\keyw}[1]{\isacommand{#1}}
-\renewcommand{\isactrlsub}[1]{\/$\sb{\mathrm{#1}}$}
+%\renewcommand{\isactrlsub}[1]{\/$\sb{\mathrm{#1}}$}
+\renewcommand{\isactrlsub}[1]{\/$\sb{#1}$}
+\renewcommand{\isadigit}[1]{\/\ensuremath{\mathrm{#1}}}
\renewcommand{\isacharprime}{\isamath{{'}\mskip-2mu}}
\renewcommand{\isacharunderscore}{\mbox{\_}}
\renewcommand{\isacharunderscorekeyword}{\mbox{\_}}
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Functions/document/build
--- a/src/Doc/Functions/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Functions/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Intro/document/build
--- a/src/Doc/Intro/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Intro/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/IsarImplementation/document/build
--- a/src/Doc/IsarImplementation/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/IsarImplementation/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/IsarRef/Misc.thy
--- a/src/Doc/IsarRef/Misc.thy Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/IsarRef/Misc.thy Tue Sep 10 20:11:01 2013 +0200
@@ -46,7 +46,7 @@
\begin{description}
\item @{command "print_theory"} prints the main logical content of
- the theory context; the ``@{text "!"}'' option indicates extra
+ the background theory; the ``@{text "!"}'' option indicates extra
verbosity.
\item @{command "print_methods"} prints all proof methods
@@ -55,8 +55,9 @@
\item @{command "print_attributes"} prints all attributes
available in the current theory context.
- \item @{command "print_theorems"} prints theorems resulting from the
- last command; the ``@{text "!"}'' option indicates extra verbosity.
+ \item @{command "print_theorems"} prints theorems of the background
+ theory resulting from the last command; the ``@{text "!"}'' option
+ indicates extra verbosity.
\item @{command "find_theorems"}~@{text criteria} retrieves facts
from the theory or proof context matching all of given search
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/IsarRef/document/build
--- a/src/Doc/IsarRef/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/IsarRef/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/LaTeXsugar/document/build
--- a/src/Doc/LaTeXsugar/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/LaTeXsugar/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Locales/document/build
--- a/src/Doc/Locales/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Locales/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Logics/document/build
--- a/src/Doc/Logics/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Logics/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Main/document/build
--- a/src/Doc/Main/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Main/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Nitpick/document/build
--- a/src/Doc/Nitpick/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Nitpick/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/ProgProve/document/build
--- a/src/Doc/ProgProve/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/ProgProve/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Sledgehammer/document/build
--- a/src/Doc/Sledgehammer/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Sledgehammer/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/System/document/build
--- a/src/Doc/System/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/System/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/Tutorial/document/build
--- a/src/Doc/Tutorial/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/Tutorial/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/ZF/document/build
--- a/src/Doc/ZF/document/build Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/ZF/document/build Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/fixbookmarks
--- a/src/Doc/fixbookmarks Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/fixbookmarks Tue Sep 10 20:11:01 2013 +0200
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
perl -pi -e 's/\\([a-zA-Z]+)\s*/$1/g; s/\$//g; s/^BOOKMARK/\\BOOKMARK/g;' "$@"
diff -r 437c0a63bb16 -r c9d6f6285e1d src/Doc/prepare_document
--- a/src/Doc/prepare_document Tue Sep 10 20:09:53 2013 +0200
+++ b/src/Doc/prepare_document Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/ATP.thy
--- a/src/HOL/ATP.thy Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/ATP.thy Tue Sep 10 20:11:01 2013 +0200
@@ -11,7 +11,6 @@
ML_file "Tools/lambda_lifting.ML"
ML_file "Tools/monomorph.ML"
-ML_file "Tools/legacy_monomorph.ML"
ML_file "Tools/ATP/atp_util.ML"
ML_file "Tools/ATP/atp_problem.ML"
ML_file "Tools/ATP/atp_proof.ML"
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/BNF/Tools/bnf_ctr_sugar.ML
--- a/src/HOL/BNF/Tools/bnf_ctr_sugar.ML Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_ctr_sugar.ML Tue Sep 10 20:11:01 2013 +0200
@@ -23,7 +23,11 @@
split_asm: thm,
disc_thmss: thm list list,
discIs: thm list,
- sel_thmss: thm list list};
+ sel_thmss: thm list list,
+ disc_exhausts: thm list,
+ collapses: thm list,
+ expands: thm list,
+ case_convs: thm list};
val morph_ctr_sugar: morphism -> ctr_sugar -> ctr_sugar
@@ -68,10 +72,15 @@
split_asm: thm,
disc_thmss: thm list list,
discIs: thm list,
- sel_thmss: thm list list};
+ sel_thmss: thm list list,
+ disc_exhausts: thm list,
+ collapses: thm list,
+ expands: thm list,
+ case_convs: thm list};
fun morph_ctr_sugar phi {ctrs, casex, discs, selss, exhaust, nchotomy, injects, distincts,
- case_thms, case_cong, weak_case_cong, split, split_asm, disc_thmss, discIs, sel_thmss} =
+ case_thms, case_cong, weak_case_cong, split, split_asm, disc_thmss, discIs, sel_thmss,
+ disc_exhausts, collapses, expands, case_convs} =
{ctrs = map (Morphism.term phi) ctrs,
casex = Morphism.term phi casex,
discs = map (Morphism.term phi) discs,
@@ -87,7 +96,11 @@
split_asm = Morphism.thm phi split_asm,
disc_thmss = map (map (Morphism.thm phi)) disc_thmss,
discIs = map (Morphism.thm phi) discIs,
- sel_thmss = map (map (Morphism.thm phi)) sel_thmss};
+ sel_thmss = map (map (Morphism.thm phi)) sel_thmss,
+ disc_exhausts = map (Morphism.thm phi) disc_exhausts,
+ collapses = map (Morphism.thm phi) collapses,
+ expands = map (Morphism.thm phi) expands,
+ case_convs = map (Morphism.thm phi) case_convs};
val rep_compat_prefix = "new";
@@ -762,7 +775,8 @@
nchotomy = nchotomy_thm, injects = inject_thms, distincts = distinct_thms,
case_thms = case_thms, case_cong = case_cong_thm, weak_case_cong = weak_case_cong_thm,
split = split_thm, split_asm = split_asm_thm, disc_thmss = disc_thmss,
- discIs = discI_thms, sel_thmss = sel_thmss},
+ discIs = discI_thms, sel_thmss = sel_thmss, disc_exhausts = disc_exhaust_thms,
+ collapses = collapse_thms, expands = expand_thms, case_convs = case_conv_thms},
lthy
|> not rep_compat ?
(Local_Theory.declaration {syntax = false, pervasive = true}
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/BNF/Tools/bnf_fp_def_sugar.ML
--- a/src/HOL/BNF/Tools/bnf_fp_def_sugar.ML Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_def_sugar.ML Tue Sep 10 20:11:01 2013 +0200
@@ -18,8 +18,11 @@
ctr_defss: thm list list,
ctr_sugars: BNF_Ctr_Sugar.ctr_sugar list,
co_iterss: term list list,
+ mapss: thm list list,
co_inducts: thm list,
- co_iter_thmsss: thm list list list};
+ co_iter_thmsss: thm list list list,
+ disc_co_itersss: thm list list list,
+ sel_co_iterssss: thm list list list list};
val of_fp_sugar: (fp_sugar -> 'a list) -> fp_sugar -> 'a
val morph_fp_sugar: morphism -> fp_sugar -> fp_sugar
@@ -80,7 +83,7 @@
* (thm list list * thm list list * Args.src list)
* (thm list list * thm list list) * (thm list list * thm list list * Args.src list)
* (thm list list * thm list list * Args.src list)
- * (thm list list * thm list list * Args.src list)
+ * (thm list list list * thm list list list * Args.src list)
val co_datatypes: BNF_FP_Util.fp_kind -> (mixfix list -> binding list -> binding list ->
binding list list -> binding list -> (string * sort) list -> typ list * typ list list ->
@@ -118,8 +121,11 @@
ctr_defss: thm list list,
ctr_sugars: ctr_sugar list,
co_iterss: term list list,
+ mapss: thm list list,
co_inducts: thm list,
- co_iter_thmsss: thm list list list};
+ co_iter_thmsss: thm list list list,
+ disc_co_itersss: thm list list list,
+ sel_co_iterssss: thm list list list list};
fun of_fp_sugar f (fp_sugar as {index, ...}) = nth (f fp_sugar) index;
@@ -128,15 +134,18 @@
T1 = T2 andalso fp1 = fp2 andalso index1 = index2 andalso eq_fp_result (fp_res1, fp_res2);
fun morph_fp_sugar phi {T, fp, index, pre_bnfs, nested_bnfs, nesting_bnfs, fp_res, ctr_defss,
- ctr_sugars, co_iterss, co_inducts, co_iter_thmsss} =
+ ctr_sugars, co_iterss, mapss, co_inducts, co_iter_thmsss, disc_co_itersss, sel_co_iterssss} =
{T = Morphism.typ phi T, fp = fp, index = index, pre_bnfs = map (morph_bnf phi) pre_bnfs,
nested_bnfs = map (morph_bnf phi) nested_bnfs, nesting_bnfs = map (morph_bnf phi) nesting_bnfs,
fp_res = morph_fp_result phi fp_res,
ctr_defss = map (map (Morphism.thm phi)) ctr_defss,
ctr_sugars = map (morph_ctr_sugar phi) ctr_sugars,
co_iterss = map (map (Morphism.term phi)) co_iterss,
+ mapss = map (map (Morphism.thm phi)) mapss,
co_inducts = map (Morphism.thm phi) co_inducts,
- co_iter_thmsss = map (map (map (Morphism.thm phi))) co_iter_thmsss};
+ co_iter_thmsss = map (map (map (Morphism.thm phi))) co_iter_thmsss,
+ disc_co_itersss = map (map (map (Morphism.thm phi))) disc_co_itersss,
+ sel_co_iterssss = map (map (map (map (Morphism.thm phi)))) sel_co_iterssss};
structure Data = Generic_Data
(
@@ -161,13 +170,14 @@
(fn phi => Data.map (Symtab.default (key, morph_fp_sugar phi fp_sugar)));
fun register_fp_sugars fp pre_bnfs nested_bnfs nesting_bnfs (fp_res as {Ts, ...}) ctr_defss
- ctr_sugars co_iterss co_inducts co_iter_thmsss lthy =
+ ctr_sugars co_iterss mapss co_inducts co_iter_thmsss disc_co_itersss sel_co_iterssss lthy =
(0, lthy)
|> fold (fn T as Type (s, _) => fn (kk, lthy) => (kk + 1,
register_fp_sugar s {T = T, fp = fp, index = kk, pre_bnfs = pre_bnfs,
nested_bnfs = nested_bnfs, nesting_bnfs = nesting_bnfs, fp_res = fp_res,
- ctr_defss = ctr_defss, ctr_sugars = ctr_sugars, co_iterss = co_iterss,
- co_inducts = co_inducts, co_iter_thmsss = co_iter_thmsss}
+ ctr_defss = ctr_defss, ctr_sugars = ctr_sugars, co_iterss = co_iterss, mapss = mapss,
+ co_inducts = co_inducts, co_iter_thmsss = co_iter_thmsss, disc_co_itersss = disc_co_itersss,
+ sel_co_iterssss = sel_co_iterssss}
lthy)) Ts
|> snd;
@@ -999,10 +1009,10 @@
end;
fun mk_sel_coiter_thms coiter_thmss =
- map3 (map3 (map2 o mk_sel_coiter_thm)) coiter_thmss selsss sel_thmsss |> map flat;
+ map3 (map3 (map2 o mk_sel_coiter_thm)) coiter_thmss selsss sel_thmsss;
- val sel_unfold_thmss = mk_sel_coiter_thms unfold_thmss;
- val sel_corec_thmss = mk_sel_coiter_thms corec_thmss;
+ val sel_unfold_thmsss = mk_sel_coiter_thms unfold_thmss;
+ val sel_corec_thmsss = mk_sel_coiter_thms corec_thmss;
val coinduct_consumes_attr = Attrib.internal (K (Rule_Cases.consumes nn));
val coinduct_case_names_attr = Attrib.internal (K (Rule_Cases.case_names coinduct_cases));
@@ -1018,7 +1028,7 @@
(safe_unfold_thmss, safe_corec_thmss),
(disc_unfold_thmss, disc_corec_thmss, simp_attrs),
(disc_unfold_iff_thmss, disc_corec_iff_thmss, simp_attrs),
- (sel_unfold_thmss, sel_corec_thmss, simp_attrs))
+ (sel_unfold_thmsss, sel_corec_thmsss, simp_attrs))
end;
fun define_co_datatypes prepare_constraint prepare_typ prepare_term fp construct_fp
@@ -1407,7 +1417,7 @@
@ rel_distincts @ flat setss);
fun derive_and_note_induct_iters_thms_for_types
- ((((mapsx, rel_injects, rel_distincts, setss), (ctrss, _, ctr_defss, ctr_sugars)),
+ ((((mapss, rel_injects, rel_distincts, setss), (ctrss, _, ctr_defss, ctr_sugars)),
(iterss, iter_defss)), lthy) =
let
val ((induct_thms, induct_thm, induct_attrs), (fold_thmss, fold_attrs),
@@ -1419,7 +1429,7 @@
val induct_type_attr = Attrib.internal o K o Induct.induct_type;
val simp_thmss =
- mk_simp_thmss ctr_sugars fold_thmss rec_thmss mapsx rel_injects rel_distincts setss;
+ mk_simp_thmss ctr_sugars fold_thmss rec_thmss mapss rel_injects rel_distincts setss;
val common_notes =
(if nn > 1 then [(inductN, [induct_thm], induct_attrs)] else [])
@@ -1435,11 +1445,11 @@
lthy
|> Local_Theory.notes (common_notes @ notes) |> snd
|> register_fp_sugars Least_FP pre_bnfs nested_bnfs nesting_bnfs fp_res ctr_defss ctr_sugars
- iterss [induct_thm] (transpose [fold_thmss, rec_thmss])
+ iterss mapss [induct_thm] (transpose [fold_thmss, rec_thmss]) [] []
end;
fun derive_and_note_coinduct_coiters_thms_for_types
- ((((mapsx, rel_injects, rel_distincts, setss), (_, _, ctr_defss, ctr_sugars)),
+ ((((mapss, rel_injects, rel_distincts, setss), (_, _, ctr_defss, ctr_sugars)),
(coiterss, coiter_defss)), lthy) =
let
val (([(coinduct_thms, coinduct_thm), (strong_coinduct_thms, strong_coinduct_thm)],
@@ -1448,11 +1458,14 @@
(safe_unfold_thmss, safe_corec_thmss),
(disc_unfold_thmss, disc_corec_thmss, disc_coiter_attrs),
(disc_unfold_iff_thmss, disc_corec_iff_thmss, disc_coiter_iff_attrs),
- (sel_unfold_thmss, sel_corec_thmss, sel_coiter_attrs)) =
+ (sel_unfold_thmsss, sel_corec_thmsss, sel_coiter_attrs)) =
derive_coinduct_coiters_thms_for_types pre_bnfs (the coiters_args_types) xtor_co_induct
dtor_injects dtor_ctors xtor_co_iter_thmss nesting_bnfs fpTs Cs kss mss ns ctr_defss
ctr_sugars coiterss coiter_defss (Proof_Context.export lthy' no_defs_lthy) lthy;
+ val sel_unfold_thmss = map flat sel_unfold_thmsss;
+ val sel_corec_thmss = map flat sel_corec_thmsss;
+
val coinduct_type_attr = Attrib.internal o K o Induct.coinduct_type;
fun flat_coiter_thms coiters disc_coiters sel_coiters =
@@ -1462,7 +1475,7 @@
mk_simp_thmss ctr_sugars
(map3 flat_coiter_thms safe_unfold_thmss disc_unfold_thmss sel_unfold_thmss)
(map3 flat_coiter_thms safe_corec_thmss disc_corec_thmss sel_corec_thmss)
- mapsx rel_injects rel_distincts setss;
+ mapss rel_injects rel_distincts setss;
val anonymous_notes =
[(flat safe_unfold_thmss @ flat safe_corec_thmss, simp_attrs)]
@@ -1494,8 +1507,9 @@
lthy
|> Local_Theory.notes (anonymous_notes @ common_notes @ notes) |> snd
|> register_fp_sugars Greatest_FP pre_bnfs nested_bnfs nesting_bnfs fp_res ctr_defss
- ctr_sugars coiterss [coinduct_thm, strong_coinduct_thm]
- (transpose [unfold_thmss, corec_thmss])
+ ctr_sugars coiterss mapss [coinduct_thm, strong_coinduct_thm]
+ (transpose [unfold_thmss, corec_thmss]) (transpose [disc_unfold_thmss, disc_corec_thmss])
+ (transpose [sel_unfold_thmsss, sel_corec_thmsss])
end;
val lthy'' = lthy'
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/BNF/Tools/bnf_fp_n2m_sugar.ML
--- a/src/HOL/BNF/Tools/bnf_fp_n2m_sugar.ML Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_n2m_sugar.ML Tue Sep 10 20:11:01 2013 +0200
@@ -59,6 +59,7 @@
end;
val ctr_defss = map (of_fp_sugar #ctr_defss) fp_sugars0;
+ val mapss = map (of_fp_sugar #mapss) fp_sugars0;
val ctr_sugars0 = map2 target_ctr_sugar_of_fp_sugar fpTs fp_sugars0;
val ctrss = map #ctrs ctr_sugars0;
@@ -145,27 +146,33 @@
val ctr_sugars = map inst_ctr_sugar ctr_sugars0;
- val (co_inducts, un_fold_thmss, co_rec_thmss) =
+ val (co_inducts, un_fold_thmss, co_rec_thmss, disc_unfold_thmss, disc_corec_thmss,
+ sel_unfold_thmsss, sel_corec_thmsss) =
if fp = Least_FP then
derive_induct_iters_thms_for_types pre_bnfs (the iters_args_types) xtor_co_induct
xtor_co_iter_thmss nesting_bnfs nested_bnfs fpTs Cs Xs ctrXs_Tsss ctrss ctr_defss
co_iterss co_iter_defss lthy
|> (fn ((_, induct, _), (fold_thmss, _), (rec_thmss, _)) =>
- ([induct], fold_thmss, rec_thmss))
+ ([induct], fold_thmss, rec_thmss, [], [], [], []))
else
derive_coinduct_coiters_thms_for_types pre_bnfs (the coiters_args_types) xtor_co_induct
dtor_injects dtor_ctors xtor_co_iter_thmss nesting_bnfs fpTs Cs kss mss ns ctr_defss
ctr_sugars co_iterss co_iter_defss (Proof_Context.export lthy no_defs_lthy) lthy
- |> (fn ((coinduct_thms_pairs, _), (unfold_thmss, corec_thmss, _), _, _, _, _) =>
- (map snd coinduct_thms_pairs, unfold_thmss, corec_thmss));
+ |> (fn ((coinduct_thms_pairs, _), (unfold_thmss, corec_thmss, _), _, _,
+ (disc_unfold_thmss, disc_corec_thmss, _),
+ (sel_unfold_thmsss, sel_corec_thmsss, _)) =>
+ (map snd coinduct_thms_pairs, unfold_thmss, corec_thmss, disc_unfold_thmss,
+ disc_corec_thmss, sel_unfold_thmsss, sel_corec_thmsss));
val phi = Proof_Context.export_morphism no_defs_lthy no_defs_lthy0;
fun mk_target_fp_sugar (kk, T) =
{T = T, fp = fp, index = kk, pre_bnfs = pre_bnfs, nested_bnfs = nested_bnfs,
nesting_bnfs = nesting_bnfs, fp_res = fp_res, ctr_defss = ctr_defss,
- ctr_sugars = ctr_sugars, co_inducts = co_inducts, co_iterss = co_iterss,
- co_iter_thmsss = transpose [un_fold_thmss, co_rec_thmss]}
+ ctr_sugars = ctr_sugars, co_iterss = co_iterss, mapss = mapss, co_inducts = co_inducts,
+ co_iter_thmsss = transpose [un_fold_thmss, co_rec_thmss],
+ disc_co_itersss = transpose [disc_unfold_thmss, disc_corec_thmss],
+ sel_co_iterssss = transpose [sel_unfold_thmsss, sel_corec_thmsss]}
|> morph_fp_sugar phi;
in
((true, map_index mk_target_fp_sugar fpTs), lthy)
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/BNF/Tools/bnf_fp_rec_sugar_tactics.ML
--- a/src/HOL/BNF/Tools/bnf_fp_rec_sugar_tactics.ML Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_rec_sugar_tactics.ML Tue Sep 10 20:11:01 2013 +0200
@@ -54,8 +54,8 @@
fun mk_primcorec_disc_tac ctxt defs disc k m exclsss =
mk_primcorec_prelude ctxt defs disc THEN mk_primcorec_cases_tac ctxt k m exclsss;
-fun mk_primcorec_eq_tac ctxt defs sel k m exclsss maps map_idents map_comps =
- mk_primcorec_prelude ctxt defs (sel RS trans) THEN mk_primcorec_cases_tac ctxt k m exclsss THEN
+fun mk_primcorec_eq_tac ctxt defs eq_thm k m exclsss maps map_idents map_comps =
+ mk_primcorec_prelude ctxt defs (eq_thm RS trans) THEN mk_primcorec_cases_tac ctxt k m exclsss THEN
unfold_thms_tac ctxt (@{thms if_if_True if_if_False if_True if_False o_def split_def sum.cases} @
maps @ map_comps @ map_idents) THEN HEADGOAL (rtac refl);
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/BNF/Tools/bnf_fp_rec_sugar_util.ML
--- a/src/HOL/BNF/Tools/bnf_fp_rec_sugar_util.ML Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_rec_sugar_util.ML Tue Sep 10 20:11:01 2013 +0200
@@ -31,7 +31,10 @@
sels: term list,
pred: int option,
calls: corec_call list,
- corec_thm: thm}
+ collapse: thm,
+ corec_thm: thm,
+ disc_corec: thm,
+ sel_corecs: thm list}
type rec_spec =
{recx: term,
@@ -41,6 +44,9 @@
type corec_spec =
{corec: term,
+ nested_maps: thm list,
+ nested_map_idents: thm list,
+ nested_map_comps: thm list,
ctr_specs: corec_ctr_spec list}
val massage_indirect_rec_call: Proof.context -> (term -> bool) -> (typ -> typ -> term -> term) ->
@@ -90,7 +96,10 @@
sels: term list,
pred: int option,
calls: corec_call list,
- corec_thm: thm};
+ collapse: thm,
+ corec_thm: thm,
+ disc_corec: thm,
+ sel_corecs: thm list};
type rec_spec =
{recx: term,
@@ -100,6 +109,9 @@
type corec_spec =
{corec: term,
+ nested_maps: thm list,
+ nested_map_idents: thm list,
+ nested_map_comps: thm list,
ctr_specs: corec_ctr_spec list};
val id_def = @{thm id_def};
@@ -260,6 +272,18 @@
fun find_index_eq hs h = find_index (curry (op =) h) hs;
+(*FIXME: remove special cases for products and sum once they are registered as datatypes*)
+fun map_thms_of_typ ctxt (Type (s, _)) =
+ if s = @{type_name prod} then
+ @{thms map_pair_simp}
+ else if s = @{type_name sum} then
+ @{thms sum_map.simps}
+ else
+ (case fp_sugar_of ctxt s of
+ SOME {index, mapss, ...} => nth mapss index
+ | NONE => [])
+ | map_thms_of_typ _ _ = [];
+
val lose_co_rec = false (*FIXME: try true?*);
fun rec_specs_of bs arg_Ts res_Ts get_indices callssss0 lthy =
@@ -348,8 +372,8 @@
val thy = Proof_Context.theory_of lthy;
val ((nontriv, missing_res_Ts, perm0_kks,
- fp_sugars as {fp_res = {xtor_co_iterss = dtor_coiters1 :: _, ...},
- co_inducts = coinduct_thms, ...} :: _), lthy') =
+ fp_sugars as {nested_bnfs, fp_res = {xtor_co_iterss = dtor_coiters1 :: _, ...},
+ co_inducts = coinduct_thms, ...} :: _), lthy') =
nested_to_mutual_fps lose_co_rec Greatest_FP bs res_Ts get_indices callssss0 lthy;
val perm_fp_sugars = sort (int_ord o pairself #index) fp_sugars;
@@ -407,27 +431,38 @@
else No_Corec) g_i
| call_of _ [q_i] [g_i, g_i'] _ = Direct_Corec (q_i, g_i, g_i');
- fun mk_ctr_spec ctr disc sels p_ho q_iss f_iss f_Tss corec_thm =
+ fun mk_ctr_spec ctr disc sels p_ho q_iss f_iss f_Tss collapse corec_thm disc_corec sel_corecs =
let val nullary = not (can dest_funT (fastype_of ctr)) in
{ctr = substA ctr, disc = substA disc, sels = map substA sels, pred = p_ho,
- calls = map3 (call_of nullary) q_iss f_iss f_Tss, corec_thm = corec_thm}
+ calls = map3 (call_of nullary) q_iss f_iss f_Tss, collapse = collapse,
+ corec_thm = corec_thm, disc_corec = disc_corec, sel_corecs = sel_corecs}
end;
- fun mk_ctr_specs index ctr_sugars p_is q_isss f_isss f_Tsss coiter_thmsss =
+ fun mk_ctr_specs index ctr_sugars p_is q_isss f_isss f_Tsss coiter_thmsss disc_coitersss
+ sel_coiterssss =
let
val ctrs = #ctrs (nth ctr_sugars index);
val discs = #discs (nth ctr_sugars index);
val selss = #selss (nth ctr_sugars index);
val p_ios = map SOME p_is @ [NONE];
- val corec_thmss = co_rec_of (nth coiter_thmsss index);
+ val collapses = #collapses (nth ctr_sugars index);
+ val corec_thms = co_rec_of (nth coiter_thmsss index);
+ val disc_corecs = co_rec_of (nth disc_coitersss index);
+ val sel_corecss = co_rec_of (nth sel_coiterssss index);
in
- map8 mk_ctr_spec ctrs discs selss p_ios q_isss f_isss f_Tsss corec_thmss
+ map11 mk_ctr_spec ctrs discs selss p_ios q_isss f_isss f_Tsss collapses corec_thms
+ disc_corecs sel_corecss
end;
- fun mk_spec {T, index, ctr_sugars, co_iterss = coiterss, co_iter_thmsss = coiter_thmsss, ...}
+ fun mk_spec {T, index, ctr_sugars, co_iterss = coiterss, co_iter_thmsss = coiter_thmsss,
+ disc_co_itersss = disc_coitersss, sel_co_iterssss = sel_coiterssss, ...}
p_is q_isss f_isss f_Tsss =
{corec = mk_co_iter thy Greatest_FP (substAT T) perm_Cs' (co_rec_of (nth coiterss index)),
- ctr_specs = mk_ctr_specs index ctr_sugars p_is q_isss f_isss f_Tsss coiter_thmsss};
+ nested_maps = maps (map_thms_of_typ lthy o T_of_bnf) nested_bnfs,
+ nested_map_idents = map (unfold_thms lthy [id_def] o map_id0_of_bnf) nested_bnfs,
+ nested_map_comps = map map_comp_of_bnf nested_bnfs,
+ ctr_specs = mk_ctr_specs index ctr_sugars p_is q_isss f_isss f_Tsss coiter_thmsss
+ disc_coitersss sel_coiterssss};
in
((nontriv, map5 mk_spec fp_sugars p_iss q_issss f_issss f_Tssss, missing_res_Ts,
co_induct_of coinduct_thms, strong_co_induct_of coinduct_thms, co_induct_of coinduct_thmss,
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/IMP/export.sh
--- a/src/HOL/IMP/export.sh Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/IMP/export.sh Tue Sep 10 20:11:01 2013 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Author: Gerwin Klein
#
diff -r 437c0a63bb16 -r c9d6f6285e1d src/HOL/Multivariate_Analysis/Integration.thy
--- a/src/HOL/Multivariate_Analysis/Integration.thy Tue Sep 10 20:09:53 2013 +0200
+++ b/src/HOL/Multivariate_Analysis/Integration.thy Tue Sep 10 20:11:01 2013 +0200
@@ -2999,7 +2999,7 @@
done
lemma integrable_setsum:
- "finite t \ \a \ t.(f a) integrable_on s \ (\x. setsum (\a. f a x) t) integrable_on s"
+ "finite t \ \a \ t. (f a) integrable_on s \ (\x. setsum (\a. f a x) t) integrable_on s"
unfolding integrable_on_def
apply (drule bchoice)
using has_integral_setsum[of t]
@@ -3141,7 +3141,12 @@
proof (rule, rule)
case goal1
then have "e/2 > 0" by auto
- then guess d apply- apply(drule y[rule_format]) by(erule exE,erule conjE) note d=this[rule_format]
+ then guess d
+ apply -
+ apply (drule y[rule_format])
+ apply (elim exE conjE)
+ done
+ note d=this[rule_format]
show ?case
apply (rule_tac x=d in exI)
apply rule
@@ -3215,7 +3220,8 @@
by auto
guess N2 using y[OF *] .. note N2=this
show "\d. gauge d \
- (\p. p tagged_division_of {a..b} \ d fine p \ norm ((\(x, k)\p. content k *\<^sub>R f x) - y) < e)"
+ (\p. p tagged_division_of {a..b} \ d fine p \
+ norm ((\(x, k)\p. content k *\<^sub>R f x) - y) < e)"
apply (rule_tac x="d (N1 + N2)" in exI)
apply rule
defer
@@ -3315,7 +3321,8 @@
shows "content(k1 \ {x. x\k \ c}) = 0"
proof -
note d=division_ofD[OF assms(1)]
- have *: "\a b::'a. \ c. (content({a..b} \ {x. x\k \ c}) = 0 \ interior({a..b} \ {x. x\k \ c}) = {})"
+ have *: "\(a::'a) b c. content ({a..b} \ {x. x\k \ c}) = 0 \
+ interior({a..b} \ {x. x\k \ c}) = {}"
unfolding interval_split[OF k] content_eq_0_interior by auto
guess u1 v1 using d(4)[OF assms(2)] apply-by(erule exE)+ note uv1=this
guess u2 v2 using d(4)[OF assms(3)] apply-by(erule exE)+ note uv2=this
@@ -3344,8 +3351,8 @@
have *: "\a b::'a. \c. content({a..b} \ {x. x\k \ c}) = 0 \
interior({a..b} \ {x. x\k \ c}) = {}"
unfolding interval_split[OF k] content_eq_0_interior by auto
- guess u1 v1 using d(4)[OF assms(2)] apply-by(erule exE)+ note uv1=this
- guess u2 v2 using d(4)[OF assms(3)] apply-by(erule exE)+ note uv2=this
+ guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
+ guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
have **: "\s t u. s \ t = {} \ u \ s \ u \ t \ u = {}"
by auto
show ?thesis
@@ -3361,7 +3368,7 @@
lemma tagged_division_split_left_inj:
fixes x1 :: "'a::ordered_euclidean_space"
assumes "d tagged_division_of i"
- and "(x1,k1) \ d"
+ and "(x1, k1) \ d"
and "(x2, k2) \ d"
and "k1 \ k2"
and "k1 \ {x. x\k \ c} = k2 \ {x. x\k \ c}"
@@ -3389,7 +3396,7 @@
and "k1 \ k2"
and "k1 \ {x. x\k \ c} = k2 \ {x. x\k \ c}"
and k: "k \ Basis"
- shows "content(k1 \ {x. x\k \ c}) = 0"
+ shows "content (k1 \ {x. x\k \ c}) = 0"
proof -
have *: "\a b c. (a,b) \ c \ b \ snd ` c"
unfolding image_iff
@@ -3472,8 +3479,10 @@
case goal1
then have e: "e/2 > 0"
by auto
- guess d1 using has_integralD[OF assms(1)[unfolded interval_split[OF k]] e] . note d1=this[unfolded interval_split[symmetric,OF k]]
- guess d2 using has_integralD[OF assms(2)[unfolded interval_split[OF k]] e] . note d2=this[unfolded interval_split[symmetric,OF k]]
+ guess d1 using has_integralD[OF assms(1)[unfolded interval_split[OF k]] e] .
+ note d1=this[unfolded interval_split[symmetric,OF k]]
+ guess d2 using has_integralD[OF assms(2)[unfolded interval_split[OF k]] e] .
+ note d2=this[unfolded interval_split[symmetric,OF k]]
let ?d = "\x. if x\k = c then (d1 x \ d2 x) else ball x (abs(x\k - c)) \ d1 x \ d2 x"
show ?case
apply (rule_tac x="?d" in exI)
@@ -3486,7 +3495,8 @@
show "gauge ?d"
using d1(1) d2(1) unfolding gauge_def by auto
fix p
- assume "p tagged_division_of {a..b}" "?d fine p" note p = this tagged_division_ofD[OF this(1)]
+ assume "p tagged_division_of {a..b}" "?d fine p"
+ note p = this tagged_division_ofD[OF this(1)]
have lem0:
"\x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {} \ x\k \ c"
"\x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {} \ x\k \ c"
@@ -3701,7 +3711,8 @@
qed
also note setsum_addf[symmetric]
also have *: "\x. x \ p \
- (\(x,ka). content (ka \ {x. x \ k \ c}) *\<^sub>R f x) x + (\(x,ka). content (ka \ {x. c \ x \ k}) *\<^sub>R f x) x =
+ (\(x,ka). content (ka \ {x. x \ k \ c}) *\<^sub>R f x) x +
+ (\(x,ka). content (ka \ {x. c \ x \ k}) *\<^sub>R f x) x =
(\(x,ka). content ka *\<^sub>R f x) x"
unfolding split_paired_all split_conv
proof -
@@ -3728,170 +3739,296 @@
subsection {* A sort of converse, integrability on subintervals. *}
-lemma tagged_division_union_interval: fixes a::"'a::ordered_euclidean_space"
- assumes "p1 tagged_division_of ({a..b} \ {x. x\k \ (c::real)})" "p2 tagged_division_of ({a..b} \ {x. x\k \ c})"
- and k:"k\Basis"
+lemma tagged_division_union_interval:
+ fixes a :: "'a::ordered_euclidean_space"
+ assumes "p1 tagged_division_of ({a..b} \ {x. x\k \ (c::real)})"
+ and "p2 tagged_division_of ({a..b} \ {x. x\k \ c})"
+ and k: "k \ Basis"
shows "(p1 \ p2) tagged_division_of ({a..b})"
-proof- have *:"{a..b} = ({a..b} \ {x. x\k \ c}) \ ({a..b} \ {x. x\k \ c})" by auto
- show ?thesis apply(subst *) apply(rule tagged_division_union[OF assms(1-2)])
- unfolding interval_split[OF k] interior_closed_interval using k
- by(auto simp add: eucl_less[where 'a='a] elim!: ballE[where x=k]) qed
-
-lemma has_integral_separate_sides: fixes f::"'a::ordered_euclidean_space \ 'b::real_normed_vector"
- assumes "(f has_integral i) ({a..b})" "e>0" and k:"k\Basis"
- obtains d where "gauge d" "(\p1 p2. p1 tagged_division_of ({a..b} \ {x. x\k \ c}) \ d fine p1 \
- p2 tagged_division_of ({a..b} \ {x. x\k \ c}) \ d fine p2
- \ norm((setsum (\(x,k). content k *\<^sub>R f x) p1 +
- setsum (\(x,k). content k *\<^sub>R f x) p2) - i) < e)"
-proof- guess d using has_integralD[OF assms(1-2)] . note d=this
- show ?thesis apply(rule that[of d]) apply(rule d) apply(rule,rule,rule,(erule conjE)+)
- proof- fix p1 p2 assume "p1 tagged_division_of {a..b} \ {x. x \ k \ c}" "d fine p1" note p1=tagged_division_ofD[OF this(1)] this
- assume "p2 tagged_division_of {a..b} \ {x. c \ x \ k}" "d fine p2" note p2=tagged_division_ofD[OF this(1)] this
+proof -
+ have *: "{a..b} = ({a..b} \ {x. x\k \ c}) \ ({a..b} \ {x. x\k \ c})"
+ by auto
+ show ?thesis
+ apply (subst *)
+ apply (rule tagged_division_union[OF assms(1-2)])
+ unfolding interval_split[OF k] interior_closed_interval
+ using k
+ apply (auto simp add: eucl_less[where 'a='a] elim!: ballE[where x=k])
+ done
+qed
+
+lemma has_integral_separate_sides:
+ fixes f :: "'a::ordered_euclidean_space \ 'b::real_normed_vector"
+ assumes "(f has_integral i) ({a..b})"
+ and "e > 0"
+ and k: "k \ Basis"
+ obtains d where "gauge d"
+ "\p1 p2. p1 tagged_division_of ({a..b} \ {x. x\k \ c}) \ d fine p1 \
+ p2 tagged_division_of ({a..b} \ {x. x\k \ c}) \ d fine p2 \
+ norm ((setsum (\(x,k). content k *\<^sub>R f x) p1 + setsum (\(x,k). content k *\<^sub>R f x) p2) - i) < e"
+proof -
+ guess d using has_integralD[OF assms(1-2)] . note d=this
+ show ?thesis
+ apply (rule that[of d])
+ apply (rule d)
+ apply rule
+ apply rule
+ apply rule
+ apply (elim conjE)
+ proof -
+ fix p1 p2
+ assume "p1 tagged_division_of {a..b} \ {x. x \ k \ c}" "d fine p1"
+ note p1=tagged_division_ofD[OF this(1)] this
+ assume "p2 tagged_division_of {a..b} \ {x. c \ x \ k}" "d fine p2"
+ note p2=tagged_division_ofD[OF this(1)] this
note tagged_division_union_interval[OF p1(7) p2(7)] note p12 = tagged_division_ofD[OF this] this
- have "norm ((\(x, k)\p1. content k *\<^sub>R f x) + (\(x, k)\p2. content k *\<^sub>R f x) - i) = norm ((\(x, k)\p1 \ p2. content k *\<^sub>R f x) - i)"
- apply(subst setsum_Un_zero) apply(rule p1 p2)+ apply(rule) unfolding split_paired_all split_conv
- proof- fix a b assume ab:"(a,b) \ p1 \ p2"
- have "(a,b) \ p1" using ab by auto from p1(4)[OF this] guess u v apply-by(erule exE)+ note uv =this
- have "b \ {x. x\