IntEx.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 04 Nov 2009 10:31:20 +0100
changeset 274 df225aa45770
parent 268 4d58c02289ca
child 275 34ad627ac5d5
permissions -rw-r--r--
simplified the quotient_def code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory IntEx
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports QuotMain
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
fun
206
1e227c9ee915 Fixed APPLY_RSP vs Cong in the InjRepAbs tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 200
diff changeset
     6
  intrel :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  "intrel (x, y) (u, v) = (x + v = u + y)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
quotient my_int = "nat \<times> nat" / intrel
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  apply(unfold EQUIV_def)
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  apply(auto simp add: mem_def expand_fun_eq)
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  done
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
    15
print_theorems
274
df225aa45770 simplified the quotient_def code
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    16
print_quotients
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
    17
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    18
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    19
  ZERO::"my_int"
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    20
where
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    21
  "ZERO \<equiv> (0::nat, 0::nat)"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    23
term ZERO
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    24
thm ZERO_def
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    26
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    27
  ONE::"my_int"
193
Christian Urban <urbanc@in.tum.de>
parents: 192
diff changeset
    28
where
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    29
  "ONE \<equiv> (1::nat, 0::nat)"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
term ONE
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
thm ONE_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  my_plus :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  "my_plus (x, y) (u, v) = (x + u, y + v)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    39
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    40
  PLUS::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    41
where
274
df225aa45770 simplified the quotient_def code
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    42
  "PLUS x y \<equiv> my_plus x y"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
term PLUS
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
thm PLUS_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  my_neg :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  "my_neg (x, y) = (y, x)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    52
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    53
  NEG::"my_int \<Rightarrow> my_int"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    54
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    55
  "NEG \<equiv> my_neg"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
term NEG
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
thm NEG_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  MINUS :: "my_int \<Rightarrow> my_int \<Rightarrow> my_int"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  "MINUS z w = PLUS z (NEG w)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
  my_mult :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  "my_mult (x, y) (u, v) = (x*u + y*v, x*v + y*u)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    70
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    71
  MULT::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    72
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    73
  "MULT \<equiv> my_mult"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
term MULT
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
thm MULT_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
(* NOT SURE WETHER THIS DEFINITION IS CORRECT *)
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  my_le :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
  "my_le (x, y) (u, v) = (x+v \<le> u+y)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
268
4d58c02289ca simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents: 263
diff changeset
    84
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    85
  LE :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    86
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    87
  "LE \<equiv> my_le"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
term LE
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
thm LE_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  LESS :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  "LESS z w = (LE z w \<and> z \<noteq> w)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
term LESS
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
thm LESS_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  ABS :: "my_int \<Rightarrow> my_int"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  "ABS i = (if (LESS i ZERO) then (NEG i) else i)"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  SIGN :: "my_int \<Rightarrow> my_int"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
 "SIGN i = (if i = ZERO then ZERO else if (LESS ZERO i) then ONE else (NEG ONE))"
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
199
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   110
lemma plus_sym_pre:
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   111
  shows "intrel (my_plus a b) (my_plus b a)"
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   112
  apply(cases a)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   113
  apply(cases b)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   114
  apply(auto)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   115
  done
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   116
206
1e227c9ee915 Fixed APPLY_RSP vs Cong in the InjRepAbs tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 200
diff changeset
   117
lemma ho_plus_rsp:
228
268a727b0f10 disambiguate ===> syntax
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 224
diff changeset
   118
  "(intrel ===> intrel ===> intrel) my_plus my_plus"
192
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   119
  by (simp)
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   120
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   121
ML {* val qty = @{typ "my_int"} *}
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   122
ML {* val ty_name = "my_int" *}
192
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   123
ML {* val rsp_thms = @{thms ho_plus_rsp} @ @{thms ho_all_prs ho_ex_prs} *}
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   124
ML {* val defs = @{thms PLUS_def} *}
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   125
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   126
ML {*
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   127
fun lift_thm_my_int lthy t =
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   128
  lift_thm lthy qty ty_name rsp_thms defs t
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   129
*}
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   130
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   131
ML {*
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   132
  val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty;
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   133
*}
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   134
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   135
ML {* lift_thm_my_int @{context} @{thm plus_sym_pre} *}
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   136
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   137
lemma plus_assoc_pre:
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   138
  shows "intrel (my_plus (my_plus i j) k) (my_plus i (my_plus j k))"
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   139
  apply (cases i)
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   140
  apply (cases j)
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   141
  apply (cases k)
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   142
  apply (simp)
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   143
  done
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   144
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   145
ML {* lift_thm_my_int @{context} @{thm plus_assoc_pre} *}
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   146
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   147
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   148
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   149
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   150
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   151
191
b97f3f5fbc18 Symmetry of integer addition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 184
diff changeset
   152
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   153
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   154
text {* Below is the construction site code used if things do not work *}
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   155
ML {* val (trans2, reps_same, quot) = lookup_quot_thms @{context} "my_int" *}
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   156
ML {* val abs = findabs rty (prop_of (atomize_thm @{thm plus_sym_pre})) *}
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   157
ML {* val simp_lam_prs_thms = map (make_simp_prs_thm @{context} quot @{thm LAMBDA_PRS}) abs *}
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   158
ML {* val defs_sym = add_lower_defs @{context} defs *}
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   159
ML {* val consts = lookup_quot_consts defs *}
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 218
diff changeset
   160
ML {* val t_a = atomize_thm @{thm plus_sym_pre} *}
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   161
ML {* val t_r = regularize t_a rty rel rel_eqv rel_refl @{context} *}
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   162
ML {* val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms *}
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 218
diff changeset
   163
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *}
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   164
ML {* val t_a = simp_allex_prs quot [] t_l *}
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   165
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_a *}
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   166
ML {* val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d *}
191
b97f3f5fbc18 Symmetry of integer addition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 184
diff changeset
   167
ML {* ObjectLogic.rulify t_r *}
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   169
thm FORALL_PRS
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170