src/HOL/Presburger.thy
author nipkow
Sat, 23 Jun 2007 19:33:22 +0200
changeset 23477 f4b83f03cac9
parent 23472 02099ea56555
child 23685 1b0f4071946c
permissions -rw-r--r--
tuned and renamed group_eq_simps and ring_eq_simps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     1
(* Title:      HOL/Presburger.thy
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     2
   ID:         $Id$
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     3
   Author:     Amine Chaieb, TU Muenchen
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     4
*)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     5
23472
02099ea56555 section headings
huffman
parents: 23465
diff changeset
     6
header {* Decision Procedure for Presburger Arithmetic *}
02099ea56555 section headings
huffman
parents: 23465
diff changeset
     7
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     8
theory Presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
     9
imports Arith_Tools SetInterval
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    10
uses
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    11
  "Tools/Qelim/cooper_data.ML"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    12
  "Tools/Qelim/generated_cooper.ML"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    13
  ("Tools/Qelim/cooper.ML")
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    14
  ("Tools/Qelim/presburger.ML")
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    15
begin
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    16
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    17
setup CooperData.setup
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    18
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    19
subsection{* The @{text "-\<infinity>"} and @{text "+\<infinity>"} Properties *}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    20
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    21
lemma minf:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    22
  "\<lbrakk>\<exists>(z ::'a::linorder).\<forall>x<z. P x = P' x; \<exists>z.\<forall>x<z. Q x = Q' x\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    23
     \<Longrightarrow> \<exists>z.\<forall>x<z. (P x \<and> Q x) = (P' x \<and> Q' x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    24
  "\<lbrakk>\<exists>(z ::'a::linorder).\<forall>x<z. P x = P' x; \<exists>z.\<forall>x<z. Q x = Q' x\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    25
     \<Longrightarrow> \<exists>z.\<forall>x<z. (P x \<or> Q x) = (P' x \<or> Q' x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    26
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x = t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    27
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x \<noteq> t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    28
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x < t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    29
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x \<le> t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    30
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x > t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    31
  "\<exists>(z ::'a::{linorder}).\<forall>x<z.(x \<ge> t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    32
  "\<exists>z.\<forall>(x::'a::{linorder,plus,times})<z. (d dvd x + s) = (d dvd x + s)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    33
  "\<exists>z.\<forall>(x::'a::{linorder,plus,times})<z. (\<not> d dvd x + s) = (\<not> d dvd x + s)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    34
  "\<exists>z.\<forall>x<z. F = F"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    35
  by ((erule exE, erule exE,rule_tac x="min z za" in exI,simp)+, (rule_tac x="t" in exI,fastsimp)+) simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    36
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    37
lemma pinf:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    38
  "\<lbrakk>\<exists>(z ::'a::linorder).\<forall>x>z. P x = P' x; \<exists>z.\<forall>x>z. Q x = Q' x\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    39
     \<Longrightarrow> \<exists>z.\<forall>x>z. (P x \<and> Q x) = (P' x \<and> Q' x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    40
  "\<lbrakk>\<exists>(z ::'a::linorder).\<forall>x>z. P x = P' x; \<exists>z.\<forall>x>z. Q x = Q' x\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    41
     \<Longrightarrow> \<exists>z.\<forall>x>z. (P x \<or> Q x) = (P' x \<or> Q' x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    42
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x = t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    43
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x \<noteq> t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    44
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x < t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    45
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x \<le> t) = False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    46
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x > t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    47
  "\<exists>(z ::'a::{linorder}).\<forall>x>z.(x \<ge> t) = True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    48
  "\<exists>z.\<forall>(x::'a::{linorder,plus,times})>z. (d dvd x + s) = (d dvd x + s)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    49
  "\<exists>z.\<forall>(x::'a::{linorder,plus,times})>z. (\<not> d dvd x + s) = (\<not> d dvd x + s)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    50
  "\<exists>z.\<forall>x>z. F = F"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    51
  by ((erule exE, erule exE,rule_tac x="max z za" in exI,simp)+,(rule_tac x="t" in exI,fastsimp)+) simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    52
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    53
lemma inf_period:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    54
  "\<lbrakk>\<forall>x k. P x = P (x - k*D); \<forall>x k. Q x = Q (x - k*D)\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    55
    \<Longrightarrow> \<forall>x k. (P x \<and> Q x) = (P (x - k*D) \<and> Q (x - k*D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    56
  "\<lbrakk>\<forall>x k. P x = P (x - k*D); \<forall>x k. Q x = Q (x - k*D)\<rbrakk> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    57
    \<Longrightarrow> \<forall>x k. (P x \<or> Q x) = (P (x - k*D) \<or> Q (x - k*D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    58
  "(d::'a::{comm_ring}) dvd D \<Longrightarrow> \<forall>x k. (d dvd x + t) = (d dvd (x - k*D) + t)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    59
  "(d::'a::{comm_ring}) dvd D \<Longrightarrow> \<forall>x k. (\<not>d dvd x + t) = (\<not>d dvd (x - k*D) + t)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    60
  "\<forall>x k. F = F"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    61
by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    62
  (clarsimp simp add: dvd_def, rule iffI, clarsimp,rule_tac x = "kb - ka*k" in exI,
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
    63
    simp add: ring_simps, clarsimp,rule_tac x = "kb + ka*k" in exI,simp add: ring_simps)+
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    64
23472
02099ea56555 section headings
huffman
parents: 23465
diff changeset
    65
subsection{* The A and B sets *}
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    66
lemma bset:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    67
  "\<lbrakk>\<forall>x.(\<forall>j \<in> {1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> P x \<longrightarrow> P(x - D) ;
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    68
     \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> Q x \<longrightarrow> Q(x - D)\<rbrakk> \<Longrightarrow> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    69
  \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j) \<longrightarrow> (P x \<and> Q x) \<longrightarrow> (P(x - D) \<and> Q (x - D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    70
  "\<lbrakk>\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> P x \<longrightarrow> P(x - D) ;
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    71
     \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> Q x \<longrightarrow> Q(x - D)\<rbrakk> \<Longrightarrow> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    72
  \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (P x \<or> Q x) \<longrightarrow> (P(x - D) \<or> Q (x - D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    73
  "\<lbrakk>D>0; t - 1\<in> B\<rbrakk> \<Longrightarrow> (\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x = t) \<longrightarrow> (x - D = t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    74
  "\<lbrakk>D>0 ; t \<in> B\<rbrakk> \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<noteq> t) \<longrightarrow> (x - D \<noteq> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    75
  "D>0 \<Longrightarrow> (\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x < t) \<longrightarrow> (x - D < t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    76
  "D>0 \<Longrightarrow> (\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<le> t) \<longrightarrow> (x - D \<le> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    77
  "\<lbrakk>D>0 ; t \<in> B\<rbrakk> \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x > t) \<longrightarrow> (x - D > t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    78
  "\<lbrakk>D>0 ; t - 1 \<in> B\<rbrakk> \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<ge> t) \<longrightarrow> (x - D \<ge> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    79
  "d dvd D \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (d dvd x+t) \<longrightarrow> (d dvd (x - D) + t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    80
  "d dvd D \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not> d dvd (x - D) + t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    81
  "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j) \<longrightarrow> F \<longrightarrow> F"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    82
proof (blast, blast)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    83
  assume dp: "D > 0" and tB: "t - 1\<in> B"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    84
  show "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x = t) \<longrightarrow> (x - D = t))" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    85
    apply (rule allI, rule impI,erule ballE[where x="1"],erule ballE[where x="t - 1"])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    86
    using dp tB by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    87
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    88
  assume dp: "D > 0" and tB: "t \<in> B"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    89
  show "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<noteq> t) \<longrightarrow> (x - D \<noteq> t))" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    90
    apply (rule allI, rule impI,erule ballE[where x="D"],erule ballE[where x="t"])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    91
    using dp tB by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    92
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    93
  assume dp: "D > 0" thus "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x < t) \<longrightarrow> (x - D < t))" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    94
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    95
  assume dp: "D > 0" thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<le> t) \<longrightarrow> (x - D \<le> t)" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    96
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    97
  assume dp: "D > 0" and tB:"t \<in> B"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    98
  {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j" and g: "x > t" and ng: "\<not> (x - D) > t"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
    99
    hence "x -t \<le> D" and "1 \<le> x - t" by simp+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   100
      hence "\<exists>j \<in> {1 .. D}. x - t = j" by auto
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   101
      hence "\<exists>j \<in> {1 .. D}. x = t + j" by (simp add: ring_simps)
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   102
      with nob tB have "False" by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   103
  thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x > t) \<longrightarrow> (x - D > t)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   104
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   105
  assume dp: "D > 0" and tB:"t - 1\<in> B"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   106
  {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j" and g: "x \<ge> t" and ng: "\<not> (x - D) \<ge> t"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   107
    hence "x - (t - 1) \<le> D" and "1 \<le> x - (t - 1)" by simp+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   108
      hence "\<exists>j \<in> {1 .. D}. x - (t - 1) = j" by auto
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   109
      hence "\<exists>j \<in> {1 .. D}. x = (t - 1) + j" by (simp add: ring_simps)
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   110
      with nob tB have "False" by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   111
  thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<ge> t) \<longrightarrow> (x - D \<ge> t)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   112
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   113
  assume d: "d dvd D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   114
  {fix x assume H: "d dvd x + t" with d have "d dvd (x - D) + t"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   115
      by (clarsimp simp add: dvd_def,rule_tac x= "ka - k" in exI,simp add: ring_simps)}
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   116
  thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (d dvd x+t) \<longrightarrow> (d dvd (x - D) + t)" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   117
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   118
  assume d: "d dvd D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   119
  {fix x assume H: "\<not>(d dvd x + t)" with d have "\<not>d dvd (x - D) + t"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   120
      by (clarsimp simp add: dvd_def,erule_tac x= "ka + k" in allE,simp add: ring_simps)}
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   121
  thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not>d dvd (x - D) + t)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   122
qed blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   123
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   124
lemma aset:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   125
  "\<lbrakk>\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> P x \<longrightarrow> P(x + D) ;
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   126
     \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> Q x \<longrightarrow> Q(x + D)\<rbrakk> \<Longrightarrow> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   127
  \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j) \<longrightarrow> (P x \<and> Q x) \<longrightarrow> (P(x + D) \<and> Q (x + D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   128
  "\<lbrakk>\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> P x \<longrightarrow> P(x + D) ;
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   129
     \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> Q x \<longrightarrow> Q(x + D)\<rbrakk> \<Longrightarrow> 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   130
  \<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (P x \<or> Q x) \<longrightarrow> (P(x + D) \<or> Q (x + D))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   131
  "\<lbrakk>D>0; t + 1\<in> A\<rbrakk> \<Longrightarrow> (\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x = t) \<longrightarrow> (x + D = t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   132
  "\<lbrakk>D>0 ; t \<in> A\<rbrakk> \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<noteq> t) \<longrightarrow> (x + D \<noteq> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   133
  "\<lbrakk>D>0; t\<in> A\<rbrakk> \<Longrightarrow>(\<forall>(x::int). (\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x < t) \<longrightarrow> (x + D < t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   134
  "\<lbrakk>D>0; t + 1 \<in> A\<rbrakk> \<Longrightarrow> (\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<le> t) \<longrightarrow> (x + D \<le> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   135
  "D>0 \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x > t) \<longrightarrow> (x + D > t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   136
  "D>0 \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<ge> t) \<longrightarrow> (x + D \<ge> t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   137
  "d dvd D \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (d dvd x+t) \<longrightarrow> (d dvd (x + D) + t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   138
  "d dvd D \<Longrightarrow>(\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not> d dvd (x + D) + t))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   139
  "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j) \<longrightarrow> F \<longrightarrow> F"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   140
proof (blast, blast)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   141
  assume dp: "D > 0" and tA: "t + 1 \<in> A"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   142
  show "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x = t) \<longrightarrow> (x + D = t))" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   143
    apply (rule allI, rule impI,erule ballE[where x="1"],erule ballE[where x="t + 1"])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   144
    using dp tA by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   145
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   146
  assume dp: "D > 0" and tA: "t \<in> A"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   147
  show "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<noteq> t) \<longrightarrow> (x + D \<noteq> t))" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   148
    apply (rule allI, rule impI,erule ballE[where x="D"],erule ballE[where x="t"])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   149
    using dp tA by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   150
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   151
  assume dp: "D > 0" thus "(\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x > t) \<longrightarrow> (x + D > t))" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   152
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   153
  assume dp: "D > 0" thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<ge> t) \<longrightarrow> (x + D \<ge> t)" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   154
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   155
  assume dp: "D > 0" and tA:"t \<in> A"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   156
  {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j" and g: "x < t" and ng: "\<not> (x + D) < t"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   157
    hence "t - x \<le> D" and "1 \<le> t - x" by simp+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   158
      hence "\<exists>j \<in> {1 .. D}. t - x = j" by auto
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   159
      hence "\<exists>j \<in> {1 .. D}. x = t - j" by (auto simp add: ring_simps) 
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   160
      with nob tA have "False" by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   161
  thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x < t) \<longrightarrow> (x + D < t)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   162
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   163
  assume dp: "D > 0" and tA:"t + 1\<in> A"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   164
  {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j" and g: "x \<le> t" and ng: "\<not> (x + D) \<le> t"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   165
    hence "(t + 1) - x \<le> D" and "1 \<le> (t + 1) - x" by (simp_all add: ring_simps)
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   166
      hence "\<exists>j \<in> {1 .. D}. (t + 1) - x = j" by auto
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   167
      hence "\<exists>j \<in> {1 .. D}. x = (t + 1) - j" by (auto simp add: ring_simps)
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   168
      with nob tA have "False" by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   169
  thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<le> t) \<longrightarrow> (x + D \<le> t)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   170
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   171
  assume d: "d dvd D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   172
  {fix x assume H: "d dvd x + t" with d have "d dvd (x + D) + t"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   173
      by (clarsimp simp add: dvd_def,rule_tac x= "ka + k" in exI,simp add: ring_simps)}
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   174
  thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (d dvd x+t) \<longrightarrow> (d dvd (x + D) + t)" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   175
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   176
  assume d: "d dvd D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   177
  {fix x assume H: "\<not>(d dvd x + t)" with d have "\<not>d dvd (x + D) + t"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   178
      by (clarsimp simp add: dvd_def,erule_tac x= "ka - k" in allE,simp add: ring_simps)}
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   179
  thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not>d dvd (x + D) + t)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   180
qed blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   181
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   182
subsection{* Cooper's Theorem @{text "-\<infinity>"} and @{text "+\<infinity>"} Version *}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   183
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   184
subsubsection{* First some trivial facts about periodic sets or predicates *}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   185
lemma periodic_finite_ex:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   186
  assumes dpos: "(0::int) < d" and modd: "ALL x k. P x = P(x - k*d)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   187
  shows "(EX x. P x) = (EX j : {1..d}. P j)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   188
  (is "?LHS = ?RHS")
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   189
proof
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   190
  assume ?LHS
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   191
  then obtain x where P: "P x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   192
  have "x mod d = x - (x div d)*d" by(simp add:zmod_zdiv_equality mult_ac eq_diff_eq)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   193
  hence Pmod: "P x = P(x mod d)" using modd by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   194
  show ?RHS
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   195
  proof (cases)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   196
    assume "x mod d = 0"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   197
    hence "P 0" using P Pmod by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   198
    moreover have "P 0 = P(0 - (-1)*d)" using modd by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   199
    ultimately have "P d" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   200
    moreover have "d : {1..d}" using dpos by(simp add:atLeastAtMost_iff)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   201
    ultimately show ?RHS ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   202
  next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   203
    assume not0: "x mod d \<noteq> 0"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   204
    have "P(x mod d)" using dpos P Pmod by(simp add:pos_mod_sign pos_mod_bound)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   205
    moreover have "x mod d : {1..d}"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   206
    proof -
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   207
      from dpos have "0 \<le> x mod d" by(rule pos_mod_sign)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   208
      moreover from dpos have "x mod d < d" by(rule pos_mod_bound)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   209
      ultimately show ?thesis using not0 by(simp add:atLeastAtMost_iff)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   210
    qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   211
    ultimately show ?RHS ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   212
  qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   213
qed auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   214
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   215
subsubsection{* The @{text "-\<infinity>"} Version*}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   216
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   217
lemma decr_lemma: "0 < (d::int) \<Longrightarrow> x - (abs(x-z)+1) * d < z"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   218
by(induct rule: int_gr_induct,simp_all add:int_distrib)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   219
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   220
lemma incr_lemma: "0 < (d::int) \<Longrightarrow> z < x + (abs(x-z)+1) * d"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   221
by(induct rule: int_gr_induct, simp_all add:int_distrib)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   222
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   223
theorem int_induct[case_names base step1 step2]:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   224
  assumes 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   225
  base: "P(k::int)" and step1: "\<And>i. \<lbrakk>k \<le> i; P i\<rbrakk> \<Longrightarrow> P(i+1)" and
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   226
  step2: "\<And>i. \<lbrakk>k \<ge> i; P i\<rbrakk> \<Longrightarrow> P(i - 1)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   227
  shows "P i"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   228
proof -
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   229
  have "i \<le> k \<or> i\<ge> k" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   230
  thus ?thesis using prems int_ge_induct[where P="P" and k="k" and i="i"] int_le_induct[where P="P" and k="k" and i="i"] by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   231
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   232
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   233
lemma decr_mult_lemma:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   234
  assumes dpos: "(0::int) < d" and minus: "\<forall>x. P x \<longrightarrow> P(x - d)" and knneg: "0 <= k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   235
  shows "ALL x. P x \<longrightarrow> P(x - k*d)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   236
using knneg
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   237
proof (induct rule:int_ge_induct)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   238
  case base thus ?case by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   239
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   240
  case (step i)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   241
  {fix x
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   242
    have "P x \<longrightarrow> P (x - i * d)" using step.hyps by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   243
    also have "\<dots> \<longrightarrow> P(x - (i + 1) * d)" using minus[THEN spec, of "x - i * d"]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   244
      by (simp add:int_distrib OrderedGroup.diff_diff_eq[symmetric])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   245
    ultimately have "P x \<longrightarrow> P(x - (i + 1) * d)" by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   246
  thus ?case ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   247
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   248
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   249
lemma  minusinfinity:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   250
  assumes dpos: "0 < d" and
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   251
    P1eqP1: "ALL x k. P1 x = P1(x - k*d)" and ePeqP1: "EX z::int. ALL x. x < z \<longrightarrow> (P x = P1 x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   252
  shows "(EX x. P1 x) \<longrightarrow> (EX x. P x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   253
proof
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   254
  assume eP1: "EX x. P1 x"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   255
  then obtain x where P1: "P1 x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   256
  from ePeqP1 obtain z where P1eqP: "ALL x. x < z \<longrightarrow> (P x = P1 x)" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   257
  let ?w = "x - (abs(x-z)+1) * d"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   258
  from dpos have w: "?w < z" by(rule decr_lemma)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   259
  have "P1 x = P1 ?w" using P1eqP1 by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   260
  also have "\<dots> = P(?w)" using w P1eqP by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   261
  finally have "P ?w" using P1 by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   262
  thus "EX x. P x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   263
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   264
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   265
lemma cpmi: 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   266
  assumes dp: "0 < D" and p1:"\<exists>z. \<forall> x< z. P x = P' x"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   267
  and nb:"\<forall>x.(\<forall> j\<in> {1..D}. \<forall>(b::int) \<in> B. x \<noteq> b+j) --> P (x) --> P (x - D)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   268
  and pd: "\<forall> x k. P' x = P' (x-k*D)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   269
  shows "(\<exists>x. P x) = ((\<exists> j\<in> {1..D} . P' j) | (\<exists> j \<in> {1..D}.\<exists> b\<in> B. P (b+j)))" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   270
         (is "?L = (?R1 \<or> ?R2)")
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   271
proof-
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   272
 {assume "?R2" hence "?L"  by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   273
 moreover
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   274
 {assume H:"?R1" hence "?L" using minusinfinity[OF dp pd p1] periodic_finite_ex[OF dp pd] by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   275
 moreover 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   276
 { fix x
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   277
   assume P: "P x" and H: "\<not> ?R2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   278
   {fix y assume "\<not> (\<exists>j\<in>{1..D}. \<exists>b\<in>B. P (b + j))" and P: "P y"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   279
     hence "~(EX (j::int) : {1..D}. EX (b::int) : B. y = b+j)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   280
     with nb P  have "P (y - D)" by auto }
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   281
   hence "ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   282
   with H P have th: " \<forall>x. P x \<longrightarrow> P (x - D)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   283
   from p1 obtain z where z: "ALL x. x < z --> (P x = P' x)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   284
   let ?y = "x - (\<bar>x - z\<bar> + 1)*D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   285
   have zp: "0 <= (\<bar>x - z\<bar> + 1)" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   286
   from dp have yz: "?y < z" using decr_lemma[OF dp] by simp   
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   287
   from z[rule_format, OF yz] decr_mult_lemma[OF dp th zp, rule_format, OF P] have th2: " P' ?y" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   288
   with periodic_finite_ex[OF dp pd]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   289
   have "?R1" by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   290
 ultimately show ?thesis by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   291
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   292
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   293
subsubsection {* The @{text "+\<infinity>"} Version*}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   294
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   295
lemma  plusinfinity:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   296
  assumes dpos: "(0::int) < d" and
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   297
    P1eqP1: "\<forall>x k. P' x = P'(x - k*d)" and ePeqP1: "\<exists> z. \<forall> x>z. P x = P' x"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   298
  shows "(\<exists> x. P' x) \<longrightarrow> (\<exists> x. P x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   299
proof
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   300
  assume eP1: "EX x. P' x"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   301
  then obtain x where P1: "P' x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   302
  from ePeqP1 obtain z where P1eqP: "\<forall>x>z. P x = P' x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   303
  let ?w' = "x + (abs(x-z)+1) * d"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   304
  let ?w = "x - (-(abs(x-z) + 1))*d"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 23472
diff changeset
   305
  have ww'[simp]: "?w = ?w'" by (simp add: ring_simps)
23465
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   306
  from dpos have w: "?w > z" by(simp only: ww' incr_lemma)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   307
  hence "P' x = P' ?w" using P1eqP1 by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   308
  also have "\<dots> = P(?w)" using w P1eqP by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   309
  finally have "P ?w" using P1 by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   310
  thus "EX x. P x" ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   311
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   312
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   313
lemma incr_mult_lemma:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   314
  assumes dpos: "(0::int) < d" and plus: "ALL x::int. P x \<longrightarrow> P(x + d)" and knneg: "0 <= k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   315
  shows "ALL x. P x \<longrightarrow> P(x + k*d)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   316
using knneg
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   317
proof (induct rule:int_ge_induct)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   318
  case base thus ?case by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   319
next
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   320
  case (step i)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   321
  {fix x
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   322
    have "P x \<longrightarrow> P (x + i * d)" using step.hyps by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   323
    also have "\<dots> \<longrightarrow> P(x + (i + 1) * d)" using plus[THEN spec, of "x + i * d"]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   324
      by (simp add:int_distrib zadd_ac)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   325
    ultimately have "P x \<longrightarrow> P(x + (i + 1) * d)" by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   326
  thus ?case ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   327
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   328
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   329
lemma cppi: 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   330
  assumes dp: "0 < D" and p1:"\<exists>z. \<forall> x> z. P x = P' x"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   331
  and nb:"\<forall>x.(\<forall> j\<in> {1..D}. \<forall>(b::int) \<in> A. x \<noteq> b - j) --> P (x) --> P (x + D)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   332
  and pd: "\<forall> x k. P' x= P' (x-k*D)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   333
  shows "(\<exists>x. P x) = ((\<exists> j\<in> {1..D} . P' j) | (\<exists> j \<in> {1..D}.\<exists> b\<in> A. P (b - j)))" (is "?L = (?R1 \<or> ?R2)")
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   334
proof-
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   335
 {assume "?R2" hence "?L"  by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   336
 moreover
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   337
 {assume H:"?R1" hence "?L" using plusinfinity[OF dp pd p1] periodic_finite_ex[OF dp pd] by simp}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   338
 moreover 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   339
 { fix x
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   340
   assume P: "P x" and H: "\<not> ?R2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   341
   {fix y assume "\<not> (\<exists>j\<in>{1..D}. \<exists>b\<in>A. P (b - j))" and P: "P y"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   342
     hence "~(EX (j::int) : {1..D}. EX (b::int) : A. y = b - j)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   343
     with nb P  have "P (y + D)" by auto }
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   344
   hence "ALL x.~(EX (j::int) : {1..D}. EX (b::int) : A. P(b-j)) --> P (x) --> P (x + D)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   345
   with H P have th: " \<forall>x. P x \<longrightarrow> P (x + D)" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   346
   from p1 obtain z where z: "ALL x. x > z --> (P x = P' x)" by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   347
   let ?y = "x + (\<bar>x - z\<bar> + 1)*D"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   348
   have zp: "0 <= (\<bar>x - z\<bar> + 1)" by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   349
   from dp have yz: "?y > z" using incr_lemma[OF dp] by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   350
   from z[rule_format, OF yz] incr_mult_lemma[OF dp th zp, rule_format, OF P] have th2: " P' ?y" by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   351
   with periodic_finite_ex[OF dp pd]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   352
   have "?R1" by blast}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   353
 ultimately show ?thesis by blast
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   354
qed
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   355
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   356
lemma simp_from_to: "{i..j::int} = (if j < i then {} else insert i {i+1..j})"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   357
apply(simp add:atLeastAtMost_def atLeast_def atMost_def)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   358
apply(fastsimp)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   359
done
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   360
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   361
theorem unity_coeff_ex: "(\<exists>(x::'a::{semiring_0}). P (l * x)) \<equiv> (\<exists>x. l dvd (x + 0) \<and> P x)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   362
  apply (rule eq_reflection[symmetric])
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   363
  apply (rule iffI)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   364
  defer
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   365
  apply (erule exE)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   366
  apply (rule_tac x = "l * x" in exI)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   367
  apply (simp add: dvd_def)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   368
  apply (rule_tac x="x" in exI, simp)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   369
  apply (erule exE)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   370
  apply (erule conjE)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   371
  apply (erule dvdE)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   372
  apply (rule_tac x = k in exI)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   373
  apply simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   374
  done
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   375
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   376
lemma zdvd_mono: assumes not0: "(k::int) \<noteq> 0"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   377
shows "((m::int) dvd t) \<equiv> (k*m dvd k*t)" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   378
  using not0 by (simp add: dvd_def)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   379
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   380
lemma uminus_dvd_conv: "(d dvd (t::int)) \<equiv> (-d dvd t)" "(d dvd (t::int)) \<equiv> (d dvd -t)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   381
  by simp_all
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   382
text {* \bigskip Theorems for transforming predicates on nat to predicates on @{text int}*}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   383
lemma all_nat: "(\<forall>x::nat. P x) = (\<forall>x::int. 0 <= x \<longrightarrow> P (nat x))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   384
  by (simp split add: split_nat)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   385
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   386
lemma ex_nat: "(\<exists>x::nat. P x) = (\<exists>x::int. 0 <= x \<and> P (nat x))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   387
  apply (auto split add: split_nat)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   388
  apply (rule_tac x="int x" in exI, simp)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   389
  apply (rule_tac x = "nat x" in exI,erule_tac x = "nat x" in allE, simp)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   390
  done
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   391
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   392
lemma zdiff_int_split: "P (int (x - y)) =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   393
  ((y \<le> x \<longrightarrow> P (int x - int y)) \<and> (x < y \<longrightarrow> P 0))"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   394
  by (case_tac "y \<le> x", simp_all add: zdiff_int)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   395
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   396
lemma number_of1: "(0::int) <= number_of n \<Longrightarrow> (0::int) <= number_of (n BIT b)" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   397
lemma number_of2: "(0::int) <= Numeral0" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   398
lemma Suc_plus1: "Suc n = n + 1" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   399
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   400
text {*
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   401
  \medskip Specific instances of congruence rules, to prevent
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   402
  simplifier from looping. *}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   403
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   404
theorem imp_le_cong: "(0 <= x \<Longrightarrow> P = P') \<Longrightarrow> (0 <= (x::int) \<longrightarrow> P) = (0 <= x \<longrightarrow> P')" by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   405
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   406
theorem conj_le_cong: "(0 <= x \<Longrightarrow> P = P') \<Longrightarrow> (0 <= (x::int) \<and> P) = (0 <= x \<and> P')" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   407
  by (simp cong: conj_cong)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   408
lemma int_eq_number_of_eq:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   409
  "(((number_of v)::int) = (number_of w)) = iszero ((number_of (v + (uminus w)))::int)"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   410
  by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   411
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   412
lemma mod_eq0_dvd_iff[presburger]: "(m::nat) mod n = 0 \<longleftrightarrow> n dvd m"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   413
unfolding dvd_eq_mod_eq_0[symmetric] ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   414
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   415
lemma zmod_eq0_zdvd_iff[presburger]: "(m::int) mod n = 0 \<longleftrightarrow> n dvd m"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   416
unfolding zdvd_iff_zmod_eq_0[symmetric] ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   417
declare mod_1[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   418
declare mod_0[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   419
declare zmod_1[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   420
declare zmod_zero[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   421
declare zmod_self[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   422
declare mod_self[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   423
declare DIVISION_BY_ZERO_MOD[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   424
declare nat_mod_div_trivial[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   425
declare div_mod_equality2[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   426
declare div_mod_equality[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   427
declare mod_div_equality2[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   428
declare mod_div_equality[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   429
declare mod_mult_self1[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   430
declare mod_mult_self2[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   431
declare zdiv_zmod_equality2[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   432
declare zdiv_zmod_equality[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   433
declare mod2_Suc_Suc[presburger]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   434
lemma [presburger]: "(a::int) div 0 = 0" and [presburger]: "a mod 0 = a"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   435
using IntDiv.DIVISION_BY_ZERO by blast+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   436
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   437
use "Tools/Qelim/cooper.ML"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   438
oracle linzqe_oracle ("term") = Coopereif.cooper_oracle
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   439
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   440
use "Tools/Qelim/presburger.ML"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   441
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   442
setup {* 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   443
  arith_tactic_add 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   444
    (mk_arith_tactic "presburger" (fn i => fn st =>
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   445
       (warning "Trying Presburger arithmetic ...";   
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   446
    Presburger.cooper_tac true [] [] ((ProofContext.init o theory_of_thm) st) i st)))
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   447
  (* FIXME!!!!!!! get the right context!!*)	
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   448
*}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   449
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   450
method_setup presburger = {*
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   451
let
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   452
 fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K ()
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   453
 fun simple_keyword k = Scan.lift (Args.$$$ k) >> K ()
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   454
 val addN = "add"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   455
 val delN = "del"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   456
 val elimN = "elim"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   457
 val any_keyword = keyword addN || keyword delN || simple_keyword elimN
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   458
 val thms = Scan.repeat (Scan.unless any_keyword Attrib.multi_thm) >> flat;
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   459
in
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   460
  fn src => Method.syntax 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   461
   ((Scan.optional (simple_keyword elimN >> K false) true) -- 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   462
    (Scan.optional (keyword addN |-- thms) []) -- 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   463
    (Scan.optional (keyword delN |-- thms) [])) src 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   464
  #> (fn (((elim, add_ths), del_ths),ctxt) => 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   465
         Method.SIMPLE_METHOD' (Presburger.cooper_tac elim add_ths del_ths ctxt))
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   466
end
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   467
*} "Cooper's algorithm for Presburger arithmetic"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   468
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   469
lemma [presburger]: "m mod 2 = (1::nat) \<longleftrightarrow> \<not> 2 dvd m " by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   470
lemma [presburger]: "m mod 2 = Suc 0 \<longleftrightarrow> \<not> 2 dvd m " by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   471
lemma [presburger]: "m mod (Suc (Suc 0)) = (1::nat) \<longleftrightarrow> \<not> 2 dvd m " by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   472
lemma [presburger]: "m mod (Suc (Suc 0)) = Suc 0 \<longleftrightarrow> \<not> 2 dvd m " by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   473
lemma [presburger]: "m mod 2 = (1::int) \<longleftrightarrow> \<not> 2 dvd m " by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   474
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   475
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   476
subsection {* Code generator setup *}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   477
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   478
text {*
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   479
  Presburger arithmetic is convenient to prove some
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   480
  of the following code lemmas on integer numerals:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   481
*}
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   482
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   483
lemma eq_Pls_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   484
  "Numeral.Pls = Numeral.Pls \<longleftrightarrow> True" by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   485
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   486
lemma eq_Pls_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   487
  "Numeral.Pls = Numeral.Min \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   488
  unfolding Pls_def Numeral.Min_def by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   489
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   490
lemma eq_Pls_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   491
  "Numeral.Pls = Numeral.Bit k bit.B0 \<longleftrightarrow> Numeral.Pls = k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   492
  unfolding Pls_def Bit_def bit.cases by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   493
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   494
lemma eq_Pls_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   495
  "Numeral.Pls = Numeral.Bit k bit.B1 \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   496
  unfolding Pls_def Bit_def bit.cases by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   497
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   498
lemma eq_Min_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   499
  "Numeral.Min = Numeral.Pls \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   500
  unfolding Pls_def Numeral.Min_def by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   501
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   502
lemma eq_Min_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   503
  "Numeral.Min = Numeral.Min \<longleftrightarrow> True" by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   504
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   505
lemma eq_Min_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   506
  "Numeral.Min = Numeral.Bit k bit.B0 \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   507
  unfolding Numeral.Min_def Bit_def bit.cases by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   508
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   509
lemma eq_Min_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   510
  "Numeral.Min = Numeral.Bit k bit.B1 \<longleftrightarrow> Numeral.Min = k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   511
  unfolding Numeral.Min_def Bit_def bit.cases by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   512
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   513
lemma eq_Bit0_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   514
  "Numeral.Bit k bit.B0 = Numeral.Pls \<longleftrightarrow> Numeral.Pls = k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   515
  unfolding Pls_def Bit_def bit.cases by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   516
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   517
lemma eq_Bit1_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   518
  "Numeral.Bit k bit.B1 = Numeral.Pls \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   519
  unfolding Pls_def Bit_def bit.cases  by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   520
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   521
lemma eq_Bit0_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   522
  "Numeral.Bit k bit.B0 = Numeral.Min \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   523
  unfolding Numeral.Min_def Bit_def bit.cases  by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   524
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   525
lemma eq_Bit1_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   526
  "(Numeral.Bit k bit.B1) = Numeral.Min \<longleftrightarrow> Numeral.Min = k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   527
  unfolding Numeral.Min_def Bit_def bit.cases  by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   528
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   529
lemma eq_Bit_Bit:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   530
  "Numeral.Bit k1 v1 = Numeral.Bit k2 v2 \<longleftrightarrow>
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   531
    v1 = v2 \<and> k1 = k2" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   532
  unfolding Bit_def
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   533
  apply (cases v1)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   534
  apply (cases v2)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   535
  apply auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   536
  apply presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   537
  apply (cases v2)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   538
  apply auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   539
  apply presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   540
  apply (cases v2)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   541
  apply auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   542
  done
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   543
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   544
lemma eq_number_of:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   545
  "(number_of k \<Colon> int) = number_of l \<longleftrightarrow> k = l" 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   546
  unfolding number_of_is_id ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   547
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   548
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   549
lemma less_eq_Pls_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   550
  "Numeral.Pls \<le> Numeral.Pls \<longleftrightarrow> True" by rule+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   551
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   552
lemma less_eq_Pls_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   553
  "Numeral.Pls \<le> Numeral.Min \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   554
  unfolding Pls_def Numeral.Min_def by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   555
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   556
lemma less_eq_Pls_Bit:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   557
  "Numeral.Pls \<le> Numeral.Bit k v \<longleftrightarrow> Numeral.Pls \<le> k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   558
  unfolding Pls_def Bit_def by (cases v) auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   559
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   560
lemma less_eq_Min_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   561
  "Numeral.Min \<le> Numeral.Pls \<longleftrightarrow> True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   562
  unfolding Pls_def Numeral.Min_def by presburger
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   563
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   564
lemma less_eq_Min_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   565
  "Numeral.Min \<le> Numeral.Min \<longleftrightarrow> True" by rule+
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   566
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   567
lemma less_eq_Min_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   568
  "Numeral.Min \<le> Numeral.Bit k bit.B0 \<longleftrightarrow> Numeral.Min < k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   569
  unfolding Numeral.Min_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   570
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   571
lemma less_eq_Min_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   572
  "Numeral.Min \<le> Numeral.Bit k bit.B1 \<longleftrightarrow> Numeral.Min \<le> k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   573
  unfolding Numeral.Min_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   574
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   575
lemma less_eq_Bit0_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   576
  "Numeral.Bit k bit.B0 \<le> Numeral.Pls \<longleftrightarrow> k \<le> Numeral.Pls"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   577
  unfolding Pls_def Bit_def by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   578
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   579
lemma less_eq_Bit1_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   580
  "Numeral.Bit k bit.B1 \<le> Numeral.Pls \<longleftrightarrow> k < Numeral.Pls"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   581
  unfolding Pls_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   582
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   583
lemma less_eq_Bit_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   584
  "Numeral.Bit k v \<le> Numeral.Min \<longleftrightarrow> k \<le> Numeral.Min"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   585
  unfolding Numeral.Min_def Bit_def by (cases v) auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   586
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   587
lemma less_eq_Bit0_Bit:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   588
  "Numeral.Bit k1 bit.B0 \<le> Numeral.Bit k2 v \<longleftrightarrow> k1 \<le> k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   589
  unfolding Bit_def bit.cases by (cases v) auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   590
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   591
lemma less_eq_Bit_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   592
  "Numeral.Bit k1 v \<le> Numeral.Bit k2 bit.B1 \<longleftrightarrow> k1 \<le> k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   593
  unfolding Bit_def bit.cases by (cases v) auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   594
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   595
lemma less_eq_Bit1_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   596
  "Numeral.Bit k1 bit.B1 \<le> Numeral.Bit k2 bit.B0 \<longleftrightarrow> k1 < k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   597
  unfolding Bit_def by (auto split: bit.split)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   598
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   599
lemma less_eq_number_of:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   600
  "(number_of k \<Colon> int) \<le> number_of l \<longleftrightarrow> k \<le> l"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   601
  unfolding number_of_is_id ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   602
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   603
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   604
lemma less_Pls_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   605
  "Numeral.Pls < Numeral.Pls \<longleftrightarrow> False" by simp 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   606
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   607
lemma less_Pls_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   608
  "Numeral.Pls < Numeral.Min \<longleftrightarrow> False"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   609
  unfolding Pls_def Numeral.Min_def  by presburger 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   610
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   611
lemma less_Pls_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   612
  "Numeral.Pls < Numeral.Bit k bit.B0 \<longleftrightarrow> Numeral.Pls < k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   613
  unfolding Pls_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   614
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   615
lemma less_Pls_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   616
  "Numeral.Pls < Numeral.Bit k bit.B1 \<longleftrightarrow> Numeral.Pls \<le> k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   617
  unfolding Pls_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   618
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   619
lemma less_Min_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   620
  "Numeral.Min < Numeral.Pls \<longleftrightarrow> True"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   621
  unfolding Pls_def Numeral.Min_def by presburger 
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   622
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   623
lemma less_Min_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   624
  "Numeral.Min < Numeral.Min \<longleftrightarrow> False"  by simp
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   625
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   626
lemma less_Min_Bit:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   627
  "Numeral.Min < Numeral.Bit k v \<longleftrightarrow> Numeral.Min < k"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   628
  unfolding Numeral.Min_def Bit_def by (auto split: bit.split)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   629
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   630
lemma less_Bit_Pls:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   631
  "Numeral.Bit k v < Numeral.Pls \<longleftrightarrow> k < Numeral.Pls"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   632
  unfolding Pls_def Bit_def by (auto split: bit.split)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   633
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   634
lemma less_Bit0_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   635
  "Numeral.Bit k bit.B0 < Numeral.Min \<longleftrightarrow> k \<le> Numeral.Min"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   636
  unfolding Numeral.Min_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   637
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   638
lemma less_Bit1_Min:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   639
  "Numeral.Bit k bit.B1 < Numeral.Min \<longleftrightarrow> k < Numeral.Min"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   640
  unfolding Numeral.Min_def Bit_def by auto
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   641
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   642
lemma less_Bit_Bit0:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   643
  "Numeral.Bit k1 v < Numeral.Bit k2 bit.B0 \<longleftrightarrow> k1 < k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   644
  unfolding Bit_def by (auto split: bit.split)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   645
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   646
lemma less_Bit1_Bit:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   647
  "Numeral.Bit k1 bit.B1 < Numeral.Bit k2 v \<longleftrightarrow> k1 < k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   648
  unfolding Bit_def by (auto split: bit.split)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   649
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   650
lemma less_Bit0_Bit1:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   651
  "Numeral.Bit k1 bit.B0 < Numeral.Bit k2 bit.B1 \<longleftrightarrow> k1 \<le> k2"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   652
  unfolding Bit_def bit.cases  by arith
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   653
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   654
lemma less_number_of:
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   655
  "(number_of k \<Colon> int) < number_of l \<longleftrightarrow> k < l"
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   656
  unfolding number_of_is_id ..
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   657
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   658
lemmas pred_succ_numeral_code [code func] =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   659
  arith_simps(5-12)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   660
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   661
lemmas plus_numeral_code [code func] =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   662
  arith_simps(13-17)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   663
  arith_simps(26-27)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   664
  arith_extra_simps(1) [where 'a = int]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   665
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   666
lemmas minus_numeral_code [code func] =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   667
  arith_simps(18-21)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   668
  arith_extra_simps(2) [where 'a = int]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   669
  arith_extra_simps(5) [where 'a = int]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   670
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   671
lemmas times_numeral_code [code func] =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   672
  arith_simps(22-25)
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   673
  arith_extra_simps(4) [where 'a = int]
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   674
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   675
lemmas eq_numeral_code [code func] =
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   676
  eq_Pls_Pls eq_Pls_Min eq_Pls_Bit0 eq_Pls_Bit1
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   677
  eq_Min_Pls eq_Min_Min eq_Min_Bit0 eq_Min_Bit1
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   678
  eq_Bit0_Pls eq_Bit1_Pls eq_Bit0_Min eq_Bit1_Min eq_Bit_Bit
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   679
  eq_number_of
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   680
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   681
lemmas less_eq_numeral_code [code func] = less_eq_Pls_Pls less_eq_Pls_Min less_eq_Pls_Bit
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   682
  less_eq_Min_Pls less_eq_Min_Min less_eq_Min_Bit0 less_eq_Min_Bit1
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   683
  less_eq_Bit0_Pls less_eq_Bit1_Pls less_eq_Bit_Min less_eq_Bit0_Bit less_eq_Bit_Bit1 less_eq_Bit1_Bit0
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   684
  less_eq_number_of
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   685
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   686
lemmas less_numeral_code [code func] = less_Pls_Pls less_Pls_Min less_Pls_Bit0
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   687
  less_Pls_Bit1 less_Min_Pls less_Min_Min less_Min_Bit less_Bit_Pls
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   688
  less_Bit0_Min less_Bit1_Min less_Bit_Bit0 less_Bit1_Bit less_Bit0_Bit1
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   689
  less_number_of
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   690
8f8835aac299 moved Presburger setup back to Presburger.thy;
wenzelm
parents:
diff changeset
   691
end