src/HOL/Decision_Procs/Commutative_Ring_Complete.thy
author traytel
Fri, 28 Feb 2014 17:54:52 +0100
changeset 55811 aa1acc25126b
parent 55793 52c8f934ea6f
child 58259 52c35a59bbf5
permissions -rw-r--r--
load Metis a little later
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31021
53642251a04f farewell to class recpower
haftmann
parents: 23464
diff changeset
     1
(*  Author:     Bernhard Haeupler
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
     2
17388
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     3
This theory is about of the relative completeness of method comm-ring
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     4
method.  As long as the reified atomic polynomials of type 'a pol are
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     5
in normal form, the cring method is complete.
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     6
*)
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     7
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     8
header {* Proof of the relative completeness of method comm-ring *}
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
     9
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    10
theory Commutative_Ring_Complete
17508
c84af7f39a6b tuned theory dependencies;
wenzelm
parents: 17396
diff changeset
    11
imports Commutative_Ring
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    12
begin
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
    13
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
    14
text {* Formalization of normal form *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    15
fun isnorm :: "'a::comm_ring pol \<Rightarrow> bool"
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
    16
where
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    17
  "isnorm (Pc c) \<longleftrightarrow> True"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    18
| "isnorm (Pinj i (Pc c)) \<longleftrightarrow> False"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    19
| "isnorm (Pinj i (Pinj j Q)) \<longleftrightarrow> False"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    20
| "isnorm (Pinj 0 P) \<longleftrightarrow> False"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    21
| "isnorm (Pinj i (PX Q1 j Q2)) \<longleftrightarrow> isnorm (PX Q1 j Q2)"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    22
| "isnorm (PX P 0 Q) \<longleftrightarrow> False"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    23
| "isnorm (PX (Pc c) i Q) \<longleftrightarrow> c \<noteq> 0 \<and> isnorm Q"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    24
| "isnorm (PX (PX P1 j (Pc c)) i Q) \<longleftrightarrow> c \<noteq> 0 \<and> isnorm (PX P1 j (Pc c)) \<and> isnorm Q"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    25
| "isnorm (PX P i Q) \<longleftrightarrow> isnorm P \<and> isnorm Q"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    26
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    27
(* Some helpful lemmas *)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    28
lemma norm_Pinj_0_False: "isnorm (Pinj 0 P) = False"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    29
  by (cases P) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    30
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    31
lemma norm_PX_0_False: "isnorm (PX (Pc 0) i Q) = False"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    32
  by (cases i) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    33
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    34
lemma norm_Pinj: "isnorm (Pinj i Q) \<Longrightarrow> isnorm Q"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    35
  by (cases i) (simp add: norm_Pinj_0_False norm_PX_0_False, cases Q, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    36
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    37
lemma norm_PX2: "isnorm (PX P i Q) \<Longrightarrow> isnorm Q"
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    38
  apply (cases i)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    39
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    40
  apply (cases P)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    41
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    42
  apply (case_tac pol2)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    43
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    44
  done
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    45
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    46
lemma norm_PX1: "isnorm (PX P i Q) \<Longrightarrow> isnorm P"
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    47
  apply (cases i)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    48
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    49
  apply (cases P)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    50
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    51
  apply (case_tac pol2)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    52
  apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    53
  done
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    54
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    55
lemma mkPinj_cn: "y \<noteq> 0 \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (mkPinj y Q)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    56
  apply (auto simp add: mkPinj_def norm_Pinj_0_False split: pol.split)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    57
  apply (case_tac nat, auto simp add: norm_Pinj_0_False)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    58
  apply (case_tac pol, auto)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    59
  apply (case_tac y, auto)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    60
  done
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    61
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    62
lemma norm_PXtrans:
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    63
  assumes A: "isnorm (PX P x Q)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    64
    and "isnorm Q2"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    65
  shows "isnorm (PX P x Q2)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    66
proof (cases P)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    67
  case (PX p1 y p2)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    68
  with assms show ?thesis
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    69
    apply (cases x)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    70
    apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    71
    apply (cases p2)
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    72
    apply auto
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    73
    done
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    74
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    75
  case Pc
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    76
  with assms show ?thesis by (cases x) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    77
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    78
  case Pinj
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    79
  with assms show ?thesis by (cases x) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    80
qed
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
    81
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    82
lemma norm_PXtrans2:
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    83
  assumes "isnorm (PX P x Q)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    84
    and "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    85
  shows "isnorm (PX P (Suc (n + x)) Q2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    86
proof (cases P)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    87
  case (PX p1 y p2)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    88
  with assms show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    89
    apply (cases x)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    90
    apply auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    91
    apply (cases p2)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    92
    apply auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    93
    done
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    94
next
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    95
  case Pc
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    96
  with assms show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    97
    by (cases x) auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    98
next
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    99
  case Pinj
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   100
  with assms show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   101
    by (cases x) auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   102
qed
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   103
23266
50f0a4f12ed3 tuned document;
wenzelm
parents: 22742
diff changeset
   104
text {* mkPX conserves normalizedness (@{text "_cn"}) *}
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   105
lemma mkPX_cn:
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   106
  assumes "x \<noteq> 0"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   107
    and "isnorm P"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   108
    and "isnorm Q"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   109
  shows "isnorm (mkPX P x Q)"
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   110
proof (cases P)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   111
  case (Pc c)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   112
  with assms show ?thesis
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   113
    by (cases x) (auto simp add: mkPinj_cn mkPX_def)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   114
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   115
  case (Pinj i Q)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   116
  with assms show ?thesis
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   117
    by (cases x) (auto simp add: mkPinj_cn mkPX_def)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   118
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   119
  case (PX P1 y P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   120
  with assms have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   121
    by (cases y) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   122
  from assms PX have "isnorm P1" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   123
    by (auto simp add: norm_PX1[of P1 y P2] norm_PX2[of P1 y P2])
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   124
  from assms PX Y0 show ?thesis
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   125
    by (cases x) (auto simp add: mkPX_def norm_PXtrans2[of P1 y _ Q _], cases P2, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   126
qed
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   127
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   128
text {* add conserves normalizedness *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   129
lemma add_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<oplus> Q)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   130
proof (induct P Q rule: add.induct)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   131
  case (2 c i P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   132
  then show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   133
    by (cases P2) (simp_all, cases i, simp_all)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   134
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   135
  case (3 i P2 c)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   136
  then show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   137
    by (cases P2) (simp_all, cases i, simp_all)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   138
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   139
  case (4 c P2 i Q2)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   140
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   141
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   142
  with 4 show ?case
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   143
    by (cases i) (simp, cases P2, auto, case_tac pol2, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   144
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   145
  case (5 P2 i Q2 c)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   146
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   147
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   148
  with 5 show ?case
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   149
    by (cases i) (simp, cases P2, auto, case_tac pol2, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   150
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   151
  case (6 x P2 y Q2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   152
  then have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   153
    by (cases y) (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   154
  with 6 have X0: "x > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   155
    by (cases x) (auto simp add: norm_Pinj_0_False)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   156
  have "x < y \<or> x = y \<or> x > y" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   157
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   158
    assume "x < y"
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   159
    then have "\<exists>d. y = d + x" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   160
    then obtain d where y: "y = d + x" ..
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   161
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   162
    note 6 X0
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   163
    moreover
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   164
    from 6 have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   165
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   166
    moreover
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   167
    from 6 `x < y` y have "isnorm (Pinj d Q2)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   168
      by (cases d, simp, cases Q2, auto)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   169
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   170
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   171
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   172
    assume "x = y"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   173
    moreover
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   174
    from 6 have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   175
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   176
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   177
    note 6 Y0
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   178
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   179
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   180
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   181
    assume "x > y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   182
    then have "\<exists>d. x = d + y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   183
      by arith
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   184
    then obtain d where x: "x = d + y" ..
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   185
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   186
    note 6 Y0
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   187
    moreover
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   188
    from 6 have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   189
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   190
    moreover
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   191
    from 6 `x > y` x have "isnorm (Pinj d P2)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   192
      by (cases d) (simp, cases P2, auto)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   193
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   194
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   195
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   196
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   197
  case (7 x P2 Q2 y R)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   198
  have "x = 0 \<or> x = 1 \<or> x > 1" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   199
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   200
    assume "x = 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   201
    with 7 have ?case by (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   202
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   203
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   204
    assume "x = 1"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   205
    from 7 have "isnorm R" "isnorm P2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   206
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   207
    with 7 `x = 1` have "isnorm (R \<oplus> P2)" by simp
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   208
    with 7 `x = 1` have ?case
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   209
      by (simp add: norm_PXtrans[of Q2 y _])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   210
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   211
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   212
    assume "x > 1" then have "\<exists>d. x=Suc (Suc d)" by arith
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   213
    then obtain d where X: "x=Suc (Suc d)" ..
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   214
    with 7 have NR: "isnorm R" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   215
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   216
    with 7 X have "isnorm (Pinj (x - 1) P2)" by (cases P2) auto
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   217
    with 7 X NR have "isnorm (R \<oplus> Pinj (x - 1) P2)" by simp
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   218
    with `isnorm (PX Q2 y R)` X have ?case
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   219
      by (simp add: norm_PXtrans[of Q2 y _])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   220
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   221
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   222
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   223
  case (8 Q2 y R x P2)
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   224
  have "x = 0 \<or> x = 1 \<or> x > 1" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   225
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   226
    assume "x = 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   227
    with 8 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   228
      by (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   229
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   230
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   231
    assume "x = 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   232
    with 8 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   233
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   234
    with 8 `x = 1` have "isnorm (R \<oplus> P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   235
      by simp
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   236
    with 8 `x = 1` have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   237
      by (simp add: norm_PXtrans[of Q2 y _])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   238
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   239
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   240
    assume "x > 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   241
    then have "\<exists>d. x = Suc (Suc d)" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   242
    then obtain d where X: "x = Suc (Suc d)" ..
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   243
    with 8 have NR: "isnorm R" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   244
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   245
    with 8 X have "isnorm (Pinj (x - 1) P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   246
      by (cases P2) auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   247
    with 8 `x > 1` NR have "isnorm (R \<oplus> Pinj (x - 1) P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   248
      by simp
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   249
    with `isnorm (PX Q2 y R)` X have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   250
      by (simp add: norm_PXtrans[of Q2 y _])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   251
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   252
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   253
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   254
  case (9 P1 x P2 Q1 y Q2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   255
  then have Y0: "y > 0" by (cases y) auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   256
  with 9 have X0: "x > 0" by (cases x) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   257
  with 9 have NP1: "isnorm P1" and NP2: "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   258
    by (auto simp add: norm_PX1[of P1 _ P2] norm_PX2[of P1 _ P2])
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   259
  with 9 have NQ1: "isnorm Q1" and NQ2: "isnorm Q2"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   260
    by (auto simp add: norm_PX1[of Q1 _ Q2] norm_PX2[of Q1 _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   261
  have "y < x \<or> x = y \<or> x < y" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   262
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   263
    assume sm1: "y < x"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   264
    then have "\<exists>d. x = d + y" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   265
    then obtain d where sm2: "x = d + y" ..
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   266
    note 9 NQ1 NP1 NP2 NQ2 sm1 sm2
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   267
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   268
    have "isnorm (PX P1 d (Pc 0))"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   269
    proof (cases P1)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   270
      case (PX p1 y p2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   271
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   272
        by (cases d) (simp, cases p2, auto)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   273
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   274
      case Pc
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   275
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   276
        by (cases d) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   277
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   278
      case Pinj
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   279
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   280
        by (cases d) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   281
    qed
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   282
    ultimately have "isnorm (P2 \<oplus> Q2)" "isnorm (PX P1 (x - y) (Pc 0) \<oplus> Q1)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   283
      by auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   284
    with Y0 sm1 sm2 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   285
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   286
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   287
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   288
    assume "x = y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   289
    with 9 NP1 NP2 NQ1 NQ2 have "isnorm (P2 \<oplus> Q2)" "isnorm (P1 \<oplus> Q1)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   290
      by auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   291
    with `x = y` Y0 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   292
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   293
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   294
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   295
    assume sm1: "x < y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   296
    then have "\<exists>d. y = d + x" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   297
    then obtain d where sm2: "y = d + x" ..
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   298
    note 9 NQ1 NP1 NP2 NQ2 sm1 sm2
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   299
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   300
    have "isnorm (PX Q1 d (Pc 0))"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   301
    proof (cases Q1)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   302
      case (PX p1 y p2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   303
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   304
        by (cases d) (simp, cases p2, auto)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   305
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   306
      case Pc
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   307
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   308
        by (cases d) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   309
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   310
      case Pinj
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   311
      with 9 sm1 sm2 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   312
        by (cases d) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   313
    qed
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   314
    ultimately have "isnorm (P2 \<oplus> Q2)" "isnorm (PX Q1 (y - x) (Pc 0) \<oplus> P1)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   315
      by auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   316
    with X0 sm1 sm2 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   317
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   318
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   319
  ultimately show ?case by blast
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   320
qed simp
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   321
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   322
text {* mul concerves normalizedness *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   323
lemma mul_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<otimes> Q)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   324
proof (induct P Q rule: mul.induct)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   325
  case (2 c i P2)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   326
  then show ?case
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   327
    by (cases P2) (simp_all, cases i, simp_all add: mkPinj_cn)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   328
next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   329
  case (3 i P2 c)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   330
  then show ?case
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   331
    by (cases P2) (simp_all, cases i, simp_all add: mkPinj_cn)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   332
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   333
  case (4 c P2 i Q2)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   334
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   335
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   336
  with 4 show ?case
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   337
    by (cases "c = 0") (simp_all, cases "i = 0", simp_all add: mkPX_cn)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   338
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   339
  case (5 P2 i Q2 c)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   340
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   341
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   342
  with 5 show ?case
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   343
    by (cases "c = 0") (simp_all, cases "i = 0", simp_all add: mkPX_cn)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   344
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   345
  case (6 x P2 y Q2)
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   346
  have "x < y \<or> x = y \<or> x > y" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   347
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   348
    assume "x < y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   349
    then have "\<exists>d. y = d + x" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   350
    then obtain d where y: "y = d + x" ..
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   351
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   352
    note 6
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   353
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   354
    from 6 have "x > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   355
      by (cases x) (auto simp add: norm_Pinj_0_False)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   356
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   357
    from 6 have "isnorm P2" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   358
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   359
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   360
    from 6 `x < y` y have "isnorm (Pinj d Q2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   361
      by (cases d) (simp, cases Q2, auto)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   362
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   363
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   364
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   365
    assume "x = y"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   366
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   367
    from 6 have "isnorm P2" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   368
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   369
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   370
    from 6 have "y>0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   371
      by (cases y) (auto simp add: norm_Pinj_0_False)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   372
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   373
    note 6
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   374
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   375
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   376
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   377
    assume "x > y"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   378
    then have "\<exists>d. x = d + y" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   379
    then obtain d where x: "x = d + y" ..
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   380
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   381
    note 6
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   382
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   383
    from 6 have "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   384
      by (cases y) (auto simp add: norm_Pinj_0_False)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   385
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   386
    from 6 have "isnorm P2" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   387
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   388
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   389
    from 6 `x > y` x have "isnorm (Pinj d P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   390
      by (cases d) (simp, cases P2, auto)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   391
    ultimately have ?case by (simp add: mkPinj_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   392
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   393
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   394
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   395
  case (7 x P2 Q2 y R)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   396
  then have Y0: "y > 0" by (cases y) auto
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   397
  have "x = 0 \<or> x = 1 \<or> x > 1" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   398
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   399
    assume "x = 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   400
    with 7 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   401
      by (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   402
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   403
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   404
    assume "x = 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   405
    from 7 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   406
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   407
    with 7 `x = 1` have "isnorm (R \<otimes> P2)" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   408
      by (auto simp add: norm_PX1[of Q2 y R])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   409
    with 7 `x = 1` Y0 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   410
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   411
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   412
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   413
    assume "x > 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   414
    then have "\<exists>d. x = Suc (Suc d)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   415
      by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   416
    then obtain d where X: "x = Suc (Suc d)" ..
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   417
    from 7 have NR: "isnorm R" "isnorm Q2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   418
      by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   419
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   420
    from 7 X have "isnorm (Pinj (x - 1) P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   421
      by (cases P2) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   422
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   423
    from 7 have "isnorm (Pinj x P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   424
      by (cases P2) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   425
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   426
    note 7 X
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   427
    ultimately have "isnorm (R \<otimes> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<otimes> Q2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   428
      by auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   429
    with Y0 X have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   430
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   431
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   432
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   433
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   434
  case (8 Q2 y R x P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   435
  then have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   436
    by (cases y) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   437
  have "x = 0 \<or> x = 1 \<or> x > 1" by arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   438
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   439
    assume "x = 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   440
    with 8 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   441
      by (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   442
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   443
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   444
    assume "x = 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   445
    from 8 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   446
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   447
    with 8 `x = 1` have "isnorm (R \<otimes> P2)" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   448
      by (auto simp add: norm_PX1[of Q2 y R])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   449
    with 8 `x = 1` Y0 have ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   450
      by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   451
  }
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   452
  moreover {
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   453
    assume "x > 1"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   454
    then have "\<exists>d. x = Suc (Suc d)" by arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   455
    then obtain d where X: "x = Suc (Suc d)" ..
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   456
    from 8 have NR: "isnorm R" "isnorm Q2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   457
      by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   458
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   459
    from 8 X have "isnorm (Pinj (x - 1) P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   460
      by (cases P2) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   461
    moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   462
    from 8 X have "isnorm (Pinj x P2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   463
      by (cases P2) auto
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   464
    moreover
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   465
    note 8 X
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   466
    ultimately have "isnorm (R \<otimes> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<otimes> Q2)"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   467
      by auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   468
    with Y0 X have ?case by (simp add: mkPX_cn)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   469
  }
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   470
  ultimately show ?case by blast
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   471
next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   472
  case (9 P1 x P2 Q1 y Q2)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   473
  from 9 have X0: "x > 0" by (cases x) auto
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   474
  from 9 have Y0: "y > 0" by (cases y) auto
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   475
  note 9
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   476
  moreover
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   477
  from 9 have "isnorm P1" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   478
    by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   479
  moreover
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   480
  from 9 have "isnorm Q1" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   481
    by (auto simp add: norm_PX1[of Q1 y Q2] norm_PX2[of Q1 y Q2])
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   482
  ultimately have "isnorm (P1 \<otimes> Q1)" "isnorm (P2 \<otimes> Q2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   483
    "isnorm (P1 \<otimes> mkPinj 1 Q2)" "isnorm (Q1 \<otimes> mkPinj 1 P2)"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   484
    by (auto simp add: mkPinj_cn)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   485
  with 9 X0 Y0 have
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   486
    "isnorm (mkPX (P1 \<otimes> Q1) (x + y) (P2 \<otimes> Q2))"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   487
    "isnorm (mkPX (P1 \<otimes> mkPinj (Suc 0) Q2) x (Pc 0))"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   488
    "isnorm (mkPX (Q1 \<otimes> mkPinj (Suc 0) P2) y (Pc 0))"
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   489
    by (auto simp add: mkPX_cn)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   490
  then show ?case by (simp add: add_cn)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   491
qed simp
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   492
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   493
text {* neg conserves normalizedness *}
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   494
lemma neg_cn: "isnorm P \<Longrightarrow> isnorm (neg P)"
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   495
proof (induct P)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   496
  case (Pinj i P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   497
  then have "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   498
    by (simp add: norm_Pinj[of i P2])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   499
  with Pinj show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   500
    by (cases P2) (auto, cases i, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   501
next
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   502
  case (PX P1 x P2) note PX1 = this
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   503
  from PX have "isnorm P2" "isnorm P1"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   504
    by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   505
  with PX show ?case
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   506
  proof (cases P1)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   507
    case (PX p1 y p2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   508
    with PX1 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   509
      by (cases x) (auto, cases p2, auto)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   510
  next
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   511
    case Pinj
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   512
    with PX1 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   513
      by (cases x) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   514
  qed (cases x, auto)
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   515
qed simp
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   516
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   517
text {* sub conserves normalizedness *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   518
lemma sub_cn: "isnorm p \<Longrightarrow> isnorm q \<Longrightarrow> isnorm (p \<ominus> q)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   519
  by (simp add: sub_def add_cn neg_cn)
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   520
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   521
text {* sqr conserves normalizizedness *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   522
lemma sqr_cn: "isnorm P \<Longrightarrow> isnorm (sqr P)"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   523
proof (induct P)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   524
  case Pc
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   525
  then show ?case by simp
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   526
next
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   527
  case (Pinj i Q)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   528
  then show ?case
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   529
    by (cases Q) (auto simp add: mkPX_cn mkPinj_cn, cases i, auto simp add: mkPX_cn mkPinj_cn)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   530
next
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   531
  case (PX P1 x P2)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   532
  then have "x + x \<noteq> 0" "isnorm P2" "isnorm P1"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   533
    by (cases x, auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   534
  with PX have "isnorm (mkPX (Pc (1 + 1) \<otimes> P1 \<otimes> mkPinj (Suc 0) P2) x (Pc 0))"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   535
      and "isnorm (mkPX (sqr P1) (x + x) (sqr P2))"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   536
    by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   537
  then show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   538
    by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   539
qed
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   540
22742
06165e40e7bd switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents: 17508
diff changeset
   541
text {* pow conserves normalizedness *}
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   542
lemma pow_cn: "isnorm P \<Longrightarrow> isnorm (pow n P)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   543
proof (induct n arbitrary: P rule: less_induct)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   544
  case (less k)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   545
  show ?case
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   546
  proof (cases "k = 0")
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   547
    case True
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   548
    then show ?thesis by simp
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   549
  next
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   550
    case False
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   551
    then have K2: "k div 2 < k" by (cases k) auto
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   552
    from less have "isnorm (sqr P)" by (simp add: sqr_cn)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   553
    with less False K2 show ?thesis
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   554
      by (simp add: allE[of _ "(k div 2)" _] allE[of _ "(sqr P)" _], cases k, auto simp add: mul_cn)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   555
  qed
17378
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   556
qed
105519771c67 The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff changeset
   557
17388
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
   558
end