equal
deleted
inserted
replaced
40 by (simp add: fun_rel_def) |
40 by (simp add: fun_rel_def) |
41 |
41 |
42 |
42 |
43 subsection {* Transfer method *} |
43 subsection {* Transfer method *} |
44 |
44 |
45 text {* Explicit tags for application, abstraction, and relation |
45 text {* Explicit tag for relation membership allows for |
46 membership allow for backward proof methods. *} |
46 backward proof methods. *} |
47 |
|
48 definition App :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b" |
|
49 where "App f \<equiv> f" |
|
50 |
|
51 definition Abs :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b" |
|
52 where "Abs f \<equiv> f" |
|
53 |
47 |
54 definition Rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool" |
48 definition Rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool" |
55 where "Rel r \<equiv> r" |
49 where "Rel r \<equiv> r" |
56 |
50 |
57 text {* Handling of meta-logic connectives *} |
51 text {* Handling of meta-logic connectives *} |
85 by simp |
79 by simp |
86 |
80 |
87 lemma Rel_eq_refl: "Rel (op =) x x" |
81 lemma Rel_eq_refl: "Rel (op =) x x" |
88 unfolding Rel_def .. |
82 unfolding Rel_def .. |
89 |
83 |
90 lemma Rel_App: |
84 lemma Rel_app: |
91 assumes "Rel (A ===> B) f g" and "Rel A x y" |
85 assumes "Rel (A ===> B) f g" and "Rel A x y" |
92 shows "Rel B (App f x) (App g y)" |
86 shows "Rel B (f x) (g y)" |
93 using assms unfolding Rel_def App_def fun_rel_def by fast |
87 using assms unfolding Rel_def fun_rel_def by fast |
94 |
88 |
95 lemma Rel_Abs: |
89 lemma Rel_abs: |
96 assumes "\<And>x y. Rel A x y \<Longrightarrow> Rel B (f x) (g y)" |
90 assumes "\<And>x y. Rel A x y \<Longrightarrow> Rel B (f x) (g y)" |
97 shows "Rel (A ===> B) (Abs (\<lambda>x. f x)) (Abs (\<lambda>y. g y))" |
91 shows "Rel (A ===> B) (\<lambda>x. f x) (\<lambda>y. g y)" |
98 using assms unfolding Rel_def Abs_def fun_rel_def by fast |
92 using assms unfolding Rel_def fun_rel_def by fast |
99 |
93 |
100 use "Tools/transfer.ML" |
94 use "Tools/transfer.ML" |
101 |
95 |
102 setup Transfer.setup |
96 setup Transfer.setup |
103 |
97 |
104 declare fun_rel_eq [relator_eq] |
98 declare fun_rel_eq [relator_eq] |
105 |
99 |
106 hide_const (open) App Abs Rel |
100 hide_const (open) Rel |
107 |
101 |
108 |
102 |
109 subsection {* Predicates on relations, i.e. ``class constraints'' *} |
103 subsection {* Predicates on relations, i.e. ``class constraints'' *} |
110 |
104 |
111 definition right_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" |
105 definition right_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" |