src/HOL/Presburger.thy
changeset 18202 46af82efd311
parent 17589 58eeffd73be1
child 20051 859e7129961b
     1.1 --- a/src/HOL/Presburger.thy	Fri Nov 18 07:10:37 2005 +0100
     1.2 +++ b/src/HOL/Presburger.thy	Fri Nov 18 07:13:58 2005 +0100
     1.3 @@ -982,6 +982,99 @@
     1.4  theorem conj_le_cong: "(0 <= x \<Longrightarrow> P = P') \<Longrightarrow> (0 <= (x::int) \<and> P) = (0 <= x \<and> P')"
     1.5    by (simp cong: conj_cong)
     1.6  
     1.7 +    (* Theorems used in presburger.ML for the computation simpset*)
     1.8 +    (* FIXME: They are present in Float.thy, so may be Float.thy should be lightened.*)
     1.9 +
    1.10 +lemma lift_bool: "x \<Longrightarrow> x=True"
    1.11 +  by simp
    1.12 +
    1.13 +lemma nlift_bool: "~x \<Longrightarrow> x=False"
    1.14 +  by simp
    1.15 +
    1.16 +lemma not_false_eq_true: "(~ False) = True" by simp
    1.17 +
    1.18 +lemma not_true_eq_false: "(~ True) = False" by simp
    1.19 +
    1.20 +
    1.21 +lemma int_eq_number_of_eq: "(((number_of v)::int)=(number_of w)) = iszero ((number_of (bin_add v (bin_minus w)))::int)"
    1.22 +  by simp
    1.23 +lemma int_iszero_number_of_Pls: "iszero (Numeral0::int)" 
    1.24 +  by (simp only: iszero_number_of_Pls)
    1.25 +
    1.26 +lemma int_nonzero_number_of_Min: "~(iszero ((-1)::int))"
    1.27 +  by simp
    1.28 +
    1.29 +lemma int_iszero_number_of_0: "iszero ((number_of (w BIT bit.B0))::int) = iszero ((number_of w)::int)"
    1.30 +  by simp
    1.31 +
    1.32 +lemma int_iszero_number_of_1: "\<not> iszero ((number_of (w BIT bit.B1))::int)" 
    1.33 +  by simp
    1.34 +
    1.35 +lemma int_less_number_of_eq_neg: "(((number_of x)::int) < number_of y) = neg ((number_of (bin_add x (bin_minus y)))::int)"
    1.36 +  by simp
    1.37 +
    1.38 +lemma int_not_neg_number_of_Pls: "\<not> (neg (Numeral0::int))" 
    1.39 +  by simp
    1.40 +
    1.41 +lemma int_neg_number_of_Min: "neg (-1::int)"
    1.42 +  by simp
    1.43 +
    1.44 +lemma int_neg_number_of_BIT: "neg ((number_of (w BIT x))::int) = neg ((number_of w)::int)"
    1.45 +  by simp
    1.46 +
    1.47 +lemma int_le_number_of_eq: "(((number_of x)::int) \<le> number_of y) = (\<not> neg ((number_of (bin_add y (bin_minus x)))::int))"
    1.48 +  by simp
    1.49 +lemma int_number_of_add_sym: "((number_of v)::int) + number_of w = number_of (bin_add v w)"
    1.50 +  by simp
    1.51 +
    1.52 +lemma int_number_of_diff_sym: "((number_of v)::int) - number_of w = number_of (bin_add v (bin_minus w))"
    1.53 +  by simp
    1.54 +
    1.55 +lemma int_number_of_mult_sym: "((number_of v)::int) * number_of w = number_of (bin_mult v w)"
    1.56 +  by simp
    1.57 +
    1.58 +lemma int_number_of_minus_sym: "- ((number_of v)::int) = number_of (bin_minus v)"
    1.59 +  by simp
    1.60 +lemma add_left_zero: "0 + a = (a::'a::comm_monoid_add)"
    1.61 +  by simp
    1.62 +
    1.63 +lemma add_right_zero: "a + 0 = (a::'a::comm_monoid_add)"
    1.64 +  by simp
    1.65 +
    1.66 +lemma mult_left_one: "1 * a = (a::'a::semiring_1)"
    1.67 +  by simp
    1.68 +
    1.69 +lemma mult_right_one: "a * 1 = (a::'a::semiring_1)"
    1.70 +  by simp
    1.71 +
    1.72 +lemma int_pow_0: "(a::int)^(Numeral0) = 1"
    1.73 +  by simp
    1.74 +
    1.75 +lemma int_pow_1: "(a::int)^(Numeral1) = a"
    1.76 +  by simp
    1.77 +
    1.78 +lemma zero_eq_Numeral0_nring: "(0::'a::number_ring) = Numeral0"
    1.79 +  by simp
    1.80 +
    1.81 +lemma one_eq_Numeral1_nring: "(1::'a::number_ring) = Numeral1"
    1.82 +  by simp
    1.83 +
    1.84 +lemma zero_eq_Numeral0_nat: "(0::nat) = Numeral0"
    1.85 +  by simp
    1.86 +
    1.87 +lemma one_eq_Numeral1_nat: "(1::nat) = Numeral1"
    1.88 +  by simp
    1.89 +
    1.90 +lemma zpower_Pls: "(z::int)^Numeral0 = Numeral1"
    1.91 +  by simp
    1.92 +
    1.93 +lemma zpower_Min: "(z::int)^((-1)::nat) = Numeral1"
    1.94 +proof -
    1.95 +  have 1:"((-1)::nat) = 0"
    1.96 +    by simp
    1.97 +  show ?thesis by (simp add: 1)
    1.98 +qed
    1.99 +
   1.100  use "cooper_dec.ML"
   1.101  use "reflected_presburger.ML" 
   1.102  use "reflected_cooper.ML"