src/HOL/Word/Bit_Representation.thy
changeset 45852 24f563d94497
parent 45851 19f7ac6cf3cc
child 45853 cbb6f2243b52
equal deleted inserted replaced
45851:19f7ac6cf3cc 45852:24f563d94497
   368   apply (auto simp: even_def)
   368   apply (auto simp: even_def)
   369   done
   369   done
   370 
   370 
   371 subsection "Simplifications for (s)bintrunc"
   371 subsection "Simplifications for (s)bintrunc"
   372 
   372 
       
   373 lemma bintrunc_n_0 [simp]: "bintrunc n 0 = 0"
       
   374   by (induct n) (auto simp add: Int.Pls_def)
       
   375 
       
   376 lemma bintrunc_Suc_numeral:
       
   377   "bintrunc (Suc n) 1 = 1"
       
   378   "bintrunc (Suc n) -1 = bintrunc n -1 BIT 1"
       
   379   "bintrunc (Suc n) (number_of (Int.Bit0 w)) = bintrunc n (number_of w) BIT 0"
       
   380   "bintrunc (Suc n) (number_of (Int.Bit1 w)) = bintrunc n (number_of w) BIT 1"
       
   381   by simp_all
       
   382 
   373 lemma bit_bool:
   383 lemma bit_bool:
   374   "(b = (b' = (1::bit))) = (b' = (if b then (1::bit) else (0::bit)))"
   384   "(b = (b' = (1::bit))) = (b' = (if b then (1::bit) else (0::bit)))"
   375   by (cases b') auto
   385   by (cases b') auto
   376 
   386 
   377 lemmas bit_bool1 [simp] = refl [THEN bit_bool [THEN iffD1], symmetric]
   387 lemmas bit_bool1 [simp] = refl [THEN bit_bool [THEN iffD1], symmetric]
   450   "bintrunc (Suc n) (Int.Bit1 w) = Int.Bit1 (bintrunc n w)"
   460   "bintrunc (Suc n) (Int.Bit1 w) = Int.Bit1 (bintrunc n w)"
   451   using bintrunc_BIT [where b="(1::bit)"] by (simp add: BIT_simps)
   461   using bintrunc_BIT [where b="(1::bit)"] by (simp add: BIT_simps)
   452 
   462 
   453 lemmas bintrunc_Sucs = bintrunc_Pls bintrunc_Min bintrunc_BIT
   463 lemmas bintrunc_Sucs = bintrunc_Pls bintrunc_Min bintrunc_BIT
   454   bintrunc_Bit0 bintrunc_Bit1
   464   bintrunc_Bit0 bintrunc_Bit1
       
   465   bintrunc_Suc_numeral
   455 
   466 
   456 lemmas sbintrunc_Suc_Pls = 
   467 lemmas sbintrunc_Suc_Pls = 
   457   sbintrunc.Suc [where bin="Int.Pls", simplified bin_last_simps bin_rest_simps]
   468   sbintrunc.Suc [where bin="Int.Pls", simplified bin_last_simps bin_rest_simps]
   458 
   469 
   459 lemmas sbintrunc_Suc_Min = 
   470 lemmas sbintrunc_Suc_Min = 
   533 lemmas bintrunc_Pls_minus_I = bmsts(1)
   544 lemmas bintrunc_Pls_minus_I = bmsts(1)
   534 lemmas bintrunc_Min_minus_I = bmsts(2)
   545 lemmas bintrunc_Min_minus_I = bmsts(2)
   535 lemmas bintrunc_BIT_minus_I = bmsts(3)
   546 lemmas bintrunc_BIT_minus_I = bmsts(3)
   536 
   547 
   537 lemma bintrunc_0_Min: "bintrunc 0 Int.Min = Int.Pls"
   548 lemma bintrunc_0_Min: "bintrunc 0 Int.Min = Int.Pls"
   538   by auto
   549   by (fact bintrunc.Z) (* FIXME: delete *)
   539 lemma bintrunc_0_BIT: "bintrunc 0 (w BIT b) = Int.Pls"
   550 lemma bintrunc_0_BIT: "bintrunc 0 (w BIT b) = Int.Pls"
   540   by auto
   551   by (fact bintrunc.Z) (* FIXME: delete *)
   541 
   552 
   542 lemma bintrunc_Suc_lem:
   553 lemma bintrunc_Suc_lem:
   543   "bintrunc (Suc n) x = y ==> m = Suc n ==> bintrunc m x = y"
   554   "bintrunc (Suc n) x = y ==> m = Suc n ==> bintrunc m x = y"
   544   by auto
   555   by auto
   545 
   556