# HG changeset patch # User wenzelm # Date 1393003391 -3600 # Node ID eb07b0acbebc517d43dd67b6db1d2edb22456eaa # Parent af028f35af60ca6c7e8192c2c141abbf23fe0b3c more symbols; diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Basic_Logic.thy --- a/src/HOL/Isar_Examples/Basic_Logic.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Basic_Logic.thy Fri Feb 21 18:23:11 2014 +0100 @@ -291,7 +291,7 @@ cases actually coincide. Consequently the proof may be rephrased as follows. *} -lemma "P \ P --> P" +lemma "P \ P \ P" proof assume "P \ P" then show P @@ -307,7 +307,7 @@ are implicitly performed when concluding the single rule step of the double-dot proof as follows. *} -lemma "P \ P --> P" +lemma "P \ P \ P" proof assume "P \ P" then show P .. diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Fibonacci.thy --- a/src/HOL/Isar_Examples/Fibonacci.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Fibonacci.thy Fri Feb 21 18:23:11 2014 +0100 @@ -150,7 +150,7 @@ with hyp have "gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))" by simp also have "\ = gcd (fib m) (fib n)" - using `m <= n` by (rule gcd_fib_diff) + using `m \ n` by (rule gcd_fib_diff) finally have "gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)" . with False show ?thesis by simp diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Group.thy --- a/src/HOL/Isar_Examples/Group.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Group.thy Fri Feb 21 18:23:11 2014 +0100 @@ -27,19 +27,19 @@ proof - have "x * inverse x = 1 * (x * inverse x)" by (simp only: group_left_one) - also have "... = 1 * x * inverse x" + also have "\ = 1 * x * inverse x" by (simp only: group_assoc) - also have "... = inverse (inverse x) * inverse x * x * inverse x" + also have "\ = inverse (inverse x) * inverse x * x * inverse x" by (simp only: group_left_inverse) - also have "... = inverse (inverse x) * (inverse x * x) * inverse x" + also have "\ = inverse (inverse x) * (inverse x * x) * inverse x" by (simp only: group_assoc) - also have "... = inverse (inverse x) * 1 * inverse x" + also have "\ = inverse (inverse x) * 1 * inverse x" by (simp only: group_left_inverse) - also have "... = inverse (inverse x) * (1 * inverse x)" + also have "\ = inverse (inverse x) * (1 * inverse x)" by (simp only: group_assoc) - also have "... = inverse (inverse x) * inverse x" + also have "\ = inverse (inverse x) * inverse x" by (simp only: group_left_one) - also have "... = 1" + also have "\ = 1" by (simp only: group_left_inverse) finally show ?thesis . qed @@ -52,11 +52,11 @@ proof - have "x * 1 = x * (inverse x * x)" by (simp only: group_left_inverse) - also have "... = x * inverse x * x" + also have "\ = x * inverse x * x" by (simp only: group_assoc) - also have "... = 1 * x" + also have "\ = 1 * x" by (simp only: group_right_inverse) - also have "... = x" + also have "\ = x" by (simp only: group_left_one) finally show ?thesis . qed @@ -92,25 +92,25 @@ note calculation = this -- {* first calculational step: init calculation register *} - have "... = x * inverse x * x" + have "\ = x * inverse x * x" by (simp only: group_assoc) note calculation = trans [OF calculation this] -- {* general calculational step: compose with transitivity rule *} - have "... = 1 * x" + have "\ = 1 * x" by (simp only: group_right_inverse) note calculation = trans [OF calculation this] -- {* general calculational step: compose with transitivity rule *} - have "... = x" + have "\ = x" by (simp only: group_left_one) note calculation = trans [OF calculation this] - -- {* final calculational step: compose with transitivity rule ... *} + -- {* final calculational step: compose with transitivity rule \dots *} from calculation - -- {* ... and pick up the final result *} + -- {* \dots\ and pick up the final result *} show ?thesis . qed @@ -168,13 +168,13 @@ proof - have "1 = x * inverse x" by (simp only: group_right_inverse) - also have "... = (e * x) * inverse x" + also have "\ = (e * x) * inverse x" by (simp only: eq) - also have "... = e * (x * inverse x)" + also have "\ = e * (x * inverse x)" by (simp only: group_assoc) - also have "... = e * 1" + also have "\ = e * 1" by (simp only: group_right_inverse) - also have "... = e" + also have "\ = e" by (simp only: group_right_one) finally show ?thesis . qed @@ -187,13 +187,13 @@ proof - have "inverse x = 1 * inverse x" by (simp only: group_left_one) - also have "... = (x' * x) * inverse x" + also have "\ = (x' * x) * inverse x" by (simp only: eq) - also have "... = x' * (x * inverse x)" + also have "\ = x' * (x * inverse x)" by (simp only: group_assoc) - also have "... = x' * 1" + also have "\ = x' * 1" by (simp only: group_right_inverse) - also have "... = x'" + also have "\ = x'" by (simp only: group_right_one) finally show ?thesis . qed @@ -207,11 +207,11 @@ have "(inverse y * inverse x) * (x * y) = (inverse y * (inverse x * x)) * y" by (simp only: group_assoc) - also have "... = (inverse y * 1) * y" + also have "\ = (inverse y * 1) * y" by (simp only: group_left_inverse) - also have "... = inverse y * y" + also have "\ = inverse y * y" by (simp only: group_right_one) - also have "... = 1" + also have "\ = 1" by (simp only: group_left_inverse) finally show ?thesis . qed @@ -229,15 +229,15 @@ proof - have "x = x * 1" by (simp only: group_right_one) - also have "... = x * (inverse y * y)" + also have "\ = x * (inverse y * y)" by (simp only: group_left_inverse) - also have "... = x * (inverse x * y)" + also have "\ = x * (inverse x * y)" by (simp only: eq) - also have "... = (x * inverse x) * y" + also have "\ = (x * inverse x) * y" by (simp only: group_assoc) - also have "... = 1 * y" + also have "\ = 1 * y" by (simp only: group_right_inverse) - also have "... = y" + also have "\ = y" by (simp only: group_left_one) finally show ?thesis . qed diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Group_Context.thy --- a/src/HOL/Isar_Examples/Group_Context.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Group_Context.thy Fri Feb 21 18:23:11 2014 +0100 @@ -13,7 +13,7 @@ context fixes prod :: "'a \ 'a \ 'a" (infixl "**" 70) and one :: "'a" - and inverse :: "'a => 'a" + and inverse :: "'a \ 'a" assumes assoc: "(x ** y) ** z = x ** (y ** z)" and left_one: "one ** x = x" and left_inverse: "inverse x ** x = one" diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Group_Notepad.thy --- a/src/HOL/Isar_Examples/Group_Notepad.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Group_Notepad.thy Fri Feb 21 18:23:11 2014 +0100 @@ -14,7 +14,7 @@ fix prod :: "'a \ 'a \ 'a" (infixl "**" 70) and one :: "'a" - and inverse :: "'a => 'a" + and inverse :: "'a \ 'a" assume assoc: "\x y z. (x ** y) ** z = x ** (y ** z)" and left_one: "\x. one ** x = x" and left_inverse: "\x. inverse x ** x = one" diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Hoare.thy --- a/src/HOL/Isar_Examples/Hoare.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Hoare.thy Fri Feb 21 18:23:11 2014 +0100 @@ -22,41 +22,39 @@ type_synonym 'a assn = "'a set" datatype 'a com = - Basic "'a => 'a" + Basic "'a \ 'a" | Seq "'a com" "'a com" ("(_;/ _)" [60, 61] 60) | Cond "'a bexp" "'a com" "'a com" | While "'a bexp" "'a assn" "'a com" abbreviation Skip ("SKIP") - where "SKIP == Basic id" - -type_synonym 'a sem = "'a => 'a => bool" + where "SKIP \ Basic id" -primrec iter :: "nat => 'a bexp => 'a sem => 'a sem" -where - "iter 0 b S s s' = (s ~: b & s = s')" -| "iter (Suc n) b S s s' = (s : b & (EX s''. S s s'' & iter n b S s'' s'))" +type_synonym 'a sem = "'a \ 'a \ bool" -primrec Sem :: "'a com => 'a sem" +primrec iter :: "nat \ 'a bexp \ 'a sem \ 'a sem" where - "Sem (Basic f) s s' = (s' = f s)" -| "Sem (c1; c2) s s' = (EX s''. Sem c1 s s'' & Sem c2 s'' s')" -| "Sem (Cond b c1 c2) s s' = - (if s : b then Sem c1 s s' else Sem c2 s s')" -| "Sem (While b x c) s s' = (EX n. iter n b (Sem c) s s')" + "iter 0 b S s s' \ s \ b \ s = s'" +| "iter (Suc n) b S s s' \ s \ b \ (\s''. S s s'' \ iter n b S s'' s')" -definition Valid :: "'a bexp => 'a com => 'a bexp => bool" - ("(3|- _/ (2_)/ _)" [100, 55, 100] 50) - where "|- P c Q \ (\s s'. Sem c s s' --> s : P --> s' : Q)" +primrec Sem :: "'a com \ 'a sem" +where + "Sem (Basic f) s s' \ s' = f s" +| "Sem (c1; c2) s s' \ (\s''. Sem c1 s s'' \ Sem c2 s'' s')" +| "Sem (Cond b c1 c2) s s' \ + (if s \ b then Sem c1 s s' else Sem c2 s s')" +| "Sem (While b x c) s s' \ (\n. iter n b (Sem c) s s')" -notation (xsymbols) Valid ("(3\ _/ (2_)/ _)" [100, 55, 100] 50) +definition Valid :: "'a bexp \ 'a com \ 'a bexp \ bool" + ("(3\ _/ (2_)/ _)" [100, 55, 100] 50) + where "\ P c Q \ (\s s'. Sem c s s' \ s \ P \ s' \ Q)" lemma ValidI [intro?]: - "(!!s s'. Sem c s s' ==> s : P ==> s' : Q) ==> |- P c Q" + "(\s s'. Sem c s s' \ s \ P \ s' \ Q) \ \ P c Q" by (simp add: Valid_def) lemma ValidD [dest?]: - "|- P c Q ==> Sem c s s' ==> s : P ==> s' : Q" + "\ P c Q \ Sem c s s' \ s \ P \ s' \ Q" by (simp add: Valid_def) @@ -71,12 +69,13 @@ to the state space. This subsumes the common rules of \name{skip} and \name{assign}, as formulated in \S\ref{sec:hoare-isar}. *} -theorem basic: "|- {s. f s : P} (Basic f) P" +theorem basic: "\ {s. f s \ P} (Basic f) P" proof - fix s s' assume s: "s : {s. f s : P}" + fix s s' + assume s: "s \ {s. f s \ P}" assume "Sem (Basic f) s s'" then have "s' = f s" by simp - with s show "s' : P" by simp + with s show "s' \ P" by simp qed text {* @@ -84,26 +83,27 @@ established in a straight forward manner as follows. *} -theorem seq: "|- P c1 Q ==> |- Q c2 R ==> |- P (c1; c2) R" +theorem seq: "\ P c1 Q \ \ Q c2 R \ \ P (c1; c2) R" proof - assume cmd1: "|- P c1 Q" and cmd2: "|- Q c2 R" - fix s s' assume s: "s : P" + assume cmd1: "\ P c1 Q" and cmd2: "\ Q c2 R" + fix s s' + assume s: "s \ P" assume "Sem (c1; c2) s s'" then obtain s'' where sem1: "Sem c1 s s''" and sem2: "Sem c2 s'' s'" by auto - from cmd1 sem1 s have "s'' : Q" .. - with cmd2 sem2 show "s' : R" .. + from cmd1 sem1 s have "s'' \ Q" .. + with cmd2 sem2 show "s' \ R" .. qed -theorem conseq: "P' <= P ==> |- P c Q ==> Q <= Q' ==> |- P' c Q'" +theorem conseq: "P' \ P \ \ P c Q \ Q \ Q' \ \ P' c Q'" proof - assume P'P: "P' <= P" and QQ': "Q <= Q'" - assume cmd: "|- P c Q" + assume P'P: "P' \ P" and QQ': "Q \ Q'" + assume cmd: "\ P c Q" fix s s' :: 'a assume sem: "Sem c s s'" - assume "s : P'" with P'P have "s : P" .. - with cmd sem have "s' : Q" .. - with QQ' show "s' : Q'" .. + assume "s : P'" with P'P have "s \ P" .. + with cmd sem have "s' \ Q" .. + with QQ' show "s' \ Q'" .. qed text {* The rule for conditional commands is directly reflected by the @@ -111,26 +111,27 @@ which cases apply. *} theorem cond: - assumes case_b: "|- (P Int b) c1 Q" - and case_nb: "|- (P Int -b) c2 Q" - shows "|- P (Cond b c1 c2) Q" + assumes case_b: "\ (P \ b) c1 Q" + and case_nb: "\ (P \ -b) c2 Q" + shows "\ P (Cond b c1 c2) Q" proof - fix s s' assume s: "s : P" + fix s s' + assume s: "s \ P" assume sem: "Sem (Cond b c1 c2) s s'" - show "s' : Q" + show "s' \ Q" proof cases - assume b: "s : b" + assume b: "s \ b" from case_b show ?thesis proof from sem b show "Sem c1 s s'" by simp - from s b show "s : P Int b" by simp + from s b show "s \ P \ b" by simp qed next - assume nb: "s ~: b" + assume nb: "s \ b" from case_nb show ?thesis proof from sem nb show "Sem c2 s s'" by simp - from s nb show "s : P Int -b" by simp + from s nb show "s : P \ -b" by simp qed qed qed @@ -143,22 +144,22 @@ of the semantics of \texttt{WHILE}. *} theorem while: - assumes body: "|- (P Int b) c P" - shows "|- P (While b X c) (P Int -b)" + assumes body: "\ (P \ b) c P" + shows "\ P (While b X c) (P \ -b)" proof - fix s s' assume s: "s : P" + fix s s' assume s: "s \ P" assume "Sem (While b X c) s s'" then obtain n where "iter n b (Sem c) s s'" by auto - from this and s show "s' : P Int -b" + from this and s show "s' \ P \ -b" proof (induct n arbitrary: s) case 0 then show ?case by auto next case (Suc n) - then obtain s'' where b: "s : b" and sem: "Sem c s s''" + then obtain s'' where b: "s \ b" and sem: "Sem c s s''" and iter: "iter n b (Sem c) s'' s'" by auto - from Suc and b have "s : P Int b" by simp - with body sem have "s'' : P" .. + from Suc and b have "s \ P \ b" by simp + with body sem have "s'' \ P" .. with iter show ?case by (rule Suc) qed qed @@ -188,29 +189,26 @@ @{ML Syntax_Trans.quote_tr'},). *} syntax - "_quote" :: "'b => ('a => 'b)" ("(.'(_').)" [0] 1000) - "_antiquote" :: "('a => 'b) => 'b" ("\_" [1000] 1000) + "_quote" :: "'b \ ('a \ 'b)" ("(.'(_').)" [0] 1000) + "_antiquote" :: "('a \ 'b) \ 'b" ("\_" [1000] 1000) "_Subst" :: "'a bexp \ 'b \ idt \ 'a bexp" ("_[_'/\_]" [1000] 999) - "_Assert" :: "'a => 'a set" ("(.{_}.)" [0] 1000) - "_Assign" :: "idt => 'b => 'a com" ("(\_ :=/ _)" [70, 65] 61) - "_Cond" :: "'a bexp => 'a com => 'a com => 'a com" + "_Assert" :: "'a \ 'a set" ("(\_\)" [0] 1000) + "_Assign" :: "idt \ 'b \ 'a com" ("(\_ :=/ _)" [70, 65] 61) + "_Cond" :: "'a bexp \ 'a com \ 'a com \ 'a com" ("(0IF _/ THEN _/ ELSE _/ FI)" [0, 0, 0] 61) - "_While_inv" :: "'a bexp => 'a assn => 'a com => 'a com" + "_While_inv" :: "'a bexp \ 'a assn \ 'a com \ 'a com" ("(0WHILE _/ INV _ //DO _ /OD)" [0, 0, 0] 61) - "_While" :: "'a bexp => 'a com => 'a com" + "_While" :: "'a bexp \ 'a com \ 'a com" ("(0WHILE _ //DO _ /OD)" [0, 0] 61) -syntax (xsymbols) - "_Assert" :: "'a => 'a set" ("(\_\)" [0] 1000) - translations - ".{b}." => "CONST Collect .(b)." - "B [a/\x]" => ".{\(_update_name x (\_. a)) \ B}." - "\x := a" => "CONST Basic .(\(_update_name x (\_. a)))." - "IF b THEN c1 ELSE c2 FI" => "CONST Cond .{b}. c1 c2" - "WHILE b INV i DO c OD" => "CONST While .{b}. i c" - "WHILE b DO c OD" == "WHILE b INV CONST undefined DO c OD" + "\b\" \ "CONST Collect .(b)." + "B [a/\x]" \ "\\(_update_name x (\_. a)) \ B\" + "\x := a" \ "CONST Basic .(\(_update_name x (\_. a)))." + "IF b THEN c1 ELSE c2 FI" \ "CONST Cond \b\ c1 c2" + "WHILE b INV i DO c OD" \ "CONST While \b\ i c" + "WHILE b DO c OD" \ "WHILE b INV CONST undefined DO c OD" parse_translation {* let @@ -259,28 +257,28 @@ calculational proofs, with the inclusion expressed in terms of sets or predicates. Reversed order is supported as well. *} -lemma [trans]: "|- P c Q ==> P' <= P ==> |- P' c Q" +lemma [trans]: "\ P c Q \ P' \ P \ \ P' c Q" by (unfold Valid_def) blast -lemma [trans] : "P' <= P ==> |- P c Q ==> |- P' c Q" +lemma [trans] : "P' \ P \ \ P c Q \ \ P' c Q" by (unfold Valid_def) blast -lemma [trans]: "Q <= Q' ==> |- P c Q ==> |- P c Q'" +lemma [trans]: "Q \ Q' \ \ P c Q \ \ P c Q'" by (unfold Valid_def) blast -lemma [trans]: "|- P c Q ==> Q <= Q' ==> |- P c Q'" +lemma [trans]: "\ P c Q \ Q \ Q' \ \ P c Q'" by (unfold Valid_def) blast lemma [trans]: - "|- .{\P}. c Q ==> (!!s. P' s --> P s) ==> |- .{\P'}. c Q" + "\ \\P\ c Q \ (\s. P' s \ P s) \ \ \\P'\ c Q" by (simp add: Valid_def) lemma [trans]: - "(!!s. P' s --> P s) ==> |- .{\P}. c Q ==> |- .{\P'}. c Q" + "(\s. P' s \ P s) \ \ \\P\ c Q \ \ \\P'\ c Q" by (simp add: Valid_def) lemma [trans]: - "|- P c .{\Q}. ==> (!!s. Q s --> Q' s) ==> |- P c .{\Q'}." + "\ P c \\Q\ \ (\s. Q s \ Q' s) \ \ P c \\Q'\" by (simp add: Valid_def) lemma [trans]: - "(!!s. Q s --> Q' s) ==> |- P c .{\Q}. ==> |- P c .{\Q'}." + "(\s. Q s \ Q' s) \ \ P c \\Q\ \ \ P c \\Q'\" by (simp add: Valid_def) @@ -289,13 +287,13 @@ instances for any number of basic assignments, without producing additional verification conditions.} *} -lemma skip [intro?]: "|- P SKIP P" +lemma skip [intro?]: "\ P SKIP P" proof - - have "|- {s. id s : P} SKIP P" by (rule basic) + have "\ {s. id s \ P} SKIP P" by (rule basic) then show ?thesis by simp qed -lemma assign: "|- P [\a/\x::'a] \x := \a P" +lemma assign: "\ P [\a/\x::'a] \x := \a P" by (rule basic) text {* Note that above formulation of assignment corresponds to our @@ -315,7 +313,7 @@ lemmas [trans, intro?] = seq -lemma seq_assoc [simp]: "( |- P c1;(c2;c3) Q) = ( |- P (c1;c2);c3 Q)" +lemma seq_assoc [simp]: "\ P c1;(c2;c3) Q \ \ P (c1;c2);c3 Q" by (auto simp add: Valid_def) text {* Conditional statements. *} @@ -323,30 +321,30 @@ lemmas [trans, intro?] = cond lemma [trans, intro?]: - "|- .{\P & \b}. c1 Q - ==> |- .{\P & ~ \b}. c2 Q - ==> |- .{\P}. IF \b THEN c1 ELSE c2 FI Q" + "\ \\P \ \b\ c1 Q + \ \ \\P \ \ \b\ c2 Q + \ \ \\P\ IF \b THEN c1 ELSE c2 FI Q" by (rule cond) (simp_all add: Valid_def) text {* While statements --- with optional invariant. *} lemma [intro?]: - "|- (P Int b) c P ==> |- P (While b P c) (P Int -b)" + "\ (P \ b) c P \ \ P (While b P c) (P \ -b)" by (rule while) lemma [intro?]: - "|- (P Int b) c P ==> |- P (While b undefined c) (P Int -b)" + "\ (P \ b) c P \ \ P (While b undefined c) (P \ -b)" by (rule while) lemma [intro?]: - "|- .{\P & \b}. c .{\P}. - ==> |- .{\P}. WHILE \b INV .{\P}. DO c OD .{\P & ~ \b}." + "\ \\P \ \b\ c \\P\ + \ \ \\P\ WHILE \b INV \\P\ DO c OD \\P \ \ \b\" by (simp add: while Collect_conj_eq Collect_neg_eq) lemma [intro?]: - "|- .{\P & \b}. c .{\P}. - ==> |- .{\P}. WHILE \b DO c OD .{\P & ~ \b}." + "\ \\P \ \b\ c \\P\ + \ \ \\P\ WHILE \b DO c OD \\P \ \ \b\" by (simp add: while Collect_conj_eq Collect_neg_eq) @@ -378,13 +376,9 @@ by (auto simp: Valid_def) lemma iter_aux: - "\s s'. Sem c s s' --> s : I & s : b --> s' : I ==> - (\s s'. s : I \ iter n b (Sem c) s s' \ s' : I & s' ~: b)" - apply(induct n) - apply clarsimp - apply (simp (no_asm_use)) - apply blast - done + "\s s'. Sem c s s' \ s \ I \ s \ b \ s' \ I \ + (\s s'. s \ I \ iter n b (Sem c) s s' \ s' \ I \ s' \ b)" + by (induct n) auto lemma WhileRule: "p \ i \ Valid (i \ b) c i \ i \ (-b) \ q \ Valid p (While b i c) q" diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Hoare_Ex.thy --- a/src/HOL/Isar_Examples/Hoare_Ex.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Hoare_Ex.thy Fri Feb 21 18:23:11 2014 +0100 @@ -32,7 +32,7 @@ text {* Using the basic @{text assign} rule directly is a bit cumbersome. *} -lemma "|- .{\(N_update (\_. (2 * \N))) : .{\N = 10}.}. \N := 2 * \N .{\N = 10}." +lemma "\ \\(N_update (\_. (2 * \N))) \ \\N = 10\\ \N := 2 * \N \\N = 10\" by (rule assign) text {* Certainly we want the state modification already done, e.g.\ @@ -40,31 +40,31 @@ update for us; we may apply the Simplifier afterwards to achieve ``obvious'' consequences as well. *} -lemma "|- .{True}. \N := 10 .{\N = 10}." +lemma "\ \True\ \N := 10 \\N = 10\" by hoare -lemma "|- .{2 * \N = 10}. \N := 2 * \N .{\N = 10}." +lemma "\ \2 * \N = 10\ \N := 2 * \N \\N = 10\" by hoare -lemma "|- .{\N = 5}. \N := 2 * \N .{\N = 10}." +lemma "\ \\N = 5\ \N := 2 * \N \\N = 10\" by hoare simp -lemma "|- .{\N + 1 = a + 1}. \N := \N + 1 .{\N = a + 1}." +lemma "\ \\N + 1 = a + 1\ \N := \N + 1 \\N = a + 1\" by hoare -lemma "|- .{\N = a}. \N := \N + 1 .{\N = a + 1}." +lemma "\ \\N = a\ \N := \N + 1 \\N = a + 1\" by hoare simp -lemma "|- .{a = a & b = b}. \M := a; \N := b .{\M = a & \N = b}." +lemma "\ \a = a \ b = b\ \M := a; \N := b \\M = a \ \N = b\" by hoare -lemma "|- .{True}. \M := a; \N := b .{\M = a & \N = b}." +lemma "\ \True\ \M := a; \N := b \\M = a \ \N = b\" by hoare simp lemma - "|- .{\M = a & \N = b}. + "\ \\M = a \ \N = b\ \I := \M; \M := \N; \N := \I - .{\M = b & \N = a}." + \\M = b \ \N = a\" by hoare simp text {* It is important to note that statements like the following one @@ -72,10 +72,10 @@ extra-logical nature of record fields, we cannot formulate a theorem relating record selectors and updates schematically. *} -lemma "|- .{\N = a}. \N := \N .{\N = a}." +lemma "\ \\N = a\ \N := \N \\N = a\" by hoare -lemma "|- .{\x = a}. \x := \x .{\x = a}." +lemma "\ \\x = a\ \x := \x \\x = a\" oops lemma @@ -88,27 +88,27 @@ rule in order to achieve the intended precondition. Certainly, the \name{hoare} method is able to handle this case, too. *} -lemma "|- .{\M = \N}. \M := \M + 1 .{\M ~= \N}." +lemma "\ \\M = \N\ \M := \M + 1 \\M \ \N\" proof - - have ".{\M = \N}. <= .{\M + 1 ~= \N}." + have "\\M = \N\ \ \\M + 1 \ \N\" by auto - also have "|- ... \M := \M + 1 .{\M ~= \N}." + also have "\ \ \M := \M + 1 \\M \ \N\" by hoare finally show ?thesis . qed -lemma "|- .{\M = \N}. \M := \M + 1 .{\M ~= \N}." +lemma "\ \\M = \N\ \M := \M + 1 \\M \ \N\" proof - - have "!!m n::nat. m = n --> m + 1 ~= n" + have "\m n::nat. m = n \ m + 1 \ n" -- {* inclusion of assertions expressed in ``pure'' logic, *} -- {* without mentioning the state space *} by simp - also have "|- .{\M + 1 ~= \N}. \M := \M + 1 .{\M ~= \N}." + also have "\ \\M + 1 \ \N\ \M := \M + 1 \\M \ \N\" by hoare finally show ?thesis . qed -lemma "|- .{\M = \N}. \M := \M + 1 .{\M ~= \N}." +lemma "\ \\M = \N\ \M := \M + 1 \\M \ \N\" by hoare simp @@ -120,24 +120,24 @@ structured proof based on single-step Hoare rules. *} lemma - "|- .{\M = 0 & \S = 0}. - WHILE \M ~= a + "\ \\M = 0 \ \S = 0\ + WHILE \M \ a DO \S := \S + b; \M := \M + 1 OD - .{\S = a * b}." + \\S = a * b\" proof - - let "|- _ ?while _" = ?thesis - let ".{\?inv}." = ".{\S = \M * b}." + let "\ _ ?while _" = ?thesis + let "\\?inv\" = "\\S = \M * b\" - have ".{\M = 0 & \S = 0}. <= .{\?inv}." by auto - also have "|- ... ?while .{\?inv & ~ (\M ~= a)}." + have "\\M = 0 \ \S = 0\ \ \\?inv\" by auto + also have "\ \ ?while \\?inv \ \ (\M \ a)\" proof let ?c = "\S := \S + b; \M := \M + 1" - have ".{\?inv & \M ~= a}. <= .{\S + b = (\M + 1) * b}." + have "\\?inv \ \M \ a\ \ \\S + b = (\M + 1) * b\" by auto - also have "|- ... ?c .{\?inv}." by hoare - finally show "|- .{\?inv & \M ~= a}. ?c .{\?inv}." . + also have "\ \ ?c \\?inv\" by hoare + finally show "\ \\?inv \ \M \ a\ ?c \\?inv\" . qed - also have "... <= .{\S = a * b}." by auto + also have "\ \ \\S = a * b\" by auto finally show ?thesis . qed @@ -147,11 +147,11 @@ specify the \texttt{WHILE} loop invariant in the original statement. *} lemma - "|- .{\M = 0 & \S = 0}. - WHILE \M ~= a - INV .{\S = \M * b}. + "\ \\M = 0 \ \S = 0\ + WHILE \M \ a + INV \\S = \M * b\ DO \S := \S + b; \M := \M + 1 OD - .{\S = a * b}." + \\S = a * b\" by hoare auto @@ -168,37 +168,37 @@ the state space. *} theorem - "|- .{True}. + "\ \True\ \S := 0; \I := 1; - WHILE \I ~= n + WHILE \I \ n DO \S := \S + \I; \I := \I + 1 OD - .{\S = (SUM j\S = (\j" + (is "\ _ (_; ?while) _") proof - - let ?sum = "\k::nat. SUM jS := 0; \I := 1 .{?inv \S \I}." + have "\ \True\ \S := 0; \I := 1 \?inv \S \I\" proof - - have "True --> 0 = ?sum 1" + have "True \ 0 = ?sum 1" by simp - also have "|- .{...}. \S := 0; \I := 1 .{?inv \S \I}." + also have "\ \\\ \S := 0; \I := 1 \?inv \S \I\" by hoare finally show ?thesis . qed - also have "|- ... ?while .{?inv \S \I & ~ \I ~= n}." + also have "\ \ ?while \?inv \S \I \ \ \I \ n\" proof let ?body = "\S := \S + \I; \I := \I + 1" - have "!!s i. ?inv s i & i ~= n --> ?inv (s + i) (i + 1)" + have "\s i. ?inv s i \ i \ n \ ?inv (s + i) (i + 1)" by simp - also have "|- .{\S + \I = ?sum (\I + 1)}. ?body .{?inv \S \I}." + also have "\ \\S + \I = ?sum (\I + 1)\ ?body \?inv \S \I\" by hoare - finally show "|- .{?inv \S \I & \I ~= n}. ?body .{?inv \S \I}." . + finally show "\ \?inv \S \I \ \I \ n\ ?body \?inv \S \I\" . qed - also have "!!s i. s = ?sum i & ~ i ~= n --> s = ?sum n" + also have "\s i. s = ?sum i \ \ i \ n \ s = ?sum n" by simp finally show ?thesis . qed @@ -208,27 +208,29 @@ structured manner. *} theorem - "|- .{True}. + "\ \True\ \S := 0; \I := 1; - WHILE \I ~= n - INV .{\S = (SUM j<\I. j)}. + WHILE \I \ n + INV \\S = (\j<\I. j)\ DO \S := \S + \I; \I := \I + 1 OD - .{\S = (SUM j\S = (\j" proof - - let ?sum = "\k::nat. SUM j i \ n" then show "?inv (s + i) (i + 1)" by simp next - fix s i assume "?inv s i & ~ i ~= n" + fix s i + assume "?inv s i \ \ i \ n" then show "s = ?sum n" by simp qed qed @@ -237,15 +239,15 @@ provided that the invariant is given beforehand. *} theorem - "|- .{True}. + "\ \True\ \S := 0; \I := 1; - WHILE \I ~= n - INV .{\S = (SUM j<\I. j)}. + WHILE \I \ n + INV \\S = (\j<\I. j)\ DO \S := \S + \I; \I := \I + 1 OD - .{\S = (SUM j\S = (\j" by hoare auto @@ -273,18 +275,18 @@ by (induct n) simp_all lemma - "|- .{i = \I & \time = 0}. - timeit ( - WHILE \I \ 0 - INV .{2 *\ time + \I * \I + 5 * \I = i * i + 5 * i}. - DO - \J := \I; - WHILE \J \ 0 - INV .{0 < \I & 2 * \time + \I * \I + 3 * \I + 2 * \J - 2 = i * i + 5 * i}. - DO \J := \J - 1 OD; - \I := \I - 1 - OD - ) .{2*\time = i*i + 5*i}." + "\ \i = \I \ \time = 0\ + (timeit + (WHILE \I \ 0 + INV \2 *\ time + \I * \I + 5 * \I = i * i + 5 * i\ + DO + \J := \I; + WHILE \J \ 0 + INV \0 < \I \ 2 * \time + \I * \I + 3 * \I + 2 * \J - 2 = i * i + 5 * i\ + DO \J := \J - 1 OD; + \I := \I - 1 + OD)) + \2 * \time = i * i + 5 * i\" apply simp apply hoare apply simp diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Mutilated_Checkerboard.thy --- a/src/HOL/Isar_Examples/Mutilated_Checkerboard.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Mutilated_Checkerboard.thy Fri Feb 21 18:23:11 2014 +0100 @@ -14,40 +14,40 @@ subsection {* Tilings *} -inductive_set tiling :: "'a set set => 'a set set" +inductive_set tiling :: "'a set set \ 'a set set" for A :: "'a set set" where - empty: "{} : tiling A" -| Un: "a : A ==> t : tiling A ==> a <= - t ==> a Un t : tiling A" + empty: "{} \ tiling A" +| Un: "a \ A \ t \ tiling A \ a \ - t \ a \ t \ tiling A" text "The union of two disjoint tilings is a tiling." lemma tiling_Un: - assumes "t : tiling A" - and "u : tiling A" - and "t Int u = {}" - shows "t Un u : tiling A" + assumes "t \ tiling A" + and "u \ tiling A" + and "t \ u = {}" + shows "t \ u \ tiling A" proof - let ?T = "tiling A" - from `t : ?T` and `t Int u = {}` - show "t Un u : ?T" + from `t \ ?T` and `t \ u = {}` + show "t \ u \ ?T" proof (induct t) case empty - with `u : ?T` show "{} Un u : ?T" by simp + with `u \ ?T` show "{} \ u \ ?T" by simp next case (Un a t) - show "(a Un t) Un u : ?T" + show "(a \ t) \ u \ ?T" proof - - have "a Un (t Un u) : ?T" - using `a : A` + have "a \ (t \ u) \ ?T" + using `a \ A` proof (rule tiling.Un) - from `(a Un t) Int u = {}` have "t Int u = {}" by blast - then show "t Un u: ?T" by (rule Un) - from `a <= - t` and `(a Un t) Int u = {}` - show "a <= - (t Un u)" by blast + from `(a \ t) \ u = {}` have "t \ u = {}" by blast + then show "t \ u \ ?T" by (rule Un) + from `a \ - t` and `(a \ t) \ u = {}` + show "a \ - (t \ u)" by blast qed - also have "a Un (t Un u) = (a Un t) Un u" + also have "a \ (t \ u) = (a \ t) \ u" by (simp only: Un_assoc) finally show ?thesis . qed @@ -57,22 +57,21 @@ subsection {* Basic properties of ``below'' *} -definition below :: "nat => nat set" +definition below :: "nat \ nat set" where "below n = {i. i < n}" -lemma below_less_iff [iff]: "(i: below k) = (i < k)" +lemma below_less_iff [iff]: "i \ below k \ i < k" by (simp add: below_def) lemma below_0: "below 0 = {}" by (simp add: below_def) -lemma Sigma_Suc1: - "m = n + 1 ==> below m <*> B = ({n} <*> B) Un (below n <*> B)" +lemma Sigma_Suc1: "m = n + 1 \ below m \ B = ({n} \ B) \ (below n \ B)" by (simp add: below_def less_Suc_eq) blast lemma Sigma_Suc2: - "m = n + 2 ==> A <*> below m = - (A <*> {n}) Un (A <*> {n + 1}) Un (A <*> below n)" + "m = n + 2 \ + A \ below m = (A \ {n}) \ (A \ {n + 1}) \ (A \ below n)" by (auto simp add: below_def) lemmas Sigma_Suc = Sigma_Suc1 Sigma_Suc2 @@ -80,22 +79,22 @@ subsection {* Basic properties of ``evnodd'' *} -definition evnodd :: "(nat * nat) set => nat => (nat * nat) set" - where "evnodd A b = A Int {(i, j). (i + j) mod 2 = b}" +definition evnodd :: "(nat \ nat) set \ nat \ (nat \ nat) set" + where "evnodd A b = A \ {(i, j). (i + j) mod 2 = b}" -lemma evnodd_iff: "(i, j): evnodd A b = ((i, j): A & (i + j) mod 2 = b)" +lemma evnodd_iff: "(i, j) \ evnodd A b \ (i, j) \ A \ (i + j) mod 2 = b" by (simp add: evnodd_def) -lemma evnodd_subset: "evnodd A b <= A" +lemma evnodd_subset: "evnodd A b \ A" unfolding evnodd_def by (rule Int_lower1) -lemma evnoddD: "x : evnodd A b ==> x : A" +lemma evnoddD: "x \ evnodd A b \ x \ A" by (rule subsetD) (rule evnodd_subset) -lemma evnodd_finite: "finite A ==> finite (evnodd A b)" +lemma evnodd_finite: "finite A \ finite (evnodd A b)" by (rule finite_subset) (rule evnodd_subset) -lemma evnodd_Un: "evnodd (A Un B) b = evnodd A b Un evnodd B b" +lemma evnodd_Un: "evnodd (A \ B) b = evnodd A b \ evnodd B b" unfolding evnodd_def by blast lemma evnodd_Diff: "evnodd (A - B) b = evnodd A b - evnodd B b" @@ -112,60 +111,60 @@ subsection {* Dominoes *} -inductive_set domino :: "(nat * nat) set set" +inductive_set domino :: "(nat \ nat) set set" where - horiz: "{(i, j), (i, j + 1)} : domino" -| vertl: "{(i, j), (i + 1, j)} : domino" + horiz: "{(i, j), (i, j + 1)} \ domino" +| vertl: "{(i, j), (i + 1, j)} \ domino" lemma dominoes_tile_row: - "{i} <*> below (2 * n) : tiling domino" - (is "?B n : ?T") + "{i} \ below (2 * n) \ tiling domino" + (is "?B n \ ?T") proof (induct n) case 0 show ?case by (simp add: below_0 tiling.empty) next case (Suc n) - let ?a = "{i} <*> {2 * n + 1} Un {i} <*> {2 * n}" - have "?B (Suc n) = ?a Un ?B n" + let ?a = "{i} \ {2 * n + 1} \ {i} \ {2 * n}" + have "?B (Suc n) = ?a \ ?B n" by (auto simp add: Sigma_Suc Un_assoc) - also have "... : ?T" + also have "\ \ ?T" proof (rule tiling.Un) - have "{(i, 2 * n), (i, 2 * n + 1)} : domino" + have "{(i, 2 * n), (i, 2 * n + 1)} \ domino" by (rule domino.horiz) also have "{(i, 2 * n), (i, 2 * n + 1)} = ?a" by blast - finally show "... : domino" . - show "?B n : ?T" by (rule Suc) - show "?a <= - ?B n" by blast + finally show "\ \ domino" . + show "?B n \ ?T" by (rule Suc) + show "?a \ - ?B n" by blast qed finally show ?case . qed lemma dominoes_tile_matrix: - "below m <*> below (2 * n) : tiling domino" - (is "?B m : ?T") + "below m \ below (2 * n) \ tiling domino" + (is "?B m \ ?T") proof (induct m) case 0 show ?case by (simp add: below_0 tiling.empty) next case (Suc m) - let ?t = "{m} <*> below (2 * n)" - have "?B (Suc m) = ?t Un ?B m" by (simp add: Sigma_Suc) - also have "... : ?T" + let ?t = "{m} \ below (2 * n)" + have "?B (Suc m) = ?t \ ?B m" by (simp add: Sigma_Suc) + also have "\ \ ?T" proof (rule tiling_Un) - show "?t : ?T" by (rule dominoes_tile_row) - show "?B m : ?T" by (rule Suc) - show "?t Int ?B m = {}" by blast + show "?t \ ?T" by (rule dominoes_tile_row) + show "?B m \ ?T" by (rule Suc) + show "?t \ ?B m = {}" by blast qed finally show ?case . qed lemma domino_singleton: - assumes "d : domino" + assumes "d \ domino" and "b < 2" - shows "EX i j. evnodd d b = {(i, j)}" (is "?P d") + shows "\i j. evnodd d b = {(i, j)}" (is "?P d") using assms proof induct - from `b < 2` have b_cases: "b = 0 | b = 1" by arith + from `b < 2` have b_cases: "b = 0 \ b = 1" by arith fix i j note [simp] = evnodd_empty evnodd_insert mod_Suc from b_cases show "?P {(i, j), (i, j + 1)}" by rule auto @@ -173,7 +172,7 @@ qed lemma domino_finite: - assumes "d: domino" + assumes "d \ domino" shows "finite d" using assms proof induct @@ -186,18 +185,19 @@ subsection {* Tilings of dominoes *} lemma tiling_domino_finite: - assumes t: "t : tiling domino" (is "t : ?T") + assumes t: "t \ tiling domino" (is "t \ ?T") shows "finite t" (is "?F t") using t proof induct show "?F {}" by (rule finite.emptyI) fix a t assume "?F t" - assume "a : domino" then have "?F a" by (rule domino_finite) - from this and `?F t` show "?F (a Un t)" by (rule finite_UnI) + assume "a \ domino" + then have "?F a" by (rule domino_finite) + from this and `?F t` show "?F (a \ t)" by (rule finite_UnI) qed lemma tiling_domino_01: - assumes t: "t : tiling domino" (is "t : ?T") + assumes t: "t \ tiling domino" (is "t \ ?T") shows "card (evnodd t 0) = card (evnodd t 1)" using t proof induct @@ -207,33 +207,34 @@ case (Un a t) let ?e = evnodd note hyp = `card (?e t 0) = card (?e t 1)` - and at = `a <= - t` + and at = `a \ - t` have card_suc: - "!!b. b < 2 ==> card (?e (a Un t) b) = Suc (card (?e t b))" + "\b. b < 2 \ card (?e (a \ t) b) = Suc (card (?e t b))" proof - - fix b :: nat assume "b < 2" - have "?e (a Un t) b = ?e a b Un ?e t b" by (rule evnodd_Un) + fix b :: nat + assume "b < 2" + have "?e (a \ t) b = ?e a b \ ?e t b" by (rule evnodd_Un) also obtain i j where e: "?e a b = {(i, j)}" proof - from `a \ domino` and `b < 2` - have "EX i j. ?e a b = {(i, j)}" by (rule domino_singleton) + have "\i j. ?e a b = {(i, j)}" by (rule domino_singleton) then show ?thesis by (blast intro: that) qed - also have "... Un ?e t b = insert (i, j) (?e t b)" by simp - also have "card ... = Suc (card (?e t b))" + also have "\ \ ?e t b = insert (i, j) (?e t b)" by simp + also have "card \ = Suc (card (?e t b))" proof (rule card_insert_disjoint) from `t \ tiling domino` have "finite t" by (rule tiling_domino_finite) then show "finite (?e t b)" by (rule evnodd_finite) - from e have "(i, j) : ?e a b" by simp - with at show "(i, j) ~: ?e t b" by (blast dest: evnoddD) + from e have "(i, j) \ ?e a b" by simp + with at show "(i, j) \ ?e t b" by (blast dest: evnoddD) qed finally show "?thesis b" . qed - then have "card (?e (a Un t) 0) = Suc (card (?e t 0))" by simp + then have "card (?e (a \ t) 0) = Suc (card (?e t 0))" by simp also from hyp have "card (?e t 0) = card (?e t 1)" . - also from card_suc have "Suc ... = card (?e (a Un t) 1)" + also from card_suc have "Suc \ = card (?e (a \ t) 1)" by simp finally show ?case . qed @@ -241,23 +242,23 @@ subsection {* Main theorem *} -definition mutilated_board :: "nat => nat => (nat * nat) set" +definition mutilated_board :: "nat \ nat \ (nat \ nat) set" where "mutilated_board m n = - below (2 * (m + 1)) <*> below (2 * (n + 1)) + below (2 * (m + 1)) \ below (2 * (n + 1)) - {(0, 0)} - {(2 * m + 1, 2 * n + 1)}" -theorem mutil_not_tiling: "mutilated_board m n ~: tiling domino" +theorem mutil_not_tiling: "mutilated_board m n \ tiling domino" proof (unfold mutilated_board_def) let ?T = "tiling domino" - let ?t = "below (2 * (m + 1)) <*> below (2 * (n + 1))" + let ?t = "below (2 * (m + 1)) \ below (2 * (n + 1))" let ?t' = "?t - {(0, 0)}" let ?t'' = "?t' - {(2 * m + 1, 2 * n + 1)}" - show "?t'' ~: ?T" + show "?t'' \ ?T" proof - have t: "?t : ?T" by (rule dominoes_tile_matrix) - assume t'': "?t'' : ?T" + have t: "?t \ ?T" by (rule dominoes_tile_matrix) + assume t'': "?t'' \ ?T" let ?e = evnodd have fin: "finite (?e ?t 0)" @@ -271,23 +272,23 @@ proof (rule card_Diff1_less) from _ fin show "finite (?e ?t' 0)" by (rule finite_subset) auto - show "(2 * m + 1, 2 * n + 1) : ?e ?t' 0" by simp + show "(2 * m + 1, 2 * n + 1) \ ?e ?t' 0" by simp qed then show ?thesis by simp qed - also have "... < card (?e ?t 0)" + also have "\ < card (?e ?t 0)" proof - - have "(0, 0) : ?e ?t 0" by simp + have "(0, 0) \ ?e ?t 0" by simp with fin have "card (?e ?t 0 - {(0, 0)}) < card (?e ?t 0)" by (rule card_Diff1_less) then show ?thesis by simp qed - also from t have "... = card (?e ?t 1)" + also from t have "\ = card (?e ?t 1)" by (rule tiling_domino_01) also have "?e ?t 1 = ?e ?t'' 1" by simp - also from t'' have "card ... = card (?e ?t'' 0)" + also from t'' have "card \ = card (?e ?t'' 0)" by (rule tiling_domino_01 [symmetric]) - finally have "... < ..." . then show False .. + finally have "\ < \" . then show False .. qed qed diff -r af028f35af60 -r eb07b0acbebc src/HOL/Isar_Examples/Nested_Datatype.thy --- a/src/HOL/Isar_Examples/Nested_Datatype.thy Fri Feb 21 17:06:48 2014 +0100 +++ b/src/HOL/Isar_Examples/Nested_Datatype.thy Fri Feb 21 18:23:11 2014 +0100 @@ -7,12 +7,11 @@ subsection {* Terms and substitution *} datatype ('a, 'b) "term" = - Var 'a - | App 'b "('a, 'b) term list" + Var 'a +| App 'b "('a, 'b) term list" -primrec - subst_term :: "('a => ('a, 'b) term) => ('a, 'b) term => ('a, 'b) term" and - subst_term_list :: "('a => ('a, 'b) term) => ('a, 'b) term list => ('a, 'b) term list" +primrec subst_term :: "('a \ ('a, 'b) term) \ ('a, 'b) term \ ('a, 'b) term" + and subst_term_list :: "('a \ ('a, 'b) term) \ ('a, 'b) term list \ ('a, 'b) term list" where "subst_term f (Var a) = f a" | "subst_term f (App b ts) = App b (subst_term_list f ts)" @@ -24,18 +23,18 @@ text {* \medskip A simple lemma about composition of substitutions. *} lemma - "subst_term (subst_term f1 o f2) t = + "subst_term (subst_term f1 \ f2) t = subst_term f1 (subst_term f2 t)" and - "subst_term_list (subst_term f1 o f2) ts = + "subst_term_list (subst_term f1 \ f2) ts = subst_term_list f1 (subst_term_list f2 ts)" by (induct t and ts) simp_all -lemma "subst_term (subst_term f1 o f2) t = +lemma "subst_term (subst_term f1 \ f2) t = subst_term f1 (subst_term f2 t)" proof - let "?P t" = ?thesis - let ?Q = "\ts. subst_term_list (subst_term f1 o f2) ts = + let ?Q = "\ts. subst_term_list (subst_term f1 \ f2) ts = subst_term_list f1 (subst_term_list f2 ts)" show ?thesis proof (induct t) @@ -57,8 +56,8 @@ subsection {* Alternative induction *} theorem term_induct' [case_names Var App]: - assumes var: "!!a. P (Var a)" - and app: "!!b ts. (\t \ set ts. P t) ==> P (App b ts)" + assumes var: "\a. P (Var a)" + and app: "\b ts. (\t \ set ts. P t) \ P (App b ts)" shows "P t" proof (induct t) fix a show "P (Var a)" by (rule var) @@ -72,8 +71,7 @@ then show "\t' \ set (t # ts). P t'" by simp qed -lemma - "subst_term (subst_term f1 o f2) t = subst_term f1 (subst_term f2 t)" +lemma "subst_term (subst_term f1 \ f2) t = subst_term f1 (subst_term f2 t)" proof (induct t rule: term_induct') case (Var a) show ?case by (simp add: o_def)