src/HOL/Integ/Bin.thy
changeset 14473 846c237bd9b3
parent 14387 e96d5c42c4b0
child 14479 0eca4aabf371
equal deleted inserted replaced
14472:cba7c0a3ffb3 14473:846c237bd9b3
   157 
   157 
   158 text{*The premise involving @{term Ints} prevents @{term "a = 1/2"}.*}
   158 text{*The premise involving @{term Ints} prevents @{term "a = 1/2"}.*}
   159 lemma Ints_odd_nonzero: "a \<in> Ints ==> 1 + a + a \<noteq> (0::'a::ordered_ring)"
   159 lemma Ints_odd_nonzero: "a \<in> Ints ==> 1 + a + a \<noteq> (0::'a::ordered_ring)"
   160 proof (unfold Ints_def) 
   160 proof (unfold Ints_def) 
   161   assume "a \<in> range of_int"
   161   assume "a \<in> range of_int"
   162   from this obtain z where a: "a = of_int z" ..
   162   then obtain z where a: "a = of_int z" ..
   163   show ?thesis
   163   show ?thesis
   164   proof
   164   proof
   165     assume eq: "1 + a + a = 0"
   165     assume eq: "1 + a + a = 0"
   166     hence "of_int (1 + z + z) = (of_int 0 :: 'a)" by (simp add: a)
   166     hence "of_int (1 + z + z) = (of_int 0 :: 'a)" by (simp add: a)
   167     hence "1 + z + z = 0" by (simp only: of_int_eq_iff)
   167     hence "1 + z + z = 0" by (simp only: of_int_eq_iff)
   231 text{*The premise involving @{term Ints} prevents @{term "a = 1/2"}.*}
   231 text{*The premise involving @{term Ints} prevents @{term "a = 1/2"}.*}
   232 lemma Ints_odd_less_0: 
   232 lemma Ints_odd_less_0: 
   233      "a \<in> Ints ==> (1 + a + a < 0) = (a < (0::'a::ordered_ring))";
   233      "a \<in> Ints ==> (1 + a + a < 0) = (a < (0::'a::ordered_ring))";
   234 proof (unfold Ints_def) 
   234 proof (unfold Ints_def) 
   235   assume "a \<in> range of_int"
   235   assume "a \<in> range of_int"
   236   from this obtain z where a: "a = of_int z" ..
   236   then obtain z where a: "a = of_int z" ..
   237   hence "((1::'a) + a + a < 0) = (of_int (1 + z + z) < (of_int 0 :: 'a))"
   237   hence "((1::'a) + a + a < 0) = (of_int (1 + z + z) < (of_int 0 :: 'a))"
   238     by (simp add: prems)
   238     by (simp add: prems)
   239   also have "... = (z < 0)" by (simp only: of_int_less_iff odd_less_0)
   239   also have "... = (z < 0)" by (simp only: of_int_less_iff odd_less_0)
   240   also have "... = (a < 0)" by (simp add: prems)
   240   also have "... = (a < 0)" by (simp add: prems)
   241   finally show ?thesis .
   241   finally show ?thesis .