stylistic improvements
authorpaulson
Tue, 28 Jun 2005 17:56:04 +0200
changeset 16593 0115764233e4
parent 16592 e7df213a1918
child 16594 5d73fbf4eb1e
stylistic improvements
src/HOL/ex/Classical.thy
src/HOL/ex/NatSum.thy
--- a/src/HOL/ex/Classical.thy	Tue Jun 28 16:12:03 2005 +0200
+++ b/src/HOL/ex/Classical.thy	Tue Jun 28 17:56:04 2005 +0200
@@ -706,26 +706,27 @@
        --> (\<forall>x. f x --> g x)"
 by blast
 
-text{*Problem 47.  Schubert's Steamroller*}
-        text{*26 clauses; 63 Horn clauses
-          87094 inferences so far.  Searching to depth 36*}
-lemma "(\<forall>x. P1 x --> P0 x) & (\<exists>x. P1 x) &
-       (\<forall>x. P2 x --> P0 x) & (\<exists>x. P2 x) &
-       (\<forall>x. P3 x --> P0 x) & (\<exists>x. P3 x) &
-       (\<forall>x. P4 x --> P0 x) & (\<exists>x. P4 x) &
-       (\<forall>x. P5 x --> P0 x) & (\<exists>x. P5 x) &
-       (\<forall>x. Q1 x --> Q0 x) & (\<exists>x. Q1 x) &
-       (\<forall>x. P0 x --> ((\<forall>y. Q0 y-->R x y) |
-			(\<forall>y. P0 y & S y x &
-			     (\<exists>z. Q0 z&R y z) --> R x y))) &
-       (\<forall>x y. P3 y & (P5 x|P4 x) --> S x y) &
-       (\<forall>x y. P3 x & P2 y --> S x y) &
-       (\<forall>x y. P2 x & P1 y --> S x y) &
-       (\<forall>x y. P1 x & (P2 y|Q1 y) --> ~R x y) &
-       (\<forall>x y. P3 x & P4 y --> R x y) &
-       (\<forall>x y. P3 x & P5 y --> ~R x y) &
-       (\<forall>x. (P4 x|P5 x) --> (\<exists>y. Q0 y & R x y))
-       --> (\<exists>x y. P0 x & P0 y & (\<exists>z. Q1 z & R y z & R x y))"
+text{*Problem 47.  Schubert's Steamroller.
+      26 clauses; 63 Horn clauses.
+      87094 inferences so far.  Searching to depth 36*}
+lemma "(\<forall>x. wolf x \<longrightarrow> animal x) & (\<exists>x. wolf x) &
+       (\<forall>x. fox x \<longrightarrow> animal x) & (\<exists>x. fox x) &
+       (\<forall>x. bird x \<longrightarrow> animal x) & (\<exists>x. bird x) &
+       (\<forall>x. caterpillar x \<longrightarrow> animal x) & (\<exists>x. caterpillar x) &
+       (\<forall>x. snail x \<longrightarrow> animal x) & (\<exists>x. snail x) &
+       (\<forall>x. grain x \<longrightarrow> plant x) & (\<exists>x. grain x) &
+       (\<forall>x. animal x \<longrightarrow>
+             ((\<forall>y. plant y \<longrightarrow> eats x y)  \<or> 
+	      (\<forall>y. animal y & smaller_than y x &
+                    (\<exists>z. plant z & eats y z) \<longrightarrow> eats x y))) &
+       (\<forall>x y. bird y & (snail x \<or> caterpillar x) \<longrightarrow> smaller_than x y) &
+       (\<forall>x y. bird x & fox y \<longrightarrow> smaller_than x y) &
+       (\<forall>x y. fox x & wolf y \<longrightarrow> smaller_than x y) &
+       (\<forall>x y. wolf x & (fox y \<or> grain y) \<longrightarrow> ~eats x y) &
+       (\<forall>x y. bird x & caterpillar y \<longrightarrow> eats x y) &
+       (\<forall>x y. bird x & snail y \<longrightarrow> ~eats x y) &
+       (\<forall>x. (caterpillar x \<or> snail x) \<longrightarrow> (\<exists>y. plant y & eats x y))
+       \<longrightarrow> (\<exists>x y. animal x & animal y & (\<exists>z. grain z & eats y z & eats x y))"
 by (tactic{*safe_best_meson_tac 1*})
     --{*Nearly twice as fast as @{text meson},
         which performs iterative deepening rather than best-first search*}
--- a/src/HOL/ex/NatSum.thy	Tue Jun 28 16:12:03 2005 +0200
+++ b/src/HOL/ex/NatSum.thy	Tue Jun 28 17:56:04 2005 +0200
@@ -18,7 +18,6 @@
 *}
 
 lemmas [simp] =
-  lessThan_Suc atMost_Suc setsum_op_ivl_Suc setsum_cl_ivl_Suc
   left_distrib right_distrib
   left_diff_distrib right_diff_distrib --{*for true subtraction*}
   diff_mult_distrib diff_mult_distrib2 --{*for type nat*}
@@ -28,10 +27,8 @@
   squared.
 *}
 
-lemma sum_of_odds: "(\<Sum>i \<in> {0..<n}. Suc (i + i)) = n * n"
-  apply (induct n)
-   apply auto
-  done
+lemma sum_of_odds: "(\<Sum>i=0..<n. Suc (i + i)) = n * n"
+  by (induct n, auto)
 
 
 text {*
@@ -40,23 +37,17 @@
 
 lemma sum_of_odd_squares:
   "3 * (\<Sum>i=0..<n. Suc(2*i) * Suc(2*i)) = n * (4 * n * n - 1)"
-  apply (induct n)
-   apply (auto split: nat_diff_split) (*eliminate the subtraction*)
-  done
+  by (induct n, auto)
 
 
 text {*
   \medskip The sum of the first @{text n} odd cubes
 *}
 
-lemma numeral_2_eq_2: "2 = Suc (Suc 0)" by auto
-
 lemma sum_of_odd_cubes:
   "(\<Sum>i=0..<n. Suc (2*i) * Suc (2*i) * Suc (2*i)) =
     n * n * (2 * n * n - 1)"
-  apply (induct n)
-   apply (auto split: nat_diff_split) (*eliminate the subtraction*)
-  done
+  by (induct n, auto)
 
 text {*
   \medskip The sum of the first @{text n} positive integers equals
@@ -64,21 +55,15 @@
 
 lemma sum_of_naturals:
     "2 * (\<Sum>i=0..n. i) = n * Suc n"
-  apply (induct n)
-   apply auto
-  done
+  by (induct n, auto)
 
 lemma sum_of_squares:
     "6 * (\<Sum>i=0..n. i * i) = n * Suc n * Suc (2 * n)"
-  apply (induct n)
-   apply auto
-  done
+  by (induct n, auto)
 
 lemma sum_of_cubes:
     "4 * (\<Sum>i=0..n. i * i * i) = n * n * Suc n * Suc n"
-  apply (induct n)
-   apply auto
-  done
+  by (induct n, auto)
 
 
 text {*
@@ -95,24 +80,20 @@
   done
 
 text {*
-  Tow alternative proofs, with a change of variables and much more
+  Two alternative proofs, with a change of variables and much more
   subtraction, performed using the integers. *}
 
 lemma int_sum_of_fourth_powers:
   "30 * int (\<Sum>i=0..<m. i * i * i * i) =
     int m * (int m - 1) * (int(2 * m) - 1) *
     (int(3 * m * m) - int(3 * m) - 1)"
-  apply (induct m)
-   apply (simp_all add:zmult_int[symmetric])
-  done
+  by (induct m, simp_all add: int_mult)
 
 lemma of_nat_sum_of_fourth_powers:
   "30 * of_nat (\<Sum>i=0..<m. i * i * i * i) =
     of_nat m * (of_nat m - 1) * (of_nat (2 * m) - 1) *
     (of_nat (3 * m * m) - of_nat (3 * m) - (1::int))"
-  apply (induct m)
-   apply simp_all
-  done
+  by (induct m, simp_all)
 
 
 text {*
@@ -126,13 +107,10 @@
   done
 
 lemma sum_of_3_powers: "2 * (\<Sum>i=0..<n. 3^i) = 3^n - (1::nat)"
-  apply (induct n)
-   apply auto
-  done
+  by (induct n, auto)
 
 lemma sum_of_powers: "0 < k ==> (k - 1) * (\<Sum>i=0..<n. k^i) = k^n - (1::nat)"
-  apply (induct n)
-   apply auto
-  done
+  by (induct n, auto)
+
 
 end