# HG changeset patch # User paulson # Date 1245341648 -3600 # Node ID b41d61c768e2e2e42743e7fcb152f6aef3392fd3 # Parent 4e6064759aeb79e37ce94758dfcca82fdd3fee6e Removed unnecessary conditions concerning nonzero divisors diff -r 4e6064759aeb -r b41d61c768e2 src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Thu Jun 18 15:08:57 2009 +0200 +++ b/src/HOL/Finite_Set.thy Thu Jun 18 17:14:08 2009 +0100 @@ -524,7 +524,7 @@ subsection {* A fold functional for finite sets *} text {* The intended behaviour is -@{text "fold f z {x\<^isub>1, ..., x\<^isub>n} = f x\<^isub>1 (\ (f x\<^isub>n z)\)"} +@{text "fold f z {x1, ..., xn} = f x1 (\ (f xn z)\)"} if @{text f} is ``left-commutative'': *} @@ -1879,14 +1879,14 @@ (if a:A then setprod f A / f a else setprod f A)" by (erule finite_induct) (auto simp add: insert_Diff_if) -lemma setprod_inversef: "finite A ==> - ALL x: A. f x \ (0::'a::{field,division_by_zero}) ==> - setprod (inverse \ f) A = inverse (setprod f A)" +lemma setprod_inversef: + fixes f :: "'b \ 'a::{field,division_by_zero}" + shows "finite A ==> setprod (inverse \ f) A = inverse (setprod f A)" by (erule finite_induct) auto lemma setprod_dividef: - "[|finite A; - \x \ A. g x \ (0::'a::{field,division_by_zero})|] + fixes f :: "'b \ 'a::{field,division_by_zero}" + shows "finite A ==> setprod (%x. f x / g x) A = setprod f A / setprod g A" apply (subgoal_tac "setprod (%x. f x / g x) A = setprod (%x. f x * (inverse \ g) x) A") @@ -2721,16 +2721,16 @@ begin definition - Inf_fin :: "'a set \ 'a" ("\\<^bsub>fin\<^esub>_" [900] 900) + Inf_fin :: "'a set \ 'a" ("\fin_" [900] 900) where "Inf_fin = fold1 inf" definition - Sup_fin :: "'a set \ 'a" ("\\<^bsub>fin\<^esub>_" [900] 900) + Sup_fin :: "'a set \ 'a" ("\fin_" [900] 900) where "Sup_fin = fold1 sup" -lemma Inf_le_Sup [simp]: "\ finite A; A \ {} \ \ \\<^bsub>fin\<^esub>A \ \\<^bsub>fin\<^esub>A" +lemma Inf_le_Sup [simp]: "\ finite A; A \ {} \ \ \finA \ \finA" apply(unfold Sup_fin_def Inf_fin_def) apply(subgoal_tac "EX a. a:A") prefer 2 apply blast @@ -2741,13 +2741,13 @@ done lemma sup_Inf_absorb [simp]: - "finite A \ a \ A \ sup a (\\<^bsub>fin\<^esub>A) = a" + "finite A \ a \ A \ sup a (\finA) = a" apply(subst sup_commute) apply(simp add: Inf_fin_def sup_absorb2 fold1_belowI) done lemma inf_Sup_absorb [simp]: - "finite A \ a \ A \ inf a (\\<^bsub>fin\<^esub>A) = a" + "finite A \ a \ A \ inf a (\finA) = a" by (simp add: Sup_fin_def inf_absorb1 lower_semilattice.fold1_belowI [OF dual_lattice]) @@ -2759,7 +2759,7 @@ lemma sup_Inf1_distrib: assumes "finite A" and "A \ {}" - shows "sup x (\\<^bsub>fin\<^esub>A) = \\<^bsub>fin\<^esub>{sup x a|a. a \ A}" + shows "sup x (\finA) = \fin{sup x a|a. a \ A}" proof - interpret ab_semigroup_idem_mult inf by (rule ab_semigroup_idem_mult_inf) @@ -2771,7 +2771,7 @@ lemma sup_Inf2_distrib: assumes A: "finite A" "A \ {}" and B: "finite B" "B \ {}" - shows "sup (\\<^bsub>fin\<^esub>A) (\\<^bsub>fin\<^esub>B) = \\<^bsub>fin\<^esub>{sup a b|a b. a \ A \ b \ B}" + shows "sup (\finA) (\finB) = \fin{sup a b|a b. a \ A \ b \ B}" using A proof (induct rule: finite_ne_induct) case singleton thus ?case by (simp add: sup_Inf1_distrib [OF B] fold1_singleton_def [OF Inf_fin_def]) @@ -2788,13 +2788,13 @@ thus ?thesis by(simp add: insert(1) B(1)) qed have ne: "{sup a b |a b. a \ A \ b \ B} \ {}" using insert B by blast - have "sup (\\<^bsub>fin\<^esub>(insert x A)) (\\<^bsub>fin\<^esub>B) = sup (inf x (\\<^bsub>fin\<^esub>A)) (\\<^bsub>fin\<^esub>B)" + have "sup (\fin(insert x A)) (\finB) = sup (inf x (\finA)) (\finB)" using insert by (simp add: fold1_insert_idem_def [OF Inf_fin_def]) - also have "\ = inf (sup x (\\<^bsub>fin\<^esub>B)) (sup (\\<^bsub>fin\<^esub>A) (\\<^bsub>fin\<^esub>B))" by(rule sup_inf_distrib2) - also have "\ = inf (\\<^bsub>fin\<^esub>{sup x b|b. b \ B}) (\\<^bsub>fin\<^esub>{sup a b|a b. a \ A \ b \ B})" + also have "\ = inf (sup x (\finB)) (sup (\finA) (\finB))" by(rule sup_inf_distrib2) + also have "\ = inf (\fin{sup x b|b. b \ B}) (\fin{sup a b|a b. a \ A \ b \ B})" using insert by(simp add:sup_Inf1_distrib[OF B]) - also have "\ = \\<^bsub>fin\<^esub>({sup x b |b. b \ B} \ {sup a b |a b. a \ A \ b \ B})" - (is "_ = \\<^bsub>fin\<^esub>?M") + also have "\ = \fin({sup x b |b. b \ B} \ {sup a b |a b. a \ A \ b \ B})" + (is "_ = \fin?M") using B insert by (simp add: Inf_fin_def fold1_Un2 [OF finB _ finAB ne]) also have "?M = {sup a b |a b. a \ insert x A \ b \ B}" @@ -2804,7 +2804,7 @@ lemma inf_Sup1_distrib: assumes "finite A" and "A \ {}" - shows "inf x (\\<^bsub>fin\<^esub>A) = \\<^bsub>fin\<^esub>{inf x a|a. a \ A}" + shows "inf x (\finA) = \fin{inf x a|a. a \ A}" proof - interpret ab_semigroup_idem_mult sup by (rule ab_semigroup_idem_mult_sup) @@ -2815,7 +2815,7 @@ lemma inf_Sup2_distrib: assumes A: "finite A" "A \ {}" and B: "finite B" "B \ {}" - shows "inf (\\<^bsub>fin\<^esub>A) (\\<^bsub>fin\<^esub>B) = \\<^bsub>fin\<^esub>{inf a b|a b. a \ A \ b \ B}" + shows "inf (\finA) (\finB) = \fin{inf a b|a b. a \ A \ b \ B}" using A proof (induct rule: finite_ne_induct) case singleton thus ?case by(simp add: inf_Sup1_distrib [OF B] fold1_singleton_def [OF Sup_fin_def]) @@ -2832,13 +2832,13 @@ have ne: "{inf a b |a b. a \ A \ b \ B} \ {}" using insert B by blast interpret ab_semigroup_idem_mult sup by (rule ab_semigroup_idem_mult_sup) - have "inf (\\<^bsub>fin\<^esub>(insert x A)) (\\<^bsub>fin\<^esub>B) = inf (sup x (\\<^bsub>fin\<^esub>A)) (\\<^bsub>fin\<^esub>B)" + have "inf (\fin(insert x A)) (\finB) = inf (sup x (\finA)) (\finB)" using insert by (simp add: fold1_insert_idem_def [OF Sup_fin_def]) - also have "\ = sup (inf x (\\<^bsub>fin\<^esub>B)) (inf (\\<^bsub>fin\<^esub>A) (\\<^bsub>fin\<^esub>B))" by(rule inf_sup_distrib2) - also have "\ = sup (\\<^bsub>fin\<^esub>{inf x b|b. b \ B}) (\\<^bsub>fin\<^esub>{inf a b|a b. a \ A \ b \ B})" + also have "\ = sup (inf x (\finB)) (inf (\finA) (\finB))" by(rule inf_sup_distrib2) + also have "\ = sup (\fin{inf x b|b. b \ B}) (\fin{inf a b|a b. a \ A \ b \ B})" using insert by(simp add:inf_Sup1_distrib[OF B]) - also have "\ = \\<^bsub>fin\<^esub>({inf x b |b. b \ B} \ {inf a b |a b. a \ A \ b \ B})" - (is "_ = \\<^bsub>fin\<^esub>?M") + also have "\ = \fin({inf x b |b. b \ B} \ {inf a b |a b. a \ A \ b \ B})" + (is "_ = \fin?M") using B insert by (simp add: Sup_fin_def fold1_Un2 [OF finB _ finAB ne]) also have "?M = {inf a b |a b. a \ insert x A \ b \ B}" @@ -2857,7 +2857,7 @@ lemma Inf_fin_Inf: assumes "finite A" and "A \ {}" - shows "\\<^bsub>fin\<^esub>A = Inf A" + shows "\finA = Inf A" proof - interpret ab_semigroup_idem_mult inf by (rule ab_semigroup_idem_mult_inf) @@ -2868,7 +2868,7 @@ lemma Sup_fin_Sup: assumes "finite A" and "A \ {}" - shows "\\<^bsub>fin\<^esub>A = Sup A" + shows "\finA = Sup A" proof - interpret ab_semigroup_idem_mult sup by (rule ab_semigroup_idem_mult_sup)