1 (* Title: HOL/Transfer.thy
2 Author: Brian Huffman, TU Muenchen
3 Author: Ondrej Kuncar, TU Muenchen
6 header {* Generic theorem transfer using relations *}
9 imports Hilbert_Choice Basic_BNFs BNF_FP_Base Metis Option
12 (* We include Option here altough it's not needed here.
13 By doing this, we avoid a diamond problem for BNF and
14 FP sugar interpretation defined in this file. *)
16 subsection {* Relator for function space *}
20 notation rel_fun (infixr "===>" 55)
21 notation map_fun (infixr "--->" 55)
26 interpretation lifting_syntax .
29 assumes "rel_fun A B f g" and "A x x"
31 using assms by (rule rel_funD)
34 assumes "rel_fun A B f g" and "A x y"
35 obtains "B (f x) (g y)"
36 using assms by (simp add: rel_fun_def)
38 lemmas rel_fun_eq = fun.rel_eq
41 shows "rel_fun (op =) R = (\<lambda>f g. \<forall>x. R (f x) (g x))"
42 by (simp add: rel_fun_def)
45 subsection {* Transfer method *}
47 text {* Explicit tag for relation membership allows for
48 backward proof methods. *}
50 definition Rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
51 where "Rel r \<equiv> r"
53 text {* Handling of equality relations *}
55 definition is_equality :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
56 where "is_equality R \<longleftrightarrow> R = (op =)"
58 lemma is_equality_eq: "is_equality (op =)"
59 unfolding is_equality_def by simp
61 text {* Reverse implication for monotonicity rules *}
63 definition rev_implies where
64 "rev_implies x y \<longleftrightarrow> (y \<longrightarrow> x)"
66 text {* Handling of meta-logic connectives *}
68 definition transfer_forall where
69 "transfer_forall \<equiv> All"
71 definition transfer_implies where
72 "transfer_implies \<equiv> op \<longrightarrow>"
74 definition transfer_bforall :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
75 where "transfer_bforall \<equiv> (\<lambda>P Q. \<forall>x. P x \<longrightarrow> Q x)"
77 lemma transfer_forall_eq: "(\<And>x. P x) \<equiv> Trueprop (transfer_forall (\<lambda>x. P x))"
78 unfolding atomize_all transfer_forall_def ..
80 lemma transfer_implies_eq: "(A \<Longrightarrow> B) \<equiv> Trueprop (transfer_implies A B)"
81 unfolding atomize_imp transfer_implies_def ..
83 lemma transfer_bforall_unfold:
84 "Trueprop (transfer_bforall P (\<lambda>x. Q x)) \<equiv> (\<And>x. P x \<Longrightarrow> Q x)"
85 unfolding transfer_bforall_def atomize_imp atomize_all ..
87 lemma transfer_start: "\<lbrakk>P; Rel (op =) P Q\<rbrakk> \<Longrightarrow> Q"
88 unfolding Rel_def by simp
90 lemma transfer_start': "\<lbrakk>P; Rel (op \<longrightarrow>) P Q\<rbrakk> \<Longrightarrow> Q"
91 unfolding Rel_def by simp
93 lemma transfer_prover_start: "\<lbrakk>x = x'; Rel R x' y\<rbrakk> \<Longrightarrow> Rel R x y"
96 lemma untransfer_start: "\<lbrakk>Q; Rel (op =) P Q\<rbrakk> \<Longrightarrow> P"
97 unfolding Rel_def by simp
99 lemma Rel_eq_refl: "Rel (op =) x x"
103 assumes "Rel (A ===> B) f g" and "Rel A x y"
104 shows "Rel B (f x) (g y)"
105 using assms unfolding Rel_def rel_fun_def by fast
108 assumes "\<And>x y. Rel A x y \<Longrightarrow> Rel B (f x) (g y)"
109 shows "Rel (A ===> B) (\<lambda>x. f x) (\<lambda>y. g y)"
110 using assms unfolding Rel_def rel_fun_def by fast
112 subsection {* Predicates on relations, i.e. ``class constraints'' *}
114 definition left_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
115 where "left_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y)"
117 definition left_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
118 where "left_unique R \<longleftrightarrow> (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y)"
120 definition right_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
121 where "right_total R \<longleftrightarrow> (\<forall>y. \<exists>x. R x y)"
123 definition right_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
124 where "right_unique R \<longleftrightarrow> (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z)"
126 definition bi_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
127 where "bi_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y) \<and> (\<forall>y. \<exists>x. R x y)"
129 definition bi_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
130 where "bi_unique R \<longleftrightarrow>
131 (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z) \<and>
132 (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y)"
134 lemma left_uniqueI: "(\<And>x y z. \<lbrakk> A x z; A y z \<rbrakk> \<Longrightarrow> x = y) \<Longrightarrow> left_unique A"
135 unfolding left_unique_def by blast
137 lemma left_uniqueD: "\<lbrakk> left_unique A; A x z; A y z \<rbrakk> \<Longrightarrow> x = y"
138 unfolding left_unique_def by blast
141 "(\<And>x. \<exists>y. R x y) \<Longrightarrow> left_total R"
142 unfolding left_total_def by blast
145 assumes "left_total R"
146 obtains "(\<And>x. \<exists>y. R x y)"
147 using assms unfolding left_total_def by blast
149 lemma bi_uniqueDr: "\<lbrakk> bi_unique A; A x y; A x z \<rbrakk> \<Longrightarrow> y = z"
150 by(simp add: bi_unique_def)
152 lemma bi_uniqueDl: "\<lbrakk> bi_unique A; A x y; A z y \<rbrakk> \<Longrightarrow> x = z"
153 by(simp add: bi_unique_def)
155 lemma right_uniqueI: "(\<And>x y z. \<lbrakk> A x y; A x z \<rbrakk> \<Longrightarrow> y = z) \<Longrightarrow> right_unique A"
156 unfolding right_unique_def by fast
158 lemma right_uniqueD: "\<lbrakk> right_unique A; A x y; A x z \<rbrakk> \<Longrightarrow> y = z"
159 unfolding right_unique_def by fast
161 lemma right_total_alt_def2:
162 "right_total R \<longleftrightarrow> ((R ===> op \<longrightarrow>) ===> op \<longrightarrow>) All All"
163 unfolding right_total_def rel_fun_def
164 apply (rule iffI, fast)
166 apply (drule_tac x="\<lambda>x. True" in spec)
167 apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
171 lemma right_unique_alt_def2:
172 "right_unique R \<longleftrightarrow> (R ===> R ===> op \<longrightarrow>) (op =) (op =)"
173 unfolding right_unique_def rel_fun_def by auto
175 lemma bi_total_alt_def2:
176 "bi_total R \<longleftrightarrow> ((R ===> op =) ===> op =) All All"
177 unfolding bi_total_def rel_fun_def
178 apply (rule iffI, fast)
180 apply (drule_tac x="\<lambda>x. \<exists>y. R x y" in spec)
181 apply (drule_tac x="\<lambda>y. True" in spec)
183 apply (drule_tac x="\<lambda>x. True" in spec)
184 apply (drule_tac x="\<lambda>y. \<exists>x. R x y" in spec)
188 lemma bi_unique_alt_def2:
189 "bi_unique R \<longleftrightarrow> (R ===> R ===> op =) (op =) (op =)"
190 unfolding bi_unique_def rel_fun_def by auto
193 shows left_unique_conversep: "left_unique A\<inverse>\<inverse> \<longleftrightarrow> right_unique A"
194 and right_unique_conversep: "right_unique A\<inverse>\<inverse> \<longleftrightarrow> left_unique A"
195 by(auto simp add: left_unique_def right_unique_def)
198 shows left_total_conversep: "left_total A\<inverse>\<inverse> \<longleftrightarrow> right_total A"
199 and right_total_conversep: "right_total A\<inverse>\<inverse> \<longleftrightarrow> left_total A"
200 by(simp_all add: left_total_def right_total_def)
202 lemma bi_unique_conversep [simp]: "bi_unique R\<inverse>\<inverse> = bi_unique R"
203 by(auto simp add: bi_unique_def)
205 lemma bi_total_conversep [simp]: "bi_total R\<inverse>\<inverse> = bi_total R"
206 by(auto simp add: bi_total_def)
208 lemma right_unique_alt_def: "right_unique R = (conversep R OO R \<le> op=)" unfolding right_unique_def by blast
209 lemma left_unique_alt_def: "left_unique R = (R OO (conversep R) \<le> op=)" unfolding left_unique_def by blast
211 lemma right_total_alt_def: "right_total R = (conversep R OO R \<ge> op=)" unfolding right_total_def by blast
212 lemma left_total_alt_def: "left_total R = (R OO conversep R \<ge> op=)" unfolding left_total_def by blast
214 lemma bi_total_alt_def: "bi_total A = (left_total A \<and> right_total A)"
215 unfolding left_total_def right_total_def bi_total_def by blast
217 lemma bi_unique_alt_def: "bi_unique A = (left_unique A \<and> right_unique A)"
218 unfolding left_unique_def right_unique_def bi_unique_def by blast
220 lemma bi_totalI: "left_total R \<Longrightarrow> right_total R \<Longrightarrow> bi_total R"
221 unfolding bi_total_alt_def ..
223 lemma bi_uniqueI: "left_unique R \<Longrightarrow> right_unique R \<Longrightarrow> bi_unique R"
224 unfolding bi_unique_alt_def ..
228 subsection {* Equality restricted by a predicate *}
230 definition eq_onp :: "('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"
231 where "eq_onp R = (\<lambda>x y. R x \<and> x = y)"
233 lemma eq_onp_Grp: "eq_onp P = BNF_Util.Grp (Collect P) id"
234 unfolding eq_onp_def Grp_def by auto
237 assumes "eq_onp P x y"
239 using assms by (simp add: eq_onp_def)
241 lemma eq_onp_same_args:
242 shows "eq_onp P x x = P x"
243 using assms by (auto simp add: eq_onp_def)
245 lemma Ball_Collect: "Ball A P = (A \<subseteq> (Collect P))"
246 by (metis mem_Collect_eq subset_eq)
248 ML_file "Tools/Transfer/transfer.ML"
250 declare refl [transfer_rule]
252 ML_file "Tools/Transfer/transfer_bnf.ML"
254 declare pred_fun_def [simp]
255 declare rel_fun_eq [relator_eq]
257 hide_const (open) Rel
261 interpretation lifting_syntax .
263 text {* Handling of domains *}
265 lemma Domainp_iff: "Domainp T x \<longleftrightarrow> (\<exists>y. T x y)"
268 lemma Domaimp_refl[transfer_domain_rule]:
269 "Domainp T = Domainp T" ..
271 lemma Domainp_prod_fun_eq[relator_domain]:
272 "Domainp (op= ===> T) = (\<lambda>f. \<forall>x. (Domainp T) (f x))"
273 by (auto intro: choice simp: Domainp_iff rel_fun_def fun_eq_iff)
275 text {* Properties are preserved by relation composition. *}
277 lemma OO_def: "R OO S = (\<lambda>x z. \<exists>y. R x y \<and> S y z)"
280 lemma bi_total_OO: "\<lbrakk>bi_total A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A OO B)"
281 unfolding bi_total_def OO_def by fast
283 lemma bi_unique_OO: "\<lbrakk>bi_unique A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A OO B)"
284 unfolding bi_unique_def OO_def by blast
286 lemma right_total_OO:
287 "\<lbrakk>right_total A; right_total B\<rbrakk> \<Longrightarrow> right_total (A OO B)"
288 unfolding right_total_def OO_def by fast
290 lemma right_unique_OO:
291 "\<lbrakk>right_unique A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A OO B)"
292 unfolding right_unique_def OO_def by fast
294 lemma left_total_OO: "left_total R \<Longrightarrow> left_total S \<Longrightarrow> left_total (R OO S)"
295 unfolding left_total_def OO_def by fast
297 lemma left_unique_OO: "left_unique R \<Longrightarrow> left_unique S \<Longrightarrow> left_unique (R OO S)"
298 unfolding left_unique_def OO_def by blast
301 subsection {* Properties of relators *}
303 lemma left_total_eq[transfer_rule]: "left_total op="
304 unfolding left_total_def by blast
306 lemma left_unique_eq[transfer_rule]: "left_unique op="
307 unfolding left_unique_def by blast
309 lemma right_total_eq [transfer_rule]: "right_total op="
310 unfolding right_total_def by simp
312 lemma right_unique_eq [transfer_rule]: "right_unique op="
313 unfolding right_unique_def by simp
315 lemma bi_total_eq[transfer_rule]: "bi_total (op =)"
316 unfolding bi_total_def by simp
318 lemma bi_unique_eq[transfer_rule]: "bi_unique (op =)"
319 unfolding bi_unique_def by simp
321 lemma left_total_fun[transfer_rule]:
322 "\<lbrakk>left_unique A; left_total B\<rbrakk> \<Longrightarrow> left_total (A ===> B)"
323 unfolding left_total_def rel_fun_def
324 apply (rule allI, rename_tac f)
325 apply (rule_tac x="\<lambda>y. SOME z. B (f (THE x. A x y)) z" in exI)
327 apply (subgoal_tac "(THE x. A x y) = x", simp)
328 apply (rule someI_ex)
330 apply (rule the_equality)
332 apply (simp add: left_unique_def)
335 lemma left_unique_fun[transfer_rule]:
336 "\<lbrakk>left_total A; left_unique B\<rbrakk> \<Longrightarrow> left_unique (A ===> B)"
337 unfolding left_total_def left_unique_def rel_fun_def
338 by (clarify, rule ext, fast)
340 lemma right_total_fun [transfer_rule]:
341 "\<lbrakk>right_unique A; right_total B\<rbrakk> \<Longrightarrow> right_total (A ===> B)"
342 unfolding right_total_def rel_fun_def
343 apply (rule allI, rename_tac g)
344 apply (rule_tac x="\<lambda>x. SOME z. B z (g (THE y. A x y))" in exI)
346 apply (subgoal_tac "(THE y. A x y) = y", simp)
347 apply (rule someI_ex)
349 apply (rule the_equality)
351 apply (simp add: right_unique_def)
354 lemma right_unique_fun [transfer_rule]:
355 "\<lbrakk>right_total A; right_unique B\<rbrakk> \<Longrightarrow> right_unique (A ===> B)"
356 unfolding right_total_def right_unique_def rel_fun_def
357 by (clarify, rule ext, fast)
359 lemma bi_total_fun[transfer_rule]:
360 "\<lbrakk>bi_unique A; bi_total B\<rbrakk> \<Longrightarrow> bi_total (A ===> B)"
361 unfolding bi_unique_alt_def bi_total_alt_def
362 by (blast intro: right_total_fun left_total_fun)
364 lemma bi_unique_fun[transfer_rule]:
365 "\<lbrakk>bi_total A; bi_unique B\<rbrakk> \<Longrightarrow> bi_unique (A ===> B)"
366 unfolding bi_unique_alt_def bi_total_alt_def
367 by (blast intro: right_unique_fun left_unique_fun)
369 subsection {* Transfer rules *}
371 lemma Domainp_forall_transfer [transfer_rule]:
372 assumes "right_total A"
373 shows "((A ===> op =) ===> op =)
374 (transfer_bforall (Domainp A)) transfer_forall"
375 using assms unfolding right_total_def
376 unfolding transfer_forall_def transfer_bforall_def rel_fun_def Domainp_iff
379 text {* Transfer rules using implication instead of equality on booleans. *}
381 lemma transfer_forall_transfer [transfer_rule]:
382 "bi_total A \<Longrightarrow> ((A ===> op =) ===> op =) transfer_forall transfer_forall"
383 "right_total A \<Longrightarrow> ((A ===> op =) ===> implies) transfer_forall transfer_forall"
384 "right_total A \<Longrightarrow> ((A ===> implies) ===> implies) transfer_forall transfer_forall"
385 "bi_total A \<Longrightarrow> ((A ===> op =) ===> rev_implies) transfer_forall transfer_forall"
386 "bi_total A \<Longrightarrow> ((A ===> rev_implies) ===> rev_implies) transfer_forall transfer_forall"
387 unfolding transfer_forall_def rev_implies_def rel_fun_def right_total_def bi_total_def
390 lemma transfer_implies_transfer [transfer_rule]:
391 "(op = ===> op = ===> op = ) transfer_implies transfer_implies"
392 "(rev_implies ===> implies ===> implies ) transfer_implies transfer_implies"
393 "(rev_implies ===> op = ===> implies ) transfer_implies transfer_implies"
394 "(op = ===> implies ===> implies ) transfer_implies transfer_implies"
395 "(op = ===> op = ===> implies ) transfer_implies transfer_implies"
396 "(implies ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
397 "(implies ===> op = ===> rev_implies) transfer_implies transfer_implies"
398 "(op = ===> rev_implies ===> rev_implies) transfer_implies transfer_implies"
399 "(op = ===> op = ===> rev_implies) transfer_implies transfer_implies"
400 unfolding transfer_implies_def rev_implies_def rel_fun_def by auto
402 lemma eq_imp_transfer [transfer_rule]:
403 "right_unique A \<Longrightarrow> (A ===> A ===> op \<longrightarrow>) (op =) (op =)"
404 unfolding right_unique_alt_def2 .
406 text {* Transfer rules using equality. *}
408 lemma left_unique_transfer [transfer_rule]:
409 assumes "right_total A"
410 assumes "right_total B"
411 assumes "bi_unique A"
412 shows "((A ===> B ===> op=) ===> implies) left_unique left_unique"
413 using assms unfolding left_unique_def[abs_def] right_total_def bi_unique_def rel_fun_def
416 lemma eq_transfer [transfer_rule]:
417 assumes "bi_unique A"
418 shows "(A ===> A ===> op =) (op =) (op =)"
419 using assms unfolding bi_unique_def rel_fun_def by auto
421 lemma right_total_Ex_transfer[transfer_rule]:
422 assumes "right_total A"
423 shows "((A ===> op=) ===> op=) (Bex (Collect (Domainp A))) Ex"
424 using assms unfolding right_total_def Bex_def rel_fun_def Domainp_iff[abs_def]
427 lemma right_total_All_transfer[transfer_rule]:
428 assumes "right_total A"
429 shows "((A ===> op =) ===> op =) (Ball (Collect (Domainp A))) All"
430 using assms unfolding right_total_def Ball_def rel_fun_def Domainp_iff[abs_def]
433 lemma All_transfer [transfer_rule]:
435 shows "((A ===> op =) ===> op =) All All"
436 using assms unfolding bi_total_def rel_fun_def by fast
438 lemma Ex_transfer [transfer_rule]:
440 shows "((A ===> op =) ===> op =) Ex Ex"
441 using assms unfolding bi_total_def rel_fun_def by fast
443 lemma If_transfer [transfer_rule]: "(op = ===> A ===> A ===> A) If If"
444 unfolding rel_fun_def by simp
446 lemma Let_transfer [transfer_rule]: "(A ===> (A ===> B) ===> B) Let Let"
447 unfolding rel_fun_def by simp
449 lemma id_transfer [transfer_rule]: "(A ===> A) id id"
450 unfolding rel_fun_def by simp
452 lemma comp_transfer [transfer_rule]:
453 "((B ===> C) ===> (A ===> B) ===> (A ===> C)) (op \<circ>) (op \<circ>)"
454 unfolding rel_fun_def by simp
456 lemma fun_upd_transfer [transfer_rule]:
457 assumes [transfer_rule]: "bi_unique A"
458 shows "((A ===> B) ===> A ===> B ===> A ===> B) fun_upd fun_upd"
459 unfolding fun_upd_def [abs_def] by transfer_prover
461 lemma case_nat_transfer [transfer_rule]:
462 "(A ===> (op = ===> A) ===> op = ===> A) case_nat case_nat"
463 unfolding rel_fun_def by (simp split: nat.split)
465 lemma rec_nat_transfer [transfer_rule]:
466 "(A ===> (op = ===> A ===> A) ===> op = ===> A) rec_nat rec_nat"
467 unfolding rel_fun_def by (clarsimp, rename_tac n, induct_tac n, simp_all)
469 lemma funpow_transfer [transfer_rule]:
470 "(op = ===> (A ===> A) ===> (A ===> A)) compow compow"
471 unfolding funpow_def by transfer_prover
473 lemma mono_transfer[transfer_rule]:
474 assumes [transfer_rule]: "bi_total A"
475 assumes [transfer_rule]: "(A ===> A ===> op=) op\<le> op\<le>"
476 assumes [transfer_rule]: "(B ===> B ===> op=) op\<le> op\<le>"
477 shows "((A ===> B) ===> op=) mono mono"
478 unfolding mono_def[abs_def] by transfer_prover
480 lemma right_total_relcompp_transfer[transfer_rule]:
481 assumes [transfer_rule]: "right_total B"
482 shows "((A ===> B ===> op=) ===> (B ===> C ===> op=) ===> A ===> C ===> op=)
483 (\<lambda>R S x z. \<exists>y\<in>Collect (Domainp B). R x y \<and> S y z) op OO"
484 unfolding OO_def[abs_def] by transfer_prover
486 lemma relcompp_transfer[transfer_rule]:
487 assumes [transfer_rule]: "bi_total B"
488 shows "((A ===> B ===> op=) ===> (B ===> C ===> op=) ===> A ===> C ===> op=) op OO op OO"
489 unfolding OO_def[abs_def] by transfer_prover
491 lemma right_total_Domainp_transfer[transfer_rule]:
492 assumes [transfer_rule]: "right_total B"
493 shows "((A ===> B ===> op=) ===> A ===> op=) (\<lambda>T x. \<exists>y\<in>Collect(Domainp B). T x y) Domainp"
494 apply(subst(2) Domainp_iff[abs_def]) by transfer_prover
496 lemma Domainp_transfer[transfer_rule]:
497 assumes [transfer_rule]: "bi_total B"
498 shows "((A ===> B ===> op=) ===> A ===> op=) Domainp Domainp"
499 unfolding Domainp_iff[abs_def] by transfer_prover
501 lemma reflp_transfer[transfer_rule]:
502 "bi_total A \<Longrightarrow> ((A ===> A ===> op=) ===> op=) reflp reflp"
503 "right_total A \<Longrightarrow> ((A ===> A ===> implies) ===> implies) reflp reflp"
504 "right_total A \<Longrightarrow> ((A ===> A ===> op=) ===> implies) reflp reflp"
505 "bi_total A \<Longrightarrow> ((A ===> A ===> rev_implies) ===> rev_implies) reflp reflp"
506 "bi_total A \<Longrightarrow> ((A ===> A ===> op=) ===> rev_implies) reflp reflp"
507 using assms unfolding reflp_def[abs_def] rev_implies_def bi_total_def right_total_def rel_fun_def
510 lemma right_unique_transfer [transfer_rule]:
511 assumes [transfer_rule]: "right_total A"
512 assumes [transfer_rule]: "right_total B"
513 assumes [transfer_rule]: "bi_unique B"
514 shows "((A ===> B ===> op=) ===> implies) right_unique right_unique"
515 using assms unfolding right_unique_def[abs_def] right_total_def bi_unique_def rel_fun_def
518 lemma rel_fun_eq_eq_onp: "(op= ===> eq_onp P) = eq_onp (\<lambda>f. \<forall>x. P(f x))"
519 unfolding eq_onp_def rel_fun_def by auto
521 lemma rel_fun_eq_onp_rel:
522 shows "((eq_onp R) ===> S) = (\<lambda>f g. \<forall>x. R x \<longrightarrow> S (f x) (g x))"
523 by (auto simp add: eq_onp_def rel_fun_def)
525 lemma eq_onp_transfer [transfer_rule]:
526 assumes [transfer_rule]: "bi_unique A"
527 shows "((A ===> op=) ===> A ===> A ===> op=) eq_onp eq_onp"
528 unfolding eq_onp_def[abs_def] by transfer_prover