src/HOL/Presburger.thy
author wenzelm
Fri, 16 Apr 2004 04:07:10 +0200
changeset 14577 dbb95b825244
parent 14485 ea2707645af8
child 14738 83f1a514dcb4
permissions -rw-r--r--
tuned document;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     1
(*  Title:      HOL/Integ/Presburger.thy
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     2
    ID:         $Id$
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     3
    Author:     Amine Chaieb, Tobias Nipkow and Stefan Berghofer, TU Muenchen
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     5
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     6
File containing necessary theorems for the proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     7
generation for Cooper Algorithm  
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     8
*)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
     9
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    10
header {* Presburger Arithmetic: Cooper Algorithm *}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    11
14485
ea2707645af8 new material from Avigad
paulson
parents: 14378
diff changeset
    12
theory Presburger = NatSimprocs + SetInterval
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    13
files
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    14
  ("cooper_dec.ML")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    15
  ("cooper_proof.ML")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    16
  ("qelim.ML")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    17
  ("presburger.ML"):
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    18
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    19
text {* Theorem for unitifying the coeffitients of @{text x} in an existential formula*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    20
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    21
theorem unity_coeff_ex: "(\<exists>x::int. P (l * x)) = (\<exists>x. l dvd (1*x+0) \<and> P x)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    22
  apply (rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    23
  apply (erule exE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    24
  apply (rule_tac x = "l * x" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    25
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    26
  apply (erule exE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    27
  apply (erule conjE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    28
  apply (erule dvdE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    29
  apply (rule_tac x = k in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    30
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    31
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    32
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    33
lemma uminus_dvd_conv: "(d dvd (t::int)) = (-d dvd t)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    34
apply(unfold dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    35
apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    36
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    37
apply(rename_tac k)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    38
apply(rule_tac x = "-k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    39
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    40
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    41
apply(rename_tac k)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    42
apply(rule_tac x = "-k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    43
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    44
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    45
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    46
lemma uminus_dvd_conv': "(d dvd (t::int)) = (d dvd -t)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    47
apply(unfold dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    48
apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    49
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    50
apply(rule_tac x = "-k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    51
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    52
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    53
apply(rule_tac x = "-k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    54
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    55
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    56
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    57
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    58
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    59
text {*Theorems for the combination of proofs of the equality of @{text P} and @{text P_m} for integers @{text x} less than some integer @{text z}.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    60
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    61
theorem eq_minf_conjI: "\<exists>z1::int. \<forall>x. x < z1 \<longrightarrow> (A1 x = A2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    62
  \<exists>z2::int. \<forall>x. x < z2 \<longrightarrow> (B1 x = B2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    63
  \<exists>z::int. \<forall>x. x < z \<longrightarrow> ((A1 x \<and> B1 x) = (A2 x \<and> B2 x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    64
  apply (erule exE)+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    65
  apply (rule_tac x = "min z1 z2" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    66
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    67
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    68
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    69
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    70
theorem eq_minf_disjI: "\<exists>z1::int. \<forall>x. x < z1 \<longrightarrow> (A1 x = A2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    71
  \<exists>z2::int. \<forall>x. x < z2 \<longrightarrow> (B1 x = B2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    72
  \<exists>z::int. \<forall>x. x < z \<longrightarrow> ((A1 x \<or> B1 x) = (A2 x \<or> B2 x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    73
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    74
  apply (erule exE)+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    75
  apply (rule_tac x = "min z1 z2" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    76
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    77
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    78
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    79
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    80
text {*Theorems for the combination of proofs of the equality of @{text P} and @{text P_m} for integers @{text x} greather than some integer @{text z}.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    81
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    82
theorem eq_pinf_conjI: "\<exists>z1::int. \<forall>x. z1 < x \<longrightarrow> (A1 x = A2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    83
  \<exists>z2::int. \<forall>x. z2 < x \<longrightarrow> (B1 x = B2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    84
  \<exists>z::int. \<forall>x. z < x \<longrightarrow> ((A1 x \<and> B1 x) = (A2 x \<and> B2 x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    85
  apply (erule exE)+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    86
  apply (rule_tac x = "max z1 z2" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    87
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    88
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    89
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    90
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    91
theorem eq_pinf_disjI: "\<exists>z1::int. \<forall>x. z1 < x \<longrightarrow> (A1 x = A2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    92
  \<exists>z2::int. \<forall>x. z2 < x \<longrightarrow> (B1 x = B2 x) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    93
  \<exists>z::int. \<forall>x. z < x  \<longrightarrow> ((A1 x \<or> B1 x) = (A2 x \<or> B2 x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    94
  apply (erule exE)+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    95
  apply (rule_tac x = "max z1 z2" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    96
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
    97
  done
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    98
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
    99
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   100
  \medskip Theorems for the combination of proofs of the modulo @{text
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   101
  D} property for @{text "P plusinfinity"}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   102
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   103
  FIXME: This is THE SAME theorem as for the @{text minusinf} version,
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   104
  but with @{text "+k.."} instead of @{text "-k.."} In the future
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   105
  replace these both with only one. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   106
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   107
theorem modd_pinf_conjI: "\<forall>(x::int) k. A x = A (x+k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   108
  \<forall>(x::int) k. B x = B (x+k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   109
  \<forall>(x::int) (k::int). (A x \<and> B x) = (A (x+k*d) \<and> B (x+k*d))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   110
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   111
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   112
theorem modd_pinf_disjI: "\<forall>(x::int) k. A x = A (x+k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   113
  \<forall>(x::int) k. B x = B (x+k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   114
  \<forall>(x::int) (k::int). (A x \<or> B x) = (A (x+k*d) \<or> B (x+k*d))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   115
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   116
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   117
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   118
  This is one of the cases where the simplifed formula is prooved to
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   119
  habe some property (in relation to @{text P_m}) but we need to prove
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   120
  the property for the original formula (@{text P_m})
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   121
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   122
  FIXME: This is exaclty the same thm as for @{text minusinf}. *}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   123
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   124
lemma pinf_simp_eq: "ALL x. P(x) = Q(x) ==> (EX (x::int). P(x)) --> (EX (x::int). F(x))  ==> (EX (x::int). Q(x)) --> (EX (x::int). F(x)) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   125
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   126
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   127
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   128
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   129
  \medskip Theorems for the combination of proofs of the modulo @{text D}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   130
  property for @{text "P minusinfinity"} *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   131
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   132
theorem modd_minf_conjI: "\<forall>(x::int) k. A x = A (x-k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   133
  \<forall>(x::int) k. B x = B (x-k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   134
  \<forall>(x::int) (k::int). (A x \<and> B x) = (A (x-k*d) \<and> B (x-k*d))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   135
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   136
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   137
theorem modd_minf_disjI: "\<forall>(x::int) k. A x = A (x-k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   138
  \<forall>(x::int) k. B x = B (x-k*d) \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   139
  \<forall>(x::int) (k::int). (A x \<or> B x) = (A (x-k*d) \<or> B (x-k*d))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   140
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   141
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   142
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   143
  This is one of the cases where the simplifed formula is prooved to
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   144
  have some property (in relation to @{text P_m}) but we need to
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   145
  prove the property for the original formula (@{text P_m}). *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   146
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   147
lemma minf_simp_eq: "ALL x. P(x) = Q(x) ==> (EX (x::int). P(x)) --> (EX (x::int). F(x))  ==> (EX (x::int). Q(x)) --> (EX (x::int). F(x)) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   148
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   149
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   150
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   151
  Theorem needed for proving at runtime divide properties using the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   152
  arithmetic tactic (which knows only about modulo = 0). *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   153
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   154
lemma zdvd_iff_zmod_eq_0: "(m dvd n) = (n mod m = (0::int))"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   155
  by(simp add:dvd_def zmod_eq_0_iff)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   156
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   157
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   158
  \medskip Theorems used for the combination of proof for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   159
  backwards direction of Cooper's Theorem. They rely exclusively on
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   160
  Predicate calculus.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   161
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   162
lemma not_ast_p_disjI: "(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> P1(x) --> P1(x + d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   163
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   164
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> P2(x) --> P2(x + d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   165
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   166
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) -->(P1(x) \<or> P2(x)) --> (P1(x + d) \<or> P2(x + d))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   167
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   168
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   169
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   170
lemma not_ast_p_conjI: "(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a- j)) --> P1(x) --> P1(x + d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   171
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   172
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> P2(x) --> P2(x + d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   173
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   174
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) -->(P1(x) \<and> P2(x)) --> (P1(x + d)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   175
\<and> P2(x + d))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   176
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   177
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   178
lemma not_ast_p_Q_elim: "
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   179
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) -->P(x) --> P(x + d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   180
==> ( P = Q )
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   181
==> (ALL x. ~(EX (j::int) : {1..d}. EX (a::int) : A. P(a - j)) -->P(x) --> P(x + d))"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   182
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   183
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   184
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   185
  \medskip Theorems used for the combination of proof for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   186
  backwards direction of Cooper's Theorem. They rely exclusively on
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   187
  Predicate calculus.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   188
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   189
lemma not_bst_p_disjI: "(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> P1(x) --> P1(x - d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   190
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   191
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> P2(x) --> P2(x - d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   192
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   193
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) -->(P1(x) \<or> P2(x)) --> (P1(x - d)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   194
\<or> P2(x-d))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   195
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   196
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   197
lemma not_bst_p_conjI: "(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> P1(x) --> P1(x - d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   198
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   199
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> P2(x) --> P2(x - d))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   200
==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   201
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) -->(P1(x) \<and> P2(x)) --> (P1(x - d)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   202
\<and> P2(x-d))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   203
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   204
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   205
lemma not_bst_p_Q_elim: "
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   206
(ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) -->P(x) --> P(x - d)) 
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   207
==> ( P = Q )
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   208
==> (ALL x. ~(EX (j::int) : {1..d}. EX (b::int) : B. P(b+j)) -->P(x) --> P(x - d))"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   209
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   210
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   211
text {* \medskip This is the first direction of Cooper's Theorem. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   212
lemma cooper_thm: "(R --> (EX x::int. P x))  ==> (Q -->(EX x::int.  P x )) ==> ((R|Q) --> (EX x::int. P x )) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   213
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   214
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   215
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   216
  \medskip The full Cooper's Theorem in its equivalence Form. Given
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   217
  the premises it is trivial too, it relies exclusively on prediacte calculus.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   218
lemma cooper_eq_thm: "(R --> (EX x::int. P x))  ==> (Q -->(EX x::int.  P x )) ==> ((~Q)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   219
--> (EX x::int. P x ) --> R) ==> (EX x::int. P x) = R|Q "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   220
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   221
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   222
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   223
  \medskip Some of the atomic theorems generated each time the atom
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   224
  does not depend on @{text x}, they are trivial.*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   225
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   226
lemma  fm_eq_minf: "EX z::int. ALL x. x < z --> (P = P) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   227
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   228
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   229
lemma  fm_modd_minf: "ALL (x::int). ALL (k::int). (P = P)"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   230
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   231
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   232
lemma not_bst_p_fm: "ALL (x::int). Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> fm --> fm"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   233
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   234
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   235
lemma  fm_eq_pinf: "EX z::int. ALL x. z < x --> (P = P) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   236
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   237
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   238
text {* The next two thms are the same as the @{text minusinf} version. *}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   239
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   240
lemma  fm_modd_pinf: "ALL (x::int). ALL (k::int). (P = P)"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   241
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   242
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   243
lemma not_ast_p_fm: "ALL (x::int). Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> fm --> fm"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   244
  by blast
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   245
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   246
text {* Theorems to be deleted from simpset when proving simplified formulaes. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   247
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   248
lemma P_eqtrue: "(P=True) = P"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   249
  by rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   250
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   251
lemma P_eqfalse: "(P=False) = (~P)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   252
  by rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   253
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   254
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   255
  \medskip Theorems for the generation of the bachwards direction of
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   256
  Cooper's Theorem.
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   257
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   258
  These are the 6 interesting atomic cases which have to be proved relying on the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   259
  properties of B-set and the arithmetic and contradiction proofs. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   260
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   261
lemma not_bst_p_lt: "0 < (d::int) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   262
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> ( 0 < -x + a) --> (0 < -(x - d) + a )"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   263
  by arith
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   264
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   265
lemma not_bst_p_gt: "\<lbrakk> (g::int) \<in> B; g = -a \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   266
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> (0 < (x) + a) --> ( 0 < (x - d) + a)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   267
apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   268
apply(rule ccontr)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   269
apply(drule_tac x = "x+a" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   270
apply(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   271
apply(drule_tac x = "-a" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   272
apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   273
apply(simp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   274
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   275
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   276
lemma not_bst_p_eq: "\<lbrakk> 0 < d; (g::int) \<in> B; g = -a - 1 \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   277
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> (0 = x + a) --> (0 = (x - d) + a )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   278
apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   279
apply(subgoal_tac "x = -a")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   280
 prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   281
apply(drule_tac x = "1" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   282
apply(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   283
apply(drule_tac x = "-a- 1" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   284
apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   285
apply(simp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   286
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   287
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   288
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   289
lemma not_bst_p_ne: "\<lbrakk> 0 < d; (g::int) \<in> B; g = -a \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   290
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> ~(0 = x + a) --> ~(0 = (x - d) + a)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   291
apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   292
apply(subgoal_tac "x = -a+d")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   293
 prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   294
apply(drule_tac x = "d" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   295
apply(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   296
apply(drule_tac x = "-a" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   297
apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   298
apply(simp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   299
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   300
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   301
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   302
lemma not_bst_p_dvd: "(d1::int) dvd d ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   303
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> d1 dvd (x + a) --> d1 dvd ((x - d) + a )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   304
apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   305
apply(rename_tac m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   306
apply(rule_tac x = "m - k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   307
apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   308
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   309
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   310
lemma not_bst_p_ndvd: "(d1::int) dvd d ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   311
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (b::int) : B. Q(b+j)) --> ~(d1 dvd (x + a)) --> ~(d1 dvd ((x - d) + a ))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   312
apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   313
apply(rename_tac m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   314
apply(erule_tac x = "m + k" in allE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   315
apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   316
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   317
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   318
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   319
  \medskip Theorems for the generation of the bachwards direction of
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   320
  Cooper's Theorem.
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   321
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   322
  These are the 6 interesting atomic cases which have to be proved
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   323
  relying on the properties of A-set ant the arithmetic and
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   324
  contradiction proofs. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   325
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   326
lemma not_ast_p_gt: "0 < (d::int) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   327
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> ( 0 < x + t) --> (0 < (x + d) + t )"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   328
  by arith
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   329
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   330
lemma not_ast_p_lt: "\<lbrakk>0 < d ;(t::int) \<in> A \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   331
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> (0 < -x + t) --> ( 0 < -(x + d) + t)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   332
  apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   333
  apply (rule ccontr)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   334
  apply (drule_tac x = "t-x" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   335
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   336
  apply (drule_tac x = "t" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   337
  apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   338
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   339
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   340
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   341
lemma not_ast_p_eq: "\<lbrakk> 0 < d; (g::int) \<in> A; g = -t + 1 \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   342
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> (0 = x + t) --> (0 = (x + d) + t )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   343
  apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   344
  apply (drule_tac x="1" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   345
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   346
  apply (drule_tac x="- t + 1" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   347
  apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   348
  apply(subgoal_tac "x = -t")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   349
  prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   350
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   351
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   352
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   353
lemma not_ast_p_ne: "\<lbrakk> 0 < d; (g::int) \<in> A; g = -t \<rbrakk> \<Longrightarrow>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   354
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> ~(0 = x + t) --> ~(0 = (x + d) + t)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   355
  apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   356
  apply (subgoal_tac "x = -t-d")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   357
  prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   358
  apply (drule_tac x = "d" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   359
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   360
  apply (drule_tac x = "-t" in bspec)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   361
  apply assumption
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   362
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   363
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   364
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   365
lemma not_ast_p_dvd: "(d1::int) dvd d ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   366
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> d1 dvd (x + t) --> d1 dvd ((x + d) + t )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   367
  apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   368
  apply(rename_tac m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   369
  apply(rule_tac x = "m + k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   370
  apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   371
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   372
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   373
lemma not_ast_p_ndvd: "(d1::int) dvd d ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   374
 ALL x. Q(x::int) \<and> ~(EX (j::int) : {1..d}. EX (a::int) : A. Q(a - j)) --> ~(d1 dvd (x + t)) --> ~(d1 dvd ((x + d) + t ))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   375
  apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   376
  apply(rename_tac m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   377
  apply(erule_tac x = "m - k" in allE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   378
  apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   379
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   380
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   381
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   382
  \medskip These are the atomic cases for the proof generation for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   383
  modulo @{text D} property for @{text "P plusinfinity"}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   384
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   385
  They are fully based on arithmetics. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   386
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   387
lemma  dvd_modd_pinf: "((d::int) dvd d1) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   388
 (ALL (x::int). ALL (k::int). (((d::int) dvd (x + t)) = (d dvd (x+k*d1 + t))))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   389
  apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   390
  apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   391
  apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   392
  apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   393
  apply(rule_tac x = "m + n*k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   394
  apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   395
  apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   396
  apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   397
  apply(rule_tac x = "m - n*k" in exI)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   398
  apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   399
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   400
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   401
lemma  not_dvd_modd_pinf: "((d::int) dvd d1) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   402
 (ALL (x::int). ALL k. (~((d::int) dvd (x + t))) = (~(d dvd (x+k*d1 + t))))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   403
  apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   404
  apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   405
  apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   406
  apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   407
  apply(erule_tac x = "m - n*k" in allE)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   408
  apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   409
  apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   410
  apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   411
  apply(erule_tac x = "m + n*k" in allE)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   412
  apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   413
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   414
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   415
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   416
  \medskip These are the atomic cases for the proof generation for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   417
  equivalence of @{text P} and @{text "P plusinfinity"} for integers
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   418
  @{text x} greater than some integer @{text z}.
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   419
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   420
  They are fully based on arithmetics. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   421
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   422
lemma  eq_eq_pinf: "EX z::int. ALL x. z < x --> (( 0 = x +t ) = False )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   423
  apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   424
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   425
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   426
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   427
lemma  neq_eq_pinf: "EX z::int. ALL x.  z < x --> ((~( 0 = x +t )) = True )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   428
  apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   429
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   430
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   431
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   432
lemma  le_eq_pinf: "EX z::int. ALL x.  z < x --> ( 0 < x +t  = True )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   433
  apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   434
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   435
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   436
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   437
lemma  len_eq_pinf: "EX z::int. ALL x. z < x  --> (0 < -x +t  = False )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   438
  apply(rule_tac x = "t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   439
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   440
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   441
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   442
lemma  dvd_eq_pinf: "EX z::int. ALL x.  z < x --> ((d dvd (x + t)) = (d dvd (x + t))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   443
  by simp
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   444
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   445
lemma  not_dvd_eq_pinf: "EX z::int. ALL x. z < x  --> ((~(d dvd (x + t))) = (~(d dvd (x + t)))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   446
  by simp
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   447
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   448
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   449
  \medskip These are the atomic cases for the proof generation for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   450
  modulo @{text D} property for @{text "P minusinfinity"}.
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   451
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   452
  They are fully based on arithmetics. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   453
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   454
lemma  dvd_modd_minf: "((d::int) dvd d1) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   455
 (ALL (x::int). ALL (k::int). (((d::int) dvd (x + t)) = (d dvd (x-k*d1 + t))))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   456
apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   457
apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   458
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   459
apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   460
apply(rule_tac x = "m - n*k" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   461
apply(simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   462
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   463
apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   464
apply(rule_tac x = "m + n*k" in exI)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   465
apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   466
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   467
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   468
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   469
lemma  not_dvd_modd_minf: "((d::int) dvd d1) ==>
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   470
 (ALL (x::int). ALL k. (~((d::int) dvd (x + t))) = (~(d dvd (x-k*d1 + t))))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   471
apply(clarsimp simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   472
apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   473
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   474
apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   475
apply(erule_tac x = "m + n*k" in allE)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   476
apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   477
apply(clarsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   478
apply(rename_tac n m)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   479
apply(erule_tac x = "m - n*k" in allE)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   480
apply(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   481
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   482
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   483
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   484
  \medskip These are the atomic cases for the proof generation for the
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   485
  equivalence of @{text P} and @{text "P minusinfinity"} for integers
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   486
  @{text x} less than some integer @{text z}.
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   487
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   488
  They are fully based on arithmetics. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   489
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   490
lemma  eq_eq_minf: "EX z::int. ALL x. x < z --> (( 0 = x +t ) = False )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   491
apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   492
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   493
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   494
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   495
lemma  neq_eq_minf: "EX z::int. ALL x. x < z --> ((~( 0 = x +t )) = True )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   496
apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   497
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   498
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   499
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   500
lemma  le_eq_minf: "EX z::int. ALL x. x < z --> ( 0 < x +t  = False )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   501
apply(rule_tac x = "-t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   502
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   503
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   504
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   505
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   506
lemma  len_eq_minf: "EX z::int. ALL x. x < z --> (0 < -x +t  = True )"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   507
apply(rule_tac x = "t" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   508
apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   509
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   510
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   511
lemma  dvd_eq_minf: "EX z::int. ALL x. x < z --> ((d dvd (x + t)) = (d dvd (x + t))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   512
  by simp
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   513
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   514
lemma  not_dvd_eq_minf: "EX z::int. ALL x. x < z --> ((~(d dvd (x + t))) = (~(d dvd (x + t)))) "
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   515
  by simp
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   516
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   517
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   518
  \medskip This Theorem combines whithnesses about @{text "P
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   519
  minusinfinity"} to show one component of the equivalence proof for
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   520
  Cooper's Theorem.
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   521
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   522
  FIXME: remove once they are part of the distribution. *}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   523
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   524
theorem int_ge_induct[consumes 1,case_names base step]:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   525
  assumes ge: "k \<le> (i::int)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   526
        base: "P(k)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   527
        step: "\<And>i. \<lbrakk>k \<le> i; P i\<rbrakk> \<Longrightarrow> P(i+1)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   528
  shows "P i"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   529
proof -
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   530
  { fix n have "\<And>i::int. n = nat(i-k) \<Longrightarrow> k <= i \<Longrightarrow> P i"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   531
    proof (induct n)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   532
      case 0
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   533
      hence "i = k" by arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   534
      thus "P i" using base by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   535
    next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   536
      case (Suc n)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   537
      hence "n = nat((i - 1) - k)" by arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   538
      moreover
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   539
      have ki1: "k \<le> i - 1" using Suc.prems by arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   540
      ultimately
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   541
      have "P(i - 1)" by(rule Suc.hyps)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   542
      from step[OF ki1 this] show ?case by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   543
    qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   544
  }
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   545
  from this ge show ?thesis by fast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   546
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   547
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   548
theorem int_gr_induct[consumes 1,case_names base step]:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   549
  assumes gr: "k < (i::int)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   550
        base: "P(k+1)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   551
        step: "\<And>i. \<lbrakk>k < i; P i\<rbrakk> \<Longrightarrow> P(i+1)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   552
  shows "P i"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   553
apply(rule int_ge_induct[of "k + 1"])
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   554
  using gr apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   555
 apply(rule base)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   556
apply(rule step)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   557
 apply simp+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   558
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   559
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   560
lemma decr_lemma: "0 < (d::int) \<Longrightarrow> x - (abs(x-z)+1) * d < z"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   561
apply(induct rule: int_gr_induct)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   562
 apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   563
 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   564
apply (simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   565
apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   566
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   567
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   568
lemma incr_lemma: "0 < (d::int) \<Longrightarrow> z < x + (abs(x-z)+1) * d"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   569
apply(induct rule: int_gr_induct)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   570
 apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   571
 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   572
apply (simp add:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   573
apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   574
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   575
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   576
lemma  minusinfinity:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   577
  assumes "0 < d" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   578
    P1eqP1: "ALL x k. P1 x = P1(x - k*d)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   579
    ePeqP1: "EX z::int. ALL x. x < z \<longrightarrow> (P x = P1 x)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   580
  shows "(EX x. P1 x) \<longrightarrow> (EX x. P x)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   581
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   582
  assume eP1: "EX x. P1 x"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   583
  then obtain x where P1: "P1 x" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   584
  from ePeqP1 obtain z where P1eqP: "ALL x. x < z \<longrightarrow> (P x = P1 x)" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   585
  let ?w = "x - (abs(x-z)+1) * d"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   586
  show "EX x. P x"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   587
  proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   588
    have w: "?w < z" by(rule decr_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   589
    have "P1 x = P1 ?w" using P1eqP1 by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   590
    also have "\<dots> = P(?w)" using w P1eqP by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   591
    finally show "P ?w" using P1 by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   592
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   593
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   594
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   595
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   596
  \medskip This Theorem combines whithnesses about @{text "P
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   597
  minusinfinity"} to show one component of the equivalence proof for
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   598
  Cooper's Theorem. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   599
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   600
lemma plusinfinity:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   601
  assumes "0 < d" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   602
    P1eqP1: "ALL (x::int) (k::int). P1 x = P1 (x + k * d)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   603
    ePeqP1: "EX z::int. ALL x. z < x  --> (P x = P1 x)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   604
  shows "(EX x::int. P1 x) --> (EX x::int. P x)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   605
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   606
  assume eP1: "EX x. P1 x"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   607
  then obtain x where P1: "P1 x" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   608
  from ePeqP1 obtain z where P1eqP: "ALL x. z < x \<longrightarrow> (P x = P1 x)" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   609
  let ?w = "x + (abs(x-z)+1) * d"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   610
  show "EX x. P x"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   611
  proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   612
    have w: "z < ?w" by(rule incr_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   613
    have "P1 x = P1 ?w" using P1eqP1 by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   614
    also have "\<dots> = P(?w)" using w P1eqP by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   615
    finally show "P ?w" using P1 by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   616
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   617
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   618
 
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   619
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   620
  \medskip Theorem for periodic function on discrete sets. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   621
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   622
lemma minf_vee:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   623
  assumes dpos: "(0::int) < d" and modd: "ALL x k. P x = P(x - k*d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   624
  shows "(EX x. P x) = (EX j : {1..d}. P j)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   625
  (is "?LHS = ?RHS")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   626
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   627
  assume ?LHS
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   628
  then obtain x where P: "P x" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   629
  have "x mod d = x - (x div d)*d"
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   630
    by(simp add:zmod_zdiv_equality mult_ac eq_diff_eq)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   631
  hence Pmod: "P x = P(x mod d)" using modd by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   632
  show ?RHS
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   633
  proof (cases)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   634
    assume "x mod d = 0"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   635
    hence "P 0" using P Pmod by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   636
    moreover have "P 0 = P(0 - (-1)*d)" using modd by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   637
    ultimately have "P d" by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   638
    moreover have "d : {1..d}" using dpos by(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   639
    ultimately show ?RHS ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   640
  next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   641
    assume not0: "x mod d \<noteq> 0"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   642
    have "P(x mod d)" using dpos P Pmod by(simp add:pos_mod_sign pos_mod_bound)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   643
    moreover have "x mod d : {1..d}"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   644
    proof -
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   645
      have "0 \<le> x mod d" by(rule pos_mod_sign)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   646
      moreover have "x mod d < d" by(rule pos_mod_bound)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   647
      ultimately show ?thesis using not0 by(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   648
    qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   649
    ultimately show ?RHS ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   650
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   651
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   652
  assume ?RHS thus ?LHS by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   653
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   654
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   655
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   656
  \medskip Theorem for periodic function on discrete sets. *}
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   657
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   658
lemma pinf_vee:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   659
  assumes dpos: "0 < (d::int)" and modd: "ALL (x::int) (k::int). P x = P (x+k*d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   660
  shows "(EX x::int. P x) = (EX (j::int) : {1..d} . P j)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   661
  (is "?LHS = ?RHS")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   662
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   663
  assume ?LHS
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   664
  then obtain x where P: "P x" ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   665
  have "x mod d = x + (-(x div d))*d"
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   666
    by(simp add:zmod_zdiv_equality mult_ac eq_diff_eq)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   667
  hence Pmod: "P x = P(x mod d)" using modd by (simp only:)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   668
  show ?RHS
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   669
  proof (cases)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   670
    assume "x mod d = 0"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   671
    hence "P 0" using P Pmod by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   672
    moreover have "P 0 = P(0 + 1*d)" using modd by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   673
    ultimately have "P d" by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   674
    moreover have "d : {1..d}" using dpos by(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   675
    ultimately show ?RHS ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   676
  next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   677
    assume not0: "x mod d \<noteq> 0"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   678
    have "P(x mod d)" using dpos P Pmod by(simp add:pos_mod_sign pos_mod_bound)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   679
    moreover have "x mod d : {1..d}"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   680
    proof -
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   681
      have "0 \<le> x mod d" by(rule pos_mod_sign)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   682
      moreover have "x mod d < d" by(rule pos_mod_bound)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   683
      ultimately show ?thesis using not0 by(simp add:atLeastAtMost_iff)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   684
    qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   685
    ultimately show ?RHS ..
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   686
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   687
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   688
  assume ?RHS thus ?LHS by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   689
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   690
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   691
lemma decr_mult_lemma:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   692
  assumes dpos: "(0::int) < d" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   693
          minus: "ALL x::int. P x \<longrightarrow> P(x - d)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   694
          knneg: "0 <= k"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   695
  shows "ALL x. P x \<longrightarrow> P(x - k*d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   696
using knneg
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   697
proof (induct rule:int_ge_induct)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   698
  case base thus ?case by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   699
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   700
  case (step i)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   701
  show ?case
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   702
  proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   703
    fix x
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   704
    have "P x \<longrightarrow> P (x - i * d)" using step.hyps by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   705
    also have "\<dots> \<longrightarrow> P(x - (i + 1) * d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   706
      using minus[THEN spec, of "x - i * d"]
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   707
      by (simp add:int_distrib Ring_and_Field.diff_diff_eq[symmetric])
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   708
    ultimately show "P x \<longrightarrow> P(x - (i + 1) * d)" by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   709
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   710
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   711
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   712
lemma incr_mult_lemma:
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   713
  assumes dpos: "(0::int) < d" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   714
          plus: "ALL x::int. P x \<longrightarrow> P(x + d)" and
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   715
          knneg: "0 <= k"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   716
  shows "ALL x. P x \<longrightarrow> P(x + k*d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   717
using knneg
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   718
proof (induct rule:int_ge_induct)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   719
  case base thus ?case by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   720
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   721
  case (step i)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   722
  show ?case
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   723
  proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   724
    fix x
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   725
    have "P x \<longrightarrow> P (x + i * d)" using step.hyps by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   726
    also have "\<dots> \<longrightarrow> P(x + (i + 1) * d)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   727
      using plus[THEN spec, of "x + i * d"]
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   728
      by (simp add:int_distrib zadd_ac)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   729
    ultimately show "P x \<longrightarrow> P(x + (i + 1) * d)" by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   730
  qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   731
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   732
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   733
lemma cpmi_eq: "0 < D \<Longrightarrow> (EX z::int. ALL x. x < z --> (P x = P1 x))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   734
==> ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D) 
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   735
==> (ALL (x::int). ALL (k::int). ((P1 x)= (P1 (x-k*D))))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   736
==> (EX (x::int). P(x)) = ((EX (j::int) : {1..D} . (P1(j))) | (EX (j::int) : {1..D}. EX (b::int) : B. P (b+j)))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   737
apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   738
prefer 2
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   739
apply(drule minusinfinity)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   740
apply assumption+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   741
apply(fastsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   742
apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   743
apply(subgoal_tac "!!k. 0<=k \<Longrightarrow> !x. P x \<longrightarrow> P (x - k*D)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   744
apply(frule_tac x = x and z=z in decr_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   745
apply(subgoal_tac "P1(x - (\<bar>x - z\<bar> + 1) * D)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   746
prefer 2
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   747
apply(subgoal_tac "0 <= (\<bar>x - z\<bar> + 1)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   748
prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   749
 apply fastsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   750
apply(drule (1) minf_vee)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   751
apply blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   752
apply(blast dest:decr_mult_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   753
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   754
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   755
text {* Cooper Theorem, plus infinity version. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   756
lemma cppi_eq: "0 < D \<Longrightarrow> (EX z::int. ALL x. z < x --> (P x = P1 x))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   757
==> ALL x.~(EX (j::int) : {1..D}. EX (a::int) : A. P(a - j)) --> P (x) --> P (x + D) 
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   758
==> (ALL (x::int). ALL (k::int). ((P1 x)= (P1 (x+k*D))))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   759
==> (EX (x::int). P(x)) = ((EX (j::int) : {1..D} . (P1(j))) | (EX (j::int) : {1..D}. EX (a::int) : A. P (a - j)))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   760
  apply(rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   761
  prefer 2
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   762
  apply(drule plusinfinity)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   763
  apply assumption+
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   764
  apply(fastsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   765
  apply clarsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   766
  apply(subgoal_tac "!!k. 0<=k \<Longrightarrow> !x. P x \<longrightarrow> P (x + k*D)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   767
  apply(frule_tac x = x and z=z in incr_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   768
  apply(subgoal_tac "P1(x + (\<bar>x - z\<bar> + 1) * D)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   769
  prefer 2
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   770
  apply(subgoal_tac "0 <= (\<bar>x - z\<bar> + 1)")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   771
  prefer 2 apply arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   772
  apply fastsimp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   773
  apply(drule (1) pinf_vee)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   774
  apply blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   775
  apply(blast dest:incr_mult_lemma)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   776
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   777
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   778
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   779
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   780
  \bigskip Theorems for the quantifier elminination Functions. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   781
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   782
lemma qe_ex_conj: "(EX (x::int). A x) = R
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   783
		==> (EX (x::int). P x) = (Q & (EX x::int. A x))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   784
		==> (EX (x::int). P x) = (Q & R)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   785
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   786
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   787
lemma qe_ex_nconj: "(EX (x::int). P x) = (True & Q)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   788
		==> (EX (x::int). P x) = Q"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   789
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   790
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   791
lemma qe_conjI: "P1 = P2 ==> Q1 = Q2 ==> (P1 & Q1) = (P2 & Q2)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   792
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   793
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   794
lemma qe_disjI: "P1 = P2 ==> Q1 = Q2 ==> (P1 | Q1) = (P2 | Q2)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   795
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   796
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   797
lemma qe_impI: "P1 = P2 ==> Q1 = Q2 ==> (P1 --> Q1) = (P2 --> Q2)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   798
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   799
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   800
lemma qe_eqI: "P1 = P2 ==> Q1 = Q2 ==> (P1 = Q1) = (P2 = Q2)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   801
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   802
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   803
lemma qe_Not: "P = Q ==> (~P) = (~Q)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   804
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   805
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   806
lemma qe_ALL: "(EX x. ~P x) = R ==> (ALL x. P x) = (~R)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   807
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   808
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   809
text {* \bigskip Theorems for proving NNF *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   810
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   811
lemma nnf_im: "((~P) = P1) ==> (Q=Q1) ==> ((P --> Q) = (P1 | Q1))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   812
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   813
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   814
lemma nnf_eq: "((P & Q) = (P1 & Q1)) ==> (((~P) & (~Q)) = (P2 & Q2)) ==> ((P = Q) = ((P1 & Q1)|(P2 & Q2)))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   815
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   816
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   817
lemma nnf_nn: "(P = Q) ==> ((~~P) = Q)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   818
  by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   819
lemma nnf_ncj: "((~P) = P1) ==> ((~Q) = Q1) ==> ((~(P & Q)) = (P1 | Q1))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   820
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   821
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   822
lemma nnf_ndj: "((~P) = P1) ==> ((~Q) = Q1) ==> ((~(P | Q)) = (P1 & Q1))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   823
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   824
lemma nnf_nim: "(P = P1) ==> ((~Q) = Q1) ==> ((~(P --> Q)) = (P1 & Q1))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   825
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   826
lemma nnf_neq: "((P & (~Q)) = (P1 & Q1)) ==> (((~P) & Q) = (P2 & Q2)) ==> ((~(P = Q)) = ((P1 & Q1)|(P2 & Q2)))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   827
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   828
lemma nnf_sdj: "((A & (~B)) = (A1 & B1)) ==> ((C & (~D)) = (C1 & D1)) ==> (A = (~C)) ==> ((~((A & B) | (C & D))) = ((A1 & B1) | (C1 & D1)))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   829
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   830
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   831
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   832
lemma qe_exI2: "A = B ==> (EX (x::int). A(x)) = (EX (x::int). B(x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   833
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   834
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   835
lemma qe_exI: "(!!x::int. A x = B x) ==> (EX (x::int). A(x)) = (EX (x::int). B(x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   836
  by rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   837
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   838
lemma qe_ALLI: "(!!x::int. A x = B x) ==> (ALL (x::int). A(x)) = (ALL (x::int). B(x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   839
  by rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   840
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   841
lemma cp_expand: "(EX (x::int). P (x)) = (EX (j::int) : {1..d}. EX (b::int) : B. (P1 (j) | P(b+j)))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   842
==>(EX (x::int). P (x)) = (EX (j::int) : {1..d}. EX (b::int) : B. (P1 (j) | P(b+j))) "
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   843
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   844
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   845
lemma cppi_expand: "(EX (x::int). P (x)) = (EX (j::int) : {1..d}. EX (a::int) : A. (P1 (j) | P(a - j)))
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   846
==>(EX (x::int). P (x)) = (EX (j::int) : {1..d}. EX (a::int) : A. (P1 (j) | P(a - j))) "
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   847
by blast
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   848
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   849
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   850
lemma simp_from_to: "{i..j::int} = (if j < i then {} else insert i {i+1..j})"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   851
apply(simp add:atLeastAtMost_def atLeast_def atMost_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   852
apply(fastsimp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   853
done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   854
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   855
text {* \bigskip Theorems required for the @{text adjustcoeffitienteq} *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   856
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   857
lemma ac_dvd_eq: assumes not0: "0 ~= (k::int)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   858
shows "((m::int) dvd (c*n+t)) = (k*m dvd ((k*c)*n+(k*t)))" (is "?P = ?Q")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   859
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   860
  assume ?P
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   861
  thus ?Q
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   862
    apply(simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   863
    apply clarify
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   864
    apply(rename_tac d)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   865
    apply(drule_tac f = "op * k" in arg_cong)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   866
    apply(simp only:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   867
    apply(rule_tac x = "d" in exI)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   868
    apply(simp only:mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   869
    done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   870
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   871
  assume ?Q
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   872
  then obtain d where "k * c * n + k * t = (k*m)*d" by(fastsimp simp:dvd_def)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   873
  hence "(c * n + t) * k = (m*d) * k" by(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   874
  hence "((c * n + t) * k) div k = ((m*d) * k) div k" by(rule arg_cong[of _ _ "%t. t div k"])
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   875
  hence "c*n+t = m*d" by(simp add: zdiv_zmult_self1[OF not0[symmetric]])
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   876
  thus ?P by(simp add:dvd_def)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   877
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   878
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   879
lemma ac_lt_eq: assumes gr0: "0 < (k::int)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   880
shows "((m::int) < (c*n+t)) = (k*m <((k*c)*n+(k*t)))" (is "?P = ?Q")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   881
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   882
  assume P: ?P
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   883
  show ?Q using zmult_zless_mono2[OF P gr0] by(simp add: int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   884
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   885
  assume ?Q
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   886
  hence "0 < k*(c*n + t - m)" by(simp add: int_distrib mult_ac)
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14271
diff changeset
   887
  with gr0 have "0 < (c*n + t - m)" by(simp add: zero_less_mult_iff)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   888
  thus ?P by(simp)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   889
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   890
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   891
lemma ac_eq_eq : assumes not0: "0 ~= (k::int)" shows "((m::int) = (c*n+t)) = (k*m =((k*c)*n+(k*t)) )" (is "?P = ?Q")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   892
proof
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   893
  assume ?P
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   894
  thus ?Q
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   895
    apply(drule_tac f = "op * k" in arg_cong)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   896
    apply(simp only:int_distrib)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   897
    done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   898
next
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   899
  assume ?Q
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   900
  hence "m * k = (c*n + t) * k" by(simp add:int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   901
  hence "((m) * k) div k = ((c*n + t) * k) div k" by(rule arg_cong[of _ _ "%t. t div k"])
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   902
  thus ?P by(simp add: zdiv_zmult_self1[OF not0[symmetric]])
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   903
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   904
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   905
lemma ac_pi_eq: assumes gr0: "0 < (k::int)" shows "(~((0::int) < (c*n + t))) = (0 < ((-k)*c)*n + ((-k)*t + k))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   906
proof -
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   907
  have "(~ (0::int) < (c*n + t)) = (0<1-(c*n + t))" by arith
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   908
  also have  "(1-(c*n + t)) = (-1*c)*n + (-t+1)" by(simp add: int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   909
  also have "0<(-1*c)*n + (-t+1) = (0 < (k*(-1*c)*n) + (k*(-t+1)))" by(rule ac_lt_eq[of _ 0,OF gr0,simplified])
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   910
  also have "(k*(-1*c)*n) + (k*(-t+1)) = ((-k)*c)*n + ((-k)*t + k)" by(simp add: int_distrib mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   911
  finally show ?thesis .
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   912
qed
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   913
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   914
lemma binminus_uminus_conv: "(a::int) - b = a + (-b)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   915
by arith
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   916
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   917
lemma  linearize_dvd: "(t::int) = t1 ==> (d dvd t) = (d dvd t1)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   918
by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   919
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   920
lemma lf_lt: "(l::int) = ll ==> (r::int) = lr ==> (l < r) =(ll < lr)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   921
by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   922
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   923
lemma lf_eq: "(l::int) = ll ==> (r::int) = lr ==> (l = r) =(ll = lr)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   924
by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   925
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   926
lemma lf_dvd: "(l::int) = ll ==> (r::int) = lr ==> (l dvd r) =(ll dvd lr)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   927
by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   928
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   929
text {* \bigskip Theorems for transforming predicates on nat to predicates on @{text int}*}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   930
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   931
theorem all_nat: "(\<forall>x::nat. P x) = (\<forall>x::int. 0 <= x \<longrightarrow> P (nat x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   932
  by (simp split add: split_nat)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   933
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   934
theorem ex_nat: "(\<exists>x::nat. P x) = (\<exists>x::int. 0 <= x \<and> P (nat x))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   935
  apply (simp split add: split_nat)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   936
  apply (rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   937
  apply (erule exE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   938
  apply (rule_tac x = "int x" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   939
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   940
  apply (erule exE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   941
  apply (rule_tac x = "nat x" in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   942
  apply (erule conjE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   943
  apply (erule_tac x = "nat x" in allE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   944
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   945
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   946
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   947
theorem zdiff_int_split: "P (int (x - y)) =
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   948
  ((y \<le> x \<longrightarrow> P (int x - int y)) \<and> (x < y \<longrightarrow> P 0))"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   949
  apply (case_tac "y \<le> x")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   950
  apply (simp_all add: zdiff_int)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   951
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   952
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   953
theorem zdvd_int: "(x dvd y) = (int x dvd int y)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   954
  apply (simp only: dvd_def ex_nat int_int_eq [symmetric] zmult_int [symmetric]
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   955
    nat_0_le cong add: conj_cong)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   956
  apply (rule iffI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   957
  apply rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   958
  apply (erule exE)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   959
  apply (case_tac "x=0")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   960
  apply (rule_tac x=0 in exI)
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   961
  apply simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   962
  apply (case_tac "0 \<le> k")
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   963
  apply rules
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   964
  apply (simp add: linorder_not_le)
14378
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14353
diff changeset
   965
  apply (drule mult_strict_left_mono_neg [OF iffD2 [OF zero_less_int_conv]])
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   966
  apply assumption
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14139
diff changeset
   967
  apply (simp add: mult_ac)
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   968
  done
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   969
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   970
theorem number_of1: "(0::int) <= number_of n \<Longrightarrow> (0::int) <= number_of (n BIT b)"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   971
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   972
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   973
theorem number_of2: "(0::int) <= number_of bin.Pls" by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   974
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   975
theorem Suc_plus1: "Suc n = n + 1" by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   976
14577
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   977
text {*
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   978
  \medskip Specific instances of congruence rules, to prevent
dbb95b825244 tuned document;
wenzelm
parents: 14485
diff changeset
   979
  simplifier from looping. *}
13876
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   980
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   981
theorem imp_le_cong: "(0 <= x \<Longrightarrow> P = P') \<Longrightarrow> (0 <= (x::nat) \<longrightarrow> P) = (0 <= x \<longrightarrow> P')"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   982
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   983
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   984
theorem conj_le_cong: "(0 <= x \<Longrightarrow> P = P') \<Longrightarrow> (0 <= (x::nat) \<and> P) = (0 <= x \<and> P')"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   985
  by simp
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   986
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   987
use "cooper_dec.ML"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   988
use "cooper_proof.ML"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   989
use "qelim.ML"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   990
use "presburger.ML"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   991
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   992
setup "Presburger.setup"
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   993
68f4ed8311ac New decision procedure for Presburger arithmetic.
berghofe
parents:
diff changeset
   994
end