# HG changeset patch # User wenzelm # Date 1459720652 -7200 # Node ID 388719339ada7fe43336dc42b654c5bac3fb7303 # Parent 609f97d79bc282c710c071df90c650eff59857d0# Parent d9744f41a4eca4dc7b9849ea90ec5ffa5341d392 merged diff -r 609f97d79bc2 -r 388719339ada Admin/lib/Tools/build_doc --- a/Admin/lib/Tools/build_doc Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: build Isabelle documentation - -isabelle_admin_build jars || exit $? - - -case "$ISABELLE_JAVA_PLATFORM" in - x86-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" - ;; - x86_64-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" - ;; -esac - -declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" - -isabelle java "${JAVA_ARGS[@]}" isabelle.Build_Doc "$@" diff -r 609f97d79bc2 -r 388719339ada NEWS --- a/NEWS Sun Apr 03 10:25:17 2016 +0200 +++ b/NEWS Sun Apr 03 23:57:32 2016 +0200 @@ -259,6 +259,12 @@ *** System *** +* Many Isabelle tools that require a Java runtime system refer to the +settings ISABELLE_TOOL_JAVA_OPTIONS32 / ISABELLE_TOOL_JAVA_OPTIONS64, +depending on the underlying platform. The settings for "isabelle build" +ISABELLE_BUILD_JAVA_OPTIONS32 / ISABELLE_BUILD_JAVA_OPTIONS64 have been +discontinued. Potential INCOMPATIBILITY. + * The Isabelle system environment always ensures that the main executables are found within the shell search $PATH: "isabelle" and "isabelle_scala_script". diff -r 609f97d79bc2 -r 388719339ada bin/isabelle --- a/bin/isabelle Sun Apr 03 10:25:17 2016 +0200 +++ b/bin/isabelle Sun Apr 03 23:57:32 2016 +0200 @@ -18,46 +18,40 @@ source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2 -## diagnostics +## external tool (shell script) + +if [ "$#" -ge 1 -a "$1" != "-?" ] +then + TOOL_NAME="$1" -function usage() -{ - echo - echo "Usage: $PRG NAME [ARGS ...]" - echo - echo " Start Isabelle tool NAME with ARGS; pass \"-?\" for tool specific help." - echo - echo "Available tools:" - perl -w "$ISABELLE_HOME/lib/scripts/tools.pl" - exit 1 -} - -function fail() -{ - echo "$1" >&2 - exit 2 -} + splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}") + for DIR in "${TOOLS[@]}" + do + TOOL="$DIR/$TOOL_NAME" + case "$TOOL" in + *~ | *.orig) ;; + *) + if [ -f "$TOOL" -a -x "$TOOL" ]; then + shift + exec "$TOOL" "$@" + fi + ;; + esac + done +fi -## args - -[ "$#" -lt 1 -o "$1" = "-?" ] && usage +## internal tool or usage (Scala) -TOOLNAME="$1" -shift - - -## main +isabelle_admin_build jars || exit $? -splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}") +case "$ISABELLE_JAVA_PLATFORM" in + x86-*) + eval "declare -a JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS32)" + ;; + x86_64-*) + eval "declare -a JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS64)" + ;; +esac -for DIR in "${TOOLS[@]}" -do - TOOL="$DIR/$TOOLNAME" - case "$TOOL" in - *~ | *.orig) ;; - *) [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" ;; - esac -done - -fail "Unknown Isabelle tool: $TOOLNAME" +exec isabelle java "${JAVA_ARGS[@]}" isabelle.Isabelle_Tool "$@" diff -r 609f97d79bc2 -r 388719339ada etc/settings --- a/etc/settings Sun Apr 03 10:25:17 2016 +0200 +++ b/etc/settings Sun Apr 03 23:57:32 2016 +0200 @@ -16,6 +16,9 @@ ISABELLE_JAVA_SYSTEM_OPTIONS="-server -Dfile.encoding=UTF-8 -Disabelle.threads=0" +ISABELLE_TOOL_JAVA_OPTIONS32="-Djava.awt.headless=true -Xms128m -Xmx1024m -Xss1m" +ISABELLE_TOOL_JAVA_OPTIONS64="-Djava.awt.headless=true -Xms512m -Xmx2560m -Xss4m" + classpath "$ISABELLE_HOME/lib/classes/Pure.jar" #paranoia settings -- avoid intrusion of alien options @@ -39,9 +42,6 @@ ISABELLE_BUILD_OPTIONS="" -ISABELLE_BUILD_JAVA_OPTIONS32="-Djava.awt.headless=true -Xms128m -Xmx1024m -Xss1m" -ISABELLE_BUILD_JAVA_OPTIONS64="-Djava.awt.headless=true -Xms512m -Xmx2560m -Xss4m" - ### ### Document preparation (cf. isabelle latex/document) diff -r 609f97d79bc2 -r 388719339ada lib/Tools/build --- a/lib/Tools/build Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: build and manage Isabelle sessions - -isabelle_admin_build jars || exit $? - -case "$ISABELLE_JAVA_PLATFORM" in - x86-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" - ;; - x86_64-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" - ;; -esac - -eval "declare -a JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" - -exec isabelle java "${JAVA_ARGS[@]}" isabelle.Build "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/check_sources --- a/lib/Tools/check_sources Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: some sanity checks for Isabelle sources - -isabelle_admin_build jars || exit $? - -isabelle java isabelle.Check_Sources "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/console --- a/lib/Tools/console Sun Apr 03 10:25:17 2016 +0200 +++ b/lib/Tools/console Sun Apr 03 23:57:32 2016 +0200 @@ -8,14 +8,14 @@ case "$ISABELLE_JAVA_PLATFORM" in x86-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" + ISABELLE_TOOL_JAVA_OPTIONS="$ISABELLE_TOOL_JAVA_OPTIONS32" ;; x86_64-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" + ISABELLE_TOOL_JAVA_OPTIONS="$ISABELLE_TOOL_JAVA_OPTIONS64" ;; esac -declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" +declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS)" mkdir -p "$ISABELLE_TMP_PREFIX" || exit $? diff -r 609f97d79bc2 -r 388719339ada lib/Tools/doc --- a/lib/Tools/doc Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Markus Wenzel, TU Muenchen -# -# DESCRIPTION: view Isabelle documentation - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Doc "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/getenv --- a/lib/Tools/getenv Sun Apr 03 10:25:17 2016 +0200 +++ b/lib/Tools/getenv Sun Apr 03 23:57:32 2016 +0200 @@ -57,6 +57,7 @@ # args +[ -z "$ALL" -a -z "$DUMP" -a "$#" -eq 0 ] && usage [ -n "$ALL" -a "$#" -ne 0 ] && usage diff -r 609f97d79bc2 -r 388719339ada lib/Tools/options --- a/lib/Tools/options Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: print Isabelle system options - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Options "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/process --- a/lib/Tools/process Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: raw ML process (batch mode) - -isabelle_admin_build jars || exit $? - -case "$ISABELLE_JAVA_PLATFORM" in - x86-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" - ;; - x86_64-*) - ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" - ;; -esac - -declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" - -mkdir -p "$ISABELLE_TMP_PREFIX" || exit $? - -exec isabelle java isabelle.ML_Process "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/update_cartouches --- a/lib/Tools/update_cartouches Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: update theory syntax to use cartouches - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Update_Cartouches "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/update_header --- a/lib/Tools/update_header Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: replace obsolete theory header command - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Update_Header "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/update_then --- a/lib/Tools/update_then Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: expand old Isar command conflations 'hence' and 'thus' - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Update_Then "$@" diff -r 609f97d79bc2 -r 388719339ada lib/Tools/update_theorems --- a/lib/Tools/update_theorems Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Author: Makarius -# -# DESCRIPTION: update toplevel theorem keywords - -isabelle_admin_build jars || exit $? - -exec isabelle java isabelle.Update_Theorems "$@" diff -r 609f97d79bc2 -r 388719339ada lib/scripts/tools.pl --- a/lib/scripts/tools.pl Sun Apr 03 10:25:17 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -# -# Author: Makarius -# -# tools.pl - list Isabelle tools with description -# - -use strict; -use warnings; - -my @tools = (); - -for my $dir (split(":", $ENV{"ISABELLE_TOOLS"})) { - if (-d $dir) { - if (opendir DIR, $dir) { - for my $name (readdir DIR) { - my $file = "$dir/$name"; - if (-f $file and -x $file and !($file =~ /~$/ or $file =~ /\.orig$/)) { - if (open FILE, $file) { - my $description; - while () { - if (!defined($description) and m/DESCRIPTION: *(.*)$/) { - $description = $1; - } - } - close FILE; - if (defined($description)) { - push(@tools, " $name - $description\n"); - } - } - } - } - closedir DIR; - } - } -} - -for (sort @tools) { print }; diff -r 609f97d79bc2 -r 388719339ada src/Doc/System/Environment.thy --- a/src/Doc/System/Environment.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Doc/System/Environment.thy Sun Apr 03 23:57:32 2016 +0200 @@ -267,7 +267,7 @@ @{verbatim [display] \Usage: isabelle TOOL [ARGS ...] - Start Isabelle tool NAME with ARGS; pass "-?" for tool specific help. + Start Isabelle TOOL with ARGS; pass "-?" for tool-specific help. Available tools: ...\} diff -r 609f97d79bc2 -r 388719339ada src/Doc/System/Sessions.thy --- a/src/Doc/System/Sessions.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Doc/System/Sessions.thy Sun Apr 03 23:57:32 2016 +0200 @@ -270,7 +270,6 @@ Build and manage Isabelle sessions, depending on implicit settings: ISABELLE_BUILD_OPTIONS="..." - ISABELLE_BUILD_JAVA_OPTIONS="..." ML_PLATFORM="..." ML_HOME="..." diff -r 609f97d79bc2 -r 388719339ada src/Doc/antiquote_setup.ML --- a/src/Doc/antiquote_setup.ML Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Doc/antiquote_setup.ML Sun Apr 03 23:57:32 2016 +0200 @@ -157,17 +157,6 @@ (Context_Position.report ctxt pos (Options.default_markup (name, pos)); true) handle ERROR _ => false; -fun check_tool ctxt (name, pos) = - let - fun tool dir = - let val path = Path.append dir (Path.basic name) - in if File.exists path then SOME path else NONE end; - in - (case get_first tool (Path.split (getenv "ISABELLE_TOOLS")) of - NONE => false - | SOME path => (Context_Position.report ctxt pos (Markup.path (Path.implode path)); true)) - end; - val arg = enclose "{" "}" o clean_string; fun entity check markup binding index = @@ -220,7 +209,7 @@ entity_antiqs check_system_option "isasystem" @{binding system_option} #> entity_antiqs no_check "" @{binding inference} #> entity_antiqs no_check "isasystem" @{binding executable} #> - entity_antiqs check_tool "isatool" @{binding tool} #> + entity_antiqs no_check "isatool" @{binding tool} #> entity_antiqs ML_Context.check_antiquotation "" @{binding ML_antiquotation} #> entity_antiqs (K JEdit.check_action) "isasystem" @{binding action}); diff -r 609f97d79bc2 -r 388719339ada src/HOL/Library/Complete_Partial_Order2.thy --- a/src/HOL/Library/Complete_Partial_Order2.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/HOL/Library/Complete_Partial_Order2.thy Sun Apr 03 23:57:32 2016 +0200 @@ -2,7 +2,7 @@ Author: Andreas Lochbihler, ETH Zurich *) -section {* Formalisation of chain-complete partial orders, continuity and admissibility *} +section \Formalisation of chain-complete partial orders, continuity and admissibility\ theory Complete_Partial_Order2 imports Main @@ -83,10 +83,10 @@ fix x' assume "x' \ (\f. f x) ` Y" then obtain f where "f \ Y" "x' = f x" by blast - note `x' = f x` also - from `f \ Y` `x \ y` have "f x \ f y" by(blast dest: mono monotoneD) + note \x' = f x\ also + from \f \ Y\ \x \ y\ have "f x \ f y" by(blast dest: mono monotoneD) also have "\ \ \((\f. f y) ` Y)" using chain'' - by(rule ccpo_Sup_upper)(simp add: `f \ Y`) + by(rule ccpo_Sup_upper)(simp add: \f \ Y\) finally show "x' \ \((\f. f y) ` Y)" . qed qed @@ -108,9 +108,9 @@ fix x' assume "x' \ f x ` Y" then obtain y' where "y' \ Y" "x' = f x y'" by blast note this(2) - also from mono1[OF `y' \ Y`] le have "\ \ f y y'" by(rule monotoneD) + also from mono1[OF \y' \ Y\] le have "\ \ f y y'" by(rule monotoneD) also have "\ \ ?rhs" using chain'[OF y] - by (auto intro!: ccpo_Sup_upper simp add: `y' \ Y`) + by (auto intro!: ccpo_Sup_upper simp add: \y' \ Y\) finally show "x' \ ?rhs" . qed(rule x) @@ -128,17 +128,17 @@ fix x' assume "x' \ (\x. \(f x ` Y)) ` Y" then obtain y' where "y' \ Y" "x' = \(f y' ` Y)" by blast note this(2) - also have "\ \ ?rhs" using chain2[OF `y' \ Y`] + also have "\ \ ?rhs" using chain2[OF \y' \ Y\] proof(rule ccpo_Sup_least) fix x assume "x \ f y' ` Y" then obtain y where "y \ Y" and x: "x = f y' y" by blast def y'' \ "if y \ y' then y' else y" - from chain `y \ Y` `y' \ Y` have "y \ y' \ y' \ y" by(rule chainD) - hence "f y' y \ f y'' y''" using `y \ Y` `y' \ Y` + from chain \y \ Y\ \y' \ Y\ have "y \ y' \ y' \ y" by(rule chainD) + hence "f y' y \ f y'' y''" using \y \ Y\ \y' \ Y\ by(auto simp add: y''_def intro: mono2 monotoneD[OF mono1]) - also from `y \ Y` `y' \ Y` have "y'' \ Y" by(simp add: y''_def) - from chain3 have "f y'' y'' \ ?rhs" by(rule ccpo_Sup_upper)(simp add: `y'' \ Y`) + also from \y \ Y\ \y' \ Y\ have "y'' \ Y" by(simp add: y''_def) + from chain3 have "f y'' y'' \ ?rhs" by(rule ccpo_Sup_upper)(simp add: \y'' \ Y\) finally show "x \ ?rhs" by(simp add: x) qed finally show "x' \ ?rhs" . @@ -149,9 +149,9 @@ fix y assume "y \ (\x. f x x) ` Y" then obtain x where "x \ Y" and "y = f x x" by blast note this(2) - also from chain2[OF `x \ Y`] have "\ \ \(f x ` Y)" - by(rule ccpo_Sup_upper)(simp add: `x \ Y`) - also have "\ \ ?lhs" by(rule ccpo_Sup_upper[OF chain1])(simp add: `x \ Y`) + also from chain2[OF \x \ Y\] have "\ \ \(f x ` Y)" + by(rule ccpo_Sup_upper)(simp add: \x \ Y\) + also have "\ \ ?lhs" by(rule ccpo_Sup_upper[OF chain1])(simp add: \x \ Y\) finally show "y \ ?lhs" . qed qed @@ -171,8 +171,8 @@ fix x assume "x \ f ` Y" then obtain y where "y \ Y" and "x = f y" by blast note this(2) - also have "y \ \Y" using ccpo chain `y \ Y` by(rule ccpo.ccpo_Sup_upper) - hence "f y \ f (\Y)" using `y \ Y` by(rule mono) + also have "y \ \Y" using ccpo chain \y \ Y\ by(rule ccpo.ccpo_Sup_upper) + hence "f y \ f (\Y)" using \y \ Y\ by(rule mono) finally show "x \ \" . qed @@ -196,14 +196,14 @@ fix f g assume "f \ Z" "g \ Z" and "fun_ord op \ f g" - from chain1[OF `f \ Z`] show "\(f ` Y) \ \(g ` Y)" + from chain1[OF \f \ Z\] show "\(f ` Y) \ \(g ` Y)" proof(rule ccpo_Sup_least) fix x assume "x \ f ` Y" then obtain y where "y \ Y" "x = f y" by blast note this(2) - also have "\ \ g y" using `fun_ord op \ f g` by(simp add: fun_ord_def) - also have "\ \ \(g ` Y)" using chain1[OF `g \ Z`] - by(rule ccpo_Sup_upper)(simp add: `y \ Y`) + also have "\ \ g y" using \fun_ord op \ f g\ by(simp add: fun_ord_def) + also have "\ \ \(g ` Y)" using chain1[OF \g \ Z\] + by(rule ccpo_Sup_upper)(simp add: \y \ Y\) finally show "x \ \(g ` Y)" . qed qed @@ -219,9 +219,9 @@ fix x' assume "x' \ (\f. f x) ` Z" then obtain f where "f \ Z" "x' = f x" by blast note this(2) - also have "f x \ f y" using `f \ Z` `x \ y` by(rule monotoneD[OF mono]) + also have "f x \ f y" using \f \ Z\ \x \ y\ by(rule monotoneD[OF mono]) also have "f y \ ?rhs" using chain3 - by(rule ccpo_Sup_upper)(simp add: `f \ Z`) + by(rule ccpo_Sup_upper)(simp add: \f \ Z\) finally show "x' \ ?rhs" . qed qed @@ -231,14 +231,14 @@ fix x assume "x \ (\x. \(x ` Y)) ` Z" then obtain f where "f \ Z" "x = \(f ` Y)" by blast note this(2) - also have "\ \ ?rhs" using chain1[OF `f \ Z`] + also have "\ \ ?rhs" using chain1[OF \f \ Z\] proof(rule ccpo_Sup_least) fix x' assume "x' \ f ` Y" then obtain y where "y \ Y" "x' = f y" by blast note this(2) also have "f y \ \((\f. f y) ` Z)" using chain3 - by(rule ccpo_Sup_upper)(simp add: `f \ Z`) - also have "\ \ ?rhs" using chain4 by(rule ccpo_Sup_upper)(simp add: `y \ Y`) + by(rule ccpo_Sup_upper)(simp add: \f \ Z\) + also have "\ \ ?rhs" using chain4 by(rule ccpo_Sup_upper)(simp add: \y \ Y\) finally show "x' \ ?rhs" . qed finally show "x \ ?rhs" . @@ -254,10 +254,10 @@ fix x' assume "x' \ (\f. f y) ` Z" then obtain f where "f \ Z" "x' = f y" by blast note this(2) - also have "f y \ \(f ` Y)" using chain1[OF `f \ Z`] - by(rule ccpo_Sup_upper)(simp add: `y \ Y`) + also have "f y \ \(f ` Y)" using chain1[OF \f \ Z\] + by(rule ccpo_Sup_upper)(simp add: \y \ Y\) also have "\ \ ?lhs" using chain2 - by(rule ccpo_Sup_upper)(simp add: `f \ Z`) + by(rule ccpo_Sup_upper)(simp add: \f \ Z\) finally show "x' \ ?lhs" . qed finally show "x \ ?lhs" . @@ -314,9 +314,9 @@ assume "x' \ (\f. f x) ` ?iter" then obtain f where "f \ ?iter" "x' = f x" by blast note this(2) also have "f x \ f y" - by(rule monotoneD[OF iterates_mono[OF `f \ ?iter` mono2]])(blast intro: `x \ y`)+ + by(rule monotoneD[OF iterates_mono[OF \f \ ?iter\ mono2]])(blast intro: \x \ y\)+ also have "f y \ \((\f. f y) ` ?iter)" using chain - by(rule ccpo_Sup_upper)(simp add: `f \ ?iter`) + by(rule ccpo_Sup_upper)(simp add: \f \ ?iter\) finally show "x' \ \" . qed qed @@ -333,7 +333,7 @@ shows "monotone orda ordc (\x. f x (t x))" by(blast intro: monotoneI transpD[OF trans] monotoneD[OF t] monotoneD[OF 2] monotoneD[OF 1]) -subsection {* Continuity *} +subsection \Continuity\ definition cont :: "('a set \ 'a) \ ('a \ 'a \ bool) \ ('b set \ 'b) \ ('b \ 'b \ bool) \ ('a \ 'b) \ bool" where @@ -345,10 +345,10 @@ "mcont luba orda lubb ordb f \ monotone orda ordb f \ cont luba orda lubb ordb f" -subsubsection {* Theorem collection @{text cont_intro} *} +subsubsection \Theorem collection \cont_intro\\ named_theorems cont_intro "continuity and admissibility intro rules" -ML {* +ML \ (* apply cont_intro rules as intro and try to solve the remaining of the emerging subgoals with simp *) fun cont_intro_tac ctxt = @@ -374,13 +374,13 @@ end handle THM _ => NONE | TYPE _ => NONE -*} +\ simproc_setup "cont_intro" ( "ccpo.admissible lub ord P" | "mcont lub ord lub' ord' f" | "monotone ord ord' f" - ) = {* K cont_intro_simproc *} + ) = \K cont_intro_simproc\ lemmas [cont_intro] = call_mono @@ -604,10 +604,10 @@ fix x' assume "x' \ (\f. f x) ` ?iter" then obtain f where "f \ ?iter" "x' = f x" by blast note this(2) - also from _ `x \ y` have "f x \ f y" - by(rule mcont_monoD[OF iterates_mcont[OF `f \ ?iter` mcont]]) + also from _ \x \ y\ have "f x \ f y" + by(rule mcont_monoD[OF iterates_mcont[OF \f \ ?iter\ mcont]]) also have "f y \ \((\f. f y) ` ?iter)" using chain - by(rule ccpo_Sup_upper)(simp add: `f \ ?iter`) + by(rule ccpo_Sup_upper)(simp add: \f \ ?iter\) finally show "x' \ \" . qed next @@ -783,7 +783,7 @@ end -subsection {* Admissibility *} +subsection \Admissibility\ lemma admissible_subst: assumes adm: "ccpo.admissible luba orda (\x. P x)" @@ -860,10 +860,10 @@ fix x assume "x \ f ` A" then obtain y where "y \ A" "x = f y" by blast note this(2) - also have "f y \ g y" using le `y \ A` by simp + also have "f y \ g y" using le \y \ A\ by simp also have "Complete_Partial_Order.chain op \ (g ` A)" using chain by(rule chain_imageI)(rule mcont_monoD[OF g]) - hence "g y \ \(g ` A)" by(rule ccpo_Sup_upper)(simp add: `y \ A`) + hence "g y \ \(g ` A)" by(rule ccpo_Sup_upper)(simp add: \y \ A\) finally show "x \ \" . qed also have "\ = g (luba A)" by(simp add: mcont_contD[OF g] chain False) @@ -992,7 +992,7 @@ end -subsection {* @{term "op ="} as order *} +subsection \@{term "op ="} as order\ definition lub_singleton :: "('a set \ 'a) \ bool" where "lub_singleton lub \ (\a. lub {a} = a)" @@ -1038,7 +1038,7 @@ \ mcont the_Sup op = lub ord f" by(simp add: mcont_def cont_eqI monotone_eqI) -subsection {* ccpo for products *} +subsection \ccpo for products\ definition prod_lub :: "('a set \ 'a) \ ('b set \ 'b) \ ('a \ 'b) set \ 'a \ 'b" where "prod_lub Sup_a Sup_b Y = (Sup_a (fst ` Y), Sup_b (snd ` Y))" @@ -1197,7 +1197,7 @@ with cont have "f (prod_lub luba lubb ?Y) = lubc (f ` ?Y)" by(rule contD) moreover have "f ` ?Y = (\y. f (x, y)) ` Y" by auto ultimately show "f (x, lubb Y) = lubc ((\y. f (x, y)) ` Y)" using luba - by(simp add: prod_lub_def `Y \ {}` lub_singleton_def) + by(simp add: prod_lub_def \Y \ {}\ lub_singleton_def) qed lemma cont_prodD2: @@ -1253,9 +1253,9 @@ have "f (prod_lub luba lubb Y) = f (luba (fst ` Y), lubb (snd ` Y))" by(simp add: prod_lub_def) also from cont2 have "f (luba (fst ` Y), lubb (snd ` Y)) = \((\x. f (x, lubb (snd ` Y))) ` fst ` Y)" - by(rule contD)(simp_all add: chain_rel_prodD1[OF chain] `Y \ {}`) + by(rule contD)(simp_all add: chain_rel_prodD1[OF chain] \Y \ {}\) also from cont1 have "\x. f (x, lubb (snd ` Y)) = \((\y. f (x, y)) ` snd ` Y)" - by(rule contD)(simp_all add: chain_rel_prodD2[OF chain] `Y \ {}`) + by(rule contD)(simp_all add: chain_rel_prodD2[OF chain] \Y \ {}\) hence "\((\x. f (x, lubb (snd ` Y))) ` fst ` Y) = \((\x. \ x) ` fst ` Y)" by simp also have "\ = \((\x. f (fst x, snd x)) ` Y)" unfolding image_image split_def using chain @@ -1330,7 +1330,7 @@ shows "monotone orda ordb (\f. case_prod (pair f) x)" by(rule monotoneI)(auto split: prod.split dest: monotoneD[OF assms]) -subsection {* Complete lattices as ccpo *} +subsection \Complete lattices as ccpo\ context complete_lattice begin @@ -1374,8 +1374,8 @@ fix y assume "y \ op \ x ` Y" then obtain z where "y = x \ z" and "z \ Y" by blast - from `z \ Y` have "z \ \Y" by(rule Sup_upper) - with _ show "y \ x \ \Y" unfolding `y = x \ z` by(rule sup_mono) simp + from \z \ Y\ have "z \ \Y" by(rule Sup_upper) + with _ show "y \ x \ \Y" unfolding \y = x \ z\ by(rule sup_mono) simp next fix y assume upper: "\z. z \ op \ x ` Y \ z \ y" @@ -1385,8 +1385,8 @@ assume "z \ insert x Y" from assms obtain z' where "z' \ Y" by blast let ?z = "if z \ Y then x \ z else x \ z'" - have "z \ x \ ?z" using `z' \ Y` `z \ insert x Y` by auto - also have "\ \ y" by(rule upper)(auto split: if_split_asm intro: `z' \ Y`) + have "z \ x \ ?z" using \z' \ Y\ \z \ insert x Y\ by auto + also have "\ \ y" by(rule upper)(auto split: if_split_asm intro: \z' \ Y\) finally show "z \ y" . qed qed @@ -1426,14 +1426,14 @@ interpretation lfp: partial_function_definitions "op \ :: _ :: complete_lattice \ _" Sup by(rule complete_lattice_partial_function_definitions) -declaration {* Partial_Function.init "lfp" @{term lfp.fixp_fun} @{term lfp.mono_body} - @{thm lfp.fixp_rule_uc} @{thm lfp.fixp_induct_uc} NONE *} +declaration \Partial_Function.init "lfp" @{term lfp.fixp_fun} @{term lfp.mono_body} + @{thm lfp.fixp_rule_uc} @{thm lfp.fixp_induct_uc} NONE\ interpretation gfp: partial_function_definitions "op \ :: _ :: complete_lattice \ _" Inf by(rule complete_lattice_partial_function_definitions_dual) -declaration {* Partial_Function.init "gfp" @{term gfp.fixp_fun} @{term gfp.mono_body} - @{thm gfp.fixp_rule_uc} @{thm gfp.fixp_induct_uc} NONE *} +declaration \Partial_Function.init "gfp" @{term gfp.fixp_fun} @{term gfp.mono_body} + @{thm gfp.fixp_rule_uc} @{thm gfp.fixp_induct_uc} NONE\ lemma insert_mono [partial_function_mono]: "monotone (fun_ord op \) op \ A \ monotone (fun_ord op \) op \ (\y. insert x (A y))" @@ -1505,23 +1505,23 @@ fix u assume "u \ (\x. g x z) ` Y" then obtain y' where "u = g y' z" "y' \ Y" by auto - from chain `y \ Y` `y' \ Y` have "ord y y' \ ord y' y" by(rule chainD) + from chain \y \ Y\ \y' \ Y\ have "ord y y' \ ord y' y" by(rule chainD) thus "u \ ?rhs" proof - note `u = g y' z` also + note \u = g y' z\ also assume "ord y y'" with f have "f y \ f y'" by(rule mcont_monoD) - with `z \ f y` + with \z \ f y\ have "g y' z \ \(g y' ` f y')" by(auto intro: Sup_upper) - also have "\ \ ?rhs" using `y' \ Y` by(auto intro: Sup_upper) + also have "\ \ ?rhs" using \y' \ Y\ by(auto intro: Sup_upper) finally show ?thesis . next - note `u = g y' z` also + note \u = g y' z\ also assume "ord y' y" with g have "g y' z \ g y z" by(rule mcont_monoD) - also have "\ \ \(g y ` f y)" using `z \ f y` + also have "\ \ \(g y ` f y)" using \z \ f y\ by(auto intro: Sup_upper) - also have "\ \ ?rhs" using `y \ Y` by(auto intro: Sup_upper) + also have "\ \ ?rhs" using \y \ Y\ by(auto intro: Sup_upper) finally show ?thesis . qed qed @@ -1537,11 +1537,11 @@ fix u assume "u \ g y ` f y" then obtain z where "u = g y z" "z \ f y" by auto - note `u = g y z` + note \u = g y z\ also have "g y z \ \((\x. g x z) ` Y)" - using `y \ Y` by(auto intro: Sup_upper) + using \y \ Y\ by(auto intro: Sup_upper) also have "\ = g (lub Y) z" by(simp add: mcont_contD[OF g chain Y]) - also have "\ \ ?lhs" using `z \ f y` `y \ Y` + also have "\ \ ?lhs" using \z \ f y\ \y \ Y\ by(auto intro: Sup_upper simp add: mcont_contD[OF f chain Y]) finally show "u \ ?lhs" . qed @@ -1567,7 +1567,7 @@ shows admissible_Bex: "ccpo.admissible Union op \ (\A. \x\A. P x)" by(rule ccpo.admissibleI)(auto) -subsection {* Parallel fixpoint induction *} +subsection \Parallel fixpoint induction\ context fixes luba :: "'a set \ 'a" diff -r 609f97d79bc2 -r 388719339ada src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/HOL/Library/Multiset.thy Sun Apr 03 23:57:32 2016 +0200 @@ -443,7 +443,7 @@ interpretation subset_mset: ordered_ab_semigroup_add_imp_le "op +" "op -" "op \#" "op \#" by standard (auto simp add: subset_mset_def subseteq_mset_def multiset_eq_iff intro: order_trans antisym) - -- \FIXME: avoid junk stemming from type class interpretation\ + \ \FIXME: avoid junk stemming from type class interpretation\ lemma mset_less_eqI: "(\a. count A a \ count B a) \ A \# B" @@ -464,7 +464,7 @@ by standard (simp, fact mset_le_exists_conv) declare subset_mset.zero_order[simp del] - -- \this removes some simp rules not in the usual order for multisets\ + \ \this removes some simp rules not in the usual order for multisets\ lemma mset_le_mono_add_right_cancel [simp]: "(A::'a multiset) + C \# B + C \ A \# B" by (fact subset_mset.add_le_cancel_right) @@ -587,7 +587,7 @@ show "class.semilattice_inf op #\ op \# op \#" by standard (auto simp add: multiset_inter_def subseteq_mset_def) qed - -- \FIXME: avoid junk stemming from type class interpretation\ + \ \FIXME: avoid junk stemming from type class interpretation\ lemma multiset_inter_count [simp]: fixes A B :: "'a multiset" @@ -712,7 +712,7 @@ subsubsection \Bounded union\ definition sup_subset_mset :: "'a multiset \ 'a multiset \ 'a multiset"(infixl "#\" 70) - where "sup_subset_mset A B = A + (B - A)" -- \FIXME irregular fact name\ + where "sup_subset_mset A B = A + (B - A)" \ \FIXME irregular fact name\ interpretation subset_mset: semilattice_sup sup_subset_mset "op \#" "op \#" proof - @@ -721,9 +721,9 @@ show "class.semilattice_sup op #\ op \# op \#" by standard (auto simp add: sup_subset_mset_def subseteq_mset_def) qed - -- \FIXME: avoid junk stemming from type class interpretation\ - -lemma sup_subset_mset_count [simp]: -- \FIXME irregular fact name\ + \ \FIXME: avoid junk stemming from type class interpretation\ + +lemma sup_subset_mset_count [simp]: \ \FIXME irregular fact name\ "count (A #\ B) x = max (count A x) (count B x)" by (simp add: sup_subset_mset_def) @@ -1554,8 +1554,8 @@ "\i \# A. b" \ "CONST msetsum (CONST image_mset (\i. b) A)" abbreviation Union_mset :: "'a multiset multiset \ 'a multiset" ("\#_" [900] 900) - where "\# MM \ msetsum MM" -- \FIXME ambiguous notation -- - could likewise refer to @{text "\#"}\ + where "\# MM \ msetsum MM" \ \FIXME ambiguous notation -- + could likewise refer to \\#\\ lemma set_mset_Union_mset[simp]: "set_mset (\# MM) = (\M \ set_mset MM. set_mset M)" by (induct MM) auto @@ -2115,7 +2115,7 @@ unfolding less_multiset_def mult_def by (blast intro: trancl_trans) show "class.order (le_multiset :: 'a multiset \ _) less_multiset" by standard (auto simp add: le_multiset_def irrefl dest: trans) -qed -- \FIXME avoid junk stemming from type class interpretation\ +qed \ \FIXME avoid junk stemming from type class interpretation\ lemma mult_less_irrefl [elim!]: fixes M :: "'a::order multiset" diff -r 609f97d79bc2 -r 388719339ada src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy --- a/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy Sun Apr 03 23:57:32 2016 +0200 @@ -606,10 +606,10 @@ shows "valid_path (f o g)" proof - obtain s where "finite s" and g_diff: "g C1_differentiable_on {0..1} - s" - using `valid_path g` unfolding valid_path_def piecewise_C1_differentiable_on_def by auto + using \valid_path g\ unfolding valid_path_def piecewise_C1_differentiable_on_def by auto have "f \ g differentiable at t" when "t\{0..1} - s" for t proof (rule differentiable_chain_at) - show "g differentiable at t" using `valid_path g` + show "g differentiable at t" using \valid_path g\ by (meson C1_differentiable_on_eq \g C1_differentiable_on {0..1} - s\ that) next have "g t\path_image g" using that DiffD1 image_eqI path_image_def by metis @@ -627,7 +627,7 @@ next have "continuous_on {0..1} (\x. deriv f (g x))" using continuous_on_compose[OF _ con[unfolded path_image_def],unfolded comp_def] - `valid_path g` piecewise_C1_differentiable_on_def valid_path_def + \valid_path g\ piecewise_C1_differentiable_on_def valid_path_def by blast then show "continuous_on ({0..1} - s) (\x. deriv f (g x))" using continuous_on_subset by blast @@ -650,14 +650,14 @@ have "isCont f x" when "x\path_image g" for x proof - obtain f' where "(f has_field_derivative f') (at x)" - using der[rule_format] `x\path_image g` by auto + using der[rule_format] \x\path_image g\ by auto thus ?thesis using DERIV_isCont by auto qed then have "continuous_on (path_image g) f" using continuous_at_imp_continuous_on by auto - then show ?thesis using path_continuous_image `valid_path g` valid_path_imp_path by auto + then show ?thesis using path_continuous_image \valid_path g\ valid_path_imp_path by auto qed ultimately show ?thesis unfolding valid_path_def piecewise_C1_differentiable_on_def path_def - using `finite s` by auto + using \finite s\ by auto qed @@ -5730,13 +5730,13 @@ lemma valid_path_compose_holomorphic: assumes "valid_path g" and holo:"f holomorphic_on s" and "open s" "path_image g \ s" shows "valid_path (f o g)" -proof (rule valid_path_compose[OF `valid_path g`]) +proof (rule valid_path_compose[OF \valid_path g\]) fix x assume "x \ path_image g" then show "\f'. (f has_field_derivative f') (at x)" - using holo holomorphic_on_open[OF `open s`] `path_image g \ s` by auto + using holo holomorphic_on_open[OF \open s\] \path_image g \ s\ by auto next have "deriv f holomorphic_on s" - using holomorphic_deriv holo `open s` by auto + using holomorphic_deriv holo \open s\ by auto then show "continuous_on (path_image g) (deriv f)" using assms(4) holomorphic_on_imp_continuous_on holomorphic_on_subset by auto qed diff -r 609f97d79bc2 -r 388719339ada src/HOL/Multivariate_Analysis/Conformal_Mappings.thy --- a/src/HOL/Multivariate_Analysis/Conformal_Mappings.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Conformal_Mappings.thy Sun Apr 03 23:57:32 2016 +0200 @@ -964,7 +964,7 @@ proof - have f0: "(f \ 0) at_infinity" proof - - have DIM_complex[intro]: "2 \ DIM(complex)" --\should not be necessary!\ + have DIM_complex[intro]: "2 \ DIM(complex)" \\should not be necessary!\ by simp have "continuous_on (inverse ` (ball 0 r - {0})) f" using continuous_on_subset holf holomorphic_on_imp_continuous_on by blast @@ -2149,61 +2149,61 @@ proof - assume "n>m" have "(h \ 0) (at z within ball z r)" - proof (rule Lim_transform_within[OF _ `r>0`, where f="\w. (w - z) ^ (n - m) * g w"]) - have "\w\ball z r. w\z \ h w = (w-z)^(n-m) * g w" using `n>m` asm + proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) ^ (n - m) * g w"]) + have "\w\ball z r. w\z \ h w = (w-z)^(n-m) * g w" using \n>m\ asm by (auto simp add:field_simps power_diff) then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ \ (x' - z) ^ (n - m) * g x' = h x'" for x' by auto next def F\"at z within ball z r" and f'\"\x. (x - z) ^ (n-m)" - have "f' z=0" using `n>m` unfolding f'_def by auto + have "f' z=0" using \n>m\ unfolding f'_def by auto moreover have "continuous F f'" unfolding f'_def F_def by (intro continuous_intros) ultimately have "(f' \ 0) F" unfolding F_def by (simp add: continuous_within) moreover have "(g \ g z) F" - using holomorphic_on_imp_continuous_on[OF g_holo,unfolded continuous_on_def] `r>0` + using holomorphic_on_imp_continuous_on[OF g_holo,unfolded continuous_on_def] \r>0\ unfolding F_def by auto ultimately show " ((\w. f' w * g w) \ 0) F" using tendsto_mult by fastforce qed moreover have "(h \ h z) (at z within ball z r)" using holomorphic_on_imp_continuous_on[OF h_holo] - by (auto simp add:continuous_on_def `r>0`) - moreover have "at z within ball z r \ bot" using `r>0` + by (auto simp add:continuous_on_def \r>0\) + moreover have "at z within ball z r \ bot" using \r>0\ by (auto simp add:trivial_limit_within islimpt_ball) ultimately have "h z=0" by (auto intro: tendsto_unique) - thus False using asm `r>0` by auto + thus False using asm \r>0\ by auto qed moreover have "m>n \ False" proof - assume "m>n" have "(g \ 0) (at z within ball z r)" - proof (rule Lim_transform_within[OF _ `r>0`, where f="\w. (w - z) ^ (m - n) * h w"]) - have "\w\ball z r. w\z \ g w = (w-z)^(m-n) * h w" using `m>n` asm + proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) ^ (m - n) * h w"]) + have "\w\ball z r. w\z \ g w = (w-z)^(m-n) * h w" using \m>n\ asm by (auto simp add:field_simps power_diff) then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ \ (x' - z) ^ (m - n) * h x' = g x'" for x' by auto next def F\"at z within ball z r" and f'\"\x. (x - z) ^ (m-n)" - have "f' z=0" using `m>n` unfolding f'_def by auto + have "f' z=0" using \m>n\ unfolding f'_def by auto moreover have "continuous F f'" unfolding f'_def F_def by (intro continuous_intros) ultimately have "(f' \ 0) F" unfolding F_def by (simp add: continuous_within) moreover have "(h \ h z) F" - using holomorphic_on_imp_continuous_on[OF h_holo,unfolded continuous_on_def] `r>0` + using holomorphic_on_imp_continuous_on[OF h_holo,unfolded continuous_on_def] \r>0\ unfolding F_def by auto ultimately show " ((\w. f' w * h w) \ 0) F" using tendsto_mult by fastforce qed moreover have "(g \ g z) (at z within ball z r)" using holomorphic_on_imp_continuous_on[OF g_holo] - by (auto simp add:continuous_on_def `r>0`) - moreover have "at z within ball z r \ bot" using `r>0` + by (auto simp add:continuous_on_def \r>0\) + moreover have "at z within ball z r \ bot" using \r>0\ by (auto simp add:trivial_limit_within islimpt_ball) ultimately have "g z=0" by (auto intro: tendsto_unique) - thus False using asm `r>0` by auto + thus False using asm \r>0\ by auto qed ultimately show "n=m" by fastforce qed @@ -2220,18 +2220,18 @@ g:"g holomorphic_on ball z r" "\w. w \ ball z r \ f w = (w - z) ^ n * g w" "\w. w \ ball z r \ g w \ 0" - using holomorphic_factor_zero_nonconstant[OF holo `open s` `connected s` `z\s` `f z=0`] + using holomorphic_factor_zero_nonconstant[OF holo \open s\ \connected s\ \z\s\ \f z=0\] by (metis assms(3) assms(5) assms(6)) def r'\"r/2" have "cball z r' \ ball z r" unfolding r'_def by (simp add: \0 < r\ cball_subset_ball_iff) hence "cball z r' \ s" "g holomorphic_on cball z r'" "(\w\cball z r'. f w = (w - z) ^ n * g w \ g w \ 0)" - using g `ball z r \ s` by auto - moreover have "r'>0" unfolding r'_def using `0ball z r \ s\ by auto + moreover have "r'>0" unfolding r'_def using \0 by auto ultimately show "\n g r. 0 < n \ 0 < r \ g holomorphic_on cball z r \ (\w\cball z r. f w = (w - z) ^ n * g w \ g w \ 0)" apply (intro exI[of _ n] exI[of _ g] exI[of _ r']) - by (simp add:`0 < n`) + by (simp add:\0 < n\) next fix m n def fac\"\n g r. \w\cball z r. f w = (w - z) ^ n * g w \ g w \ 0" @@ -2242,7 +2242,7 @@ obtain h r2 where "0 < m" "0 < r2" and h_holo: "h holomorphic_on cball z r2" and "fac m h r2" using m_asm by auto def r\"min r1 r2" - have "r>0" using `r1>0` `r2>0` unfolding r_def by auto + have "r>0" using \r1>0\ \r2>0\ unfolding r_def by auto moreover have "\w\ball z r. f w = (w-z)^n * g w \ g w\0 \ f w = (w - z)^m * h w \ h w\0" using \fac m h r2\ \fac n g r1\ unfolding fac_def r_def by fastforce @@ -2257,11 +2257,11 @@ proof fix p assume "p\s" then obtain e1 where "0 < e1" and e1_b:"ball p e1 \ s" - using open_contains_ball_eq[OF `open s`] by auto + using open_contains_ball_eq[OF \open s\] by auto obtain e2 where "0x\pts. x \ p \ e2 \ dist p x" - using finite_set_avoid[OF `finite pts`,of p] by auto + using finite_set_avoid[OF \finite pts\,of p] by auto hence "\w\ball p (min e1 e2). w\s \ (w\p \ w\pts)" using e1_b by auto - thus "\e>0. \w\ball p e. w \ s \ (w \ p \ w \ pts)" using `e2>0` `e1>0` + thus "\e>0. \w\ball p e. w \ s \ (w \ p \ w \ pts)" using \e2>0\ \e1>0\ apply (rule_tac x="min e1 e2" in exI) by auto qed @@ -2275,33 +2275,33 @@ then obtain e1 where "e1>0" and e1: "\w\ball p e1. w\s \ (w\p \ w\pts)" using finite_ball_avoid[OF assms] by auto def e2\"e1/2" - have "e2>0" and "e20` by auto + have "e2>0" and "e2e1>0\ by auto then have "cball p e2 \ ball p e1" by (subst cball_subset_ball_iff,auto) - then show "\e>0. \w\cball p e. w \ s \ (w \ p \ w \ pts)" using `e2>0` e1 by auto + then show "\e>0. \w\cball p e. w \ s \ (w \ p \ w \ pts)" using \e2>0\ e1 by auto qed lemma get_integrable_path: assumes "open s" "connected (s-pts)" "finite pts" "f holomorphic_on (s-pts) " "a\s-pts" "b\s-pts" obtains g where "valid_path g" "pathstart g = a" "pathfinish g = b" "path_image g \ s-pts" "f contour_integrable_on g" using assms -proof (induct arbitrary:s thesis a rule:finite_induct[OF `finite pts`]) print_cases +proof (induct arbitrary:s thesis a rule:finite_induct[OF \finite pts\]) print_cases case 1 obtain g where "valid_path g" "path_image g \ s" "pathstart g = a" "pathfinish g = b" - using connected_open_polynomial_connected[OF `open s`,of a b ] `connected (s - {})` + using connected_open_polynomial_connected[OF \open s\,of a b ] \connected (s - {})\ valid_path_polynomial_function "1.prems"(6) "1.prems"(7) by auto moreover have "f contour_integrable_on g" - using contour_integrable_holomorphic_simple[OF _ `open s` `valid_path g` `path_image g \ s`,of f] - `f holomorphic_on s - {}` + using contour_integrable_holomorphic_simple[OF _ \open s\ \valid_path g\ \path_image g \ s\,of f] + \f holomorphic_on s - {}\ by auto ultimately show ?case using "1"(1)[of g] by auto next case idt:(2 p pts) obtain e where "e>0" and e:"\w\ball a e. w \ s \ (w \ a \ w \ insert p pts)" - using finite_ball_avoid[OF `open s` `finite (insert p pts)`,rule_format,of a] - `a \ s - insert p pts` + using finite_ball_avoid[OF \open s\ \finite (insert p pts)\,rule_format,of a] + \a \ s - insert p pts\ by auto def a'\"a+e/2" - have "a'\s-{p} -pts" using e[rule_format,of "a+e/2"] `e>0` + have "a'\s-{p} -pts" using e[rule_format,of "a+e/2"] \e>0\ by (auto simp add:dist_complex_def a'_def) then obtain g' where g'[simp]:"valid_path g'" "pathstart g' = a'" "pathfinish g' = b" "path_image g' \ s - {p} - pts" "f contour_integrable_on g'" @@ -2312,7 +2312,7 @@ moreover have "pathstart g = a" and "pathfinish g = b" unfolding g_def by auto moreover have "path_image g \ s - insert p pts" unfolding g_def proof (rule subset_path_image_join) - have "closed_segment a a' \ ball a e" using `e>0` + have "closed_segment a a' \ ball a e" using \e>0\ by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute) then show "path_image (linepath a a') \ s - insert p pts" using e idt(9) by auto @@ -2321,7 +2321,7 @@ qed moreover have "f contour_integrable_on g" proof - - have "closed_segment a a' \ ball a e" using `e>0` + have "closed_segment a a' \ ball a e" using \e>0\ by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute) then have "continuous_on (closed_segment a a') f" using e idt.prems(6) holomorphic_on_imp_continuous_on[OF idt.prems(5)] @@ -2331,7 +2331,7 @@ using contour_integrable_continuous_linepath by auto then show ?thesis unfolding g_def apply (rule contour_integrable_joinI) - by (auto simp add: `e>0`) + by (auto simp add: \e>0\) qed ultimately show ?case using idt.prems(1)[of g] by auto qed @@ -2343,32 +2343,32 @@ "\p\s. h p>0 \ (\w\cball p (h p). w\s \ (w\p \ w \ pts))" shows "contour_integral g f = (\p\pts. winding_number g p * contour_integral (circlepath p (h p)) f)" using assms -proof (induct arbitrary:s g rule:finite_induct[OF `finite pts`]) +proof (induct arbitrary:s g rule:finite_induct[OF \finite pts\]) case 1 then show ?case by (simp add: Cauchy_theorem_global contour_integral_unique) next case (2 p pts) - note fin[simp] = `finite (insert p pts)` - and connected = `connected (s - insert p pts)` - and valid[simp] = `valid_path g` - and g_loop[simp] = `pathfinish g = pathstart g` - and holo[simp]= `f holomorphic_on s - insert p pts` - and path_img = `path_image g \ s - insert p pts` - and winding = `\z. z \ s \ winding_number g z = 0` - and h = `\pa\s. 0 < h pa \ (\w\cball pa (h pa). w \ s \ (w \ pa \ w \ insert p pts))` + note fin[simp] = \finite (insert p pts)\ + and connected = \connected (s - insert p pts)\ + and valid[simp] = \valid_path g\ + and g_loop[simp] = \pathfinish g = pathstart g\ + and holo[simp]= \f holomorphic_on s - insert p pts\ + and path_img = \path_image g \ s - insert p pts\ + and winding = \\z. z \ s \ winding_number g z = 0\ + and h = \\pa\s. 0 < h pa \ (\w\cball pa (h pa). w \ s \ (w \ pa \ w \ insert p pts))\ have "h p>0" and "p\s" and h_p: "\w\cball p (h p). w \ s \ (w \ p \ w \ insert p pts)" - using h `insert p pts \ s` by auto + using h \insert p pts \ s\ by auto obtain pg where pg[simp]: "valid_path pg" "pathstart pg = pathstart g" "pathfinish pg=p+h p" "path_image pg \ s-insert p pts" "f contour_integrable_on pg" proof - have "p + h p\cball p (h p)" using h[rule_format,of p] by (simp add: \p \ s\ dist_norm) - then have "p + h p \ s - insert p pts" using h[rule_format,of p] `insert p pts \ s` + then have "p + h p \ s - insert p pts" using h[rule_format,of p] \insert p pts \ s\ by fastforce moreover have "pathstart g \ s - insert p pts " using path_img by auto ultimately show ?thesis - using get_integrable_path[OF `open s` connected fin holo,of "pathstart g" "p+h p"] that + using get_integrable_path[OF \open s\ connected fin holo,of "pathstart g" "p+h p"] that by blast qed obtain n::int where "n=winding_number g p" @@ -2394,7 +2394,7 @@ and "pathstart (n_circ 0) = p + h p" and "pathfinish (n_circ 0) = p + h p" and "p \ path_image (n_circ 0)" - unfolding n_circ_def p_circ_pt_def using `h p > 0` + unfolding n_circ_def p_circ_pt_def using \h p > 0\ by (auto simp add: dist_norm) show "winding_number (n_circ 0) p'=0 \ p'\path_image (n_circ 0)" when "p'\s- pts" for p' unfolding n_circ_def p_circ_pt_def @@ -2409,7 +2409,7 @@ case (Suc k) have n_Suc:"n_circ (Suc k) = p_circ +++ n_circ k" unfolding n_circ_def by auto have pcirc:"p \ path_image p_circ" "valid_path p_circ" "pathfinish p_circ = pathstart (n_circ k)" - using Suc(3) unfolding p_circ_def using `h p > 0` by (auto simp add: p_circ_def) + using Suc(3) unfolding p_circ_def using \h p > 0\ by (auto simp add: p_circ_def) have pcirc_image:"path_image p_circ \ s - insert p pts" proof - have "path_image p_circ \ cball p (h p)" using \0 < h p\ p_circ_def by auto @@ -2426,15 +2426,15 @@ proof - have "path_image p_circ = sphere p (h p)" unfolding p_circ_def using \0 < h p\ by auto - then show ?thesis unfolding n_Suc using Suc.hyps(5) `h p>0` + then show ?thesis unfolding n_Suc using Suc.hyps(5) \h p>0\ by (auto simp add: path_image_join[OF pcirc(3)] dist_norm) qed - then show "p \ path_image (n_circ (Suc k))" using `h p>0` by auto + then show "p \ path_image (n_circ (Suc k))" using \h p>0\ by auto show "winding_number (n_circ (Suc k)) p = of_nat (Suc k)" proof - have "winding_number p_circ p = 1" - by (simp add: `h p > 0` p_circ_def winding_number_circlepath_centre) - moreover have "p \ path_image (n_circ k)" using Suc(5) `h p>0` by auto + by (simp add: \h p > 0\ p_circ_def winding_number_circlepath_centre) + moreover have "p \ path_image (n_circ k)" using Suc(5) \h p>0\ by auto then have "winding_number (p_circ +++ n_circ k) p = winding_number p_circ p + winding_number (n_circ k) p" using valid_path_imp_path Suc.hyps(1) Suc.hyps(2) pcirc @@ -2485,14 +2485,14 @@ using n_circ unfolding cp_def by auto next have "sphere p (h p) \ s - insert p pts" - using h[rule_format,of p] `insert p pts \ s` by force + using h[rule_format,of p] \insert p pts \ s\ by force moreover have "p + complex_of_real (h p) \ s - insert p pts" using pg(3) pg(4) by (metis pathfinish_in_path_image subsetCE) ultimately show "path_image cp \ s - insert p pts" unfolding cp_def using n_circ(5) by auto next show "winding_number cp p = - n" - unfolding cp_def using winding_number_reversepath n_circ `h p>0` by auto + unfolding cp_def using winding_number_reversepath n_circ \h p>0\ by auto next show "winding_number cp p'=0 \ p' \ path_image cp" when "p'\s - pts" for p' unfolding cp_def @@ -2509,11 +2509,11 @@ qed def g'\"g +++ pg +++ cp +++ (reversepath pg)" have "contour_integral g' f = (\p\pts. winding_number g' p * contour_integral (circlepath p (h p)) f)" - proof (rule "2.hyps"(3)[of "s-{p}" "g'",OF _ _ `finite pts` ]) + proof (rule "2.hyps"(3)[of "s-{p}" "g'",OF _ _ \finite pts\ ]) show "connected (s - {p} - pts)" using connected by (metis Diff_insert2) - show "open (s - {p})" using `open s` by auto - show " pts \ s - {p}" using `insert p pts \ s` ` p \ pts` by blast - show "f holomorphic_on s - {p} - pts" using holo `p \ pts` by (metis Diff_insert2) + show "open (s - {p})" using \open s\ by auto + show " pts \ s - {p}" using \insert p pts \ s\ \ p \ pts\ by blast + show "f holomorphic_on s - {p} - pts" using holo \p \ pts\ by (metis Diff_insert2) show "valid_path g'" unfolding g'_def cp_def using n_circ valid pg g_loop by (auto intro!:valid_path_join ) @@ -2536,7 +2536,7 @@ have "winding_number (g +++ pg +++ cp +++ reversepath pg) z = winding_number g z + winding_number (pg +++ cp +++ (reversepath pg)) z" proof (rule winding_number_join) - show "path g" using `valid_path g` by simp + show "path g" using \valid_path g\ by simp show "z \ path_image g" using z path_img by auto show "path (pg +++ cp +++ reversepath pg)" using pg(3) cp by auto next @@ -2568,7 +2568,7 @@ finally have "winding_number g' z = winding_number g z + winding_number cp z" unfolding g'_def . moreover have "winding_number g z + winding_number cp z = 0" - using winding z `n=winding_number g p` by auto + using winding z \n=winding_number g p\ by auto ultimately show "winding_number g' z = 0" unfolding g'_def by auto qed show "\pa\s - {p}. 0 < h pa \ (\w\cball pa (h pa). w \ s - {p} \ (w \ pa \ w \ pts))" @@ -2581,7 +2581,7 @@ + contour_integral (pg +++ cp +++ reversepath pg) f" unfolding g'_def apply (subst Cauchy_Integral_Thm.contour_integral_join) - by (auto simp add:open_Diff[OF `open s`,OF finite_imp_closed[OF fin]] + by (auto simp add:open_Diff[OF \open s\,OF finite_imp_closed[OF fin]] intro!: contour_integrable_holomorphic_simple[OF holo _ _ path_img] contour_integrable_reversepath) also have "... = contour_integral g f + contour_integral pg f @@ -2596,7 +2596,7 @@ using contour_integral_reversepath by (auto simp add:contour_integrable_reversepath) also have "... = contour_integral g f - winding_number g p * contour_integral p_circ f" - using `n=winding_number g p` by auto + using \n=winding_number g p\ by auto finally show ?thesis . qed moreover have "winding_number g' p' = winding_number g p'" when "p'\pts" for p' @@ -2631,7 +2631,7 @@ ultimately show ?case unfolding p_circ_def apply (subst (asm) setsum.cong[OF refl, of pts _ "\p. winding_number g p * contour_integral (circlepath p (h p)) f"]) - by (auto simp add:setsum.insert[OF `finite pts` `p\pts`] algebra_simps) + by (auto simp add:setsum.insert[OF \finite pts\ \p\pts\] algebra_simps) qed @@ -2652,7 +2652,7 @@ have "pts=pts1 \ pts2" "pts1 \ pts2 = {}" "pts2 \ s={}" "pts1\s" unfolding pts1_def pts2_def by auto have "contour_integral g f = (\p\pts1. circ p)" unfolding circ_def - proof (rule Cauchy_theorem_aux[OF `open s` _ _ `pts1\s` _ `valid_path g` loop _ homo]) + proof (rule Cauchy_theorem_aux[OF \open s\ _ _ \pts1\s\ _ \valid_path g\ loop _ homo]) show "connected (s - pts1)" by (metis Diff_Int2 Int_absorb assms(2) pts1_def) show "finite pts1" using \pts = pts1 \ pts2\ assms(3) by auto show "f holomorphic_on s - pts1" by (metis Diff_Int2 Int_absorb holo pts1_def) @@ -2663,14 +2663,14 @@ moreover have "setsum circ pts2=0" proof - have "winding_number g p=0" when "p\pts2" for p - using `pts2 \ s={}` that homo[rule_format,of p] by auto + using \pts2 \ s={}\ that homo[rule_format,of p] by auto thus ?thesis unfolding circ_def apply (intro setsum.neutral) by auto qed moreover have "?R=setsum circ pts1 + setsum circ pts2" unfolding circ_def - using setsum.union_disjoint[OF _ _ `pts1 \ pts2 = {}`] `finite pts` `pts=pts1 \ pts2` + using setsum.union_disjoint[OF _ _ \pts1 \ pts2 = {}\] \finite pts\ \pts=pts1 \ pts2\ by blast ultimately show ?thesis apply (fold circ_def) @@ -2717,8 +2717,8 @@ have "(\!n. n>0 \ (\ h r. P h r n))" proof - have "\!n. \h r. n>0 \ P h r n" - using holomorphic_factor_zero_Ex1[OF `open s` `connected s` `z\s` holo `f z=0` - `\w\s. f w\0`] unfolding P_def + using holomorphic_factor_zero_Ex1[OF \open s\ \connected s\ \z\s\ holo \f z=0\ + \\w\s. f w\0\] unfolding P_def apply (subst mult.commute) by auto thus ?thesis by auto @@ -2738,10 +2738,10 @@ obtain r2 where "r2>0" "cball z r2 \ s" using assms(3) assms(5) open_contains_cball_eq by blast def r3\"min r1 r2" - have "P h r3 n" using `P h r1 n` `r2>0` unfolding P_def r3_def + have "P h r3 n" using \P h r1 n\ \r2>0\ unfolding P_def r3_def by auto - moreover have "cball z r3 \ s" using `cball z r2 \ s` unfolding r3_def by auto - ultimately show ?thesis using `n>0` unfolding P_def by auto + moreover have "cball z r3 \ s" using \cball z r2 \ s\ unfolding r3_def by auto + ultimately show ?thesis using \n>0\ unfolding P_def by auto qed lemma porder_exist: @@ -2756,8 +2756,8 @@ def zo\"zorder (inverse \ f) z" and zp\"zer_poly (inverse \ f) z" obtain r where "0 < zo" "0 < r" "cball z r \ s" and zp_holo: "zp holomorphic_on cball z r" and zp_fac: "\w\cball z r. (inverse \ f) w = zp w * (w - z) ^ zo \ zp w \ 0" - using zorder_exist[OF `open s` `connected s` `z\s` holo,folded zo_def zp_def] - `f z=0` `\w\s. f w\0` + using zorder_exist[OF \open s\ \connected s\ \z\s\ holo,folded zo_def zp_def] + \f z=0\ \\w\s. f w\0\ by auto have n:"n=zo" and h:"h=inverse o zp" unfolding n_def zo_def porder_def h_def zp_def pol_poly_def by simp_all @@ -2767,8 +2767,8 @@ using zp_fac unfolding h n comp_def by (metis divide_inverse_commute field_class.field_inverse_zero inverse_inverse_eq inverse_mult_distrib mult.commute) - moreover have "0 < n" unfolding n using `zo>0` by simp - ultimately show ?thesis using `0 < r` `cball z r \ s` by auto + moreover have "0 < n" unfolding n using \zo>0\ by simp + ultimately show ?thesis using \0 < r\ \cball z r \ s\ by auto qed lemma base_residue: @@ -2785,7 +2785,7 @@ r_b:"cball z r \ s" and h_holo:"h holomorphic_on cball z r" and h:"(\w\cball z r. f w = h w / (w - z) ^ n \ h w \ 0)" - using porder_exist[OF `open s` `connected s` `z\s` holo `f z=0` non_c] + using porder_exist[OF \open s\ \connected s\ \z\s\ holo \f z=0\ non_c] unfolding n_def h_def by auto def c\"complex_of_real (2 * pi) * \" have "residue f z = (deriv ^^ (n - 1)) h z / fact (n-1)" @@ -2795,15 +2795,15 @@ then have "((\u. h u / (u - z) ^ n) has_contour_integral c * residue f z) (circlepath z r)" using Cauchy_has_contour_integral_higher_derivative_circlepath[of z r h z "n -1" - ,unfolded Suc_diff_1[OF `n>0`],folded c_def] h_holo r_b - by (auto simp add:`r>0` holomorphic_on_imp_continuous_on holomorphic_on_subset) + ,unfolded Suc_diff_1[OF \n>0\],folded c_def] h_holo r_b + by (auto simp add:\r>0\ holomorphic_on_imp_continuous_on holomorphic_on_subset) then have "(f has_contour_integral c * residue f z) (circlepath z r)" proof (elim has_contour_integral_eq) fix x assume "x \ path_image (circlepath z r)" hence "x\cball z r" using \0 < r\ by auto then show "h x / (x - z) ^ n = f x" using h by auto qed - then show ?thesis using `r>0` `cball z r \ s` unfolding c_def by auto + then show ?thesis using \r>0\ \cball z r \ s\ unfolding c_def by auto qed theorem residue_theorem: @@ -2822,26 +2822,26 @@ def contour\"\p e. (f has_contour_integral c * residue f p) (circlepath p e)" def avoid\"\p e. \w\cball p e. w \ s \ (w \ p \ w \ pts)" have "poles \ pts" and "finite pts" - using poles `finite {p. f p=0}` unfolding pts_def is_pole_def by auto + using poles \finite {p. f p=0}\ unfolding pts_def is_pole_def by auto have "\e>0. avoid p e \ (p\poles \ contour p e)" when "p\s" for p proof - obtain e1 where e:"e1>0" and e:"avoid p e1" - using finite_cball_avoid[OF `open s` `finite pts`] `p\s` unfolding avoid_def by auto + using finite_cball_avoid[OF \open s\ \finite pts\] \p\s\ unfolding avoid_def by auto have "\e2>0. cball p e2 \ ball p e1 \ contour p e2" when "p\poles" unfolding c_def contour_def - proof (rule base_residue[of "ball p e1" p f,simplified,OF `e1>0`]) + proof (rule base_residue[of "ball p e1" p f,simplified,OF \e1>0\]) show "inverse \ f holomorphic_on ball p e1" proof - def f'\"inverse o f" have "f holomorphic_on ball p e1 - {p}" - using holo e `poles \ pts` unfolding avoid_def + using holo e \poles \ pts\ unfolding avoid_def apply (elim holomorphic_on_subset) by auto then have f'_holo:"f' holomorphic_on ball p e1 - {p}" unfolding f'_def comp_def apply (elim holomorphic_on_inverse) using e pts_def ball_subset_cball unfolding avoid_def by blast - moreover have "isCont f' p" using `p\poles` poles unfolding f'_def is_pole_def by auto + moreover have "isCont f' p" using \p\poles\ poles unfolding f'_def is_pole_def by auto ultimately show "f' holomorphic_on ball p e1" apply (elim no_isolated_singularity[rotated]) apply (auto simp add:continuous_on_eq_continuous_at[of "ball p e1",simplified]) @@ -2849,10 +2849,10 @@ holomorphic_on_imp_differentiable_at by fastforce qed next - show "f p = 0" using `p\poles` poles unfolding is_pole_def by auto + show "f p = 0" using \p\poles\ poles unfolding is_pole_def by auto next def p'\"p+e1/2" - have "p'\ball p e1" and "p'\p" using `e1>0` unfolding p'_def by (auto simp add:dist_norm) + have "p'\ball p e1" and "p'\p" using \e1>0\ unfolding p'_def by (auto simp add:dist_norm) then show "\w\ball p e1. f w \ 0" using e unfolding avoid_def apply (rule_tac x=p' in bexI) by (auto simp add:pts_def) @@ -2861,7 +2861,7 @@ def e3\"if p\poles then e2 else e1" have "avoid p e3" using e2 e that avoid_def e3_def by auto - moreover have "e3>0" using `e1>0` e2 unfolding e3_def by auto + moreover have "e3>0" using \e1>0\ e2 unfolding e3_def by auto moreover have " p\poles \ contour p e3" using e2 unfolding e3_def by auto ultimately show ?thesis by auto qed @@ -2870,12 +2870,12 @@ def cont\"\p. contour_integral (circlepath p (h p)) f" have "contour_integral \ f = (\p\poles. winding_number \ p * cont p)" unfolding cont_def - proof (rule Cauchy_theorem_singularities[OF `open s` `connected (s-poles)` _ holo `valid_path \` - loop `path_image \ \ s-poles` homo]) - show "finite poles" using `poles \ pts` and `finite pts` by (simp add: finite_subset) + proof (rule Cauchy_theorem_singularities[OF \open s\ \connected (s-poles)\ _ holo \valid_path \\ + loop \path_image \ \ s-poles\ homo]) + show "finite poles" using \poles \ pts\ and \finite pts\ by (simp add: finite_subset) next show "\p\s. 0 < h p \ (\w\cball p (h p). w \ s \ (w \ p \ w \ poles))" - using `poles \ pts` h unfolding avoid_def by blast + using \poles \ pts\ h unfolding avoid_def by blast qed also have "... = (\p\poles. c * (winding_number \ p * residue f p))" proof (rule setsum.cong[of poles poles,simplified]) @@ -2886,7 +2886,7 @@ then have "cont p=c*residue f p" unfolding cont_def apply (intro contour_integral_unique) - using h[unfolded contour_def] `p \ poles` by blast + using h[unfolded contour_def] \p \ poles\ by blast then show ?thesis by auto next assume "p\s" @@ -2925,12 +2925,12 @@ def cont_zero\"\ff p e. (ff has_contour_integral c * zorder f p * h p ) (circlepath p e)" def avoid\"\p e. \w\cball p e. w \ s \ (w \ p \ w \ pts)" have "poles \ pts" and "zeros \ pts" and "finite zeros" and "pts=zeros \ poles" - using poles `finite pts` unfolding pts_def zeros_def is_pole_def by auto + using poles \finite pts\ unfolding pts_def zeros_def is_pole_def by auto have "\e>0. avoid p e \ (p\poles \ cont_pole ff p e) \ (p\zeros \ cont_zero ff p e)" when "p\s" for p proof - obtain e1 where e:"e1>0" and e:"avoid p e1" - using finite_cball_avoid[OF `open s` `finite pts`] `p\s` unfolding avoid_def by auto + using finite_cball_avoid[OF \open s\ \finite pts\] \p\s\ unfolding avoid_def by auto have "\e2>0. cball p e2 \ ball p e1 \ cont_pole ff p e2" when "p\poles" proof - @@ -2941,7 +2941,7 @@ have "inverse \ f holomorphic_on ball p e1" proof - have "f holomorphic_on ball p e1 - {p}" - using f_holo e `poles \ pts` unfolding avoid_def + using f_holo e \poles \ pts\ unfolding avoid_def apply (elim holomorphic_on_subset) by auto then have inv_holo:"(inverse o f) holomorphic_on ball p e1 - {p}" @@ -2949,7 +2949,7 @@ apply (elim holomorphic_on_inverse) using e pts_def ball_subset_cball unfolding avoid_def by blast moreover have "isCont (inverse o f) p" - using `p\poles` poles unfolding is_pole_def by auto + using \p\poles\ poles unfolding is_pole_def by auto ultimately show "(inverse o f) holomorphic_on ball p e1" apply (elim no_isolated_singularity[rotated]) apply (auto simp add:continuous_on_eq_continuous_at[of "ball p e1",simplified]) @@ -2957,11 +2957,11 @@ holomorphic_on_imp_differentiable_at unfolding comp_def by fastforce qed - moreover have "f p = 0" using `p\poles` poles unfolding is_pole_def by auto + moreover have "f p = 0" using \p\poles\ poles unfolding is_pole_def by auto moreover have "\w\ball p e1. f w \ 0" proof - def p'\"p+e1/2" - have "p'\ball p e1" and "p'\p" using `e1>0` unfolding p'_def by (auto simp add:dist_norm) + have "p'\ball p e1" and "p'\p" using \e1>0\ unfolding p'_def by (auto simp add:dist_norm) then show "\w\ball p e1. f w \ 0" using e unfolding avoid_def apply (rule_tac x=p' in bexI) by (auto simp add:pts_def) @@ -2971,50 +2971,50 @@ "cball p r \ ball p e1" and pp_holo:"pp holomorphic_on cball p r" and pp_po:"(\w\cball p r. f w = pp w / (w - p) ^ po \ pp w \ 0)" - using porder_exist[of "ball p e1" p f,simplified,OF `e1>0`] unfolding po_def pp_def + using porder_exist[of "ball p e1" p f,simplified,OF \e1>0\] unfolding po_def pp_def by auto def e2\"r/2" - have "e2>0" using `r>0` unfolding e2_def by auto + have "e2>0" using \r>0\ unfolding e2_def by auto def anal\"\w. deriv pp w * h w / pp w" and prin\"\w. - of_nat po * h w / (w - p)" have "((\w. prin w + anal w) has_contour_integral - c * po * h p) (circlepath p e2)" proof (rule has_contour_integral_add[of _ _ _ _ 0,simplified]) have "ball p r \ s" using \cball p r \ ball p e1\ avoid_def ball_subset_cball e by blast then have "cball p e2 \ s" - using `r>0` unfolding e2_def by auto + using \r>0\ unfolding e2_def by auto then have "(\w. - of_nat po * h w) holomorphic_on cball p e2" using h_holo by (auto intro!: holomorphic_intros) then show "(prin has_contour_integral - c * of_nat po * h p ) (circlepath p e2)" using Cauchy_integral_circlepath_simple[folded c_def, of "\w. - of_nat po * h w"] - `e2>0` + \e2>0\ unfolding prin_def by (auto simp add: mult.assoc) have "anal holomorphic_on ball p r" unfolding anal_def - using pp_holo h_holo pp_po `ball p r \ s` + using pp_holo h_holo pp_po \ball p r \ s\ by (auto intro!: holomorphic_intros) then show "(anal has_contour_integral 0) (circlepath p e2)" - using e2_def `r>0` + using e2_def \r>0\ by (auto elim!: Cauchy_theorem_disc_simple) qed then have "cont_pole ff' p e2" unfolding cont_pole_def po_def proof (elim has_contour_integral_eq) fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using `r>0` by auto + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto def wp\"w-p" have "wp\0" and "pp w \0" - unfolding wp_def using `w\p` `w\ball p r` pp_po by auto + unfolding wp_def using \w\p\ \w\ball p r\ pp_po by auto moreover have der_f':"deriv f' w = - po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po" proof (rule DERIV_imp_deriv) def der \ "- po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po" - have po:"po = Suc (po - Suc 0) " using `po>0` by auto + have po:"po = Suc (po - Suc 0) " using \po>0\ by auto have "(pp has_field_derivative (deriv pp w)) (at w)" - using DERIV_deriv_iff_field_differentiable `w\ball p r` + using DERIV_deriv_iff_field_differentiable \w\ball p r\ holomorphic_on_imp_differentiable_at[of _ "ball p r"] holomorphic_on_subset [OF pp_holo ball_subset_cball] by (metis open_ball) then show "(f' has_field_derivative der) (at w)" - using `w\p` `po>0` unfolding der_def f'_def + using \w\p\ \po>0\ unfolding der_def f'_def apply (auto intro!: derivative_eq_intros simp add:field_simps) apply (subst (4) po) apply (subst power_Suc) @@ -3030,7 +3030,7 @@ then have "cont_pole ff p e2" unfolding cont_pole_def proof (elim has_contour_integral_eq) fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using `r>0` by auto + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto have "deriv f' w = deriv f w" proof (rule complex_derivative_transform_within_open[where s="ball p r - {p}"]) show "f' holomorphic_on ball p r - {p}" unfolding f'_def using pp_holo @@ -3038,14 +3038,14 @@ next have "ball p e1 - {p} \ s - poles" using avoid_def ball_subset_cball e \poles \ pts\ by auto - then have "ball p r - {p} \ s - poles" using `cball p r \ ball p e1` + then have "ball p r - {p} \ s - poles" using \cball p r \ ball p e1\ using ball_subset_cball by blast then show "f holomorphic_on ball p r - {p}" using f_holo by auto next show "open (ball p r - {p})" by auto next - show "w \ ball p r - {p}" using `w\ball p r` `w\p` by auto + show "w \ ball p r - {p}" using \w\ball p r\ \w\p\ by auto next fix x assume "x \ ball p r - {p}" then show "f' x = f x" @@ -3058,7 +3058,7 @@ qed moreover have "cball p e2 \ ball p e1" using \0 < r\ \cball p r \ ball p e1\ e2_def by auto - ultimately show ?thesis using `e2>0` by auto + ultimately show ?thesis using \e2>0\ by auto qed then obtain e2 where e2:"p\poles \ e2>0 \ cball p e2 \ ball p e1 \ cont_pole ff p e2" by auto @@ -3075,12 +3075,12 @@ using \poles \ pts\ avoid_def ball_subset_cball e that zeros_def by fastforce thus ?thesis using f_holo by auto qed - moreover have "f p = 0" using `p\zeros` + moreover have "f p = 0" using \p\zeros\ using DiffD1 mem_Collect_eq pts_def zeros_def by blast moreover have "\w\ball p e1. f w \ 0" proof - def p'\"p+e1/2" - have "p'\ball p e1" and "p'\p" using `e1>0` unfolding p'_def by (auto simp add:dist_norm) + have "p'\ball p e1" and "p'\p" using \e1>0\ unfolding p'_def by (auto simp add:dist_norm) then show "\w\ball p e1. f w \ 0" using e unfolding avoid_def apply (rule_tac x=p' in bexI) by (auto simp add:pts_def) @@ -3090,50 +3090,50 @@ "cball p r \ ball p e1" and pp_holo:"zp holomorphic_on cball p r" and pp_po:"(\w\cball p r. f w = zp w * (w - p) ^ zo \ zp w \ 0)" - using zorder_exist[of "ball p e1" p f,simplified,OF `e1>0`] unfolding zo_def zp_def + using zorder_exist[of "ball p e1" p f,simplified,OF \e1>0\] unfolding zo_def zp_def by auto def e2\"r/2" - have "e2>0" using `r>0` unfolding e2_def by auto + have "e2>0" using \r>0\ unfolding e2_def by auto def anal\"\w. deriv zp w * h w / zp w" and prin\"\w. of_nat zo * h w / (w - p)" have "((\w. prin w + anal w) has_contour_integral c * zo * h p) (circlepath p e2)" proof (rule has_contour_integral_add[of _ _ _ _ 0,simplified]) have "ball p r \ s" using \cball p r \ ball p e1\ avoid_def ball_subset_cball e by blast then have "cball p e2 \ s" - using `r>0` unfolding e2_def by auto + using \r>0\ unfolding e2_def by auto then have "(\w. of_nat zo * h w) holomorphic_on cball p e2" using h_holo by (auto intro!: holomorphic_intros) then show "(prin has_contour_integral c * of_nat zo * h p ) (circlepath p e2)" using Cauchy_integral_circlepath_simple[folded c_def, of "\w. of_nat zo * h w"] - `e2>0` + \e2>0\ unfolding prin_def by (auto simp add: mult.assoc) have "anal holomorphic_on ball p r" unfolding anal_def - using pp_holo h_holo pp_po `ball p r \ s` + using pp_holo h_holo pp_po \ball p r \ s\ by (auto intro!: holomorphic_intros) then show "(anal has_contour_integral 0) (circlepath p e2)" - using e2_def `r>0` + using e2_def \r>0\ by (auto elim!: Cauchy_theorem_disc_simple) qed then have "cont_zero ff' p e2" unfolding cont_zero_def zo_def proof (elim has_contour_integral_eq) fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using `r>0` by auto + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto def wp\"w-p" have "wp\0" and "zp w \0" - unfolding wp_def using `w\p` `w\ball p r` pp_po by auto + unfolding wp_def using \w\p\ \w\ball p r\ pp_po by auto moreover have der_f':"deriv f' w = zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" proof (rule DERIV_imp_deriv) def der\"zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" - have po:"zo = Suc (zo - Suc 0) " using `zo>0` by auto + have po:"zo = Suc (zo - Suc 0) " using \zo>0\ by auto have "(zp has_field_derivative (deriv zp w)) (at w)" - using DERIV_deriv_iff_field_differentiable `w\ball p r` + using DERIV_deriv_iff_field_differentiable \w\ball p r\ holomorphic_on_imp_differentiable_at[of _ "ball p r"] holomorphic_on_subset [OF pp_holo ball_subset_cball] by (metis open_ball) then show "(f' has_field_derivative der) (at w)" - using `w\p` `zo>0` unfolding der_def f'_def + using \w\p\ \zo>0\ unfolding der_def f'_def by (auto intro!: derivative_eq_intros simp add:field_simps) qed ultimately show "prin w + anal w = ff' w" @@ -3147,7 +3147,7 @@ then have "cont_zero ff p e2" unfolding cont_zero_def proof (elim has_contour_integral_eq) fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using `r>0` by auto + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto have "deriv f' w = deriv f w" proof (rule complex_derivative_transform_within_open[where s="ball p r - {p}"]) show "f' holomorphic_on ball p r - {p}" unfolding f'_def using pp_holo @@ -3155,14 +3155,14 @@ next have "ball p e1 - {p} \ s - poles" using avoid_def ball_subset_cball e \poles \ pts\ by auto - then have "ball p r - {p} \ s - poles" using `cball p r \ ball p e1` + then have "ball p r - {p} \ s - poles" using \cball p r \ ball p e1\ using ball_subset_cball by blast then show "f holomorphic_on ball p r - {p}" using f_holo by auto next show "open (ball p r - {p})" by auto next - show "w \ ball p r - {p}" using `w\ball p r` `w\p` by auto + show "w \ ball p r - {p}" using \w\ball p r\ \w\p\ by auto next fix x assume "x \ ball p r - {p}" then show "f' x = f x" @@ -3175,13 +3175,13 @@ qed moreover have "cball p e2 \ ball p e1" using \0 < r\ \cball p r \ ball p e1\ e2_def by auto - ultimately show ?thesis using `e2>0` by auto + ultimately show ?thesis using \e2>0\ by auto qed then obtain e3 where e3:"p\zeros \ e3>0 \ cball p e3 \ ball p e1 \ cont_zero ff p e3" by auto def e4\"if p\poles then e2 else if p\zeros then e3 else e1" - have "e4>0" using e2 e3 `e1>0` unfolding e4_def by auto - moreover have "avoid p e4" using e2 e3 `e1>0` e unfolding e4_def avoid_def by auto + have "e4>0" using e2 e3 \e1>0\ unfolding e4_def by auto + moreover have "avoid p e4" using e2 e3 \e1>0\ e unfolding e4_def avoid_def by auto moreover have "p\poles \ cont_pole ff p e4" and "p\zeros \ cont_zero ff p e4" by (auto simp add: e2 e3 e4_def pts_def zeros_def) ultimately show ?thesis by auto @@ -3193,17 +3193,17 @@ def w\"\p. winding_number g p" have "contour_integral g ff = (\p\pts. w p * cont p)" unfolding cont_def w_def - proof (rule Cauchy_theorem_singularities[OF `open s` connected finite _ `valid_path g` loop + proof (rule Cauchy_theorem_singularities[OF \open s\ connected finite _ \valid_path g\ loop path_img homo]) - have "open (s - pts)" using open_Diff[OF _ finite_imp_closed[OF finite]] `open s` by auto - then show "ff holomorphic_on s - pts" unfolding ff_def using f_holo `poles \ pts` h_holo + have "open (s - pts)" using open_Diff[OF _ finite_imp_closed[OF finite]] \open s\ by auto + then show "ff holomorphic_on s - pts" unfolding ff_def using f_holo \poles \ pts\ h_holo by (auto intro!: holomorphic_intros simp add:pts_def) next show "\p\s. 0 < get_e p \ (\w\cball p (get_e p). w \ s \ (w \ p \ w \ pts))" using get_e using avoid_def by blast qed also have "... = (\p\zeros. w p * cont p) + (\p\poles. w p * cont p)" - using `finite pts` unfolding `pts=zeros \ poles` + using \finite pts\ unfolding \pts=zeros \ poles\ apply (subst setsum.union_disjoint) by (auto simp add:zeros_def) also have "... = c * ((\p\zeros. w p * h p * zorder f p) - (\p\poles. w p * h p * porder f p))" @@ -3216,7 +3216,7 @@ assume "p \ s" have "cont p = c * h p * (zorder f p)" unfolding cont_def apply (rule contour_integral_unique) - using get_e `p\s` `p\zeros` unfolding cont_zero_def + using get_e \p\s\ \p\zeros\ unfolding cont_zero_def by (metis mult.assoc mult.commute) thus ?thesis by auto next @@ -3236,7 +3236,7 @@ assume "p \ s" have "cont p = - c * h p * (porder f p)" unfolding cont_def apply (rule contour_integral_unique) - using get_e `p\s` `p\poles` unfolding cont_pole_def + using get_e \p\s\ \p\poles\ unfolding cont_pole_def by (metis mult.assoc mult.commute) thus ?thesis by auto next @@ -3259,7 +3259,7 @@ proof (rule differentiable_at_imp_differentiable_on) fix x assume "x\s" obtain f' where "(f has_field_derivative f') (at x) " - using holomorphic_on_imp_differentiable_at[OF f_holo `open s` `x\s`] + using holomorphic_on_imp_differentiable_at[OF f_holo \open s\ \x\s\] unfolding field_differentiable_def by auto then have " (f has_derivative op * f') (at x)" using has_field_derivative_imp_has_derivative[of f f' "at x"] by auto @@ -3290,8 +3290,8 @@ proof - have False when "z\path_image \" and "f z + g z=0" for z proof - - have "cmod (f z) > cmod (g z)" using `z\path_image \` path_less by auto - moreover have "f z = - g z" using `f z + g z =0` by (simp add: eq_neg_iff_add_eq_0) + have "cmod (f z) > cmod (g z)" using \z\path_image \\ path_less by auto + moreover have "f z = - g z" using \f z + g z =0\ by (simp add: eq_neg_iff_add_eq_0) then have "cmod (f z) = cmod (g z)" by auto ultimately show False by auto qed @@ -3301,8 +3301,8 @@ proof - have False when "z\path_image \" and "f z =0" for z proof - - have "cmod (g z) < cmod (f z) " using `z\path_image \` path_less by auto - then have "cmod (g z) < 0" using `f z=0` by auto + have "cmod (g z) < cmod (f z) " using \z\path_image \\ path_less by auto + then have "cmod (g z) < 0" using \f z=0\ by auto then show False by auto qed then show ?thesis unfolding zeros_f_def using path_img by auto @@ -3312,7 +3312,7 @@ def h\"\p. g p / f p + 1" obtain spikes where "finite spikes" and spikes: "\x\{0..1} - spikes. \ differentiable at x" - using `valid_path \` + using \valid_path \\ by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) have h_contour:"((\x. deriv h x / h x) has_contour_integral 0) \" proof - @@ -3334,12 +3334,12 @@ by auto qed have valid_h:"valid_path (h \ \)" - proof (rule valid_path_compose_holomorphic[OF `valid_path \` _ _ path_f]) + proof (rule valid_path_compose_holomorphic[OF \valid_path \\ _ _ path_f]) show "h holomorphic_on s - zeros_f" unfolding h_def using f_holo g_holo by (auto intro!: holomorphic_intros simp add:zeros_f_def) next - show "open (s - zeros_f)" using `finite zeros_f` `open s` finite_imp_closed + show "open (s - zeros_f)" using \finite zeros_f\ \open s\ finite_imp_closed by auto qed have "((\z. 1/z) has_contour_integral 0) (h \ \)" @@ -3362,7 +3362,7 @@ moreover have "vector_derivative (h \ \) (at x) = vector_derivative \ (at x) * deriv h (\ x)" when "x\{0..1} - spikes" for x proof (rule vector_derivative_chain_at_general) - show "\ differentiable at x" using that `valid_path \` spikes by auto + show "\ differentiable at x" using that \valid_path \\ spikes by auto next def der\"\p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" def t\"\ x" @@ -3374,13 +3374,13 @@ unfolding h_def der_def using g_holo f_holo apply (auto intro!: derivative_eq_intros) by (auto simp add: DERIV_deriv_iff_field_differentiable - holomorphic_on_imp_differentiable_at[OF _ `open s`]) + holomorphic_on_imp_differentiable_at[OF _ \open s\]) then show "\g'. (h has_field_derivative g') (at (\ x))" unfolding t_def by auto qed then have " (op / 1 has_contour_integral 0) (h \ \) = ((\x. deriv h x / h x) has_contour_integral 0) \" unfolding has_contour_integral - apply (intro has_integral_spike_eq[OF negligible_finite, OF `finite spikes`]) + apply (intro has_integral_spike_eq[OF negligible_finite, OF \finite spikes\]) by auto ultimately show ?thesis by auto qed @@ -3390,8 +3390,8 @@ + contour_integral \ (\p. deriv h p / h p)" proof - have "(\p. deriv f p / f p) contour_integrable_on \" - proof (rule contour_integrable_holomorphic_simple[OF _ _ `valid_path \` path_f]) - show "open (s - zeros_f)" using finite_imp_closed[OF `finite zeros_f`] `open s` + proof (rule contour_integrable_holomorphic_simple[OF _ _ \valid_path \\ path_f]) + show "open (s - zeros_f)" using finite_imp_closed[OF \finite zeros_f\] \open s\ by auto then show "(\p. deriv f p / f p) holomorphic_on s - zeros_f" using f_holo @@ -3420,23 +3420,23 @@ ultimately show False by auto qed have der_fg:"deriv fg p = deriv f p + deriv g p" unfolding fg_def - using f_holo g_holo holomorphic_on_imp_differentiable_at[OF _ `open s`] path_img that + using f_holo g_holo holomorphic_on_imp_differentiable_at[OF _ \open s\] path_img that by (auto intro!: deriv_add) have der_h:"deriv h p = (deriv g p * f p - g p * deriv f p)/(f p * f p)" proof - def der\"\p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" have "p\s" using path_img that by auto then have "(h has_field_derivative der p) (at p)" - unfolding h_def der_def using g_holo f_holo `f p\0` + unfolding h_def der_def using g_holo f_holo \f p\0\ apply (auto intro!: derivative_eq_intros) by (auto simp add: DERIV_deriv_iff_field_differentiable - holomorphic_on_imp_differentiable_at[OF _ `open s`]) + holomorphic_on_imp_differentiable_at[OF _ \open s\]) then show ?thesis unfolding der_def using DERIV_imp_deriv by auto qed show ?thesis apply (simp only:der_fg der_h) - apply (auto simp add:field_simps `h p\0` `f p\0` `fg p\0`) - by (auto simp add:field_simps h_def `f p\0` fg_def) + apply (auto simp add:field_simps \h p\0\ \f p\0\ \fg p\0\) + by (auto simp add:field_simps h_def \f p\0\ fg_def) qed then have "contour_integral \ (\p. deriv fg p / fg p) = contour_integral \ (\p. deriv f p / f p + deriv h p / h p)" @@ -3445,19 +3445,19 @@ qed moreover have "contour_integral \ (\x. deriv fg x / fg x) = c * (\p\zeros_fg. w p * zorder fg p)" unfolding c_def zeros_fg_def w_def - proof (rule argument_principle[OF `open s` _ _ _ `valid_path \` loop _ homo, of _ "{}" "\_. 1",simplified]) + proof (rule argument_principle[OF \open s\ _ _ _ \valid_path \\ loop _ homo, of _ "{}" "\_. 1",simplified]) show "connected (s - {p. fg p = 0})" using connected_fg unfolding zeros_fg_def . show "fg holomorphic_on s" unfolding fg_def using f_holo g_holo holomorphic_on_add by auto show "path_image \ \ s - {p. fg p = 0}" using path_fg unfolding zeros_fg_def . - show " finite {p. fg p = 0}" using `finite zeros_fg` unfolding zeros_fg_def . + show " finite {p. fg p = 0}" using \finite zeros_fg\ unfolding zeros_fg_def . qed moreover have "contour_integral \ (\x. deriv f x / f x) = c * (\p\zeros_f. w p * zorder f p)" unfolding c_def zeros_f_def w_def - proof (rule argument_principle[OF `open s` _ _ _ `valid_path \` loop _ homo, of _ "{}" "\_. 1",simplified]) + proof (rule argument_principle[OF \open s\ _ _ _ \valid_path \\ loop _ homo, of _ "{}" "\_. 1",simplified]) show "connected (s - {p. f p = 0})" using connected_f unfolding zeros_f_def . show "f holomorphic_on s" using f_holo g_holo holomorphic_on_add by auto show "path_image \ \ s - {p. f p = 0}" using path_f unfolding zeros_f_def . - show "finite {p. f p = 0}" using `finite zeros_f` unfolding zeros_f_def . + show "finite {p. f p = 0}" using \finite zeros_f\ unfolding zeros_f_def . qed ultimately have "c * (\p\zeros_fg. w p * (zorder fg p)) = c* (\p\zeros_f. w p * (zorder f p))" by auto diff -r 609f97d79bc2 -r 388719339ada src/HOL/Multivariate_Analysis/Integration.thy --- a/src/HOL/Multivariate_Analysis/Integration.thy Sun Apr 03 10:25:17 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Integration.thy Sun Apr 03 23:57:32 2016 +0200 @@ -2409,7 +2409,7 @@ using has_integral_linear[OF _ bounded_linear_mult_left] by (simp add: comp_def) text\The case analysis eliminates the condition @{term "f integrable_on s"} at the cost - of the type class constraint @{text"division_ring"}\ + of the type class constraint \division_ring\\ corollary integral_mult_left [simp]: fixes c:: "'a::{real_normed_algebra,division_ring}" shows "integral s (\x. f x * c) = integral s f * c" diff -r 609f97d79bc2 -r 388719339ada src/Pure/General/file.scala --- a/src/Pure/General/file.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/General/file.scala Sun Apr 03 23:57:32 2016 +0200 @@ -141,7 +141,15 @@ if (path.is_file) path else error("No such file: " + path) - /* find files */ + /* directory content */ + + def read_dir(dir: Path): List[String] = + { + if (!dir.is_dir) error("Bad directory: " + dir.toString) + val files = dir.file.listFiles + if (files == null) Nil + else files.toList.map(_.getName) + } def find_files(start: JFile, pred: JFile => Boolean = _ => true): List[JFile] = { diff -r 609f97d79bc2 -r 388719339ada src/Pure/ML/ml_env.ML --- a/src/Pure/ML/ml_env.ML Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/ML/ml_env.ML Sun Apr 03 23:57:32 2016 +0200 @@ -57,12 +57,12 @@ val empty = make_data (true, (Symtab.empty, Symtab.empty, Symtab.empty, Symtab.empty, Symtab.empty, Symtab.empty), - (Symtab.make ML_Name_Space.initial_val, - Symtab.make ML_Name_Space.initial_type, - Symtab.make ML_Name_Space.initial_fixity, - Symtab.make ML_Name_Space.initial_structure, - Symtab.make ML_Name_Space.initial_signature, - Symtab.make ML_Name_Space.initial_functor), + (Symtab.make ML_Name_Space.sml_val, + Symtab.make ML_Name_Space.sml_type, + Symtab.make ML_Name_Space.sml_fixity, + Symtab.make ML_Name_Space.sml_structure, + Symtab.make ML_Name_Space.sml_signature, + Symtab.make ML_Name_Space.sml_functor), Inttab.empty); fun extend (data : T) = make_data (false, #tables data, #sml_tables data, #breakpoints data); fun merge (data : T * T) = diff -r 609f97d79bc2 -r 388719339ada src/Pure/ML/ml_name_space.ML --- a/src/Pure/ML/ml_name_space.ML Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/ML/ml_name_space.ML Sun Apr 03 23:57:32 2016 +0200 @@ -40,30 +40,35 @@ type valueVal = Values.value; fun displayVal (x, depth, space) = Values.printWithType (x, depth, SOME space); fun displayTypeExpression (x, depth, space) = Values.printType (x, depth, SOME space); - val initial_val = List.filter (fn (a, _) => a <> "use" andalso a <> "exit") (#allVal global ()); val forget_val = PolyML.Compiler.forgetValue; type typeVal = TypeConstrs.typeConstr; fun displayType (x, depth, space) = TypeConstrs.print (x, depth, SOME space); - val initial_type = #allType global (); val forget_type = PolyML.Compiler.forgetType; type fixityVal = Infixes.fixity; fun displayFix (_: string, x) = Infixes.print x; - val initial_fixity = #allFix global (); type structureVal = Structures.structureVal; fun displayStruct (x, depth, space) = Structures.print (x, depth, SOME space); - val initial_structure = - List.filter (fn (a, _) => not (List.exists (fn b => a = b) critical_structures)) - (#allStruct global ()); val forget_structure = PolyML.Compiler.forgetStructure; type signatureVal = Signatures.signatureVal; fun displaySig (x, depth, space) = Signatures.print (x, depth, SOME space); - val initial_signature = #allSig global (); type functorVal = Functors.functorVal; fun displayFunct (x, depth, space) = Functors.print (x, depth, SOME space); - val initial_functor = #allFunct global (); + + + (* Standard ML name space *) + + val sml_val = List.filter (fn (a, _) => a <> "use" andalso a <> "exit") (#allVal global ()); + val sml_type = #allType global (); + val sml_fixity = #allFix global (); + val sml_structure = + List.filter (fn (a, _) => a <> "PolyML" andalso a <> "ML_System" andalso + not (List.exists (fn b => a = b) critical_structures)) (#allStruct global ()); + val sml_signature = + List.filter (fn (a, _) => a <> "ML_SYSTEM" andalso a <> "ML_NAME_SPACE") (#allSig global ()); + val sml_functor = #allFunct global (); end; diff -r 609f97d79bc2 -r 388719339ada src/Pure/System/isabelle_system.ML --- a/src/Pure/System/isabelle_system.ML Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/System/isabelle_system.ML Sun Apr 03 23:57:32 2016 +0200 @@ -6,7 +6,6 @@ signature ISABELLE_SYSTEM = sig - val isabelle_tool: string -> string -> int val mkdirs: Path.T -> unit val mkdir: Path.T -> unit val copy_dir: Path.T -> Path.T -> unit @@ -37,29 +36,12 @@ in rc end; -(* system commands *) - -fun isabelle_tool name args = - (case space_explode ":" (getenv "ISABELLE_TOOLS") |> get_first (fn dir => - let - val path = Path.append (Path.explode dir) (Path.basic name); - val platform_path = File.platform_path path; - in - if can OS.FileSys.modTime platform_path andalso - not (OS.FileSys.isDir platform_path) andalso - OS.FileSys.access (platform_path, [OS.FileSys.A_READ, OS.FileSys.A_EXEC]) - then SOME path - else NONE - end handle OS.SysErr _ => NONE) of - SOME path => bash (File.bash_path path ^ " " ^ args) - | NONE => (warning ("Unknown Isabelle tool: " ^ name); 2)); +(* directory operations *) fun system_command cmd = - if bash cmd <> 0 then error ("System command failed: " ^ cmd) - else (); + if bash cmd <> 0 then error ("System command failed: " ^ cmd) else (); - -(* directory operations *) +fun rm_tree path = system_command ("rm -r -f " ^ File.bash_path path); fun mkdirs path = if File.is_dir path then () @@ -112,8 +94,6 @@ (* tmp dirs *) -fun rm_tree path = system_command ("rm -r -f " ^ File.bash_path path); - fun with_tmp_dir name f = let val path = create_tmp_path name ""; @@ -121,4 +101,3 @@ in Exn.release (Exn.capture f path before ignore (try rm_tree path)) end; end; - diff -r 609f97d79bc2 -r 388719339ada src/Pure/System/isabelle_tool.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/System/isabelle_tool.scala Sun Apr 03 23:57:32 2016 +0200 @@ -0,0 +1,109 @@ +/* Title: Pure/System/isabelle_tool.scala + Author: Makarius + +Isabelle system tools: external executables or internal Scala functions. +*/ + +package isabelle + + +object Isabelle_Tool +{ + /* external tools */ + + private def dirs(): List[Path] = Path.split(Isabelle_System.getenv_strict("ISABELLE_TOOLS")) + + private def is_external(dir: Path, name: String): Boolean = + { + val file = (dir + Path.basic(name)).file + try { + file.isFile && file.canRead && file.canExecute && + !name.endsWith("~") && !name.endsWith(".orig") + } + catch { case _: SecurityException => false } + } + + private def list_external(): List[(String, String)] = + { + val Description = """.*\bDESCRIPTION: *(.*)""".r + for { + dir <- dirs() if dir.is_dir + name <- File.read_dir(dir) if is_external(dir, name) + } yield { + val source = File.read(dir + Path.basic(name)) + val description = + split_lines(source).collectFirst({ case Description(s) => s }) getOrElse "" + (name, description) + } + } + + private def find_external(name: String): Option[List[String] => Unit] = + dirs.collectFirst({ case dir if is_external(dir, name) => + (args: List[String]) => + { + val tool = dir + Path.basic(name) + val result = Isabelle_System.bash(File.bash_path(tool) + " " + File.bash_args(args)) + sys.exit(result.print_stdout.rc) + } + }) + + + /* internal tools */ + + private var internal_tools = Map.empty[String, (String, List[String] => Nothing)] + + private def list_internal(): List[(String, String)] = + synchronized { + for ((name, (description, _)) <- internal_tools.toList) yield (name, description) + } + + private def find_internal(name: String): Option[List[String] => Unit] = + synchronized { internal_tools.get(name).map(_._2) } + + private def register(isabelle_tool: Isabelle_Tool): Unit = + synchronized { + internal_tools += + (isabelle_tool.name -> + (isabelle_tool.description, + args => Command_Line.tool0 { isabelle_tool.body(args) })) + } + + register(Build.isabelle_tool) + register(Build_Doc.isabelle_tool) + register(Check_Sources.isabelle_tool) + register(Doc.isabelle_tool) + register(ML_Process.isabelle_tool) + register(Options.isabelle_tool) + register(Update_Cartouches.isabelle_tool) + register(Update_Header.isabelle_tool) + register(Update_Then.isabelle_tool) + register(Update_Theorems.isabelle_tool) + + + /* command line entry point */ + + def main(args: Array[String]) + { + Command_Line.tool0 { + args.toList match { + case Nil | List("-?") => + val tool_descriptions = + (list_external() ::: list_internal()).sortBy(_._1). + map({ case (a, "") => a case (a, b) => a + " - " + b }) + Getopts(""" +Usage: isabelle TOOL [ARGS ...] + + Start Isabelle TOOL with ARGS; pass "-?" for tool-specific help. + +Available tools:""" + tool_descriptions.mkString("\n ", "\n ", "\n")).usage + case tool_name :: tool_args => + find_external(tool_name) orElse find_internal(tool_name) match { + case Some(tool) => tool(tool_args) + case None => error("Unknown Isabelle tool: " + quote(tool_name)) + } + } + } + } +} + +sealed case class Isabelle_Tool(name: String, description: String, body: List[String] => Unit) diff -r 609f97d79bc2 -r 388719339ada src/Pure/System/options.scala --- a/src/Pure/System/options.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/System/options.scala Sun Apr 03 23:57:32 2016 +0200 @@ -140,17 +140,16 @@ val encode: XML.Encode.T[Options] = (options => options.encode) - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("option", "print Isabelle system options", args => { - Command_Line.tool0 { - var build_options = false - var get_option = "" - var list_options = false - var export_file = "" + var build_options = false + var get_option = "" + var list_options = false + var export_file = "" - val getopts = Getopts(""" + val getopts = Getopts(""" Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...] Options are: @@ -162,34 +161,33 @@ Report Isabelle system options, augmented by MORE_OPTIONS given as arguments NAME=VAL or NAME. """, - "b" -> (_ => build_options = true), - "g:" -> (arg => get_option = arg), - "l" -> (_ => list_options = true), - "x:" -> (arg => export_file = arg)) + "b" -> (_ => build_options = true), + "g:" -> (arg => get_option = arg), + "l" -> (_ => list_options = true), + "x:" -> (arg => export_file = arg)) - val more_options = getopts(args) - if (get_option == "" && !list_options && export_file == "") getopts.usage() + val more_options = getopts(args) + if (get_option == "" && !list_options && export_file == "") getopts.usage() - val options = - { - val options0 = Options.init() - val options1 = - if (build_options) - (options0 /: Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")))(_ + _) - else options0 - (options1 /: more_options)(_ + _) - } + val options = + { + val options0 = Options.init() + val options1 = + if (build_options) + (options0 /: Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")))(_ + _) + else options0 + (options1 /: more_options)(_ + _) + } - if (get_option != "") - Console.println(options.check_name(get_option).value) + if (get_option != "") + Console.println(options.check_name(get_option).value) - if (export_file != "") - File.write(Path.explode(export_file), YXML.string_of_body(options.encode)) + if (export_file != "") + File.write(Path.explode(export_file), YXML.string_of_body(options.encode)) - if (get_option == "" && export_file == "") - Console.println(options.print) - } - } + if (get_option == "" && export_file == "") + Console.println(options.print) + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Thy/present.ML --- a/src/Pure/Thy/present.ML Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Thy/present.ML Sun Apr 03 23:57:32 2016 +0200 @@ -269,8 +269,8 @@ val doc_dir = Path.append doc_prefix (Path.basic doc_name); val _ = Isabelle_System.mkdirs doc_dir; val _ = - Isabelle_System.isabelle_tool "latex" - ("-o sty " ^ File.bash_path (Path.append doc_dir (Path.basic "root.tex"))); + Isabelle_System.bash ("isabelle latex -o sty " ^ + File.bash_path (Path.append doc_dir (Path.basic "root.tex"))); val _ = List.app (fn file => Isabelle_System.copy_file_base file doc_dir) doc_files; val _ = Isabelle_System.copy_file graph_file (Path.append doc_dir session_graph_path); val _ = write_tex_index tex_index doc_dir; @@ -360,8 +360,8 @@ val _ = Isabelle_System.mkdirs doc_path; val root_path = Path.append doc_path (Path.basic "root.tex"); val _ = Isabelle_System.copy_file (Path.explode "~~/lib/texinputs/draft.tex") root_path; - val _ = Isabelle_System.isabelle_tool "latex" ("-o sty " ^ File.bash_path root_path); - val _ = Isabelle_System.isabelle_tool "latex" ("-o syms " ^ File.bash_path root_path); + val _ = Isabelle_System.bash ("isabelle latex -o sty " ^ File.bash_path root_path); + val _ = Isabelle_System.bash ("isabelle latex -o syms " ^ File.bash_path root_path); fun known name = let val ss = split_lines (File.read (Path.append doc_path (Path.basic name))) @@ -382,8 +382,6 @@ val target = Path.explode "$ISABELLE_HOME_USER/tmp/drafts.pdf" val _ = Isabelle_System.mkdirs target_dir; val _ = Isabelle_System.copy_file result target; - in - Isabelle_System.isabelle_tool "display" (File.bash_path target ^ " &") - end); + in Isabelle_System.bash ("isabelle display " ^ File.bash_path target ^ " &") end); end; diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/build.scala --- a/src/Pure/Tools/build.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/build.scala Sun Apr 03 23:57:32 2016 +0200 @@ -685,43 +685,40 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("build", "build and manage Isabelle sessions", args => { - Command_Line.tool { - def show_settings(): String = - cat_lines(List( - "ISABELLE_BUILD_OPTIONS=" + - quote(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")), - "ISABELLE_BUILD_JAVA_OPTIONS=" + - quote(Isabelle_System.getenv("ISABELLE_BUILD_JAVA_OPTIONS")), - "", - "ML_PLATFORM=" + quote(Isabelle_System.getenv("ML_PLATFORM")), - "ML_HOME=" + quote(Isabelle_System.getenv("ML_HOME")), - "ML_SYSTEM=" + quote(Isabelle_System.getenv("ML_SYSTEM")), - "ML_OPTIONS=" + quote(Isabelle_System.getenv("ML_OPTIONS")))) + def show_settings(): String = + cat_lines(List( + "ISABELLE_BUILD_OPTIONS=" + + quote(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")), + "", + "ML_PLATFORM=" + quote(Isabelle_System.getenv("ML_PLATFORM")), + "ML_HOME=" + quote(Isabelle_System.getenv("ML_HOME")), + "ML_SYSTEM=" + quote(Isabelle_System.getenv("ML_SYSTEM")), + "ML_OPTIONS=" + quote(Isabelle_System.getenv("ML_OPTIONS")))) - val build_options = Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")) + val build_options = Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")) - var select_dirs: List[Path] = Nil - var requirements = false - var exclude_session_groups: List[String] = Nil - var all_sessions = false - var build_heap = false - var clean_build = false - var dirs: List[Path] = Nil - var session_groups: List[String] = Nil - var max_jobs = 1 - var check_keywords: Set[String] = Set.empty - var list_files = false - var no_build = false - var options = (Options.init() /: build_options)(_ + _) - var system_mode = false - var verbose = false - var exclude_sessions: List[String] = Nil + var select_dirs: List[Path] = Nil + var requirements = false + var exclude_session_groups: List[String] = Nil + var all_sessions = false + var build_heap = false + var clean_build = false + var dirs: List[Path] = Nil + var session_groups: List[String] = Nil + var max_jobs = 1 + var check_keywords: Set[String] = Set.empty + var list_files = false + var no_build = false + var options = (Options.init() /: build_options)(_ + _) + var system_mode = false + var verbose = false + var exclude_sessions: List[String] = Nil - val getopts = Getopts(""" + val getopts = Getopts(""" Usage: isabelle build [OPTIONS] [SESSIONS ...] Options are: @@ -745,58 +742,57 @@ Build and manage Isabelle sessions, depending on implicit settings: """ + Library.prefix_lines(" ", show_settings()), - "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))), - "R" -> (_ => requirements = true), - "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)), - "a" -> (_ => all_sessions = true), - "b" -> (_ => build_heap = true), - "c" -> (_ => clean_build = true), - "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), - "g:" -> (arg => session_groups = session_groups ::: List(arg)), - "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)), - "k:" -> (arg => check_keywords = check_keywords + arg), - "l" -> (_ => list_files = true), - "n" -> (_ => no_build = true), - "o:" -> (arg => options = options + arg), - "s" -> (_ => system_mode = true), - "v" -> (_ => verbose = true), - "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg))) + "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))), + "R" -> (_ => requirements = true), + "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)), + "a" -> (_ => all_sessions = true), + "b" -> (_ => build_heap = true), + "c" -> (_ => clean_build = true), + "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), + "g:" -> (arg => session_groups = session_groups ::: List(arg)), + "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)), + "k:" -> (arg => check_keywords = check_keywords + arg), + "l" -> (_ => list_files = true), + "n" -> (_ => no_build = true), + "o:" -> (arg => options = options + arg), + "s" -> (_ => system_mode = true), + "v" -> (_ => verbose = true), + "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg))) - val sessions = getopts(args) + val sessions = getopts(args) - val progress = new Console_Progress(verbose) + val progress = new Console_Progress(verbose) - if (verbose) { - progress.echo( - Library.trim_line( - Isabelle_System.bash( - """echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))" """).out) + "\n") - progress.echo(show_settings() + "\n") - } + if (verbose) { + progress.echo( + Library.trim_line( + Isabelle_System.bash( + """echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))" """).out) + "\n") + progress.echo(show_settings() + "\n") + } - val start_time = Time.now() - val results = - progress.interrupt_handler { - build(options, progress, requirements, all_sessions, build_heap, clean_build, - dirs, select_dirs, exclude_session_groups, session_groups, max_jobs, list_files, - check_keywords, no_build, system_mode, verbose, exclude_sessions, sessions) - } - val elapsed_time = Time.now() - start_time + val start_time = Time.now() + val results = + progress.interrupt_handler { + build(options, progress, requirements, all_sessions, build_heap, clean_build, + dirs, select_dirs, exclude_session_groups, session_groups, max_jobs, list_files, + check_keywords, no_build, system_mode, verbose, exclude_sessions, sessions) + } + val elapsed_time = Time.now() - start_time - if (verbose) { - progress.echo("\n" + - Library.trim_line( - Isabelle_System.bash("""echo -n "Finished at "; date""").out)) - } + if (verbose) { + progress.echo("\n" + + Library.trim_line( + Isabelle_System.bash("""echo -n "Finished at "; date""").out)) + } - val total_timing = - (Timing.zero /: results.sessions.iterator.map(a => results(a).timing))(_ + _). - copy(elapsed = elapsed_time) - progress.echo(total_timing.message_resources) + val total_timing = + (Timing.zero /: results.sessions.iterator.map(a => results(a).timing))(_ + _). + copy(elapsed = elapsed_time) + progress.echo(total_timing.message_resources) - results.rc - } - } + sys.exit(results.rc) + }) /* PIDE protocol */ diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/build_doc.scala --- a/src/Pure/Tools/build_doc.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/build_doc.scala Sun Apr 03 23:57:32 2016 +0200 @@ -67,17 +67,16 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("build_doc", "build Isabelle documentation", args => { - Command_Line.tool { - var all_docs = false - var max_jobs = 1 - var system_mode = false + var all_docs = false + var max_jobs = 1 + var system_mode = false - val getopts = - Getopts(""" + val getopts = + Getopts(""" Usage: isabelle build_doc [OPTIONS] [DOCS ...]" Options are: @@ -88,19 +87,20 @@ Build Isabelle documentation from documentation sessions with suitable document_variants entry. """, - "a" -> (_ => all_docs = true), - "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)), - "s" -> (_ => system_mode = true)) + "a" -> (_ => all_docs = true), + "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)), + "s" -> (_ => system_mode = true)) + + val docs = getopts(args) - val docs = getopts(args) + if (!all_docs && docs.isEmpty) getopts.usage() - if (!all_docs && docs.isEmpty) getopts.usage() - - val options = Options.init() - val progress = new Console_Progress() + val options = Options.init() + val progress = new Console_Progress() + val rc = progress.interrupt_handler { build_doc(options, progress, all_docs, max_jobs, system_mode, docs) } - } - } + sys.exit(rc) + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/check_sources.scala --- a/src/Pure/Tools/check_sources.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/check_sources.scala Sun Apr 03 23:57:32 2016 +0200 @@ -52,11 +52,11 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) - { - Command_Line.tool0 { + val isabelle_tool = + Isabelle_Tool("check_sources", "some sanity checks for Isabelle sources", args => + { val getopts = Getopts(""" Usage: isabelle check_sources [ROOT_DIRS...] @@ -67,6 +67,5 @@ if (specs.isEmpty) getopts.usage() for (root <- specs) check_hg(Path.explode(root)) - } - } + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/doc.scala --- a/src/Pure/Tools/doc.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/doc.scala Sun Apr 03 23:57:32 2016 +0200 @@ -91,28 +91,26 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("doc", "view Isabelle documentation", args => { - Command_Line.tool0 { - val getopts = Getopts(""" + val getopts = Getopts(""" Usage: isabelle doc [DOC ...] View Isabelle documentation. """) - val docs = getopts(args) + val docs = getopts(args) - val entries = contents() - if (docs.isEmpty) Console.println(cat_lines(contents_lines().map(_._2))) - else { - docs.foreach(doc => - entries.collectFirst { case Doc(name, _, path) if doc == name => path } match { - case Some(path) => view(path) - case None => error("No Isabelle documentation entry: " + quote(doc)) - } - ) - } + val entries = contents() + if (docs.isEmpty) Console.println(cat_lines(contents_lines().map(_._2))) + else { + docs.foreach(doc => + entries.collectFirst { case Doc(name, _, path) if doc == name => path } match { + case Some(path) => view(path) + case None => error("No Isabelle documentation entry: " + quote(doc)) + } + ) } - } + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/ml_process.scala --- a/src/Pure/Tools/ml_process.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/ml_process.scala Sun Apr 03 23:57:32 2016 +0200 @@ -102,18 +102,17 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("process", "raw ML process (batch mode)", args => { - Command_Line.tool { - var dirs: List[Path] = Nil - var eval_args: List[String] = Nil - var logic = Isabelle_System.getenv("ISABELLE_LOGIC") - var modes: List[String] = Nil - var options = Options.init() + var dirs: List[Path] = Nil + var eval_args: List[String] = Nil + var logic = Isabelle_System.getenv("ISABELLE_LOGIC") + var modes: List[String] = Nil + var options = Options.init() - val getopts = Getopts(""" + val getopts = Getopts(""" Usage: isabelle process [OPTIONS] Options are: @@ -127,20 +126,19 @@ Run the raw Isabelle ML process in batch mode. """, - "T:" -> (arg => - eval_args = eval_args ::: List("--eval", "use_thy " + ML_Syntax.print_string0(arg))), - "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), - "e:" -> (arg => eval_args = eval_args ::: List("--eval", arg)), - "f:" -> (arg => eval_args = eval_args ::: List("--use", arg)), - "l:" -> (arg => logic = arg), - "m:" -> (arg => modes = arg :: modes), - "o:" -> (arg => options = options + arg)) + "T:" -> (arg => + eval_args = eval_args ::: List("--eval", "use_thy " + ML_Syntax.print_string0(arg))), + "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), + "e:" -> (arg => eval_args = eval_args ::: List("--eval", arg)), + "f:" -> (arg => eval_args = eval_args ::: List("--use", arg)), + "l:" -> (arg => logic = arg), + "m:" -> (arg => modes = arg :: modes), + "o:" -> (arg => options = options + arg)) - val more_args = getopts(args) - if (args.isEmpty || !more_args.isEmpty) getopts.usage() + val more_args = getopts(args) + if (args.isEmpty || !more_args.isEmpty) getopts.usage() - ML_Process(options, logic = logic, args = eval_args, dirs = dirs, modes = modes). - result().print_stdout.rc - } - } + ML_Process(options, logic = logic, args = eval_args, dirs = dirs, modes = modes). + result().print_stdout.rc + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/update_cartouches.scala --- a/src/Pure/Tools/update_cartouches.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/update_cartouches.scala Sun Apr 03 23:57:32 2016 +0200 @@ -82,11 +82,11 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) - { - Command_Line.tool0 { + val isabelle_tool = + Isabelle_Tool("update_cartouches", "update theory syntax to use cartouches", args => + { var replace_comment = false var replace_text = false @@ -112,6 +112,5 @@ spec <- specs file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy")) } update_cartouches(replace_comment, replace_text, Path.explode(File.standard_path(file))) - } - } + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/update_header.scala --- a/src/Pure/Tools/update_header.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/update_header.scala Sun Apr 03 23:57:32 2016 +0200 @@ -23,14 +23,14 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ private val headings = Set("chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph") - def main(args: Array[String]) - { - Command_Line.tool0 { + val isabelle_tool = + Isabelle_Tool("update_header", "replace obsolete theory header command", args => + { var section = "section" val getopts = Getopts(""" @@ -57,6 +57,5 @@ spec <- specs file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy")) } update_header(section, Path.explode(File.standard_path(file))) - } - } + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/update_then.scala --- a/src/Pure/Tools/update_then.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/update_then.scala Sun Apr 03 23:57:32 2016 +0200 @@ -28,11 +28,11 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) - { - Command_Line.tool0 { + val isabelle_tool = + Isabelle_Tool("update_then", "expand old Isar command conflations 'hence' and 'thus'", args => + { val getopts = Getopts(""" Usage: isabelle update_then [FILES|DIRS...] @@ -51,6 +51,5 @@ spec <- specs file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy")) } update_then(Path.explode(File.standard_path(file))) - } - } + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/Tools/update_theorems.scala --- a/src/Pure/Tools/update_theorems.scala Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/Tools/update_theorems.scala Sun Apr 03 23:57:32 2016 +0200 @@ -29,12 +29,11 @@ } - /* command line entry point */ + /* Isabelle tool wrapper */ - def main(args: Array[String]) + val isabelle_tool = Isabelle_Tool("update_theorems", "update toplevel theorem keywords", args => { - Command_Line.tool0 { - val getopts = Getopts(""" + val getopts = Getopts(""" Usage: isabelle update_theorems [FILES|DIRS...] Recursively find .thy files and update toplevel theorem keywords: @@ -47,13 +46,12 @@ Old versions of files are preserved by appending "~~". """) - val specs = getopts(args) - if (specs.isEmpty) getopts.usage() + val specs = getopts(args) + if (specs.isEmpty) getopts.usage() - for { - spec <- specs - file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy")) - } update_theorems(Path.explode(File.standard_path(file))) - } - } + for { + spec <- specs + file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy")) + } update_theorems(Path.explode(File.standard_path(file))) + }) } diff -r 609f97d79bc2 -r 388719339ada src/Pure/build-jars --- a/src/Pure/build-jars Sun Apr 03 10:25:17 2016 +0200 +++ b/src/Pure/build-jars Sun Apr 03 23:57:32 2016 +0200 @@ -81,6 +81,7 @@ System/isabelle_charset.scala System/isabelle_process.scala System/isabelle_system.scala + System/isabelle_tool.scala System/options.scala System/platform.scala System/posix_interrupt.scala