src/HOL/SetInterval.thy
changeset 20217 25b068a99d2b
parent 19538 ae6d01fa2d8a
child 21502 7f3ea2b3bab6
equal deleted inserted replaced
20216:f30b73385060 20217:25b068a99d2b
   299   show "?A \<subseteq> ?B" by auto
   299   show "?A \<subseteq> ?B" by auto
   300 next
   300 next
   301   show "?B \<subseteq> ?A"
   301   show "?B \<subseteq> ?A"
   302   proof
   302   proof
   303     fix n assume a: "n : ?B"
   303     fix n assume a: "n : ?B"
   304     hence "n - k : {i..j}" by auto arith+
   304     hence "n - k : {i..j}" by auto
   305     moreover have "n = (n - k) + k" using a by auto
   305     moreover have "n = (n - k) + k" using a by auto
   306     ultimately show "n : ?A" by blast
   306     ultimately show "n : ?A" by blast
   307   qed
   307   qed
   308 qed
   308 qed
   309 
   309 
   313   show "?A \<subseteq> ?B" by auto
   313   show "?A \<subseteq> ?B" by auto
   314 next
   314 next
   315   show "?B \<subseteq> ?A"
   315   show "?B \<subseteq> ?A"
   316   proof
   316   proof
   317     fix n assume a: "n : ?B"
   317     fix n assume a: "n : ?B"
   318     hence "n - k : {i..<j}" by auto arith+
   318     hence "n - k : {i..<j}" by auto
   319     moreover have "n = (n - k) + k" using a by auto
   319     moreover have "n = (n - k) + k" using a by auto
   320     ultimately show "n : ?A" by blast
   320     ultimately show "n : ?A" by blast
   321   qed
   321   qed
   322 qed
   322 qed
   323 
   323 
   382   apply (subgoal_tac "(%x. x + l) ` {..<u-l} = {l..<u}")
   382   apply (subgoal_tac "(%x. x + l) ` {..<u-l} = {l..<u}")
   383   apply (erule subst)
   383   apply (erule subst)
   384   apply (rule card_image)
   384   apply (rule card_image)
   385   apply (simp add: inj_on_def)
   385   apply (simp add: inj_on_def)
   386   apply (auto simp add: image_def atLeastLessThan_def lessThan_def)
   386   apply (auto simp add: image_def atLeastLessThan_def lessThan_def)
   387   apply arith
       
   388   apply (rule_tac x = "x - l" in exI)
   387   apply (rule_tac x = "x - l" in exI)
   389   apply arith
   388   apply arith
   390   done
   389   done
   391 
   390 
   392 lemma card_atLeastAtMost [simp]: "card {l..u} = Suc u - l"
   391 lemma card_atLeastAtMost [simp]: "card {l..u} = Suc u - l"