src/HOL/Transfer.thy
author kuncar
Tue, 13 Aug 2013 15:59:22 +0200
changeset 53011 aeee0a4be6cf
parent 52358 f4c4bcb0d564
child 53927 abe2b313f0e5
permissions -rw-r--r--
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     1
(*  Title:      HOL/Transfer.thy
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman, TU Muenchen
51956
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
     3
    Author:     Ondrej Kuncar, TU Muenchen
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     4
*)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     5
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     6
header {* Generic theorem transfer using relations *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     7
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
     8
theory Transfer
51112
da97167e03f7 abandoned theory Plain
haftmann
parents: 49975
diff changeset
     9
imports Hilbert_Choice
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    10
begin
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    11
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    12
subsection {* Relator for function space *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    13
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    14
definition
53011
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    15
  fun_rel :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    16
where
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    17
  "fun_rel A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    18
53011
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    19
locale lifting_syntax
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    20
begin
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    21
  notation fun_rel (infixr "===>" 55)
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    22
  notation map_fun (infixr "--->" 55)
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    23
end
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    24
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    25
context
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    26
begin
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    27
interpretation lifting_syntax .
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
    28
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    29
lemma fun_relI [intro]:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    30
  assumes "\<And>x y. A x y \<Longrightarrow> B (f x) (g y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    31
  shows "(A ===> B) f g"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    32
  using assms by (simp add: fun_rel_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    33
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    34
lemma fun_relD:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    35
  assumes "(A ===> B) f g" and "A x y"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    36
  shows "B (f x) (g y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    37
  using assms by (simp add: fun_rel_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    38
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47924
diff changeset
    39
lemma fun_relD2:
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47924
diff changeset
    40
  assumes "(A ===> B) f g" and "A x x"
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47924
diff changeset
    41
  shows "B (f x) (g x)"
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47924
diff changeset
    42
  using assms unfolding fun_rel_def by auto
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47924
diff changeset
    43
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    44
lemma fun_relE:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    45
  assumes "(A ===> B) f g" and "A x y"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    46
  obtains "B (f x) (g y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    47
  using assms by (simp add: fun_rel_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    48
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    49
lemma fun_rel_eq:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    50
  shows "((op =) ===> (op =)) = (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    51
  by (auto simp add: fun_eq_iff elim: fun_relE)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    52
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    53
lemma fun_rel_eq_rel:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    54
  shows "((op =) ===> R) = (\<lambda>f g. \<forall>x. R (f x) (g x))"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    55
  by (simp add: fun_rel_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    56
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    57
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    58
subsection {* Transfer method *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    59
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
    60
text {* Explicit tag for relation membership allows for
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
    61
  backward proof methods. *}
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    62
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    63
definition Rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    64
  where "Rel r \<equiv> r"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    65
49975
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
    66
text {* Handling of equality relations *}
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
    67
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
    68
definition is_equality :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
    69
  where "is_equality R \<longleftrightarrow> R = (op =)"
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
    70
51437
8739f8abbecb fixing transfer tactic - unfold fully identity relation by using relator_eq
kuncar
parents: 51112
diff changeset
    71
lemma is_equality_eq: "is_equality (op =)"
8739f8abbecb fixing transfer tactic - unfold fully identity relation by using relator_eq
kuncar
parents: 51112
diff changeset
    72
  unfolding is_equality_def by simp
8739f8abbecb fixing transfer tactic - unfold fully identity relation by using relator_eq
kuncar
parents: 51112
diff changeset
    73
52354
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
    74
text {* Reverse implication for monotonicity rules *}
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
    75
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
    76
definition rev_implies where
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
    77
  "rev_implies x y \<longleftrightarrow> (y \<longrightarrow> x)"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
    78
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    79
text {* Handling of meta-logic connectives *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    80
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    81
definition transfer_forall where
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    82
  "transfer_forall \<equiv> All"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    83
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    84
definition transfer_implies where
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    85
  "transfer_implies \<equiv> op \<longrightarrow>"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    86
47355
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    87
definition transfer_bforall :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    88
  where "transfer_bforall \<equiv> (\<lambda>P Q. \<forall>x. P x \<longrightarrow> Q x)"
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    89
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    90
lemma transfer_forall_eq: "(\<And>x. P x) \<equiv> Trueprop (transfer_forall (\<lambda>x. P x))"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    91
  unfolding atomize_all transfer_forall_def ..
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    92
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    93
lemma transfer_implies_eq: "(A \<Longrightarrow> B) \<equiv> Trueprop (transfer_implies A B)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    94
  unfolding atomize_imp transfer_implies_def ..
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
    95
47355
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    96
lemma transfer_bforall_unfold:
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    97
  "Trueprop (transfer_bforall P (\<lambda>x. Q x)) \<equiv> (\<And>x. P x \<Longrightarrow> Q x)"
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    98
  unfolding transfer_bforall_def atomize_imp atomize_all ..
3d9d98e0f1a4 add bounded quantifier constant transfer_bforall, whose definition is unfolded after transfer
huffman
parents: 47325
diff changeset
    99
47658
7631f6f7873d enable variant of transfer method that proves an implication instead of an equivalence
huffman
parents: 47637
diff changeset
   100
lemma transfer_start: "\<lbrakk>P; Rel (op =) P Q\<rbrakk> \<Longrightarrow> Q"
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   101
  unfolding Rel_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   102
47658
7631f6f7873d enable variant of transfer method that proves an implication instead of an equivalence
huffman
parents: 47637
diff changeset
   103
lemma transfer_start': "\<lbrakk>P; Rel (op \<longrightarrow>) P Q\<rbrakk> \<Longrightarrow> Q"
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   104
  unfolding Rel_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   105
47635
ebb79474262c rename 'correspondence' method to 'transfer_prover'
huffman
parents: 47627
diff changeset
   106
lemma transfer_prover_start: "\<lbrakk>x = x'; Rel R x' y\<rbrakk> \<Longrightarrow> Rel R x y"
47618
1568dadd598a make correspondence tactic more robust by replacing lhs with schematic variable before applying intro rules
huffman
parents: 47612
diff changeset
   107
  by simp
1568dadd598a make correspondence tactic more robust by replacing lhs with schematic variable before applying intro rules
huffman
parents: 47612
diff changeset
   108
52358
f4c4bcb0d564 implement 'untransferred' attribute, which is like 'transferred' but works in the opposite direction
huffman
parents: 52354
diff changeset
   109
lemma untransfer_start: "\<lbrakk>Q; Rel (op =) P Q\<rbrakk> \<Longrightarrow> P"
f4c4bcb0d564 implement 'untransferred' attribute, which is like 'transferred' but works in the opposite direction
huffman
parents: 52354
diff changeset
   110
  unfolding Rel_def by simp
f4c4bcb0d564 implement 'untransferred' attribute, which is like 'transferred' but works in the opposite direction
huffman
parents: 52354
diff changeset
   111
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   112
lemma Rel_eq_refl: "Rel (op =) x x"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   113
  unfolding Rel_def ..
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   114
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   115
lemma Rel_app:
47523
1bf0e92c1ca0 make transfer method more deterministic by using SOLVED' on some subgoals
huffman
parents: 47503
diff changeset
   116
  assumes "Rel (A ===> B) f g" and "Rel A x y"
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   117
  shows "Rel B (f x) (g y)"
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   118
  using assms unfolding Rel_def fun_rel_def by fast
47523
1bf0e92c1ca0 make transfer method more deterministic by using SOLVED' on some subgoals
huffman
parents: 47503
diff changeset
   119
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   120
lemma Rel_abs:
47523
1bf0e92c1ca0 make transfer method more deterministic by using SOLVED' on some subgoals
huffman
parents: 47503
diff changeset
   121
  assumes "\<And>x y. Rel A x y \<Longrightarrow> Rel B (f x) (g y)"
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   122
  shows "Rel (A ===> B) (\<lambda>x. f x) (\<lambda>y. g y)"
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   123
  using assms unfolding Rel_def fun_rel_def by fast
47523
1bf0e92c1ca0 make transfer method more deterministic by using SOLVED' on some subgoals
huffman
parents: 47503
diff changeset
   124
53011
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   125
end
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   126
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 47937
diff changeset
   127
ML_file "Tools/transfer.ML"
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   128
setup Transfer.setup
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   129
49975
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
   130
declare refl [transfer_rule]
faf4afed009f transfer package: more flexible handling of equality relations using is_equality predicate
huffman
parents: 48891
diff changeset
   131
47503
cb44d09d9d22 add theory data for relator identity rules;
huffman
parents: 47355
diff changeset
   132
declare fun_rel_eq [relator_eq]
cb44d09d9d22 add theory data for relator identity rules;
huffman
parents: 47355
diff changeset
   133
47789
71a526ee569a implement transfer tactic with more scalable forward proof methods
huffman
parents: 47684
diff changeset
   134
hide_const (open) Rel
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   135
53011
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   136
context
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   137
begin
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   138
interpretation lifting_syntax .
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   139
51956
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   140
text {* Handling of domains *}
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   141
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   142
lemma Domaimp_refl[transfer_domain_rule]:
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   143
  "Domainp T = Domainp T" ..
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   144
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   145
subsection {* Predicates on relations, i.e. ``class constraints'' *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   146
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   147
definition right_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   148
  where "right_total R \<longleftrightarrow> (\<forall>y. \<exists>x. R x y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   149
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   150
definition right_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   151
  where "right_unique R \<longleftrightarrow> (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   152
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   153
definition bi_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   154
  where "bi_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y) \<and> (\<forall>y. \<exists>x. R x y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   155
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   156
definition bi_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   157
  where "bi_unique R \<longleftrightarrow>
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   158
    (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z) \<and>
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   159
    (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   160
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   161
lemma right_total_alt_def:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   162
  "right_total R \<longleftrightarrow> ((R ===> op \<longrightarrow>) ===> op \<longrightarrow>) All All"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   163
  unfolding right_total_def fun_rel_def
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   164
  apply (rule iffI, fast)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   165
  apply (rule allI)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   166
  apply (drule_tac x="\<lambda>x. True" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   167
  apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   168
  apply fast
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   169
  done
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   170
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   171
lemma right_unique_alt_def:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   172
  "right_unique R \<longleftrightarrow> (R ===> R ===> op \<longrightarrow>) (op =) (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   173
  unfolding right_unique_def fun_rel_def by auto
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   174
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   175
lemma bi_total_alt_def:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   176
  "bi_total R \<longleftrightarrow> ((R ===> op =) ===> op =) All All"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   177
  unfolding bi_total_def fun_rel_def
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   178
  apply (rule iffI, fast)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   179
  apply safe
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   180
  apply (drule_tac x="\<lambda>x. \<exists>y. R x y" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   181
  apply (drule_tac x="\<lambda>y. True" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   182
  apply fast
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   183
  apply (drule_tac x="\<lambda>x. True" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   184
  apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   185
  apply fast
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   186
  done
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   187
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   188
lemma bi_unique_alt_def:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   189
  "bi_unique R \<longleftrightarrow> (R ===> R ===> op =) (op =) (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   190
  unfolding bi_unique_def fun_rel_def by auto
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   191
47660
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   192
text {* Properties are preserved by relation composition. *}
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   193
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   194
lemma OO_def: "R OO S = (\<lambda>x z. \<exists>y. R x y \<and> S y z)"
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   195
  by auto
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   196
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   197
lemma bi_total_OO: "\<lbrakk>bi_total A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A OO B)"
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   198
  unfolding bi_total_def OO_def by metis
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   199
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   200
lemma bi_unique_OO: "\<lbrakk>bi_unique A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A OO B)"
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   201
  unfolding bi_unique_def OO_def by metis
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   202
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   203
lemma right_total_OO:
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   204
  "\<lbrakk>right_total A; right_total B\<rbrakk> \<Longrightarrow> right_total (A OO B)"
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   205
  unfolding right_total_def OO_def by metis
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   206
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   207
lemma right_unique_OO:
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   208
  "\<lbrakk>right_unique A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A OO B)"
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   209
  unfolding right_unique_def OO_def by metis
7a5c681c0265 new example theory for quotient/transfer
huffman
parents: 47658
diff changeset
   210
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   211
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   212
subsection {* Properties of relators *}
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   213
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   214
lemma right_total_eq [transfer_rule]: "right_total (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   215
  unfolding right_total_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   216
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   217
lemma right_unique_eq [transfer_rule]: "right_unique (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   218
  unfolding right_unique_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   219
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   220
lemma bi_total_eq [transfer_rule]: "bi_total (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   221
  unfolding bi_total_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   222
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   223
lemma bi_unique_eq [transfer_rule]: "bi_unique (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   224
  unfolding bi_unique_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   225
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   226
lemma right_total_fun [transfer_rule]:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   227
  "\<lbrakk>right_unique A; right_total B\<rbrakk> \<Longrightarrow> right_total (A ===> B)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   228
  unfolding right_total_def fun_rel_def
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   229
  apply (rule allI, rename_tac g)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   230
  apply (rule_tac x="\<lambda>x. SOME z. B z (g (THE y. A x y))" in exI)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   231
  apply clarify
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   232
  apply (subgoal_tac "(THE y. A x y) = y", simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   233
  apply (rule someI_ex)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   234
  apply (simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   235
  apply (rule the_equality)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   236
  apply assumption
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   237
  apply (simp add: right_unique_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   238
  done
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   239
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   240
lemma right_unique_fun [transfer_rule]:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   241
  "\<lbrakk>right_total A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A ===> B)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   242
  unfolding right_total_def right_unique_def fun_rel_def
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   243
  by (clarify, rule ext, fast)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   244
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   245
lemma bi_total_fun [transfer_rule]:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   246
  "\<lbrakk>bi_unique A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A ===> B)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   247
  unfolding bi_total_def fun_rel_def
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   248
  apply safe
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   249
  apply (rename_tac f)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   250
  apply (rule_tac x="\<lambda>y. SOME z. B (f (THE x. A x y)) z" in exI)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   251
  apply clarify
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   252
  apply (subgoal_tac "(THE x. A x y) = x", simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   253
  apply (rule someI_ex)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   254
  apply (simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   255
  apply (rule the_equality)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   256
  apply assumption
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   257
  apply (simp add: bi_unique_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   258
  apply (rename_tac g)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   259
  apply (rule_tac x="\<lambda>x. SOME z. B z (g (THE y. A x y))" in exI)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   260
  apply clarify
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   261
  apply (subgoal_tac "(THE y. A x y) = y", simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   262
  apply (rule someI_ex)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   263
  apply (simp)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   264
  apply (rule the_equality)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   265
  apply assumption
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   266
  apply (simp add: bi_unique_def)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   267
  done
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   268
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   269
lemma bi_unique_fun [transfer_rule]:
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   270
  "\<lbrakk>bi_total A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A ===> B)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   271
  unfolding bi_total_def bi_unique_def fun_rel_def fun_eq_iff
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   272
  by (safe, metis, fast)
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   273
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   274
47635
ebb79474262c rename 'correspondence' method to 'transfer_prover'
huffman
parents: 47627
diff changeset
   275
subsection {* Transfer rules *}
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   276
47684
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   277
text {* Transfer rules using implication instead of equality on booleans. *}
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   278
52354
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   279
lemma transfer_forall_transfer [transfer_rule]:
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   280
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> op =) transfer_forall transfer_forall"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   281
  "right_total A \<Longrightarrow> ((A ===> op =) ===> implies) transfer_forall transfer_forall"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   282
  "right_total A \<Longrightarrow> ((A ===> implies) ===> implies) transfer_forall transfer_forall"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   283
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> rev_implies) transfer_forall transfer_forall"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   284
  "bi_total A \<Longrightarrow> ((A ===> rev_implies) ===> rev_implies) transfer_forall transfer_forall"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   285
  unfolding transfer_forall_def rev_implies_def fun_rel_def right_total_def bi_total_def
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   286
  by metis+
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   287
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   288
lemma transfer_implies_transfer [transfer_rule]:
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   289
  "(op =        ===> op =        ===> op =       ) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   290
  "(rev_implies ===> implies     ===> implies    ) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   291
  "(rev_implies ===> op =        ===> implies    ) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   292
  "(op =        ===> implies     ===> implies    ) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   293
  "(op =        ===> op =        ===> implies    ) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   294
  "(implies     ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   295
  "(implies     ===> op =        ===> rev_implies) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   296
  "(op =        ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   297
  "(op =        ===> op =        ===> rev_implies) transfer_implies transfer_implies"
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   298
  unfolding transfer_implies_def rev_implies_def fun_rel_def by auto
acb4f932dd24 implement 'transferred' attribute for transfer package, with support for monotonicity of !!/==>
huffman
parents: 51956
diff changeset
   299
47684
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   300
lemma eq_imp_transfer [transfer_rule]:
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   301
  "right_unique A \<Longrightarrow> (A ===> A ===> op \<longrightarrow>) (op =) (op =)"
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   302
  unfolding right_unique_alt_def .
ead185e60b8c tuned precedence order of transfer rules
huffman
parents: 47660
diff changeset
   303
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   304
lemma eq_transfer [transfer_rule]:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   305
  assumes "bi_unique A"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   306
  shows "(A ===> A ===> op =) (op =) (op =)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   307
  using assms unfolding bi_unique_def fun_rel_def by auto
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   308
51956
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   309
lemma Domainp_iff: "Domainp T x \<longleftrightarrow> (\<exists>y. T x y)"
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   310
  by auto
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   311
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   312
lemma right_total_Ex_transfer[transfer_rule]:
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   313
  assumes "right_total A"
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   314
  shows "((A ===> op=) ===> op=) (Bex (Collect (Domainp A))) Ex"
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   315
using assms unfolding right_total_def Bex_def fun_rel_def Domainp_iff[abs_def]
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   316
by blast
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   317
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   318
lemma right_total_All_transfer[transfer_rule]:
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   319
  assumes "right_total A"
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   320
  shows "((A ===> op =) ===> op =) (Ball (Collect (Domainp A))) All"
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   321
using assms unfolding right_total_def Ball_def fun_rel_def Domainp_iff[abs_def]
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   322
by blast
a4d81cdebf8b better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents: 51955
diff changeset
   323
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   324
lemma All_transfer [transfer_rule]:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   325
  assumes "bi_total A"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   326
  shows "((A ===> op =) ===> op =) All All"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   327
  using assms unfolding bi_total_def fun_rel_def by fast
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   328
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   329
lemma Ex_transfer [transfer_rule]:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   330
  assumes "bi_total A"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   331
  shows "((A ===> op =) ===> op =) Ex Ex"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   332
  using assms unfolding bi_total_def fun_rel_def by fast
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   333
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   334
lemma If_transfer [transfer_rule]: "(op = ===> A ===> A ===> A) If If"
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   335
  unfolding fun_rel_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   336
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   337
lemma Let_transfer [transfer_rule]: "(A ===> (A ===> B) ===> B) Let Let"
47612
bc9c7b5c26fd add transfer rule for Let
huffman
parents: 47523
diff changeset
   338
  unfolding fun_rel_def by simp
bc9c7b5c26fd add transfer rule for Let
huffman
parents: 47523
diff changeset
   339
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   340
lemma id_transfer [transfer_rule]: "(A ===> A) id id"
47625
10cfaf771687 add transfer rule for 'id'
huffman
parents: 47618
diff changeset
   341
  unfolding fun_rel_def by simp
10cfaf771687 add transfer rule for 'id'
huffman
parents: 47618
diff changeset
   342
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   343
lemma comp_transfer [transfer_rule]:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   344
  "((B ===> C) ===> (A ===> B) ===> (A ===> C)) (op \<circ>) (op \<circ>)"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   345
  unfolding fun_rel_def by simp
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   346
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   347
lemma fun_upd_transfer [transfer_rule]:
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   348
  assumes [transfer_rule]: "bi_unique A"
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   349
  shows "((A ===> B) ===> A ===> B ===> A ===> B) fun_upd fun_upd"
47635
ebb79474262c rename 'correspondence' method to 'transfer_prover'
huffman
parents: 47627
diff changeset
   350
  unfolding fun_upd_def [abs_def] by transfer_prover
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   351
47637
7a34395441ff add transfer rule for nat_case
huffman
parents: 47636
diff changeset
   352
lemma nat_case_transfer [transfer_rule]:
7a34395441ff add transfer rule for nat_case
huffman
parents: 47636
diff changeset
   353
  "(A ===> (op = ===> A) ===> op = ===> A) nat_case nat_case"
7a34395441ff add transfer rule for nat_case
huffman
parents: 47636
diff changeset
   354
  unfolding fun_rel_def by (simp split: nat.split)
47627
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   355
47924
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   356
lemma nat_rec_transfer [transfer_rule]:
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   357
  "(A ===> (op = ===> A ===> A) ===> op = ===> A) nat_rec nat_rec"
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   358
  unfolding fun_rel_def by (clarsimp, rename_tac n, induct_tac n, simp_all)
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   359
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   360
lemma funpow_transfer [transfer_rule]:
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   361
  "(op = ===> (A ===> A) ===> (A ===> A)) compow compow"
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   362
  unfolding funpow_def by transfer_prover
4e951258204b add transfer rules for nat_rec and funpow
huffman
parents: 47789
diff changeset
   363
47627
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   364
lemma Domainp_forall_transfer [transfer_rule]:
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   365
  assumes "right_total A"
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   366
  shows "((A ===> op =) ===> op =)
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   367
    (transfer_bforall (Domainp A)) transfer_forall"
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   368
  using assms unfolding right_total_def
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   369
  unfolding transfer_forall_def transfer_bforall_def fun_rel_def Domainp_iff
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   370
  by metis
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   371
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   372
lemma forall_transfer [transfer_rule]:
47627
2b1d3eda59eb add secondary transfer rule for universal quantifiers on non-bi-total relations
huffman
parents: 47625
diff changeset
   373
  "bi_total A \<Longrightarrow> ((A ===> op =) ===> op =) transfer_forall transfer_forall"
47636
b786388b4b3a uniform naming scheme for transfer rules
huffman
parents: 47635
diff changeset
   374
  unfolding transfer_forall_def by (rule All_transfer)
47325
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   375
ec6187036495 new transfer proof method
huffman
parents:
diff changeset
   376
end
53011
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   377
aeee0a4be6cf introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents: 52358
diff changeset
   378
end