src/HOL/Decision_Procs/Commutative_Ring_Complete.thy
author wenzelm
Wed, 12 Mar 2025 11:39:00 +0100
changeset 82265 4b875a4c83b0
parent 80105 2fa018321400
permissions -rw-r--r--
update for release;
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
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
     3
This theory is about of the relative completeness of the ring
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
     4
method.  As long as the reified atomic polynomials of type pol are
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
     5
in normal form, the ring method is complete.
17388
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     6
*)
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
     7
60533
1e7ccd864b62 isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
     8
section \<open>Proof of the relative completeness of method comm-ring\<close>
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
67123
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
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
60533
1e7ccd864b62 isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    14
text \<open>Formalization of normal form\<close>
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
    15
fun isnorm :: "pol \<Rightarrow> bool"
67123
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    16
  where
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    17
    "isnorm (Pc c) \<longleftrightarrow> True"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    18
  | "isnorm (Pinj i (Pc c)) \<longleftrightarrow> False"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    19
  | "isnorm (Pinj i (Pinj j Q)) \<longleftrightarrow> False"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    20
  | "isnorm (Pinj 0 P) \<longleftrightarrow> False"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    21
  | "isnorm (Pinj i (PX Q1 j Q2)) \<longleftrightarrow> isnorm (PX Q1 j Q2)"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    22
  | "isnorm (PX P 0 Q) \<longleftrightarrow> False"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    23
  | "isnorm (PX (Pc c) i Q) \<longleftrightarrow> c \<noteq> 0 \<and> isnorm Q"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
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"
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
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
67123
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    27
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    28
subsection \<open>Some helpful lemmas\<close>
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
    29
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    30
lemma norm_Pinj_0_False: "isnorm (Pinj 0 P) = False"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    31
  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
    32
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    33
lemma norm_PX_0_False: "isnorm (PX (Pc 0) i Q) = False"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    34
  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
    35
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    36
lemma norm_Pinj: "isnorm (Pinj i Q) \<Longrightarrow> isnorm Q"
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    37
  using isnorm.elims(2) by fastforce
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
    38
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    39
lemma norm_PX2: "isnorm (PX P i Q) \<Longrightarrow> isnorm Q"
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    40
  using isnorm.elims(1) by auto
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    41
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    42
lemma norm_PX1: assumes "isnorm (PX P i Q)" shows "isnorm P"
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    43
proof (cases P)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    44
  case (Pc x1)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    45
  then show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    46
    by auto 
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    47
qed (use assms isnorm.elims(1) in auto)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    48
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    49
lemma mkPinj_cn:
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    50
  assumes "y \<noteq> 0" and "isnorm Q" 
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    51
  shows "isnorm (mkPinj y Q)"
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    52
proof (cases Q)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    53
  case Pc
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    54
  with assms show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    55
    by (simp add: mkPinj_def)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    56
next
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    57
  case Pinj
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    58
  with assms show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    59
    using isnorm.elims(2) isnorm.simps(5) mkPinj_def by fastforce
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    60
next
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    61
  case PX
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    62
  with assms show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    63
  using isnorm.elims(1) mkPinj_def by auto
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    64
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
    65
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    66
lemma norm_PXtrans:
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    67
  assumes "isnorm (PX P x Q)" and "isnorm Q2"
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    68
  shows "isnorm (PX P x Q2)"
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    69
  using assms isnorm.elims(3) by fastforce
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    70
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    71
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    72
lemma norm_PXtrans2:
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    73
  assumes "isnorm (PX P x Q)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    74
    and "isnorm Q2"
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    75
  shows "isnorm (PX P (Suc (n + x)) Q2)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    76
proof (cases P)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    77
  case (PX p1 y p2)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    78
  with assms show ?thesis
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    79
  using isnorm.elims(2) by fastforce
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
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    81
  case Pc
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
    82
  with assms show ?thesis
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
    83
    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
    84
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
    85
  case Pinj
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
    86
  with assms show ?thesis
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
    87
    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
    88
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
    89
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
    90
text \<open>\<open>mkPX\<close> preserves the normal property (\<open>_cn\<close>)\<close>
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    91
lemma mkPX_cn:
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    92
  assumes "x \<noteq> 0"
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    93
    and "isnorm P"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
    94
    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
    95
  shows "isnorm (mkPX P x Q)"
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    96
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
    97
  case (Pc c)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    98
  with assms show ?thesis
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
    99
    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
   100
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
   101
  case (Pinj i Q)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   102
  with assms show ?thesis
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   103
    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
   104
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
   105
  case (PX P1 y P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   106
  with assms have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   107
    by (cases y) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   108
  from assms PX have "isnorm P1" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   109
    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
   110
  from assms PX Y0 show ?thesis
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   111
  proof (cases P2)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   112
    case (Pc x1)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   113
    then show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   114
      using assms gr0_conv_Suc PX by (auto simp add: mkPX_def norm_PXtrans2)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   115
  next
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   116
    case (Pinj x21 x22)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   117
    with assms gr0_conv_Suc PX show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   118
      by (auto simp: mkPX_def)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   119
  next
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   120
    case (PX x31 x32 x33)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   121
    with assms gr0_conv_Suc \<open>P = PX P1 y P2\<close>
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   122
    show ?thesis
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   123
      using assms PX by (auto simp add: mkPX_def norm_PXtrans2)
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   124
  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
   125
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
   126
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   127
text \<open>\<open>add\<close> preserves the normal property\<close>
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   128
lemma add_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<langle>+\<rangle> Q)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   129
proof (induct P Q rule: add.induct)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   130
  case 1
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   131
  then show ?case by simp
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   132
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   133
  case (2 c i P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   134
  then show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   135
    using isnorm.elims(2) by fastforce
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
   136
next
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   137
  case (3 i P2 c)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   138
  then show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   139
    using isnorm.elims(2) by fastforce
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
   140
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
   141
  case (4 c P2 i Q2)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   142
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   143
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   144
  with 4 show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   145
    using isnorm.elims(2) by fastforce
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
   146
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
   147
  case (5 P2 i Q2 c)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   148
  then have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   149
    by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   150
  with 5 show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   151
    using isnorm.elims(2) by fastforce
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
   152
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
   153
  case (6 x P2 y Q2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   154
  then have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   155
    by (cases y) (auto simp add: norm_Pinj_0_False)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   156
  with 6 have X0: "x > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   157
    by (cases x) (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   158
  consider "x < y" | "x = y" | "x > y" by arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   159
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   160
  proof cases
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   161
    case xy: 1
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   162
    then obtain d where y: "y = d + x"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   163
      by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   164
    from 6 have *: "isnorm P2" "isnorm Q2"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   165
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   166
    from 6 xy y have "isnorm (Pinj d Q2)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   167
      by (cases d, simp, cases Q2, auto)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   168
    with 6 X0 y * show ?thesis
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   169
      by (simp add: mkPinj_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   170
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   171
    case xy: 2
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   172
    from 6 have "isnorm P2" "isnorm Q2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   173
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   174
    with xy 6 Y0 show ?thesis
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   175
      by (simp add: mkPinj_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   176
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   177
    case xy: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   178
    then obtain d where x: "x = d + y"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   179
      by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   180
    from 6 have *: "isnorm P2" "isnorm Q2"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   181
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   182
    from 6 xy x have "isnorm (Pinj d P2)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   183
      by (cases d) (simp, cases P2, auto)
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   184
    with xy 6 Y0 * x show ?thesis by (simp add: mkPinj_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   185
  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
   186
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
   187
  case (7 x P2 Q2 y R)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   188
  consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   189
    by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   190
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   191
  proof cases
60767
ad5b4771fc19 tuned proofs;
wenzelm
parents: 60708
diff changeset
   192
    case 1
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   193
    with 7 show ?thesis
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   194
      by (auto simp add: norm_Pinj_0_False)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   195
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   196
    case x: 2
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   197
    from 7 have "isnorm R" "isnorm P2"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   198
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   199
    with 7 x have "isnorm (R \<langle>+\<rangle> P2)"
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   200
      by simp
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   201
    with 7 x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   202
      by (simp add: norm_PXtrans[of Q2 y _])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   203
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   204
    case x: 3
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   205
    with 7 have NR: "isnorm R" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   206
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   207
    with 7 x have "isnorm (Pinj (x - 1) P2)"
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   208
      by (cases P2) auto
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   209
    with 7 x NR have "isnorm (R \<langle>+\<rangle> Pinj (x - 1) P2)"
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   210
      by simp
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   211
    with \<open>isnorm (PX Q2 y R)\<close> x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   212
      by (simp add: norm_PXtrans[of Q2 y _])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   213
  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
   214
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
   215
  case (8 Q2 y R x P2)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   216
  consider "x = 0" | "x = 1" | "x > 1"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   217
    by arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   218
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   219
  proof cases
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   220
    case 1
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   221
    with 8 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   222
      by (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   223
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   224
    case x: 2
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   225
    with 8 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   226
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   227
    with 8 x have "isnorm (R \<langle>+\<rangle> P2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   228
      by simp
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   229
    with 8 x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   230
      by (simp add: norm_PXtrans[of Q2 y _])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   231
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   232
    case x: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   233
    then obtain d where x: "x = Suc (Suc d)" by atomize_elim arith
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   234
    with 8 have NR: "isnorm R" "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   235
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   236
    with 8 x have "isnorm (Pinj (x - 1) P2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   237
      by (cases P2) auto
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   238
    with 8 x NR have "isnorm (R \<langle>+\<rangle> Pinj (x - 1) P2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   239
      by simp
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   240
    with \<open>isnorm (PX Q2 y R)\<close> x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   241
      by (simp add: norm_PXtrans[of Q2 y _])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   242
  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
   243
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
   244
  case (9 P1 x P2 Q1 y Q2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   245
  then have Y0: "y > 0" by (cases y) auto
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   246
  with 9 have X0: "x > 0" by (cases x) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   247
  with 9 have NP1: "isnorm P1" and NP2: "isnorm P2"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   248
    by (auto simp add: norm_PX1[of P1 _ P2] norm_PX2[of P1 _ P2])
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   249
  with 9 have NQ1: "isnorm Q1" and NQ2: "isnorm Q2"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   250
    by (auto simp add: norm_PX1[of Q1 _ Q2] norm_PX2[of Q1 _ Q2])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   251
  consider "y < x" | "x = y" | "x < y" by arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   252
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   253
  proof cases
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   254
    case xy: 1
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   255
    then obtain d where x: "x = d + y"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   256
      by atomize_elim arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   257
    have "isnorm (PX P1 d (Pc 0))"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   258
    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
   259
      case (PX p1 y p2)
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   260
      with 9 xy x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   261
        by (cases d) (simp, cases p2, auto)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   262
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   263
      case Pc
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   264
      with 9 xy x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   265
        by (cases d) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   266
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   267
      case Pinj
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   268
      with 9 xy x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   269
        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
   270
    qed
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   271
    with 9 NQ1 NP1 NP2 NQ2 xy x have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (PX P1 (x - y) (Pc 0) \<langle>+\<rangle> Q1)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   272
      by auto
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   273
    with Y0 xy x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   274
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   275
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   276
    case xy: 2
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   277
    with 9 NP1 NP2 NQ1 NQ2 have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (P1 \<langle>+\<rangle> Q1)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   278
      by auto
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   279
    with xy Y0 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   280
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   281
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   282
    case xy: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   283
    then obtain d where y: "y = d + x"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   284
      by atomize_elim arith
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   285
    have "isnorm (PX Q1 d (Pc 0))"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   286
    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
   287
      case (PX p1 y p2)
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   288
      with 9 xy y show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   289
        by (cases d) (simp, cases p2, auto)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   290
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   291
      case Pc
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   292
      with 9 xy y show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   293
        by (cases d) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   294
    next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   295
      case Pinj
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   296
      with 9 xy y show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   297
        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
   298
    qed
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   299
    with 9 NQ1 NP1 NP2 NQ2 xy y have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (PX Q1 (y - x) (Pc 0) \<langle>+\<rangle> P1)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   300
      by auto
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   301
    with X0 xy y show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   302
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   303
  qed
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   304
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
   305
67123
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
   306
text \<open>\<open>mul\<close> concerves normalizedness\<close>
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   307
lemma mul_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<langle>*\<rangle> Q)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   308
proof (induct P Q rule: mul.induct)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   309
  case 1
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   310
  then show ?case by simp
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   311
next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   312
  case (2 c i P2)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   313
  then show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   314
    by (metis mkPinj_cn mul.simps(2) norm_Pinj 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
   315
next
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   316
  case (3 i P2 c)
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   317
  then show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   318
    by (metis mkPinj_cn mul.simps(3) norm_Pinj 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
   319
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
   320
  case (4 c P2 i Q2)
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   321
  then show ?case
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   322
    by (metis isnorm.simps(6) mkPX_cn mul.simps(4) norm_PX1 norm_PX2)
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
   323
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
   324
  case (5 P2 i Q2 c)
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   325
  then show ?case
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   326
    by (metis isnorm.simps(6) mkPX_cn mul.simps(5) norm_PX1 norm_PX2)
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
   327
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
   328
  case (6 x P2 y Q2)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   329
  consider "x < y" | "x = y" | "x > y" by arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   330
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   331
  proof cases
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   332
    case xy: 1
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   333
    then obtain d where y: "y = d + x"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   334
      by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   335
    from 6 have *: "x > 0"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   336
      by (cases x) (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   337
    from 6 have **: "isnorm P2" "isnorm Q2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   338
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   339
    from 6 xy y have "isnorm (Pinj d Q2)"
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   340
      apply simp
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   341
      by (smt (verit, ccfv_SIG) "**"(2) Suc_pred isnorm.elims(1) isnorm.simps(2) isnorm.simps(3) isnorm.simps(5))
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   342
    with 6 * ** y show ?thesis
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   343
      by (simp add: mkPinj_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   344
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   345
    case xy: 2
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   346
    from 6 have *: "isnorm P2" "isnorm Q2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   347
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   348
    from 6 have **: "y > 0"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   349
      by (cases y) (auto simp add: norm_Pinj_0_False)
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   350
    with 6 xy * ** show ?thesis
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   351
      by (simp add: mkPinj_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   352
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   353
    case xy: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   354
    then obtain d where x: "x = d + y"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   355
      by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   356
    from 6 have *: "y > 0"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   357
      by (cases y) (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   358
    from 6 have **: "isnorm P2" "isnorm Q2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   359
      by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   360
    with 6 xy x have "isnorm (Pinj d P2)"
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   361
      apply simp
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   362
      by (smt (verit, ccfv_SIG) Suc_pred isnorm.elims(1) isnorm.simps(2) isnorm.simps(3) isnorm.simps(5))
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   363
    with 6 xy * ** x show ?thesis
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   364
      by (simp add: mkPinj_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   365
  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
   366
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
   367
  case (7 x P2 Q2 y R)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   368
  then have Y0: "y > 0" by (cases y) auto
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   369
  consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   370
    by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   371
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   372
  proof cases
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   373
    case 1
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   374
    with 7 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   375
      by (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   376
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   377
    case x: 2
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   378
    from 7 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   379
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   380
    with 7 x have "isnorm (R \<langle>*\<rangle> P2)" "isnorm Q2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   381
      by (auto simp add: norm_PX1[of Q2 y R])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   382
    with 7 x Y0 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   383
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   384
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   385
    case x: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   386
    from 7 have *: "isnorm R" "isnorm Q2"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   387
      by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   388
    from 7 x have "isnorm (Pinj (x - 1) P2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   389
      by (cases P2) auto
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   390
    with 7 x * have "isnorm (R \<langle>*\<rangle> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<langle>*\<rangle> Q2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   391
      by auto
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   392
    with Y0 x show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   393
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   394
  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
   395
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
   396
  case (8 Q2 y R x P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   397
  then have Y0: "y > 0"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   398
    by (cases y) auto
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   399
  consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   400
    by atomize_elim arith
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   401
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   402
  proof cases
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   403
    case 1
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   404
    with 8 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   405
      by (auto simp add: norm_Pinj_0_False)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   406
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   407
    case x: 2
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   408
    from 8 have "isnorm R" "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   409
      by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   410
    with 8 x have "isnorm (R \<langle>*\<rangle> P2)" "isnorm Q2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   411
      by (auto simp add: norm_PX1[of Q2 y R])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   412
    with 8 x Y0 show ?thesis
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   413
      by (simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   414
  next
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   415
    case x: 3
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   416
    from 8 have *: "isnorm R" "isnorm Q2"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   417
      by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   418
    from 8 x have "isnorm (Pinj (x - 1) P2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   419
      by (cases P2) auto
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   420
    with 8 x * have "isnorm (R \<langle>*\<rangle> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<langle>*\<rangle> Q2)"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   421
      by auto
60567
19c277ea65ae tuned proofs -- less digits;
wenzelm
parents: 60535
diff changeset
   422
    with Y0 x show ?thesis
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   423
      by (simp add: mkPX_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   424
  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
   425
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
   426
  case (9 P1 x P2 Q1 y Q2)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   427
  from 9 have X0: "x > 0" by (cases x) auto
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   428
  from 9 have Y0: "y > 0" by (cases y) auto
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   429
  from 9 have *: "isnorm P1" "isnorm P2"
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   430
    by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   431
  from 9 have "isnorm Q1" "isnorm Q2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   432
    by (auto simp add: norm_PX1[of Q1 y Q2] norm_PX2[of Q1 y Q2])
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   433
  with 9 * have "isnorm (P1 \<langle>*\<rangle> Q1)" "isnorm (P2 \<langle>*\<rangle> Q2)"
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   434
    "isnorm (P1 \<langle>*\<rangle> mkPinj 1 Q2)" "isnorm (Q1 \<langle>*\<rangle> 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
   435
    by (auto simp add: mkPinj_cn)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   436
  with 9 X0 Y0 have
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   437
    "isnorm (mkPX (P1 \<langle>*\<rangle> Q1) (x + y) (P2 \<langle>*\<rangle> Q2))"
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   438
    "isnorm (mkPX (P1 \<langle>*\<rangle> mkPinj (Suc 0) Q2) x (Pc 0))"
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   439
    "isnorm (mkPX (Q1 \<langle>*\<rangle> 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
   440
    by (auto simp add: mkPX_cn)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   441
  then show ?case
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   442
    by (simp add: add_cn)
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   443
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
   444
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   445
text \<open>neg preserves the normal property\<close>
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
   446
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
   447
proof (induct P)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   448
  case Pc
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   449
  then show ?case by simp
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   450
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
   451
  case (Pinj i P2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   452
  then have "isnorm P2"
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   453
    by (simp add: norm_Pinj[of i P2])
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   454
  with Pinj show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   455
    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
   456
next
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   457
  case (PX P1 x P2) note PX1 = this
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   458
  from PX have "isnorm P2" "isnorm P1"
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   459
    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
   460
  with PX show ?case
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   461
  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
   462
    case (PX p1 y p2)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   463
    with PX1 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   464
      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
   465
  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
   466
    case Pinj
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   467
    with PX1 show ?thesis
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   468
      by (cases x) auto
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   469
  qed (cases x, auto)
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   470
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
   471
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   472
text \<open>sub preserves the normal property\<close>
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   473
lemma sub_cn: "isnorm p \<Longrightarrow> isnorm q \<Longrightarrow> isnorm (p \<langle>-\<rangle> q)"
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   474
  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
   475
60533
1e7ccd864b62 isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
   476
text \<open>sqr conserves normalizizedness\<close>
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   477
lemma sqr_cn: "isnorm P \<Longrightarrow> isnorm (sqr P)"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   478
proof (induct P)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   479
  case Pc
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   480
  then show ?case by simp
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   481
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
   482
  case (Pinj i Q)
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   483
  then show ?case
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   484
    by (metis Commutative_Ring.sqr.simps(2) mkPinj_cn norm_Pinj norm_Pinj_0_False)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   485
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
   486
  case (PX P1 x P2)
55754
d14072d53c1e tuned specifications and proofs;
wenzelm
parents: 53374
diff changeset
   487
  then have "x + x \<noteq> 0" "isnorm P2" "isnorm P1"
67123
3fe40ff1b921 misc tuning and modernization;
wenzelm
parents: 64962
diff changeset
   488
    by (cases x) (use PX in \<open>auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2]\<close>)
64962
bf41e1109db3 Added new / improved tactics for fields and rings
berghofe
parents: 61586
diff changeset
   489
  with PX have "isnorm (mkPX (Pc (1 + 1) \<langle>*\<rangle> P1 \<langle>*\<rangle> mkPinj (Suc 0) P2) x (Pc 0))"
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   490
    and "isnorm (mkPX (sqr P1) (x + x) (sqr P2))"
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   491
    by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   492
  then show ?case
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   493
    by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   494
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
   495
80105
2fa018321400 Streamlining of many more archaic proofs
paulson <lp15@cam.ac.uk>
parents: 67123
diff changeset
   496
text \<open>\<open>pow\<close> preserves the normal property\<close>
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   497
lemma pow_cn: "isnorm P \<Longrightarrow> isnorm (pow n P)"
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   498
proof (induct n arbitrary: P rule: less_induct)
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   499
  case (less k)
55793
52c8f934ea6f tuned whitespace;
wenzelm
parents: 55754
diff changeset
   500
  show ?case
41807
ab5d2d81f9fb tuned proofs -- eliminated prems;
wenzelm
parents: 33356
diff changeset
   501
  proof (cases "k = 0")
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   502
    case True
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   503
    then show ?thesis by simp
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   504
  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
   505
    case False
60535
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   506
    then have K2: "k div 2 < k"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   507
      by (cases k) auto
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   508
    from less have "isnorm (sqr P)"
25a3c522cc8f tuned proofs;
wenzelm
parents: 60533
diff changeset
   509
      by (simp add: sqr_cn)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   510
    with less False K2 show ?thesis
58712
709d8f68ec29 avoid unsafe simp rules
haftmann
parents: 58710
diff changeset
   511
      by (cases "even k") (auto simp add: mul_cn elim: evenE oddE)
44779
98d597c4193d tuned proofs;
wenzelm
parents: 41807
diff changeset
   512
  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
   513
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
   514
17388
495c799df31d tuned headers etc.;
wenzelm
parents: 17378
diff changeset
   515
end