author  kuncar 
Tue, 13 Aug 2013 15:59:22 +0200  
changeset 53011  aeee0a4be6cf 
parent 52307  32c433c38ddd 
child 53151  fbf4d50dec91 
permissions  rwrr 
47308  1 
(* Title: HOL/Lifting.thy 
2 
Author: Brian Huffman and Ondrej Kuncar 

3 
Author: Cezary Kaliszyk and Christian Urban 

4 
*) 

5 

6 
header {* Lifting package *} 

7 

8 
theory Lifting 

51112  9 
imports Equiv_Relations Transfer 
47308  10 
keywords 
51374
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

11 
"parametric" and 
47308  12 
"print_quotmaps" "print_quotients" :: diag and 
13 
"lift_definition" :: thy_goal and 

14 
"setup_lifting" :: thy_decl 

15 
begin 

16 

47325  17 
subsection {* Function map *} 
47308  18 

53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and > local
kuncar
parents:
52307
diff
changeset

19 
context 
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and > local
kuncar
parents:
52307
diff
changeset

20 
begin 
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and > local
kuncar
parents:
52307
diff
changeset

21 
interpretation lifting_syntax . 
47308  22 

23 
lemma map_fun_id: 

24 
"(id > id) = id" 

25 
by (simp add: fun_eq_iff) 

26 

51994  27 
subsection {* Other predicates on relations *} 
28 

29 
definition left_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" 

30 
where "left_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y)" 

31 

32 
lemma left_totalI: 

33 
"(\<And>x. \<exists>y. R x y) \<Longrightarrow> left_total R" 

34 
unfolding left_total_def by blast 

35 

36 
lemma left_totalE: 

37 
assumes "left_total R" 

38 
obtains "(\<And>x. \<exists>y. R x y)" 

39 
using assms unfolding left_total_def by blast 

40 

41 
definition left_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" 

42 
where "left_unique R \<longleftrightarrow> (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y)" 

43 

52036
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

44 
lemma left_total_fun: 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

45 
"\<lbrakk>left_unique A; left_total B\<rbrakk> \<Longrightarrow> left_total (A ===> B)" 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

46 
unfolding left_total_def fun_rel_def 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

47 
apply (rule allI, rename_tac f) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

48 
apply (rule_tac x="\<lambda>y. SOME z. B (f (THE x. A x y)) z" in exI) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

49 
apply clarify 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

50 
apply (subgoal_tac "(THE x. A x y) = x", simp) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

51 
apply (rule someI_ex) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

52 
apply (simp) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

53 
apply (rule the_equality) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

54 
apply assumption 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

55 
apply (simp add: left_unique_def) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

56 
done 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

57 

1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

58 
lemma left_unique_fun: 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

59 
"\<lbrakk>left_total A; left_unique B\<rbrakk> \<Longrightarrow> left_unique (A ===> B)" 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

60 
unfolding left_total_def left_unique_def fun_rel_def 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

61 
by (clarify, rule ext, fast) 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

62 

1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

63 
lemma left_total_eq: "left_total op=" unfolding left_total_def by blast 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

64 

1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

65 
lemma left_unique_eq: "left_unique op=" unfolding left_unique_def by blast 
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

66 

47308  67 
subsection {* Quotient Predicate *} 
68 

69 
definition 

70 
"Quotient R Abs Rep T \<longleftrightarrow> 

71 
(\<forall>a. Abs (Rep a) = a) \<and> 

72 
(\<forall>a. R (Rep a) (Rep a)) \<and> 

73 
(\<forall>r s. R r s \<longleftrightarrow> R r r \<and> R s s \<and> Abs r = Abs s) \<and> 

74 
T = (\<lambda>x y. R x x \<and> Abs x = y)" 

75 

76 
lemma QuotientI: 

77 
assumes "\<And>a. Abs (Rep a) = a" 

78 
and "\<And>a. R (Rep a) (Rep a)" 

79 
and "\<And>r s. R r s \<longleftrightarrow> R r r \<and> R s s \<and> Abs r = Abs s" 

80 
and "T = (\<lambda>x y. R x x \<and> Abs x = y)" 

81 
shows "Quotient R Abs Rep T" 

82 
using assms unfolding Quotient_def by blast 

83 

47536  84 
context 
85 
fixes R Abs Rep T 

47308  86 
assumes a: "Quotient R Abs Rep T" 
47536  87 
begin 
88 

89 
lemma Quotient_abs_rep: "Abs (Rep a) = a" 

90 
using a unfolding Quotient_def 

47308  91 
by simp 
92 

47536  93 
lemma Quotient_rep_reflp: "R (Rep a) (Rep a)" 
94 
using a unfolding Quotient_def 

47308  95 
by blast 
96 

97 
lemma Quotient_rel: 

47536  98 
"R r r \<and> R s s \<and> Abs r = Abs s \<longleftrightarrow> R r s"  {* orientation does not loop on rewriting *} 
99 
using a unfolding Quotient_def 

47308  100 
by blast 
101 

47536  102 
lemma Quotient_cr_rel: "T = (\<lambda>x y. R x x \<and> Abs x = y)" 
47308  103 
using a unfolding Quotient_def 
104 
by blast 

105 

47536  106 
lemma Quotient_refl1: "R r s \<Longrightarrow> R r r" 
107 
using a unfolding Quotient_def 

108 
by fast 

109 

110 
lemma Quotient_refl2: "R r s \<Longrightarrow> R s s" 

111 
using a unfolding Quotient_def 

112 
by fast 

113 

114 
lemma Quotient_rel_rep: "R (Rep a) (Rep b) \<longleftrightarrow> a = b" 

115 
using a unfolding Quotient_def 

116 
by metis 

117 

118 
lemma Quotient_rep_abs: "R r r \<Longrightarrow> R (Rep (Abs r)) r" 

47308  119 
using a unfolding Quotient_def 
120 
by blast 

121 

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:
47936
diff
changeset

122 
lemma Quotient_rep_abs_fold_unmap: 
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:
47936
diff
changeset

123 
assumes "x' \<equiv> Abs x" and "R x x" and "Rep x' \<equiv> Rep' 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:
47936
diff
changeset

124 
shows "R (Rep' 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:
47936
diff
changeset

125 
proof  
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:
47936
diff
changeset

126 
have "R (Rep x') x" using assms(12) Quotient_rep_abs 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:
47936
diff
changeset

127 
then show ?thesis using assms(3) by simp 
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:
47936
diff
changeset

128 
qed 
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:
47936
diff
changeset

129 

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:
47936
diff
changeset

130 
lemma Quotient_Rep_eq: 
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:
47936
diff
changeset

131 
assumes "x' \<equiv> Abs 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:
47936
diff
changeset

132 
shows "Rep x' \<equiv> Rep 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:
47936
diff
changeset

133 
by simp 
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:
47936
diff
changeset

134 

47536  135 
lemma Quotient_rel_abs: "R r s \<Longrightarrow> Abs r = Abs s" 
136 
using a unfolding Quotient_def 

137 
by blast 

138 

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:
47936
diff
changeset

139 
lemma Quotient_rel_abs2: 
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:
47936
diff
changeset

140 
assumes "R (Rep x) y" 
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:
47936
diff
changeset

141 
shows "x = Abs y" 
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:
47936
diff
changeset

142 
proof  
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:
47936
diff
changeset

143 
from assms have "Abs (Rep x) = Abs y" by (auto intro: Quotient_rel_abs) 
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:
47936
diff
changeset

144 
then show ?thesis using assms(1) by (simp add: Quotient_abs_rep) 
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:
47936
diff
changeset

145 
qed 
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:
47936
diff
changeset

146 

47536  147 
lemma Quotient_symp: "symp R" 
47308  148 
using a unfolding Quotient_def using sympI by (metis (full_types)) 
149 

47536  150 
lemma Quotient_transp: "transp R" 
47308  151 
using a unfolding Quotient_def using transpI by (metis (full_types)) 
152 

47536  153 
lemma Quotient_part_equivp: "part_equivp R" 
154 
by (metis Quotient_rep_reflp Quotient_symp Quotient_transp part_equivpI) 

155 

156 
end 

47308  157 

158 
lemma identity_quotient: "Quotient (op =) id id (op =)" 

159 
unfolding Quotient_def by simp 

160 

47652
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

161 
text {* TODO: Use one of these alternatives as the real definition. *} 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

162 

47308  163 
lemma Quotient_alt_def: 
164 
"Quotient R Abs Rep T \<longleftrightarrow> 

165 
(\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> 

166 
(\<forall>b. T (Rep b) b) \<and> 

167 
(\<forall>x y. R x y \<longleftrightarrow> T x (Abs x) \<and> T y (Abs y) \<and> Abs x = Abs y)" 

168 
apply safe 

169 
apply (simp (no_asm_use) only: Quotient_def, fast) 

170 
apply (simp (no_asm_use) only: Quotient_def, fast) 

171 
apply (simp (no_asm_use) only: Quotient_def, fast) 

172 
apply (simp (no_asm_use) only: Quotient_def, fast) 

173 
apply (simp (no_asm_use) only: Quotient_def, fast) 

174 
apply (simp (no_asm_use) only: Quotient_def, fast) 

175 
apply (rule QuotientI) 

176 
apply simp 

177 
apply metis 

178 
apply simp 

179 
apply (rule ext, rule ext, metis) 

180 
done 

181 

182 
lemma Quotient_alt_def2: 

183 
"Quotient R Abs Rep T \<longleftrightarrow> 

184 
(\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> 

185 
(\<forall>b. T (Rep b) b) \<and> 

186 
(\<forall>x y. R x y \<longleftrightarrow> T x (Abs y) \<and> T y (Abs x))" 

187 
unfolding Quotient_alt_def by (safe, metis+) 

188 

47652
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

189 
lemma Quotient_alt_def3: 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

190 
"Quotient R Abs Rep T \<longleftrightarrow> 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

191 
(\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> (\<forall>b. T (Rep b) b) \<and> 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

192 
(\<forall>x y. R x y \<longleftrightarrow> (\<exists>z. T x z \<and> T y z))" 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

193 
unfolding Quotient_alt_def2 by (safe, metis+) 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

194 

1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

195 
lemma Quotient_alt_def4: 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

196 
"Quotient R Abs Rep T \<longleftrightarrow> 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

197 
(\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> (\<forall>b. T (Rep b) b) \<and> R = T OO conversep T" 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

198 
unfolding Quotient_alt_def3 fun_eq_iff by auto 
1b722b100301
move alternative definition lemmas into Lifting.thy;
huffman
parents:
47651
diff
changeset

199 

47308  200 
lemma fun_quotient: 
201 
assumes 1: "Quotient R1 abs1 rep1 T1" 

202 
assumes 2: "Quotient R2 abs2 rep2 T2" 

203 
shows "Quotient (R1 ===> R2) (rep1 > abs2) (abs1 > rep2) (T1 ===> T2)" 

204 
using assms unfolding Quotient_alt_def2 

205 
unfolding fun_rel_def fun_eq_iff map_fun_apply 

206 
by (safe, metis+) 

207 

208 
lemma apply_rsp: 

209 
fixes f g::"'a \<Rightarrow> 'c" 

210 
assumes q: "Quotient R1 Abs1 Rep1 T1" 

211 
and a: "(R1 ===> R2) f g" "R1 x y" 

212 
shows "R2 (f x) (g y)" 

213 
using a by (auto elim: fun_relE) 

214 

215 
lemma apply_rsp': 

216 
assumes a: "(R1 ===> R2) f g" "R1 x y" 

217 
shows "R2 (f x) (g y)" 

218 
using a by (auto elim: fun_relE) 

219 

220 
lemma apply_rsp'': 

221 
assumes "Quotient R Abs Rep T" 

222 
and "(R ===> S) f f" 

223 
shows "S (f (Rep x)) (f (Rep x))" 

224 
proof  

225 
from assms(1) have "R (Rep x) (Rep x)" by (rule Quotient_rep_reflp) 

226 
then show ?thesis using assms(2) by (auto intro: apply_rsp') 

227 
qed 

228 

229 
subsection {* Quotient composition *} 

230 

231 
lemma Quotient_compose: 

232 
assumes 1: "Quotient R1 Abs1 Rep1 T1" 

233 
assumes 2: "Quotient R2 Abs2 Rep2 T2" 

234 
shows "Quotient (T1 OO R2 OO conversep T1) (Abs2 \<circ> Abs1) (Rep1 \<circ> Rep2) (T1 OO T2)" 

51994  235 
using assms unfolding Quotient_alt_def4 by fastforce 
47308  236 

47521
69f95ac85c3d
tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents:
47501
diff
changeset

237 
lemma equivp_reflp2: 
69f95ac85c3d
tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents:
47501
diff
changeset

238 
"equivp R \<Longrightarrow> reflp R" 
69f95ac85c3d
tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents:
47501
diff
changeset

239 
by (erule equivpE) 
69f95ac85c3d
tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents:
47501
diff
changeset

240 

47544  241 
subsection {* Respects predicate *} 
242 

243 
definition Respects :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set" 

244 
where "Respects R = {x. R x x}" 

245 

246 
lemma in_respects: "x \<in> Respects R \<longleftrightarrow> R x x" 

247 
unfolding Respects_def by simp 

248 

47308  249 
subsection {* Invariant *} 
250 

251 
definition invariant :: "('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" 

252 
where "invariant R = (\<lambda>x y. R x \<and> x = y)" 

253 

254 
lemma invariant_to_eq: 

255 
assumes "invariant P x y" 

256 
shows "x = y" 

257 
using assms by (simp add: invariant_def) 

258 

259 
lemma fun_rel_eq_invariant: 

260 
shows "((invariant R) ===> S) = (\<lambda>f g. \<forall>x. R x \<longrightarrow> S (f x) (g x))" 

261 
by (auto simp add: invariant_def fun_rel_def) 

262 

263 
lemma invariant_same_args: 

264 
shows "invariant P x x \<equiv> P x" 

265 
using assms by (auto simp add: invariant_def) 

266 

47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

267 
lemma UNIV_typedef_to_Quotient: 
47308  268 
assumes "type_definition Rep Abs UNIV" 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

269 
and T_def: "T \<equiv> (\<lambda>x y. x = Rep y)" 
47308  270 
shows "Quotient (op =) Abs Rep T" 
271 
proof  

272 
interpret type_definition Rep Abs UNIV by fact 

47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

273 
from Abs_inject Rep_inverse Abs_inverse T_def show ?thesis 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

274 
by (fastforce intro!: QuotientI fun_eq_iff) 
47308  275 
qed 
276 

47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

277 
lemma UNIV_typedef_to_equivp: 
47308  278 
fixes Abs :: "'a \<Rightarrow> 'b" 
279 
and Rep :: "'b \<Rightarrow> 'a" 

280 
assumes "type_definition Rep Abs (UNIV::'a set)" 

281 
shows "equivp (op=::'a\<Rightarrow>'a\<Rightarrow>bool)" 

282 
by (rule identity_equivp) 

283 

47354  284 
lemma typedef_to_Quotient: 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

285 
assumes "type_definition Rep Abs S" 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

286 
and T_def: "T \<equiv> (\<lambda>x y. x = Rep y)" 
47501  287 
shows "Quotient (invariant (\<lambda>x. x \<in> S)) Abs Rep T" 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

288 
proof  
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

289 
interpret type_definition Rep Abs S by fact 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

290 
from Rep Abs_inject Rep_inverse Abs_inverse T_def show ?thesis 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

291 
by (auto intro!: QuotientI simp: invariant_def fun_eq_iff) 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

292 
qed 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

293 

87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

294 
lemma typedef_to_part_equivp: 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

295 
assumes "type_definition Rep Abs S" 
47501  296 
shows "part_equivp (invariant (\<lambda>x. x \<in> S))" 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

297 
proof (intro part_equivpI) 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

298 
interpret type_definition Rep Abs S by fact 
47501  299 
show "\<exists>x. invariant (\<lambda>x. x \<in> S) x x" using Rep by (auto simp: invariant_def) 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

300 
next 
47501  301 
show "symp (invariant (\<lambda>x. x \<in> S))" by (auto intro: sympI simp: invariant_def) 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

302 
next 
47501  303 
show "transp (invariant (\<lambda>x. x \<in> S))" by (auto intro: transpI simp: invariant_def) 
47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

304 
qed 
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

305 

87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

306 
lemma open_typedef_to_Quotient: 
47308  307 
assumes "type_definition Rep Abs {x. P x}" 
47354  308 
and T_def: "T \<equiv> (\<lambda>x y. x = Rep y)" 
47308  309 
shows "Quotient (invariant P) Abs Rep T" 
47651  310 
using typedef_to_Quotient [OF assms] by simp 
47308  311 

47361
87c0eaf04bad
support nonopen typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents:
47354
diff
changeset

312 
lemma open_typedef_to_part_equivp: 
47308  313 
assumes "type_definition Rep Abs {x. P x}" 
314 
shows "part_equivp (invariant P)" 

47651  315 
using typedef_to_part_equivp [OF assms] by simp 
47308  316 

47376  317 
text {* Generating transfer rules for quotients. *} 
318 

47537  319 
context 
320 
fixes R Abs Rep T 

321 
assumes 1: "Quotient R Abs Rep T" 

322 
begin 

47376  323 

47537  324 
lemma Quotient_right_unique: "right_unique T" 
325 
using 1 unfolding Quotient_alt_def right_unique_def by metis 

326 

327 
lemma Quotient_right_total: "right_total T" 

328 
using 1 unfolding Quotient_alt_def right_total_def by metis 

329 

330 
lemma Quotient_rel_eq_transfer: "(T ===> T ===> op =) R (op =)" 

331 
using 1 unfolding Quotient_alt_def fun_rel_def by simp 

47376  332 

47538  333 
lemma Quotient_abs_induct: 
334 
assumes "\<And>y. R y y \<Longrightarrow> P (Abs y)" shows "P x" 

335 
using 1 assms unfolding Quotient_def by metis 

336 

47537  337 
end 
338 

339 
text {* Generating transfer rules for total quotients. *} 

47376  340 

47537  341 
context 
342 
fixes R Abs Rep T 

343 
assumes 1: "Quotient R Abs Rep T" and 2: "reflp R" 

344 
begin 

47376  345 

47537  346 
lemma Quotient_bi_total: "bi_total T" 
347 
using 1 2 unfolding Quotient_alt_def bi_total_def reflp_def by auto 

348 

349 
lemma Quotient_id_abs_transfer: "(op = ===> T) (\<lambda>x. x) Abs" 

350 
using 1 2 unfolding Quotient_alt_def reflp_def fun_rel_def by simp 

351 

47575  352 
lemma Quotient_total_abs_induct: "(\<And>y. P (Abs y)) \<Longrightarrow> P x" 
353 
using 1 2 assms unfolding Quotient_alt_def reflp_def by metis 

354 

47889
29212a4bb866
lifting package produces abs_eq_iff rules for total quotients
huffman
parents:
47777
diff
changeset

355 
lemma Quotient_total_abs_eq_iff: "Abs x = Abs y \<longleftrightarrow> R x y" 
29212a4bb866
lifting package produces abs_eq_iff rules for total quotients
huffman
parents:
47777
diff
changeset

356 
using Quotient_rel [OF 1] 2 unfolding reflp_def by simp 
29212a4bb866
lifting package produces abs_eq_iff rules for total quotients
huffman
parents:
47777
diff
changeset

357 

47537  358 
end 
47376  359 

47368
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

360 
text {* Generating transfer rules for a type defined with @{text "typedef"}. *} 
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

361 

47534
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

362 
context 
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

363 
fixes Rep Abs A T 
47368
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

364 
assumes type: "type_definition Rep Abs A" 
47534
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

365 
assumes T_def: "T \<equiv> (\<lambda>(x::'a) (y::'b). x = Rep y)" 
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

366 
begin 
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

367 

51994  368 
lemma typedef_left_unique: "left_unique T" 
369 
unfolding left_unique_def T_def 

370 
by (simp add: type_definition.Rep_inject [OF type]) 

371 

47534
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

372 
lemma typedef_bi_unique: "bi_unique T" 
47368
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

373 
unfolding bi_unique_def T_def 
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

374 
by (simp add: type_definition.Rep_inject [OF type]) 
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

375 

51374
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

376 
(* the following two theorems are here only for convinience *) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

377 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

378 
lemma typedef_right_unique: "right_unique T" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

379 
using T_def type Quotient_right_unique typedef_to_Quotient 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

380 
by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

381 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

382 
lemma typedef_right_total: "right_total T" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

383 
using T_def type Quotient_right_total typedef_to_Quotient 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

384 
by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

385 

47535
0f94b02fda1c
lifting_setup generates transfer rule for rep of typedefs
huffman
parents:
47534
diff
changeset

386 
lemma typedef_rep_transfer: "(T ===> op =) (\<lambda>x. x) Rep" 
0f94b02fda1c
lifting_setup generates transfer rule for rep of typedefs
huffman
parents:
47534
diff
changeset

387 
unfolding fun_rel_def T_def by simp 
0f94b02fda1c
lifting_setup generates transfer rule for rep of typedefs
huffman
parents:
47534
diff
changeset

388 

47534
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

389 
end 
06cc372a80ed
use context block to organize typedef lifting theorems
huffman
parents:
47521
diff
changeset

390 

47368
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

391 
text {* Generating the correspondence rule for a constant defined with 
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

392 
@{text "lift_definition"}. *} 
4c522dff1f4d
add lemmas for generating transfer rules for typedefs
huffman
parents:
47354
diff
changeset

393 

47351  394 
lemma Quotient_to_transfer: 
395 
assumes "Quotient R Abs Rep T" and "R c c" and "c' \<equiv> Abs c" 

396 
shows "T c c'" 

397 
using assms by (auto dest: Quotient_cr_rel) 

398 

47982
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

399 
text {* Proving reflexivity *} 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

400 

51994  401 
definition reflp' :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where "reflp' R \<equiv> reflp R" 
47982
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

402 

7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

403 
lemma Quotient_to_left_total: 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

404 
assumes q: "Quotient R Abs Rep T" 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

405 
and r_R: "reflp R" 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

406 
shows "left_total T" 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

407 
using r_R Quotient_cr_rel[OF q] unfolding left_total_def by (auto elim: reflpE) 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

408 

7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

409 
lemma reflp_Quotient_composition: 
51994  410 
assumes "left_total R" 
411 
assumes "reflp T" 

412 
shows "reflp (R OO T OO R\<inverse>\<inverse>)" 

413 
using assms unfolding reflp_def left_total_def by fast 

414 

415 
lemma reflp_fun1: 

416 
assumes "is_equality R" 

417 
assumes "reflp' S" 

418 
shows "reflp (R ===> S)" 

419 
using assms unfolding is_equality_def reflp'_def reflp_def fun_rel_def by blast 

420 

421 
lemma reflp_fun2: 

422 
assumes "is_equality R" 

423 
assumes "is_equality S" 

424 
shows "reflp (R ===> S)" 

425 
using assms unfolding is_equality_def reflp_def fun_rel_def by blast 

426 

427 
lemma is_equality_Quotient_composition: 

428 
assumes "is_equality T" 

429 
assumes "left_total R" 

430 
assumes "left_unique R" 

431 
shows "is_equality (R OO T OO R\<inverse>\<inverse>)" 

432 
using assms unfolding is_equality_def left_total_def left_unique_def OO_def conversep_iff 

433 
by fastforce 

47982
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

434 

52307  435 
lemma left_total_composition: "left_total R \<Longrightarrow> left_total S \<Longrightarrow> left_total (R OO S)" 
436 
unfolding left_total_def OO_def by fast 

437 

438 
lemma left_unique_composition: "left_unique R \<Longrightarrow> left_unique S \<Longrightarrow> left_unique (R OO S)" 

439 
unfolding left_unique_def OO_def by fast 

440 

47982
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

441 
lemma reflp_equality: "reflp (op =)" 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

442 
by (auto intro: reflpI) 
7aa35601ff65
prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents:
47937
diff
changeset

443 

51374
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

444 
text {* Proving a parametrized correspondence relation *} 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

445 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

446 
lemma eq_OO: "op= OO R = R" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

447 
unfolding OO_def by metis 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

448 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

449 
definition POS :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" where 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

450 
"POS A B \<equiv> A \<le> B" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

451 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

452 
definition NEG :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" where 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

453 
"NEG A B \<equiv> B \<le> A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

454 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

455 
(* 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

456 
The following two rules are here because we don't have any proper 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

457 
leftunique ant lefttotal relations. Leftunique and lefttotal 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

458 
assumptions show up in distributivity rules for the function type. 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

459 
*) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

460 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

461 
lemma bi_unique_left_unique[transfer_rule]: "bi_unique R \<Longrightarrow> left_unique R" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

462 
unfolding bi_unique_def left_unique_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

463 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

464 
lemma bi_total_left_total[transfer_rule]: "bi_total R \<Longrightarrow> left_total R" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

465 
unfolding bi_total_def left_total_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

466 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

467 
lemma pos_OO_eq: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

468 
shows "POS (A OO op=) A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

469 
unfolding POS_def OO_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

470 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

471 
lemma pos_eq_OO: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

472 
shows "POS (op= OO A) A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

473 
unfolding POS_def OO_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

474 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

475 
lemma neg_OO_eq: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

476 
shows "NEG (A OO op=) A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

477 
unfolding NEG_def OO_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

478 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

479 
lemma neg_eq_OO: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

480 
shows "NEG (op= OO A) A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

481 
unfolding NEG_def OO_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

482 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

483 
lemma POS_trans: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

484 
assumes "POS A B" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

485 
assumes "POS B C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

486 
shows "POS A C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

487 
using assms unfolding POS_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

488 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

489 
lemma NEG_trans: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

490 
assumes "NEG A B" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

491 
assumes "NEG B C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

492 
shows "NEG A C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

493 
using assms unfolding NEG_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

494 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

495 
lemma POS_NEG: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

496 
"POS A B \<equiv> NEG B A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

497 
unfolding POS_def NEG_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

498 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

499 
lemma NEG_POS: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

500 
"NEG A B \<equiv> POS B A" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

501 
unfolding POS_def NEG_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

502 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

503 
lemma POS_pcr_rule: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

504 
assumes "POS (A OO B) C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

505 
shows "POS (A OO B OO X) (C OO X)" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

506 
using assms unfolding POS_def OO_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

507 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

508 
lemma NEG_pcr_rule: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

509 
assumes "NEG (A OO B) C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

510 
shows "NEG (A OO B OO X) (C OO X)" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

511 
using assms unfolding NEG_def OO_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

512 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

513 
lemma POS_apply: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

514 
assumes "POS R R'" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

515 
assumes "R f g" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

516 
shows "R' f g" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

517 
using assms unfolding POS_def by auto 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

518 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

519 
text {* Proving a parametrized correspondence relation *} 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

520 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

521 
lemma fun_mono: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

522 
assumes "A \<ge> C" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

523 
assumes "B \<le> D" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

524 
shows "(A ===> B) \<le> (C ===> D)" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

525 
using assms unfolding fun_rel_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

526 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

527 
lemma pos_fun_distr: "((R ===> S) OO (R' ===> S')) \<le> ((R OO R') ===> (S OO S'))" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

528 
unfolding OO_def fun_rel_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

529 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

530 
lemma functional_relation: "right_unique R \<Longrightarrow> left_total R \<Longrightarrow> \<forall>x. \<exists>!y. R x y" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

531 
unfolding right_unique_def left_total_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

532 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

533 
lemma functional_converse_relation: "left_unique R \<Longrightarrow> right_total R \<Longrightarrow> \<forall>y. \<exists>!x. R x y" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

534 
unfolding left_unique_def right_total_def by blast 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

535 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

536 
lemma neg_fun_distr1: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

537 
assumes 1: "left_unique R" "right_total R" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

538 
assumes 2: "right_unique R'" "left_total R'" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

539 
shows "(R OO R' ===> S OO S') \<le> ((R ===> S) OO (R' ===> S')) " 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

540 
using functional_relation[OF 2] functional_converse_relation[OF 1] 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

541 
unfolding fun_rel_def OO_def 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

542 
apply clarify 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

543 
apply (subst all_comm) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

544 
apply (subst all_conj_distrib[symmetric]) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

545 
apply (intro choice) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

546 
by metis 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

547 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

548 
lemma neg_fun_distr2: 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

549 
assumes 1: "right_unique R'" "left_total R'" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

550 
assumes 2: "left_unique S'" "right_total S'" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

551 
shows "(R OO R' ===> S OO S') \<le> ((R ===> S) OO (R' ===> S'))" 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

552 
using functional_converse_relation[OF 2] functional_relation[OF 1] 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

553 
unfolding fun_rel_def OO_def 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

554 
apply clarify 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

555 
apply (subst all_comm) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

556 
apply (subst all_conj_distrib[symmetric]) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

557 
apply (intro choice) 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

558 
by metis 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

559 

51956
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

560 
subsection {* Domains *} 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

561 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

562 
lemma pcr_Domainp_par_left_total: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

563 
assumes "Domainp B = P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

564 
assumes "left_total A" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

565 
assumes "(A ===> op=) P' P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

566 
shows "Domainp (A OO B) = P'" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

567 
using assms 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

568 
unfolding Domainp_iff[abs_def] OO_def bi_unique_def left_total_def fun_rel_def 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

569 
by (fast intro: fun_eq_iff) 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

570 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

571 
lemma pcr_Domainp_par: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

572 
assumes "Domainp B = P2" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

573 
assumes "Domainp A = P1" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

574 
assumes "(A ===> op=) P2' P2" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

575 
shows "Domainp (A OO B) = (inf P1 P2')" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

576 
using assms unfolding fun_rel_def Domainp_iff[abs_def] OO_def 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

577 
by (fast intro: fun_eq_iff) 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

578 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

579 
definition rel_pred_comp :: "('a => 'b => bool) => ('b => bool) => 'a => bool" (infixr "OP" 75) 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

580 
where "rel_pred_comp R P \<equiv> \<lambda>x. \<exists>y. R x y \<and> P y" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

581 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

582 
lemma pcr_Domainp: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

583 
assumes "Domainp B = P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

584 
shows "Domainp (A OO B) = (A OP P)" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

585 
using assms unfolding rel_pred_comp_def by blast 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

586 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

587 
lemma pcr_Domainp_total: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

588 
assumes "bi_total B" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

589 
assumes "Domainp A = P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

590 
shows "Domainp (A OO B) = P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

591 
using assms unfolding bi_total_def 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

592 
by fast 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

593 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

594 
lemma Quotient_to_Domainp: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

595 
assumes "Quotient R Abs Rep T" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

596 
shows "Domainp T = (\<lambda>x. R x x)" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

597 
by (simp add: Domainp_iff[abs_def] Quotient_cr_rel[OF assms]) 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

598 

a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

599 
lemma invariant_to_Domainp: 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

600 
assumes "Quotient (Lifting.invariant P) Abs Rep T" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

601 
shows "Domainp T = P" 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

602 
by (simp add: invariant_def Domainp_iff[abs_def] Quotient_cr_rel[OF assms]) 
a4d81cdebf8b
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
kuncar
parents:
51374
diff
changeset

603 

53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and > local
kuncar
parents:
52307
diff
changeset

604 
end 
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and > local
kuncar
parents:
52307
diff
changeset

605 

47308  606 
subsection {* ML setup *} 
607 

48891  608 
ML_file "Tools/Lifting/lifting_util.ML" 
47308  609 

48891  610 
ML_file "Tools/Lifting/lifting_info.ML" 
47308  611 
setup Lifting_Info.setup 
612 

51994  613 
lemmas [reflexivity_rule] = 
52036
1aa2e40df9ff
reflexivity rules for the function type and equality
kuncar
parents:
51994
diff
changeset

614 
reflp_equality reflp_Quotient_composition is_equality_Quotient_composition 
52307  615 
left_total_fun left_unique_fun left_total_eq left_unique_eq left_total_composition 
616 
left_unique_composition 

51994  617 

618 
text {* add @{thm reflp_fun1} and @{thm reflp_fun2} manually through ML 

619 
because we don't want to get reflp' variant of these theorems *} 

620 

621 
setup{* 

622 
Context.theory_map 

623 
(fold 

624 
(snd oo (Thm.apply_attribute Lifting_Info.add_reflexivity_rule_raw_attribute)) 

625 
[@{thm reflp_fun1}, @{thm reflp_fun2}]) 

626 
*} 

51374
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

627 

84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

628 
(* setup for the function type *) 
47777
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
kuncar
parents:
47698
diff
changeset

629 
declare fun_quotient[quot_map] 
51374
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

630 
declare fun_mono[relator_mono] 
84d01fd733cf
lift_definition and setup_lifting generate parametric transfer rules if parametricity theorems are provided
kuncar
parents:
51112
diff
changeset

631 
lemmas [relator_distr] = pos_fun_distr neg_fun_distr1 neg_fun_distr2 
47308  632 

48891  633 
ML_file "Tools/Lifting/lifting_term.ML" 
47308  634 

48891  635 
ML_file "Tools/Lifting/lifting_def.ML" 
47308  636 

48891  637 
ML_file "Tools/Lifting/lifting_setup.ML" 
47308  638 

51994  639 
hide_const (open) invariant POS NEG reflp' 
47308  640 

641 
end 