src/HOL/SetInterval.thy
changeset 15561 045a07ac35a7
parent 15554 03d4347b071d
child 15911 b730b0edc085
equal deleted inserted replaced
15560:c862d556fb18 15561:045a07ac35a7
   390   apply auto
   390   apply auto
   391   done
   391   done
   392 
   392 
   393 lemma image_atLeastLessThan_int_shift:
   393 lemma image_atLeastLessThan_int_shift:
   394     "(%x. x + (l::int)) ` {0..<u-l} = {l..<u}"
   394     "(%x. x + (l::int)) ` {0..<u-l} = {l..<u}"
   395   apply (auto simp add: image_def atLeastLessThan_iff)
   395   apply (auto simp add: image_def)
   396   apply (rule_tac x = "x - l" in bexI)
   396   apply (rule_tac x = "x - l" in bexI)
   397   apply auto
   397   apply auto
   398   done
   398   done
   399 
   399 
   400 lemma finite_atLeastLessThan_int [iff]: "finite {l..<u::int}"
   400 lemma finite_atLeastLessThan_int [iff]: "finite {l..<u::int}"
   610 lemma setsum_ivl_cong:
   610 lemma setsum_ivl_cong:
   611  "\<lbrakk>a = c; b = d; !!x. \<lbrakk> c \<le> x; x < d \<rbrakk> \<Longrightarrow> f x = g x \<rbrakk> \<Longrightarrow>
   611  "\<lbrakk>a = c; b = d; !!x. \<lbrakk> c \<le> x; x < d \<rbrakk> \<Longrightarrow> f x = g x \<rbrakk> \<Longrightarrow>
   612  setsum f {a..<b} = setsum g {c..<d}"
   612  setsum f {a..<b} = setsum g {c..<d}"
   613 by(rule setsum_cong, simp_all)
   613 by(rule setsum_cong, simp_all)
   614 
   614 
   615 lemma setsum_cl_ivl_add_one_nat: "(n::nat) <= m + 1 ==>
       
   616     (\<Sum>i=n..m+1. f i) = (\<Sum>i=n..m. f i) + f(m + 1)"
       
   617 by (auto simp:add_ac atLeastAtMostSuc_conv)
       
   618 
       
   619 (* FIXME delete
   615 (* FIXME delete
   620 lemma Summation_Suc[simp]: "(\<Sum>i < Suc n. b i) = b n + (\<Sum>i < n. b i)"
   616 lemma Summation_Suc[simp]: "(\<Sum>i < Suc n. b i) = b n + (\<Sum>i < n. b i)"
   621 by (simp add:lessThan_Suc)
   617 by (simp add:lessThan_Suc)
   622 *)
   618 *)
       
   619 
       
   620 lemma setsum_cl_ivl_Suc:
       
   621   "setsum f {m..Suc n} = (if Suc n < m then 0 else setsum f {m..n} + f(Suc n))"
       
   622 by (auto simp:add_ac atLeastAtMostSuc_conv)
       
   623 
       
   624 lemma setsum_op_ivl_Suc:
       
   625   "setsum f {m..<Suc n} = (if n < m then 0 else setsum f {m..<n} + f(n))"
       
   626 by (auto simp:add_ac atLeastLessThanSuc)
       
   627 
       
   628 lemma setsum_cl_ivl_add_one_nat: "(n::nat) <= m + 1 ==>
       
   629     (\<Sum>i=n..m+1. f i) = (\<Sum>i=n..m. f i) + f(m + 1)"
       
   630 by (auto simp:add_ac atLeastAtMostSuc_conv)
   623 
   631 
   624 lemma setsum_add_nat_ivl: "\<lbrakk> m \<le> n; n \<le> p \<rbrakk> \<Longrightarrow>
   632 lemma setsum_add_nat_ivl: "\<lbrakk> m \<le> n; n \<le> p \<rbrakk> \<Longrightarrow>
   625   setsum f {m..<n} + setsum f {n..<p} = setsum f {m..<p::nat}"
   633   setsum f {m..<n} + setsum f {n..<p} = setsum f {m..<p::nat}"
   626 by (simp add:setsum_Un_disjoint[symmetric] ivl_disj_int ivl_disj_un)
   634 by (simp add:setsum_Un_disjoint[symmetric] ivl_disj_int ivl_disj_un)
   627 
   635