# HG changeset patch # User nipkow # Date 1109699332 -3600 # Node ID 03d4347b071d3f45d7a52b03b7b7983940fcd8cc # Parent 2b3f9c493259eaadd9ec0f2ff2f88bece0b0c43b integrated Jeremy's FiniteLib diff -r 2b3f9c493259 -r 03d4347b071d src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Tue Mar 01 05:44:13 2005 +0100 +++ b/src/HOL/Finite_Set.thy Tue Mar 01 18:48:52 2005 +0100 @@ -895,8 +895,11 @@ "A = B ==> (!!x. x:B ==> f x = g x) ==> setsum f A = setsum g B" by(fastsimp simp: setsum_def intro: ACf.fold_cong[OF ACf_add]) +lemma setsum_cong2: "\\x. x \ A \ f x = g x\ \ setsum f A = setsum g A"; + by (rule setsum_cong[OF refl], auto); + lemma setsum_reindex_cong: - "[|inj_on f A; B = f ` A; !!a. g a = h (f a)|] + "[|inj_on f A; B = f ` A; !!a. a:A \ g a = h (f a)|] ==> setsum h B = setsum g A" by (simp add: setsum_reindex cong: setsum_cong) @@ -1066,6 +1069,17 @@ by (simp add: setsum_def) qed +lemma setsum_strict_mono: +fixes f :: "'a \ 'b::{pordered_cancel_ab_semigroup_add,comm_monoid_add}" +assumes fin_ne: "finite A" "A \ {}" +shows "(!!x. x:A \ f x < g x) \ setsum f A < setsum g A" +using fin_ne +proof (induct rule: finite_ne_induct) + case singleton thus ?case by simp +next + case insert thus ?case by (auto simp: add_strict_mono) +qed + lemma setsum_negf: "setsum (%x. - (f x)::'a::ab_group_add) A = - setsum f A" proof (cases "finite A") diff -r 2b3f9c493259 -r 03d4347b071d src/HOL/Integ/IntDef.thy --- a/src/HOL/Integ/IntDef.thy Tue Mar 01 05:44:13 2005 +0100 +++ b/src/HOL/Integ/IntDef.thy Tue Mar 01 18:48:52 2005 +0100 @@ -764,31 +764,31 @@ text{*By Jeremy Avigad*} -lemma setsum_of_nat: "of_nat (setsum f A) = setsum (of_nat \ f) A" +lemma of_nat_setsum: "of_nat (setsum f A) = (\x\A. of_nat(f x))" apply (case_tac "finite A") apply (erule finite_induct, auto) done -lemma setsum_of_int: "of_int (setsum f A) = setsum (of_int \ f) A" +lemma of_int_setsum: "of_int (setsum f A) = (\x\A. of_int(f x))" apply (case_tac "finite A") apply (erule finite_induct, auto) done -lemma int_setsum: "int (setsum f A) = setsum (int \ f) A" - by (simp add: int_eq_of_nat setsum_of_nat) +lemma int_setsum: "int (setsum f A) = (\x\A. int(f x))" + by (simp add: int_eq_of_nat of_nat_setsum) -lemma setprod_of_nat: "of_nat (setprod f A) = setprod (of_nat \ f) A" +lemma of_nat_setprod: "of_nat (setprod f A) = (\x\A. of_nat(f x))" apply (case_tac "finite A") apply (erule finite_induct, auto) done -lemma setprod_of_int: "of_int (setprod f A) = setprod (of_int \ f) A" +lemma of_int_setprod: "of_int (setprod f A) = (\x\A. of_int(f x))" apply (case_tac "finite A") apply (erule finite_induct, auto) done -lemma int_setprod: "int (setprod f A) = setprod (int \ f) A" - by (simp add: int_eq_of_nat setprod_of_nat) +lemma int_setprod: "int (setprod f A) = (\x\A. int(f x))" + by (simp add: int_eq_of_nat of_nat_setprod) lemma setprod_nonzero_nat: "finite A ==> (\x \ A. f x \ (0::nat)) ==> setprod f A \ 0" diff -r 2b3f9c493259 -r 03d4347b071d src/HOL/Set.thy --- a/src/HOL/Set.thy Tue Mar 01 05:44:13 2005 +0100 +++ b/src/HOL/Set.thy Tue Mar 01 18:48:52 2005 +0100 @@ -520,6 +520,10 @@ apply (rule Collect_mem_eq) done +(* Due to Brian Huffman *) +lemma expand_set_eq: "(A = B) = (ALL x. (x:A) = (x:B))" +by(auto intro:set_ext) + lemma subset_antisym [intro!]: "A \ B ==> B \ A ==> A = B" -- {* Anti-symmetry of the subset relation. *} by (rules intro: set_ext subsetD) diff -r 2b3f9c493259 -r 03d4347b071d src/HOL/SetInterval.thy --- a/src/HOL/SetInterval.thy Tue Mar 01 05:44:13 2005 +0100 +++ b/src/HOL/SetInterval.thy Tue Mar 01 18:48:52 2005 +0100 @@ -168,26 +168,18 @@ subsection {*Two-sided intervals*} -text {* @{text greaterThanLessThan} *} - lemma greaterThanLessThan_iff [simp]: "(i : {l<.. {m::'a::order..n} = {}"; + by (auto simp add: atLeastAtMost_def atMost_def atLeast_def); + +lemma atLeastLessThan_empty[simp]: "n \ m ==> {m.. m ==> {m.. Suc n \ {m..Suc n} = insert (Suc n) {m..n}" +by (auto simp add: atLeastAtMost_def) + subsubsection {* Finiteness *} lemma finite_lessThan [iff]: fixes k :: nat shows "finite {.. + (\i=n..m+1. f i) = (\i=n..m. f i) + f(m + 1)" +by (auto simp:add_ac atLeastAtMostSuc_conv) + +(* FIXME delete lemma Summation_Suc[simp]: "(\i < Suc n. b i) = b n + (\i < n. b i)" by (simp add:lessThan_Suc) +*) lemma setsum_add_nat_ivl: "\ m \ n; n \ p \ \ setsum f {m..