src/HOL/Transfer.thy
author Andreas Lochbihler
Fri Sep 27 09:07:45 2013 +0200 (2013-09-27)
changeset 53944 50c8f7f21327
parent 53927 abe2b313f0e5
child 53952 b2781a3ce958
permissions -rw-r--r--
add lemmas
huffman@47325
     1
(*  Title:      HOL/Transfer.thy
huffman@47325
     2
    Author:     Brian Huffman, TU Muenchen
kuncar@51956
     3
    Author:     Ondrej Kuncar, TU Muenchen
huffman@47325
     4
*)
huffman@47325
     5
huffman@47325
     6
header {* Generic theorem transfer using relations *}
huffman@47325
     7
huffman@47325
     8
theory Transfer
haftmann@51112
     9
imports Hilbert_Choice
huffman@47325
    10
begin
huffman@47325
    11
huffman@47325
    12
subsection {* Relator for function space *}
huffman@47325
    13
huffman@47325
    14
definition
kuncar@53011
    15
  fun_rel :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
huffman@47325
    16
where
huffman@47325
    17
  "fun_rel A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))"
huffman@47325
    18
kuncar@53011
    19
locale lifting_syntax
kuncar@53011
    20
begin
kuncar@53011
    21
  notation fun_rel (infixr "===>" 55)
kuncar@53011
    22
  notation map_fun (infixr "--->" 55)
kuncar@53011
    23
end
kuncar@53011
    24
kuncar@53011
    25
context
kuncar@53011
    26
begin
kuncar@53011
    27
interpretation lifting_syntax .
kuncar@53011
    28
huffman@47325
    29
lemma fun_relI [intro]:
huffman@47325
    30
  assumes "\<And>x y. A x y \<Longrightarrow> B (f x) (g y)"
huffman@47325
    31
  shows "(A ===> B) f g"
huffman@47325
    32
  using assms by (simp add: fun_rel_def)
huffman@47325
    33
huffman@47325
    34
lemma fun_relD:
huffman@47325
    35
  assumes "(A ===> B) f g" and "A x y"
huffman@47325
    36
  shows "B (f x) (g y)"
huffman@47325
    37
  using assms by (simp add: fun_rel_def)
huffman@47325
    38
kuncar@47937
    39
lemma fun_relD2:
kuncar@47937
    40
  assumes "(A ===> B) f g" and "A x x"
kuncar@47937
    41
  shows "B (f x) (g x)"
kuncar@47937
    42
  using assms unfolding fun_rel_def by auto
kuncar@47937
    43
huffman@47325
    44
lemma fun_relE:
huffman@47325
    45
  assumes "(A ===> B) f g" and "A x y"
huffman@47325
    46
  obtains "B (f x) (g y)"
huffman@47325
    47
  using assms by (simp add: fun_rel_def)
huffman@47325
    48
huffman@47325
    49
lemma fun_rel_eq:
huffman@47325
    50
  shows "((op =) ===> (op =)) = (op =)"
huffman@47325
    51
  by (auto simp add: fun_eq_iff elim: fun_relE)
huffman@47325
    52
huffman@47325
    53
lemma fun_rel_eq_rel:
huffman@47325
    54
  shows "((op =) ===> R) = (\<lambda>f g. \<forall>x. R (f x) (g x))"
huffman@47325
    55
  by (simp add: fun_rel_def)
huffman@47325
    56
huffman@47325
    57
huffman@47325
    58
subsection {* Transfer method *}
huffman@47325
    59
huffman@47789
    60
text {* Explicit tag for relation membership allows for
huffman@47789
    61
  backward proof methods. *}
huffman@47325
    62
huffman@47325
    63
definition Rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
huffman@47325
    64
  where "Rel r \<equiv> r"
huffman@47325
    65
huffman@49975
    66
text {* Handling of equality relations *}
huffman@49975
    67
huffman@49975
    68
definition is_equality :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
huffman@49975
    69
  where "is_equality R \<longleftrightarrow> R = (op =)"
huffman@49975
    70
kuncar@51437
    71
lemma is_equality_eq: "is_equality (op =)"
kuncar@51437
    72
  unfolding is_equality_def by simp
kuncar@51437
    73
huffman@52354
    74
text {* Reverse implication for monotonicity rules *}
huffman@52354
    75
huffman@52354
    76
definition rev_implies where
huffman@52354
    77
  "rev_implies x y \<longleftrightarrow> (y \<longrightarrow> x)"
huffman@52354
    78
huffman@47325
    79
text {* Handling of meta-logic connectives *}
huffman@47325
    80
huffman@47325
    81
definition transfer_forall where
huffman@47325
    82
  "transfer_forall \<equiv> All"
huffman@47325
    83
huffman@47325
    84
definition transfer_implies where
huffman@47325
    85
  "transfer_implies \<equiv> op \<longrightarrow>"
huffman@47325
    86
huffman@47355
    87
definition transfer_bforall :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
huffman@47355
    88
  where "transfer_bforall \<equiv> (\<lambda>P Q. \<forall>x. P x \<longrightarrow> Q x)"
huffman@47355
    89
huffman@47325
    90
lemma transfer_forall_eq: "(\<And>x. P x) \<equiv> Trueprop (transfer_forall (\<lambda>x. P x))"
huffman@47325
    91
  unfolding atomize_all transfer_forall_def ..
huffman@47325
    92
huffman@47325
    93
lemma transfer_implies_eq: "(A \<Longrightarrow> B) \<equiv> Trueprop (transfer_implies A B)"
huffman@47325
    94
  unfolding atomize_imp transfer_implies_def ..
huffman@47325
    95
huffman@47355
    96
lemma transfer_bforall_unfold:
huffman@47355
    97
  "Trueprop (transfer_bforall P (\<lambda>x. Q x)) \<equiv> (\<And>x. P x \<Longrightarrow> Q x)"
huffman@47355
    98
  unfolding transfer_bforall_def atomize_imp atomize_all ..
huffman@47355
    99
huffman@47658
   100
lemma transfer_start: "\<lbrakk>P; Rel (op =) P Q\<rbrakk> \<Longrightarrow> Q"
huffman@47325
   101
  unfolding Rel_def by simp
huffman@47325
   102
huffman@47658
   103
lemma transfer_start': "\<lbrakk>P; Rel (op \<longrightarrow>) P Q\<rbrakk> \<Longrightarrow> Q"
huffman@47325
   104
  unfolding Rel_def by simp
huffman@47325
   105
huffman@47635
   106
lemma transfer_prover_start: "\<lbrakk>x = x'; Rel R x' y\<rbrakk> \<Longrightarrow> Rel R x y"
huffman@47618
   107
  by simp
huffman@47618
   108
huffman@52358
   109
lemma untransfer_start: "\<lbrakk>Q; Rel (op =) P Q\<rbrakk> \<Longrightarrow> P"
huffman@52358
   110
  unfolding Rel_def by simp
huffman@52358
   111
huffman@47325
   112
lemma Rel_eq_refl: "Rel (op =) x x"
huffman@47325
   113
  unfolding Rel_def ..
huffman@47325
   114
huffman@47789
   115
lemma Rel_app:
huffman@47523
   116
  assumes "Rel (A ===> B) f g" and "Rel A x y"
huffman@47789
   117
  shows "Rel B (f x) (g y)"
huffman@47789
   118
  using assms unfolding Rel_def fun_rel_def by fast
huffman@47523
   119
huffman@47789
   120
lemma Rel_abs:
huffman@47523
   121
  assumes "\<And>x y. Rel A x y \<Longrightarrow> Rel B (f x) (g y)"
huffman@47789
   122
  shows "Rel (A ===> B) (\<lambda>x. f x) (\<lambda>y. g y)"
huffman@47789
   123
  using assms unfolding Rel_def fun_rel_def by fast
huffman@47523
   124
kuncar@53011
   125
end
kuncar@53011
   126
wenzelm@48891
   127
ML_file "Tools/transfer.ML"
huffman@47325
   128
setup Transfer.setup
huffman@47325
   129
huffman@49975
   130
declare refl [transfer_rule]
huffman@49975
   131
huffman@47503
   132
declare fun_rel_eq [relator_eq]
huffman@47503
   133
huffman@47789
   134
hide_const (open) Rel
huffman@47325
   135
kuncar@53011
   136
context
kuncar@53011
   137
begin
kuncar@53011
   138
interpretation lifting_syntax .
kuncar@53011
   139
kuncar@51956
   140
text {* Handling of domains *}
kuncar@51956
   141
kuncar@51956
   142
lemma Domaimp_refl[transfer_domain_rule]:
kuncar@51956
   143
  "Domainp T = Domainp T" ..
huffman@47325
   144
huffman@47325
   145
subsection {* Predicates on relations, i.e. ``class constraints'' *}
huffman@47325
   146
huffman@47325
   147
definition right_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
huffman@47325
   148
  where "right_total R \<longleftrightarrow> (\<forall>y. \<exists>x. R x y)"
huffman@47325
   149
huffman@47325
   150
definition right_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
huffman@47325
   151
  where "right_unique R \<longleftrightarrow> (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z)"
huffman@47325
   152
huffman@47325
   153
definition bi_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
huffman@47325
   154
  where "bi_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y) \<and> (\<forall>y. \<exists>x. R x y)"
huffman@47325
   155
huffman@47325
   156
definition bi_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
huffman@47325
   157
  where "bi_unique R \<longleftrightarrow>
huffman@47325
   158
    (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z) \<and>
huffman@47325
   159
    (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y)"
huffman@47325
   160
Andreas@53927
   161
lemma bi_uniqueDr: "\<lbrakk> bi_unique A; A x y; A x z \<rbrakk> \<Longrightarrow> y = z"
Andreas@53927
   162
by(simp add: bi_unique_def)
Andreas@53927
   163
Andreas@53927
   164
lemma bi_uniqueDl: "\<lbrakk> bi_unique A; A x y; A z y \<rbrakk> \<Longrightarrow> x = z"
Andreas@53927
   165
by(simp add: bi_unique_def)
Andreas@53927
   166
Andreas@53927
   167
lemma right_uniqueI: "(\<And>x y z. \<lbrakk> A x y; A x z \<rbrakk> \<Longrightarrow> y = z) \<Longrightarrow> right_unique A"
Andreas@53927
   168
unfolding right_unique_def by blast
Andreas@53927
   169
Andreas@53927
   170
lemma right_uniqueD: "\<lbrakk> right_unique A; A x y; A x z \<rbrakk> \<Longrightarrow> y = z"
Andreas@53927
   171
unfolding right_unique_def by blast
Andreas@53927
   172
huffman@47325
   173
lemma right_total_alt_def:
huffman@47325
   174
  "right_total R \<longleftrightarrow> ((R ===> op \<longrightarrow>) ===> op \<longrightarrow>) All All"
huffman@47325
   175
  unfolding right_total_def fun_rel_def
huffman@47325
   176
  apply (rule iffI, fast)
huffman@47325
   177
  apply (rule allI)
huffman@47325
   178
  apply (drule_tac x="\<lambda>x. True" in spec)
huffman@47325
   179
  apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
huffman@47325
   180
  apply fast
huffman@47325
   181
  done
huffman@47325
   182
huffman@47325
   183
lemma right_unique_alt_def:
huffman@47325
   184
  "right_unique R \<longleftrightarrow> (R ===> R ===> op \<longrightarrow>) (op =) (op =)"
huffman@47325
   185
  unfolding right_unique_def fun_rel_def by auto
huffman@47325
   186
huffman@47325
   187
lemma bi_total_alt_def:
huffman@47325
   188
  "bi_total R \<longleftrightarrow> ((R ===> op =) ===> op =) All All"
huffman@47325
   189
  unfolding bi_total_def fun_rel_def
huffman@47325
   190
  apply (rule iffI, fast)
huffman@47325
   191
  apply safe
huffman@47325
   192
  apply (drule_tac x="\<lambda>x. \<exists>y. R x y" in spec)
huffman@47325
   193
  apply (drule_tac x="\<lambda>y. True" in spec)
huffman@47325
   194
  apply fast
huffman@47325
   195
  apply (drule_tac x="\<lambda>x. True" in spec)
huffman@47325
   196
  apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
huffman@47325
   197
  apply fast
huffman@47325
   198
  done
huffman@47325
   199
huffman@47325
   200
lemma bi_unique_alt_def:
huffman@47325
   201
  "bi_unique R \<longleftrightarrow> (R ===> R ===> op =) (op =) (op =)"
huffman@47325
   202
  unfolding bi_unique_def fun_rel_def by auto
huffman@47325
   203
Andreas@53944
   204
lemma bi_unique_conversep [simp]: "bi_unique R\<inverse>\<inverse> = bi_unique R"
Andreas@53944
   205
by(auto simp add: bi_unique_def)
Andreas@53944
   206
Andreas@53944
   207
lemma bi_total_conversep [simp]: "bi_total R\<inverse>\<inverse> = bi_total R"
Andreas@53944
   208
by(auto simp add: bi_total_def)
Andreas@53944
   209
huffman@47660
   210
text {* Properties are preserved by relation composition. *}
huffman@47660
   211
huffman@47660
   212
lemma OO_def: "R OO S = (\<lambda>x z. \<exists>y. R x y \<and> S y z)"
huffman@47660
   213
  by auto
huffman@47660
   214
huffman@47660
   215
lemma bi_total_OO: "\<lbrakk>bi_total A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A OO B)"
huffman@47660
   216
  unfolding bi_total_def OO_def by metis
huffman@47660
   217
huffman@47660
   218
lemma bi_unique_OO: "\<lbrakk>bi_unique A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A OO B)"
huffman@47660
   219
  unfolding bi_unique_def OO_def by metis
huffman@47660
   220
huffman@47660
   221
lemma right_total_OO:
huffman@47660
   222
  "\<lbrakk>right_total A; right_total B\<rbrakk> \<Longrightarrow> right_total (A OO B)"
huffman@47660
   223
  unfolding right_total_def OO_def by metis
huffman@47660
   224
huffman@47660
   225
lemma right_unique_OO:
huffman@47660
   226
  "\<lbrakk>right_unique A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A OO B)"
huffman@47660
   227
  unfolding right_unique_def OO_def by metis
huffman@47660
   228
huffman@47325
   229
huffman@47325
   230
subsection {* Properties of relators *}
huffman@47325
   231
huffman@47325
   232
lemma right_total_eq [transfer_rule]: "right_total (op =)"
huffman@47325
   233
  unfolding right_total_def by simp
huffman@47325
   234
huffman@47325
   235
lemma right_unique_eq [transfer_rule]: "right_unique (op =)"
huffman@47325
   236
  unfolding right_unique_def by simp
huffman@47325
   237
huffman@47325
   238
lemma bi_total_eq [transfer_rule]: "bi_total (op =)"
huffman@47325
   239
  unfolding bi_total_def by simp
huffman@47325
   240
huffman@47325
   241
lemma bi_unique_eq [transfer_rule]: "bi_unique (op =)"
huffman@47325
   242
  unfolding bi_unique_def by simp
huffman@47325
   243
huffman@47325
   244
lemma right_total_fun [transfer_rule]:
huffman@47325
   245
  "\<lbrakk>right_unique A; right_total B\<rbrakk> \<Longrightarrow> right_total (A ===> B)"
huffman@47325
   246
  unfolding right_total_def fun_rel_def
huffman@47325
   247
  apply (rule allI, rename_tac g)
huffman@47325
   248
  apply (rule_tac x="\<lambda>x. SOME z. B z (g (THE y. A x y))" in exI)
huffman@47325
   249
  apply clarify
huffman@47325
   250
  apply (subgoal_tac "(THE y. A x y) = y", simp)
huffman@47325
   251
  apply (rule someI_ex)
huffman@47325
   252
  apply (simp)
huffman@47325
   253
  apply (rule the_equality)
huffman@47325
   254
  apply assumption
huffman@47325
   255
  apply (simp add: right_unique_def)
huffman@47325
   256
  done
huffman@47325
   257
huffman@47325
   258
lemma right_unique_fun [transfer_rule]:
huffman@47325
   259
  "\<lbrakk>right_total A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A ===> B)"
huffman@47325
   260
  unfolding right_total_def right_unique_def fun_rel_def
huffman@47325
   261
  by (clarify, rule ext, fast)
huffman@47325
   262
huffman@47325
   263
lemma bi_total_fun [transfer_rule]:
huffman@47325
   264
  "\<lbrakk>bi_unique A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A ===> B)"
huffman@47325
   265
  unfolding bi_total_def fun_rel_def
huffman@47325
   266
  apply safe
huffman@47325
   267
  apply (rename_tac f)
huffman@47325
   268
  apply (rule_tac x="\<lambda>y. SOME z. B (f (THE x. A x y)) z" in exI)
huffman@47325
   269
  apply clarify
huffman@47325
   270
  apply (subgoal_tac "(THE x. A x y) = x", simp)
huffman@47325
   271
  apply (rule someI_ex)
huffman@47325
   272
  apply (simp)
huffman@47325
   273
  apply (rule the_equality)
huffman@47325
   274
  apply assumption
huffman@47325
   275
  apply (simp add: bi_unique_def)
huffman@47325
   276
  apply (rename_tac g)
huffman@47325
   277
  apply (rule_tac x="\<lambda>x. SOME z. B z (g (THE y. A x y))" in exI)
huffman@47325
   278
  apply clarify
huffman@47325
   279
  apply (subgoal_tac "(THE y. A x y) = y", simp)
huffman@47325
   280
  apply (rule someI_ex)
huffman@47325
   281
  apply (simp)
huffman@47325
   282
  apply (rule the_equality)
huffman@47325
   283
  apply assumption
huffman@47325
   284
  apply (simp add: bi_unique_def)
huffman@47325
   285
  done
huffman@47325
   286
huffman@47325
   287
lemma bi_unique_fun [transfer_rule]:
huffman@47325
   288
  "\<lbrakk>bi_total A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A ===> B)"
huffman@47325
   289
  unfolding bi_total_def bi_unique_def fun_rel_def fun_eq_iff
huffman@47325
   290
  by (safe, metis, fast)
huffman@47325
   291
huffman@47325
   292
huffman@47635
   293
subsection {* Transfer rules *}
huffman@47325
   294
huffman@47684
   295
text {* Transfer rules using implication instead of equality on booleans. *}
huffman@47684
   296
huffman@52354
   297
lemma transfer_forall_transfer [transfer_rule]:
huffman@52354
   298
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> op =) transfer_forall transfer_forall"
huffman@52354
   299
  "right_total A \<Longrightarrow> ((A ===> op =) ===> implies) transfer_forall transfer_forall"
huffman@52354
   300
  "right_total A \<Longrightarrow> ((A ===> implies) ===> implies) transfer_forall transfer_forall"
huffman@52354
   301
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> rev_implies) transfer_forall transfer_forall"
huffman@52354
   302
  "bi_total A \<Longrightarrow> ((A ===> rev_implies) ===> rev_implies) transfer_forall transfer_forall"
huffman@52354
   303
  unfolding transfer_forall_def rev_implies_def fun_rel_def right_total_def bi_total_def
huffman@52354
   304
  by metis+
huffman@52354
   305
huffman@52354
   306
lemma transfer_implies_transfer [transfer_rule]:
huffman@52354
   307
  "(op =        ===> op =        ===> op =       ) transfer_implies transfer_implies"
huffman@52354
   308
  "(rev_implies ===> implies     ===> implies    ) transfer_implies transfer_implies"
huffman@52354
   309
  "(rev_implies ===> op =        ===> implies    ) transfer_implies transfer_implies"
huffman@52354
   310
  "(op =        ===> implies     ===> implies    ) transfer_implies transfer_implies"
huffman@52354
   311
  "(op =        ===> op =        ===> implies    ) transfer_implies transfer_implies"
huffman@52354
   312
  "(implies     ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
huffman@52354
   313
  "(implies     ===> op =        ===> rev_implies) transfer_implies transfer_implies"
huffman@52354
   314
  "(op =        ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
huffman@52354
   315
  "(op =        ===> op =        ===> rev_implies) transfer_implies transfer_implies"
huffman@52354
   316
  unfolding transfer_implies_def rev_implies_def fun_rel_def by auto
huffman@52354
   317
huffman@47684
   318
lemma eq_imp_transfer [transfer_rule]:
huffman@47684
   319
  "right_unique A \<Longrightarrow> (A ===> A ===> op \<longrightarrow>) (op =) (op =)"
huffman@47684
   320
  unfolding right_unique_alt_def .
huffman@47684
   321
huffman@47636
   322
lemma eq_transfer [transfer_rule]:
huffman@47325
   323
  assumes "bi_unique A"
huffman@47325
   324
  shows "(A ===> A ===> op =) (op =) (op =)"
huffman@47325
   325
  using assms unfolding bi_unique_def fun_rel_def by auto
huffman@47325
   326
kuncar@51956
   327
lemma Domainp_iff: "Domainp T x \<longleftrightarrow> (\<exists>y. T x y)"
kuncar@51956
   328
  by auto
kuncar@51956
   329
kuncar@51956
   330
lemma right_total_Ex_transfer[transfer_rule]:
kuncar@51956
   331
  assumes "right_total A"
kuncar@51956
   332
  shows "((A ===> op=) ===> op=) (Bex (Collect (Domainp A))) Ex"
kuncar@51956
   333
using assms unfolding right_total_def Bex_def fun_rel_def Domainp_iff[abs_def]
kuncar@51956
   334
by blast
kuncar@51956
   335
kuncar@51956
   336
lemma right_total_All_transfer[transfer_rule]:
kuncar@51956
   337
  assumes "right_total A"
kuncar@51956
   338
  shows "((A ===> op =) ===> op =) (Ball (Collect (Domainp A))) All"
kuncar@51956
   339
using assms unfolding right_total_def Ball_def fun_rel_def Domainp_iff[abs_def]
kuncar@51956
   340
by blast
kuncar@51956
   341
huffman@47636
   342
lemma All_transfer [transfer_rule]:
huffman@47325
   343
  assumes "bi_total A"
huffman@47325
   344
  shows "((A ===> op =) ===> op =) All All"
huffman@47325
   345
  using assms unfolding bi_total_def fun_rel_def by fast
huffman@47325
   346
huffman@47636
   347
lemma Ex_transfer [transfer_rule]:
huffman@47325
   348
  assumes "bi_total A"
huffman@47325
   349
  shows "((A ===> op =) ===> op =) Ex Ex"
huffman@47325
   350
  using assms unfolding bi_total_def fun_rel_def by fast
huffman@47325
   351
huffman@47636
   352
lemma If_transfer [transfer_rule]: "(op = ===> A ===> A ===> A) If If"
huffman@47325
   353
  unfolding fun_rel_def by simp
huffman@47325
   354
huffman@47636
   355
lemma Let_transfer [transfer_rule]: "(A ===> (A ===> B) ===> B) Let Let"
huffman@47612
   356
  unfolding fun_rel_def by simp
huffman@47612
   357
huffman@47636
   358
lemma id_transfer [transfer_rule]: "(A ===> A) id id"
huffman@47625
   359
  unfolding fun_rel_def by simp
huffman@47625
   360
huffman@47636
   361
lemma comp_transfer [transfer_rule]:
huffman@47325
   362
  "((B ===> C) ===> (A ===> B) ===> (A ===> C)) (op \<circ>) (op \<circ>)"
huffman@47325
   363
  unfolding fun_rel_def by simp
huffman@47325
   364
huffman@47636
   365
lemma fun_upd_transfer [transfer_rule]:
huffman@47325
   366
  assumes [transfer_rule]: "bi_unique A"
huffman@47325
   367
  shows "((A ===> B) ===> A ===> B ===> A ===> B) fun_upd fun_upd"
huffman@47635
   368
  unfolding fun_upd_def [abs_def] by transfer_prover
huffman@47325
   369
huffman@47637
   370
lemma nat_case_transfer [transfer_rule]:
huffman@47637
   371
  "(A ===> (op = ===> A) ===> op = ===> A) nat_case nat_case"
huffman@47637
   372
  unfolding fun_rel_def by (simp split: nat.split)
huffman@47627
   373
huffman@47924
   374
lemma nat_rec_transfer [transfer_rule]:
huffman@47924
   375
  "(A ===> (op = ===> A ===> A) ===> op = ===> A) nat_rec nat_rec"
huffman@47924
   376
  unfolding fun_rel_def by (clarsimp, rename_tac n, induct_tac n, simp_all)
huffman@47924
   377
huffman@47924
   378
lemma funpow_transfer [transfer_rule]:
huffman@47924
   379
  "(op = ===> (A ===> A) ===> (A ===> A)) compow compow"
huffman@47924
   380
  unfolding funpow_def by transfer_prover
huffman@47924
   381
huffman@47627
   382
lemma Domainp_forall_transfer [transfer_rule]:
huffman@47627
   383
  assumes "right_total A"
huffman@47627
   384
  shows "((A ===> op =) ===> op =)
huffman@47627
   385
    (transfer_bforall (Domainp A)) transfer_forall"
huffman@47627
   386
  using assms unfolding right_total_def
huffman@47627
   387
  unfolding transfer_forall_def transfer_bforall_def fun_rel_def Domainp_iff
huffman@47627
   388
  by metis
huffman@47627
   389
huffman@47636
   390
lemma forall_transfer [transfer_rule]:
huffman@47627
   391
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> op =) transfer_forall transfer_forall"
huffman@47636
   392
  unfolding transfer_forall_def by (rule All_transfer)
huffman@47325
   393
huffman@47325
   394
end
kuncar@53011
   395
kuncar@53011
   396
end