IntEx.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 21 Nov 2009 02:49:39 +0100
changeset 321 f46dc0ca08c3
parent 320 7d3d86beacd6
child 324 bdbb52979790
permissions -rw-r--r--
simplified get_fun so that it uses directly rty and qty, instead of qenv
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
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
     6
  intrel :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool" (infix "\<approx>" 50)
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
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
    11
  and    my_int' = "nat \<times> nat" / intrel
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  apply(unfold EQUIV_def)
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  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
    14
  done
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
    16
thm my_int_equiv
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
    17
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
    18
print_theorems
274
df225aa45770 simplified the quotient_def code
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    19
print_quotients
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
    20
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
    21
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    22
  ZERO::"my_int"
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    23
where
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    24
  "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
    25
318
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    26
ML {* print_qconstinfo @{context} *}
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    27
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
    28
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
    29
thm ZERO_def
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
290
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
    31
ML {* prop_of @{thm ZERO_def} *}
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
    32
318
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    33
ML {* separate *}
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    34
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
    35
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    36
  ONE::"my_int"
193
Christian Urban <urbanc@in.tum.de>
parents: 192
diff changeset
    37
where
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    38
  "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
    39
318
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    40
ML {* print_qconstinfo @{context} *}
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    41
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
term ONE
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
thm ONE_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  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
    47
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  "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
    49
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
    50
quotient_def 
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    51
  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
    52
where
275
34ad627ac5d5 fixed definition of PLUS
Christian Urban <urbanc@in.tum.de>
parents: 274
diff changeset
    53
  "PLUS \<equiv> my_plus"
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
318
746b17e1d6d8 fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents: 312
diff changeset
    55
term my_plus
181
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
term PLUS
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
thm PLUS_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  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
    61
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
  "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
    63
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
    64
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    65
  NEG::"my_int \<Rightarrow> my_int"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    66
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    67
  "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
    68
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
term NEG
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
thm NEG_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
  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
    74
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
  "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
    76
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
  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
    79
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  "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
    81
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
    82
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    83
  MULT::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    84
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    85
  "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
    86
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
term MULT
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
thm MULT_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
(* 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
    91
fun
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  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
    93
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  "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
    95
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
    96
quotient_def 
220
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    97
  LE :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    98
where
af951c8fb80a updated all definitions
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
    99
  "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
   100
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
term LE
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
thm LE_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   104
181
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
  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
   107
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
  "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
   109
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
term LESS
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
thm LESS_def
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
  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
   115
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
  "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
   117
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
definition
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
  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
   120
where
3e53081ad53a added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
 "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
   122
310
fec6301a1989 added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents: 306
diff changeset
   123
ML {* print_qconstinfo @{context} *}
fec6301a1989 added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents: 306
diff changeset
   124
fec6301a1989 added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents: 306
diff changeset
   125
ML {* print_qconstinfo @{context} *}
fec6301a1989 added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents: 306
diff changeset
   126
199
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   127
lemma plus_sym_pre:
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   128
  shows "my_plus a b \<approx> my_plus b a"
199
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   129
  apply(cases a)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   130
  apply(cases b)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   131
  apply(auto)
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   132
  done
Christian Urban <urbanc@in.tum.de>
parents: 198
diff changeset
   133
206
1e227c9ee915 Fixed APPLY_RSP vs Cong in the InjRepAbs tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 200
diff changeset
   134
lemma ho_plus_rsp:
228
268a727b0f10 disambiguate ===> syntax
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 224
diff changeset
   135
  "(intrel ===> intrel ===> intrel) my_plus my_plus"
192
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   136
  by (simp)
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   137
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   138
ML {* val qty = @{typ "my_int"} *}
239
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   139
ML {* val ty_name = "my_int" *}
192
a296bf1a3b09 Simplifying code in int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 191
diff changeset
   140
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
   141
ML {* val defs = @{thms PLUS_def} *}
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   142
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   143
ML {*
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   144
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
   145
  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
   146
*}
02b14a21761a Cleaning of the interface to lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 228
diff changeset
   147
312
4cf79f70efec looking up data in quot_info works now (needs qualified string)
Christian Urban <urbanc@in.tum.de>
parents: 310
diff changeset
   148
print_quotients
320
7d3d86beacd6 started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
parents: 319
diff changeset
   149
ML {* quotdata_lookup @{context} "IntEx.my_int" *}
7d3d86beacd6 started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
parents: 319
diff changeset
   150
ML {* quotdata_lookup @{context} "my_int" *}
312
4cf79f70efec looking up data in quot_info works now (needs qualified string)
Christian Urban <urbanc@in.tum.de>
parents: 310
diff changeset
   151
319
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   152
ML {* 
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   153
  val test = lift_thm_my_int @{context} @{thm plus_sym_pre} 
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   154
*}
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   155
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   156
ML {*
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   157
  val aqtrm = (prop_of (atomize_thm test))
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   158
  val artrm = (prop_of (atomize_thm @{thm plus_sym_pre})) 
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   159
  val reg_artm = mk_REGULARIZE_goal @{context} artrm aqtrm
319
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   160
*}
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   161
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   162
prove {* reg_artm  *}
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   163
apply(tactic {* ObjectLogic.full_atomize_tac 1 *})
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   164
apply(tactic {* REGULARIZE_tac' @{context} @{thm "TrueI"} @{thm my_int_equiv} *})
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   165
done
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   166
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   167
(*
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   168
ML {*
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   169
fun inj_REPABS lthy rtrm qtrm =
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   170
  case (rtrm, qtrm) of
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   171
    (Abs (x, T, t), Abs (x', T', t')) =>
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   172
    if T = T'
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   173
    then Abs (x, T, inj_REPABS lthy t t')
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   174
    else 
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   175
      let 
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   176
         
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   177
      in
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   178
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   179
      end
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   180
  | _ => rtrm
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   181
*}
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   182
*)
320
7d3d86beacd6 started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
parents: 319
diff changeset
   183
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   184
lemma plus_assoc_pre:
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   185
  shows "my_plus (my_plus i j) k \<approx> my_plus i (my_plus j k)"
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   186
  apply (cases i)
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   187
  apply (cases j)
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   188
  apply (cases k)
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   189
  apply (simp)
198
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   190
  done
ff4425e000db Completely cleaned Int.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 197
diff changeset
   191
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   192
ML {* val test2 = lift_thm_my_int @{context} @{thm plus_assoc_pre} *}
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   193
321
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   194
ML {*
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   195
  val aqtrm = (prop_of (atomize_thm test2))
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   196
  val artrm = (prop_of (atomize_thm @{thm plus_assoc_pre})) 
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   197
*}
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   198
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   199
prove {* mk_REGULARIZE_goal @{context} artrm aqtrm  *}
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   200
apply(tactic {* ObjectLogic.full_atomize_tac 1 *})
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   201
apply(tactic {* REGULARIZE_tac' @{context} @{thm "TrueI"} @{thm my_int_equiv} *})
f46dc0ca08c3 simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
parents: 320
diff changeset
   202
done
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   203
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   204
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   205
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   206
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   207
191
b97f3f5fbc18 Symmetry of integer addition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 184
diff changeset
   208
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   209
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   210
lemma ho_tst: "foldl my_plus x [] = x"
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   211
apply simp
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   212
done
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   213
224
f9a25fe22037 Cleaning the unnecessary theorems in 'IntEx'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 222
diff changeset
   214
text {* Below is the construction site code used if things do not work *}
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   215
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   216
ML {* val (trans2, reps_same, absrep, quot) = lookup_quot_thms @{context} "my_int" *}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   217
(* ML {* val consts = [@{const_name my_plus}] *}*)
260
59578f428bbe Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 239
diff changeset
   218
ML {* val consts = lookup_quot_consts defs *}
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   219
ML {* val t_a = atomize_thm @{thm ho_tst} *}
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   220
286
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   221
(*
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   222
prove t_r: {* build_regularize_goal t_a rty rel @{context} *}
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   223
ML_prf {*   fun tac ctxt =
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   224
      (ObjectLogic.full_atomize_tac) THEN'
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   225
     REPEAT_ALL_NEW (FIRST' [
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   226
      rtac rel_refl,
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   227
      atac,
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   228
      rtac @{thm universal_twice},
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   229
      (rtac @{thm impI} THEN' atac),
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   230
      (*rtac @{thm equality_twice},*)
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   231
      EqSubst.eqsubst_tac ctxt [0]
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   232
        [(@{thm equiv_res_forall} OF [rel_eqv]),
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   233
         (@{thm equiv_res_exists} OF [rel_eqv])],
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   234
      (rtac @{thm impI} THEN' (asm_full_simp_tac (Simplifier.context ctxt HOL_ss)) THEN' rtac rel_refl),
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   235
      (rtac @{thm RIGHT_RES_FORALL_REGULAR})
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   236
     ]);*}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   237
apply (atomize(full))
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   238
apply (tactic {* tac @{context} 1 *})
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   239
apply (auto)
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   240
done
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   241
ML {* val t_r = @{thm t_r} OF [t_a] *}*)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   242
ML {* val t_r = regularize t_a rty rel rel_eqv rel_refl @{context} *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   243
ML {*
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   244
  val rt = build_repabs_term @{context} t_r consts rty qty
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   245
  val rg = Logic.mk_equals ((Thm.prop_of t_r), rt);
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   246
*}
286
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   247
*)
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   248
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   249
lemma foldl_rsp:
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   250
  "((IntEx.intrel ===> IntEx.intrel ===> IntEx.intrel) ===>
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   251
           IntEx.intrel ===> op = ===> IntEx.intrel)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   252
           foldl foldl"
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   253
  apply (simp only:FUN_REL.simps)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   254
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   255
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   256
  apply (rule impI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   257
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   258
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   259
  apply (rule impI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   260
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   261
  apply (rule allI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   262
  apply (rule impI)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   263
  apply (simp only:)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   264
  apply (rule list.induct)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   265
  apply (simp)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   266
  apply (simp only: foldl.simps)
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   267
  sorry
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   268
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   269
ML {* val rsp_thms = @{thm foldl_rsp} :: rsp_thms *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   270
prove t_t: rg
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   271
apply(atomize(full))
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   272
ML_prf {* fun r_mk_comb_tac_int lthy = r_mk_comb_tac lthy rty quot rel_refl trans2 rsp_thms *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   273
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_int @{context}) 1 *})
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   274
done
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   275
ML {* val t_t = @{thm Pure.equal_elim_rule1} OF [@{thm t_t},t_r] *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   276
ML {* val abs = findabs rty (prop_of t_a) *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   277
ML {* val aps = findaps rty (prop_of t_a); *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   278
ML {* val simp_lam_prs_thms = map (make_simp_prs_thm @{context} quot @{thm LAMBDA_PRS}) abs *}
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   279
305
d7b60303adb8 Removed 'Toplevel.program' for polyml 5.3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 290
diff changeset
   280
(*ML {* val t_t = repabs @{context} @{thm t_r} consts rty qty quot rel_refl trans2 rsp_thms *}*)
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   281
ML {* val (alls, exs) = findallex rty qty (prop_of t_a) *}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   282
ML {* val allthms = map (make_allex_prs_thm @{context} quot @{thm FORALL_PRS}) alls *}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   283
ML {* val t_a = MetaSimplifier.rewrite_rule (allthms) t_t *}
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   284
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_a *}
281
46e6d06efe3f Experiments with lifting partially applied constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 276
diff changeset
   285
ML {* val defs_sym = add_lower_defs @{context} defs *}
276
783d6c940e45 Experiments in Int
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 275
diff changeset
   286
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_l *}
197
c0f2db9a243b Further reordering in Int code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 196
diff changeset
   287
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
   288
ML {* ObjectLogic.rulify t_r *}