author  paulson 
Wed, 31 Jul 2002 18:30:25 +0200  
changeset 13440  cdde97e1db1c 
parent 13428  99e52e78eb65 
child 13493  5aa68c051725 
permissions  rwrr 
13306  1 
header {*Absoluteness Properties for Recursive Datatypes*} 
2 

13269  3 
theory Datatype_absolute = Formula + WF_absolute: 
13268  4 

5 

6 
subsection{*The lfp of a continuous function can be expressed as a union*} 

7 

8 
constdefs 

13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

9 
directed :: "i=>o" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

10 
"directed(A) == A\<noteq>0 & (\<forall>x\<in>A. \<forall>y\<in>A. x \<union> y \<in> A)" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

11 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

12 
contin :: "(i=>i) => o" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

13 
"contin(h) == (\<forall>A. directed(A) > h(\<Union>A) = (\<Union>X\<in>A. h(X)))" 
13268  14 

15 
lemma bnd_mono_iterates_subset: "[bnd_mono(D, h); n \<in> nat] ==> h^n (0) <= D" 

16 
apply (induct_tac n) 

17 
apply (simp_all add: bnd_mono_def, blast) 

18 
done 

19 

13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

20 
lemma bnd_mono_increasing [rule_format]: 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

21 
"[i \<in> nat; j \<in> nat; bnd_mono(D,h)] ==> i \<le> j > h^i(0) \<subseteq> h^j(0)" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

22 
apply (rule_tac m=i and n=j in diff_induct, simp_all) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

23 
apply (blast del: subsetI 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

24 
intro: bnd_mono_iterates_subset bnd_monoD2 [of concl: h]) 
13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

25 
done 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

26 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

27 
lemma directed_iterates: "bnd_mono(D,h) ==> directed({h^n (0). n\<in>nat})" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

28 
apply (simp add: directed_def, clarify) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

29 
apply (rename_tac i j) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

30 
apply (rule_tac x="i \<union> j" in bexI) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

31 
apply (rule_tac i = i and j = j in Ord_linear_le) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

32 
apply (simp_all add: subset_Un_iff [THEN iffD1] le_imp_subset 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

33 
subset_Un_iff2 [THEN iffD1]) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

34 
apply (simp_all add: subset_Un_iff [THEN iff_sym] bnd_mono_increasing 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

35 
subset_Un_iff2 [THEN iff_sym]) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

36 
done 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

37 

13268  38 

39 
lemma contin_iterates_eq: 

13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

40 
"[bnd_mono(D, h); contin(h)] 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

41 
==> h(\<Union>n\<in>nat. h^n (0)) = (\<Union>n\<in>nat. h^n (0))" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

42 
apply (simp add: contin_def directed_iterates) 
13268  43 
apply (rule trans) 
44 
apply (rule equalityI) 

13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

45 
apply (simp_all add: UN_subset_iff) 
13268  46 
apply safe 
47 
apply (erule_tac [2] natE) 

48 
apply (rule_tac a="succ(x)" in UN_I) 

49 
apply simp_all 

50 
apply blast 

51 
done 

52 

53 
lemma lfp_subset_Union: 

54 
"[bnd_mono(D, h); contin(h)] ==> lfp(D,h) <= (\<Union>n\<in>nat. h^n(0))" 

55 
apply (rule lfp_lowerbound) 

56 
apply (simp add: contin_iterates_eq) 

57 
apply (simp add: contin_def bnd_mono_iterates_subset UN_subset_iff) 

58 
done 

59 

60 
lemma Union_subset_lfp: 

61 
"bnd_mono(D,h) ==> (\<Union>n\<in>nat. h^n(0)) <= lfp(D,h)" 

62 
apply (simp add: UN_subset_iff) 

63 
apply (rule ballI) 

13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
13306
diff
changeset

64 
apply (induct_tac n, simp_all) 
13268  65 
apply (rule subset_trans [of _ "h(lfp(D,h))"]) 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

66 
apply (blast dest: bnd_monoD2 [OF _ _ lfp_subset]) 
13268  67 
apply (erule lfp_lemma2) 
68 
done 

69 

70 
lemma lfp_eq_Union: 

71 
"[bnd_mono(D, h); contin(h)] ==> lfp(D,h) = (\<Union>n\<in>nat. h^n(0))" 

72 
by (blast del: subsetI 

73 
intro: lfp_subset_Union Union_subset_lfp) 

74 

75 

13385
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

76 
subsubsection{*Some Standard Datatype Constructions Preserve Continuity*} 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

77 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

78 
lemma contin_imp_mono: "[X\<subseteq>Y; contin(F)] ==> F(X) \<subseteq> F(Y)" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

79 
apply (simp add: contin_def) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

80 
apply (drule_tac x="{X,Y}" in spec) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

81 
apply (simp add: directed_def subset_Un_iff2 Un_commute) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

82 
done 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

83 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

84 
lemma sum_contin: "[contin(F); contin(G)] ==> contin(\<lambda>X. F(X) + G(X))" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

85 
by (simp add: contin_def, blast) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

86 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

87 
lemma prod_contin: "[contin(F); contin(G)] ==> contin(\<lambda>X. F(X) * G(X))" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

88 
apply (subgoal_tac "\<forall>B C. F(B) \<subseteq> F(B \<union> C)") 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

89 
prefer 2 apply (simp add: Un_upper1 contin_imp_mono) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

90 
apply (subgoal_tac "\<forall>B C. G(C) \<subseteq> G(B \<union> C)") 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

91 
prefer 2 apply (simp add: Un_upper2 contin_imp_mono) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

92 
apply (simp add: contin_def, clarify) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

93 
apply (rule equalityI) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

94 
prefer 2 apply blast 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

95 
apply clarify 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

96 
apply (rename_tac B C) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

97 
apply (rule_tac a="B \<union> C" in UN_I) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

98 
apply (simp add: directed_def, blast) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

99 
done 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

100 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

101 
lemma const_contin: "contin(\<lambda>X. A)" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

102 
by (simp add: contin_def directed_def) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

103 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

104 
lemma id_contin: "contin(\<lambda>X. X)" 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

105 
by (simp add: contin_def) 
31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

106 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

107 

31df66ca0780
Expressing Lset and L without using length and arity; simplifies Separation
paulson
parents:
13382
diff
changeset

108 

13268  109 
subsection {*Absoluteness for "Iterates"*} 
110 

13353  111 
constdefs 
112 

113 
iterates_MH :: "[i=>o, [i,i]=>o, i, i, i, i] => o" 

114 
"iterates_MH(M,isF,v,n,g,z) == 

115 
is_nat_case(M, v, \<lambda>m u. \<exists>gm[M]. fun_apply(M,g,m,gm) & isF(gm,u), 

116 
n, z)" 

117 

118 
iterates_replacement :: "[i=>o, [i,i]=>o, i] => o" 

119 
"iterates_replacement(M,isF,v) == 

13363  120 
\<forall>n[M]. n\<in>nat > 
13353  121 
wfrec_replacement(M, iterates_MH(M,isF,v), Memrel(succ(n)))" 
122 

123 
lemma (in M_axioms) iterates_MH_abs: 

124 
"[ relativize1(M,isF,F); M(n); M(g); M(z) ] 

125 
==> iterates_MH(M,isF,v,n,g,z) <> z = nat_case(v, \<lambda>m. F(g`m), n)" 

13363  126 
by (simp add: nat_case_abs [of _ "\<lambda>m. F(g ` m)"] 
127 
relativize1_def iterates_MH_def) 

13353  128 

129 
lemma (in M_axioms) iterates_imp_wfrec_replacement: 

130 
"[relativize1(M,isF,F); n \<in> nat; iterates_replacement(M,isF,v)] 

131 
==> wfrec_replacement(M, \<lambda>n f z. z = nat_case(v, \<lambda>m. F(f`m), n), 

132 
Memrel(succ(n)))" 

133 
by (simp add: iterates_replacement_def iterates_MH_abs) 

134 

135 
theorem (in M_trancl) iterates_abs: 

136 
"[ iterates_replacement(M,isF,v); relativize1(M,isF,F); 

137 
n \<in> nat; M(v); M(z); \<forall>x[M]. M(F(x)) ] 

138 
==> is_wfrec(M, iterates_MH(M,isF,v), Memrel(succ(n)), n, z) <> 

139 
z = iterates(F,n,v)" 

140 
apply (frule iterates_imp_wfrec_replacement, assumption+) 

141 
apply (simp add: wf_Memrel trans_Memrel relation_Memrel nat_into_M 

142 
relativize2_def iterates_MH_abs 

143 
iterates_nat_def recursor_def transrec_def 

144 
eclose_sing_Ord_eq nat_into_M 

145 
trans_wfrec_abs [of _ _ _ _ "\<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n)"]) 

146 
done 

147 

13268  148 

149 
lemma (in M_wfrank) iterates_closed [intro,simp]: 

13353  150 
"[ iterates_replacement(M,isF,v); relativize1(M,isF,F); 
151 
n \<in> nat; M(v); \<forall>x[M]. M(F(x)) ] 

13268  152 
==> M(iterates(F,n,v))" 
13353  153 
apply (frule iterates_imp_wfrec_replacement, assumption+) 
154 
apply (simp add: wf_Memrel trans_Memrel relation_Memrel nat_into_M 

155 
relativize2_def iterates_MH_abs 

156 
iterates_nat_def recursor_def transrec_def 

157 
eclose_sing_Ord_eq nat_into_M 

158 
trans_wfrec_closed [of _ _ _ "\<lambda>n g. nat_case(v, \<lambda>m. F(g`m), n)"]) 

159 
done 

13268  160 

161 

13386  162 
subsection {*lists without univ*} 
163 

164 
lemmas datatype_univs = Inl_in_univ Inr_in_univ 

165 
Pair_in_univ nat_into_univ A_into_univ 

166 

167 
lemma list_fun_bnd_mono: "bnd_mono(univ(A), \<lambda>X. {0} + A*X)" 

168 
apply (rule bnd_monoI) 

169 
apply (intro subset_refl zero_subset_univ A_subset_univ 

170 
sum_subset_univ Sigma_subset_univ) 

171 
apply (rule subset_refl sum_mono Sigma_mono  assumption)+ 

172 
done 

173 

174 
lemma list_fun_contin: "contin(\<lambda>X. {0} + A*X)" 

175 
by (intro sum_contin prod_contin id_contin const_contin) 

176 

177 
text{*Reexpresses lists using sum and product*} 

178 
lemma list_eq_lfp2: "list(A) = lfp(univ(A), \<lambda>X. {0} + A*X)" 

179 
apply (simp add: list_def) 

180 
apply (rule equalityI) 

181 
apply (rule lfp_lowerbound) 

182 
prefer 2 apply (rule lfp_subset) 

183 
apply (clarify, subst lfp_unfold [OF list_fun_bnd_mono]) 

184 
apply (simp add: Nil_def Cons_def) 

185 
apply blast 

186 
txt{*Opposite inclusion*} 

187 
apply (rule lfp_lowerbound) 

188 
prefer 2 apply (rule lfp_subset) 

189 
apply (clarify, subst lfp_unfold [OF list.bnd_mono]) 

190 
apply (simp add: Nil_def Cons_def) 

191 
apply (blast intro: datatype_univs 

192 
dest: lfp_subset [THEN subsetD]) 

193 
done 

194 

195 
text{*Reexpresses lists using "iterates", no univ.*} 

196 
lemma list_eq_Union: 

197 
"list(A) = (\<Union>n\<in>nat. (\<lambda>X. {0} + A*X) ^ n (0))" 

198 
by (simp add: list_eq_lfp2 lfp_eq_Union list_fun_bnd_mono list_fun_contin) 

199 

200 

13350  201 
constdefs 
202 
is_list_functor :: "[i=>o,i,i,i] => o" 

203 
"is_list_functor(M,A,X,Z) == 

204 
\<exists>n1[M]. \<exists>AX[M]. 

205 
number1(M,n1) & cartprod(M,A,X,AX) & is_sum(M,n1,AX,Z)" 

206 

207 
lemma (in M_axioms) list_functor_abs [simp]: 

208 
"[ M(A); M(X); M(Z) ] ==> is_list_functor(M,A,X,Z) <> (Z = {0} + A*X)" 

209 
by (simp add: is_list_functor_def singleton_0 nat_into_M) 

210 

211 

13386  212 
subsection {*formulas without univ*} 
213 

214 
lemma formula_fun_bnd_mono: 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

215 
"bnd_mono(univ(0), \<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X))" 
13386  216 
apply (rule bnd_monoI) 
217 
apply (intro subset_refl zero_subset_univ A_subset_univ 

218 
sum_subset_univ Sigma_subset_univ nat_subset_univ) 

219 
apply (rule subset_refl sum_mono Sigma_mono  assumption)+ 

220 
done 

221 

222 
lemma formula_fun_contin: 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

223 
"contin(\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X))" 
13386  224 
by (intro sum_contin prod_contin id_contin const_contin) 
225 

226 

227 
text{*Reexpresses formulas using sum and product*} 

228 
lemma formula_eq_lfp2: 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

229 
"formula = lfp(univ(0), \<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X))" 
13386  230 
apply (simp add: formula_def) 
231 
apply (rule equalityI) 

232 
apply (rule lfp_lowerbound) 

233 
prefer 2 apply (rule lfp_subset) 

234 
apply (clarify, subst lfp_unfold [OF formula_fun_bnd_mono]) 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

235 
apply (simp add: Member_def Equal_def Nand_def Forall_def) 
13386  236 
apply blast 
237 
txt{*Opposite inclusion*} 

238 
apply (rule lfp_lowerbound) 

239 
prefer 2 apply (rule lfp_subset, clarify) 

240 
apply (subst lfp_unfold [OF formula.bnd_mono, simplified]) 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

241 
apply (simp add: Member_def Equal_def Nand_def Forall_def) 
13386  242 
apply (elim sumE SigmaE, simp_all) 
243 
apply (blast intro: datatype_univs dest: lfp_subset [THEN subsetD])+ 

244 
done 

245 

246 
text{*Reexpresses formulas using "iterates", no univ.*} 

247 
lemma formula_eq_Union: 

248 
"formula = 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

249 
(\<Union>n\<in>nat. (\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X)) ^ n (0))" 
13386  250 
by (simp add: formula_eq_lfp2 lfp_eq_Union formula_fun_bnd_mono 
251 
formula_fun_contin) 

252 

253 

254 
constdefs 

255 
is_formula_functor :: "[i=>o,i,i] => o" 

256 
"is_formula_functor(M,X,Z) == 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

257 
\<exists>nat'[M]. \<exists>natnat[M]. \<exists>natnatsum[M]. \<exists>XX[M]. \<exists>X3[M]. 
13386  258 
omega(M,nat') & cartprod(M,nat',nat',natnat) & 
259 
is_sum(M,natnat,natnat,natnatsum) & 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

260 
cartprod(M,X,X,XX) & is_sum(M,XX,X,X3) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

261 
is_sum(M,natnatsum,X3,Z)" 
13386  262 

263 
lemma (in M_axioms) formula_functor_abs [simp]: 

264 
"[ M(X); M(Z) ] 

265 
==> is_formula_functor(M,X,Z) <> 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

266 
Z = ((nat*nat) + (nat*nat)) + (X*X + X)" 
13386  267 
by (simp add: is_formula_functor_def) 
268 

269 

270 
subsection{*@{term M} Contains the List and Formula Datatypes*} 

13395  271 

272 
constdefs 

13397  273 
list_N :: "[i,i] => i" 
274 
"list_N(A,n) == (\<lambda>X. {0} + A * X)^n (0)" 

275 

276 
lemma Nil_in_list_N [simp]: "[] \<in> list_N(A,succ(n))" 

277 
by (simp add: list_N_def Nil_def) 

278 

279 
lemma Cons_in_list_N [simp]: 

280 
"Cons(a,l) \<in> list_N(A,succ(n)) <> a\<in>A & l \<in> list_N(A,n)" 

281 
by (simp add: list_N_def Cons_def) 

282 

283 
text{*These two aren't simprules because they reveal the underlying 

284 
list representation.*} 

285 
lemma list_N_0: "list_N(A,0) = 0" 

286 
by (simp add: list_N_def) 

287 

288 
lemma list_N_succ: "list_N(A,succ(n)) = {0} + A * (list_N(A,n))" 

289 
by (simp add: list_N_def) 

290 

291 
lemma list_N_imp_list: 

292 
"[ l \<in> list_N(A,n); n \<in> nat ] ==> l \<in> list(A)" 

293 
by (force simp add: list_eq_Union list_N_def) 

294 

295 
lemma list_N_imp_length_lt [rule_format]: 

296 
"n \<in> nat ==> \<forall>l \<in> list_N(A,n). length(l) < n" 

297 
apply (induct_tac n) 

298 
apply (auto simp add: list_N_0 list_N_succ 

299 
Nil_def [symmetric] Cons_def [symmetric]) 

300 
done 

301 

302 
lemma list_imp_list_N [rule_format]: 

303 
"l \<in> list(A) ==> \<forall>n\<in>nat. length(l) < n > l \<in> list_N(A, n)" 

304 
apply (induct_tac l) 

305 
apply (force elim: natE)+ 

306 
done 

307 

308 
lemma list_N_imp_eq_length: 

309 
"[n \<in> nat; l \<notin> list_N(A, n); l \<in> list_N(A, succ(n))] 

310 
==> n = length(l)" 

311 
apply (rule le_anti_sym) 

312 
prefer 2 apply (simp add: list_N_imp_length_lt) 

313 
apply (frule list_N_imp_list, simp) 

314 
apply (simp add: not_lt_iff_le [symmetric]) 

315 
apply (blast intro: list_imp_list_N) 

316 
done 

317 

318 
text{*Express @{term list_rec} without using @{term rank} or @{term Vset}, 

319 
neither of which is absolute.*} 

320 
lemma (in M_triv_axioms) list_rec_eq: 

321 
"l \<in> list(A) ==> 

322 
list_rec(a,g,l) = 

323 
transrec (succ(length(l)), 

13409
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

324 
\<lambda>x h. Lambda (list(A), 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

325 
list_case' (a, 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

326 
\<lambda>a l. g(a, l, h ` succ(length(l)) ` l)))) ` l" 
13397  327 
apply (induct_tac l) 
328 
apply (subst transrec, simp) 

329 
apply (subst transrec) 

330 
apply (simp add: list_imp_list_N) 

331 
done 

332 

333 
constdefs 

334 
is_list_N :: "[i=>o,i,i,i] => o" 

335 
"is_list_N(M,A,n,Z) == 

13395  336 
\<exists>zero[M]. \<exists>sn[M]. \<exists>msn[M]. 
337 
empty(M,zero) & 

338 
successor(M,n,sn) & membership(M,sn,msn) & 

339 
is_wfrec(M, iterates_MH(M, is_list_functor(M,A),zero), msn, n, Z)" 

340 

341 
mem_list :: "[i=>o,i,i] => o" 

342 
"mem_list(M,A,l) == 

343 
\<exists>n[M]. \<exists>listn[M]. 

13397  344 
finite_ordinal(M,n) & is_list_N(M,A,n,listn) & l \<in> listn" 
13395  345 

346 
is_list :: "[i=>o,i,i] => o" 

347 
"is_list(M,A,Z) == \<forall>l[M]. l \<in> Z <> mem_list(M,A,l)" 

348 

349 
constdefs 

350 
is_formula_n :: "[i=>o,i,i] => o" 

351 
"is_formula_n(M,n,Z) == 

352 
\<exists>zero[M]. \<exists>sn[M]. \<exists>msn[M]. 

353 
empty(M,zero) & 

354 
successor(M,n,sn) & membership(M,sn,msn) & 

355 
is_wfrec(M, iterates_MH(M, is_formula_functor(M),zero), msn, n, Z)" 

356 

357 
mem_formula :: "[i=>o,i] => o" 

358 
"mem_formula(M,p) == 

359 
\<exists>n[M]. \<exists>formn[M]. 

360 
finite_ordinal(M,n) & is_formula_n(M,n,formn) & p \<in> formn" 

361 

362 
is_formula :: "[i=>o,i] => o" 

363 
"is_formula(M,Z) == \<forall>p[M]. p \<in> Z <> mem_formula(M,p)" 

364 

13428  365 
locale M_datatypes = M_wfrank + 
13353  366 
assumes list_replacement1: 
13363  367 
"M(A) ==> iterates_replacement(M, is_list_functor(M,A), 0)" 
13353  368 
and list_replacement2: 
13363  369 
"M(A) ==> strong_replacement(M, 
13353  370 
\<lambda>n y. n\<in>nat & 
371 
(\<exists>sn[M]. \<exists>msn[M]. successor(M,n,sn) & membership(M,sn,msn) & 

13363  372 
is_wfrec(M, iterates_MH(M,is_list_functor(M,A), 0), 
13353  373 
msn, n, y)))" 
13386  374 
and formula_replacement1: 
375 
"iterates_replacement(M, is_formula_functor(M), 0)" 

376 
and formula_replacement2: 

377 
"strong_replacement(M, 

378 
\<lambda>n y. n\<in>nat & 

379 
(\<exists>sn[M]. \<exists>msn[M]. successor(M,n,sn) & membership(M,sn,msn) & 

380 
is_wfrec(M, iterates_MH(M,is_formula_functor(M), 0), 

381 
msn, n, y)))" 

13422
af9bc8d87a75
Added the assumption nth_replacement to locale M_datatypes.
paulson
parents:
13418
diff
changeset

382 
and nth_replacement: 
af9bc8d87a75
Added the assumption nth_replacement to locale M_datatypes.
paulson
parents:
13418
diff
changeset

383 
"M(l) ==> iterates_replacement(M, %l t. is_tl(M,l,t), l)" 
af9bc8d87a75
Added the assumption nth_replacement to locale M_datatypes.
paulson
parents:
13418
diff
changeset

384 

13395  385 

386 
subsubsection{*Absoluteness of the List Construction*} 

387 

13348  388 
lemma (in M_datatypes) list_replacement2': 
13353  389 
"M(A) ==> strong_replacement(M, \<lambda>n y. n\<in>nat & y = (\<lambda>X. {0} + A * X)^n (0))" 
390 
apply (insert list_replacement2 [of A]) 

391 
apply (rule strong_replacement_cong [THEN iffD1]) 

392 
apply (rule conj_cong [OF iff_refl iterates_abs [of "is_list_functor(M,A)"]]) 

13363  393 
apply (simp_all add: list_replacement1 relativize1_def) 
13353  394 
done 
13268  395 

396 
lemma (in M_datatypes) list_closed [intro,simp]: 

397 
"M(A) ==> M(list(A))" 

13353  398 
apply (insert list_replacement1) 
399 
by (simp add: RepFun_closed2 list_eq_Union 

400 
list_replacement2' relativize1_def 

401 
iterates_closed [of "is_list_functor(M,A)"]) 

13397  402 

13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

403 
text{*WARNING: use only with @{text "dest:"} or with variables fixed!*} 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

404 
lemmas (in M_datatypes) list_into_M = transM [OF _ list_closed] 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

405 

13397  406 
lemma (in M_datatypes) list_N_abs [simp]: 
13395  407 
"[M(A); n\<in>nat; M(Z)] 
13397  408 
==> is_list_N(M,A,n,Z) <> Z = list_N(A,n)" 
13395  409 
apply (insert list_replacement1) 
13397  410 
apply (simp add: is_list_N_def list_N_def relativize1_def nat_into_M 
13395  411 
iterates_abs [of "is_list_functor(M,A)" _ "\<lambda>X. {0} + A*X"]) 
412 
done 

13268  413 

13397  414 
lemma (in M_datatypes) list_N_closed [intro,simp]: 
415 
"[M(A); n\<in>nat] ==> M(list_N(A,n))" 

416 
apply (insert list_replacement1) 

417 
apply (simp add: is_list_N_def list_N_def relativize1_def nat_into_M 

418 
iterates_closed [of "is_list_functor(M,A)"]) 

419 
done 

420 

13395  421 
lemma (in M_datatypes) mem_list_abs [simp]: 
422 
"M(A) ==> mem_list(M,A,l) <> l \<in> list(A)" 

423 
apply (insert list_replacement1) 

13397  424 
apply (simp add: mem_list_def list_N_def relativize1_def list_eq_Union 
13395  425 
iterates_closed [of "is_list_functor(M,A)"]) 
426 
done 

427 

428 
lemma (in M_datatypes) list_abs [simp]: 

429 
"[M(A); M(Z)] ==> is_list(M,A,Z) <> Z = list(A)" 

430 
apply (simp add: is_list_def, safe) 

431 
apply (rule M_equalityI, simp_all) 

432 
done 

433 

434 
subsubsection{*Absoluteness of Formulas*} 

13293  435 

13386  436 
lemma (in M_datatypes) formula_replacement2': 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

437 
"strong_replacement(M, \<lambda>n y. n\<in>nat & y = (\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X))^n (0))" 
13386  438 
apply (insert formula_replacement2) 
439 
apply (rule strong_replacement_cong [THEN iffD1]) 

440 
apply (rule conj_cong [OF iff_refl iterates_abs [of "is_formula_functor(M)"]]) 

441 
apply (simp_all add: formula_replacement1 relativize1_def) 

442 
done 

443 

444 
lemma (in M_datatypes) formula_closed [intro,simp]: 

445 
"M(formula)" 

446 
apply (insert formula_replacement1) 

447 
apply (simp add: RepFun_closed2 formula_eq_Union 

448 
formula_replacement2' relativize1_def 

449 
iterates_closed [of "is_formula_functor(M)"]) 

450 
done 

451 

13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

452 
lemmas (in M_datatypes) formula_into_M = transM [OF _ formula_closed] 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

453 

13395  454 
lemma (in M_datatypes) is_formula_n_abs [simp]: 
455 
"[n\<in>nat; M(Z)] 

456 
==> is_formula_n(M,n,Z) <> 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

457 
Z = (\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X))^n (0)" 
13395  458 
apply (insert formula_replacement1) 
459 
apply (simp add: is_formula_n_def relativize1_def nat_into_M 

460 
iterates_abs [of "is_formula_functor(M)" _ 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

461 
"\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X)"]) 
13395  462 
done 
463 

464 
lemma (in M_datatypes) mem_formula_abs [simp]: 

465 
"mem_formula(M,l) <> l \<in> formula" 

466 
apply (insert formula_replacement1) 

467 
apply (simp add: mem_formula_def relativize1_def formula_eq_Union 

468 
iterates_closed [of "is_formula_functor(M)"]) 

469 
done 

470 

471 
lemma (in M_datatypes) formula_abs [simp]: 

472 
"[M(Z)] ==> is_formula(M,Z) <> Z = formula" 

473 
apply (simp add: is_formula_def, safe) 

474 
apply (rule M_equalityI, simp_all) 

475 
done 

476 

477 

13397  478 
subsection{*Absoluteness for Some List Operators*} 
479 

13395  480 
subsection{*Absoluteness for @{text \<epsilon>}Closure: the @{term eclose} Operator*} 
481 

482 
text{*Reexpresses eclose using "iterates"*} 

483 
lemma eclose_eq_Union: 

484 
"eclose(A) = (\<Union>n\<in>nat. Union^n (A))" 

485 
apply (simp add: eclose_def) 

486 
apply (rule UN_cong) 

487 
apply (rule refl) 

488 
apply (induct_tac n) 

489 
apply (simp add: nat_rec_0) 

490 
apply (simp add: nat_rec_succ) 

491 
done 

492 

493 
constdefs 

494 
is_eclose_n :: "[i=>o,i,i,i] => o" 

495 
"is_eclose_n(M,A,n,Z) == 

496 
\<exists>sn[M]. \<exists>msn[M]. 

497 
successor(M,n,sn) & membership(M,sn,msn) & 

498 
is_wfrec(M, iterates_MH(M, big_union(M), A), msn, n, Z)" 

499 

500 
mem_eclose :: "[i=>o,i,i] => o" 

501 
"mem_eclose(M,A,l) == 

502 
\<exists>n[M]. \<exists>eclosen[M]. 

503 
finite_ordinal(M,n) & is_eclose_n(M,A,n,eclosen) & l \<in> eclosen" 

504 

505 
is_eclose :: "[i=>o,i,i] => o" 

506 
"is_eclose(M,A,Z) == \<forall>u[M]. u \<in> Z <> mem_eclose(M,A,u)" 

507 

508 

13428  509 
locale M_eclose = M_datatypes + 
13395  510 
assumes eclose_replacement1: 
511 
"M(A) ==> iterates_replacement(M, big_union(M), A)" 

512 
and eclose_replacement2: 

513 
"M(A) ==> strong_replacement(M, 

514 
\<lambda>n y. n\<in>nat & 

515 
(\<exists>sn[M]. \<exists>msn[M]. successor(M,n,sn) & membership(M,sn,msn) & 

516 
is_wfrec(M, iterates_MH(M,big_union(M), A), 

517 
msn, n, y)))" 

518 

519 
lemma (in M_eclose) eclose_replacement2': 

520 
"M(A) ==> strong_replacement(M, \<lambda>n y. n\<in>nat & y = Union^n (A))" 

521 
apply (insert eclose_replacement2 [of A]) 

522 
apply (rule strong_replacement_cong [THEN iffD1]) 

523 
apply (rule conj_cong [OF iff_refl iterates_abs [of "big_union(M)"]]) 

524 
apply (simp_all add: eclose_replacement1 relativize1_def) 

525 
done 

526 

527 
lemma (in M_eclose) eclose_closed [intro,simp]: 

528 
"M(A) ==> M(eclose(A))" 

529 
apply (insert eclose_replacement1) 

530 
by (simp add: RepFun_closed2 eclose_eq_Union 

531 
eclose_replacement2' relativize1_def 

532 
iterates_closed [of "big_union(M)"]) 

533 

534 
lemma (in M_eclose) is_eclose_n_abs [simp]: 

535 
"[M(A); n\<in>nat; M(Z)] ==> is_eclose_n(M,A,n,Z) <> Z = Union^n (A)" 

536 
apply (insert eclose_replacement1) 

537 
apply (simp add: is_eclose_n_def relativize1_def nat_into_M 

538 
iterates_abs [of "big_union(M)" _ "Union"]) 

539 
done 

540 

541 
lemma (in M_eclose) mem_eclose_abs [simp]: 

542 
"M(A) ==> mem_eclose(M,A,l) <> l \<in> eclose(A)" 

543 
apply (insert eclose_replacement1) 

544 
apply (simp add: mem_eclose_def relativize1_def eclose_eq_Union 

545 
iterates_closed [of "big_union(M)"]) 

546 
done 

547 

548 
lemma (in M_eclose) eclose_abs [simp]: 

549 
"[M(A); M(Z)] ==> is_eclose(M,A,Z) <> Z = eclose(A)" 

550 
apply (simp add: is_eclose_def, safe) 

551 
apply (rule M_equalityI, simp_all) 

552 
done 

553 

554 

555 

556 

557 
subsection {*Absoluteness for @{term transrec}*} 

558 

559 

560 
text{* @{term "transrec(a,H) \<equiv> wfrec(Memrel(eclose({a})), a, H)"} *} 

561 
constdefs 

562 

563 
is_transrec :: "[i=>o, [i,i,i]=>o, i, i] => o" 

564 
"is_transrec(M,MH,a,z) == 

565 
\<exists>sa[M]. \<exists>esa[M]. \<exists>mesa[M]. 

566 
upair(M,a,a,sa) & is_eclose(M,sa,esa) & membership(M,esa,mesa) & 

567 
is_wfrec(M,MH,mesa,a,z)" 

568 

569 
transrec_replacement :: "[i=>o, [i,i,i]=>o, i] => o" 

570 
"transrec_replacement(M,MH,a) == 

571 
\<exists>sa[M]. \<exists>esa[M]. \<exists>mesa[M]. 

572 
upair(M,a,a,sa) & is_eclose(M,sa,esa) & membership(M,esa,mesa) & 

573 
wfrec_replacement(M,MH,mesa)" 

574 

575 
text{*The condition @{term "Ord(i)"} lets us use the simpler 

576 
@{text "trans_wfrec_abs"} rather than @{text "trans_wfrec_abs"}, 

577 
which I haven't even proved yet. *} 

578 
theorem (in M_eclose) transrec_abs: 

13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

579 
"[transrec_replacement(M,MH,i); relativize2(M,MH,H); 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

580 
Ord(i); M(i); M(z); 
13395  581 
\<forall>x[M]. \<forall>g[M]. function(g) > M(H(x,g))] 
582 
==> is_transrec(M,MH,i,z) <> z = transrec(i,H)" 

13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

583 
apply (rotate_tac 2) 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

584 
apply (simp add: trans_wfrec_abs transrec_replacement_def is_transrec_def 
13395  585 
transrec_def eclose_sing_Ord_eq wf_Memrel trans_Memrel relation_Memrel) 
13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

586 
done 
13395  587 

588 

589 
theorem (in M_eclose) transrec_closed: 

13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

590 
"[transrec_replacement(M,MH,i); relativize2(M,MH,H); 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

591 
Ord(i); M(i); 
13395  592 
\<forall>x[M]. \<forall>g[M]. function(g) > M(H(x,g))] 
593 
==> M(transrec(i,H))" 

13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

594 
apply (rotate_tac 2) 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

595 
apply (simp add: trans_wfrec_closed transrec_replacement_def is_transrec_def 
13395  596 
transrec_def eclose_sing_Ord_eq wf_Memrel trans_Memrel relation_Memrel) 
13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

597 
done 
13395  598 

13440  599 
text{*Helps to prove instances of @{term transrec_replacement}*} 
600 
lemma (in M_eclose) transrec_replacementI: 

601 
"[M(a); 

602 
strong_replacement (M, 

603 
\<lambda>x z. \<exists>y[M]. pair(M, x, y, z) \<and> is_wfrec(M,MH,Memrel(eclose({a})),x,y))] 

604 
==> transrec_replacement(M,MH,a)" 

605 
by (simp add: transrec_replacement_def wfrec_replacement_def) 

606 

13395  607 

13397  608 
subsection{*Absoluteness for the List Operator @{term length}*} 
609 
constdefs 

610 

611 
is_length :: "[i=>o,i,i,i] => o" 

612 
"is_length(M,A,l,n) == 

613 
\<exists>sn[M]. \<exists>list_n[M]. \<exists>list_sn[M]. 

614 
is_list_N(M,A,n,list_n) & l \<notin> list_n & 

615 
successor(M,n,sn) & is_list_N(M,A,sn,list_sn) & l \<in> list_sn" 

616 

617 

618 
lemma (in M_datatypes) length_abs [simp]: 

619 
"[M(A); l \<in> list(A); n \<in> nat] ==> is_length(M,A,l,n) <> n = length(l)" 

620 
apply (subgoal_tac "M(l) & M(n)") 

621 
prefer 2 apply (blast dest: transM) 

622 
apply (simp add: is_length_def) 

623 
apply (blast intro: list_imp_list_N nat_into_Ord list_N_imp_eq_length 

624 
dest: list_N_imp_length_lt) 

625 
done 

626 

627 
text{*Proof is trivial since @{term length} returns natural numbers.*} 

628 
lemma (in M_triv_axioms) length_closed [intro,simp]: 

629 
"l \<in> list(A) ==> M(length(l))" 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

630 
by (simp add: nat_into_M) 
13397  631 

632 

633 
subsection {*Absoluteness for @{term nth}*} 

634 

635 
lemma nth_eq_hd_iterates_tl [rule_format]: 

636 
"xs \<in> list(A) ==> \<forall>n \<in> nat. nth(n,xs) = hd' (tl'^n (xs))" 

637 
apply (induct_tac xs) 

638 
apply (simp add: iterates_tl_Nil hd'_Nil, clarify) 

639 
apply (erule natE) 

640 
apply (simp add: hd'_Cons) 

641 
apply (simp add: tl'_Cons iterates_commute) 

642 
done 

643 

644 
lemma (in M_axioms) iterates_tl'_closed: 

645 
"[n \<in> nat; M(x)] ==> M(tl'^n (x))" 

646 
apply (induct_tac n, simp) 

647 
apply (simp add: tl'_Cons tl'_closed) 

648 
done 

649 

650 
text{*Immediate by typechecking*} 

651 
lemma (in M_datatypes) nth_closed [intro,simp]: 

652 
"[xs \<in> list(A); n \<in> nat; M(A)] ==> M(nth(n,xs))" 

653 
apply (case_tac "n < length(xs)") 

654 
apply (blast intro: nth_type transM) 

655 
apply (simp add: not_lt_iff_le nth_eq_0) 

656 
done 

657 

658 
constdefs 

659 
is_nth :: "[i=>o,i,i,i] => o" 

660 
"is_nth(M,n,l,Z) == 

661 
\<exists>X[M]. \<exists>sn[M]. \<exists>msn[M]. 

662 
successor(M,n,sn) & membership(M,sn,msn) & 

663 
is_wfrec(M, iterates_MH(M, is_tl(M), l), msn, n, X) & 

664 
is_hd(M,X,Z)" 

665 

13409
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

666 
lemma (in M_datatypes) nth_abs [simp]: 
13422
af9bc8d87a75
Added the assumption nth_replacement to locale M_datatypes.
paulson
parents:
13418
diff
changeset

667 
"[M(A); n \<in> nat; l \<in> list(A); M(Z)] 
13397  668 
==> is_nth(M,n,l,Z) <> Z = nth(n,l)" 
669 
apply (subgoal_tac "M(l)") 

670 
prefer 2 apply (blast intro: transM) 

671 
apply (simp add: is_nth_def nth_eq_hd_iterates_tl nat_into_M 

672 
tl'_closed iterates_tl'_closed 

13422
af9bc8d87a75
Added the assumption nth_replacement to locale M_datatypes.
paulson
parents:
13418
diff
changeset

673 
iterates_abs [OF _ relativize1_tl] nth_replacement) 
13397  674 
done 
675 

13395  676 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

677 
subsection{*Relativization and Absoluteness for the @{term formula} Constructors*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

678 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

679 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

680 
is_Member :: "[i=>o,i,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

681 
{* because @{term "Member(x,y) \<equiv> Inl(Inl(\<langle>x,y\<rangle>))"}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

682 
"is_Member(M,x,y,Z) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

683 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inl(M,u,Z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

684 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

685 
lemma (in M_triv_axioms) Member_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

686 
"[M(x); M(y); M(Z)] ==> is_Member(M,x,y,Z) <> (Z = Member(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

687 
by (simp add: is_Member_def Member_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

688 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

689 
lemma (in M_triv_axioms) Member_in_M_iff [iff]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

690 
"M(Member(x,y)) <> M(x) & M(y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

691 
by (simp add: Member_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

692 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

693 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

694 
is_Equal :: "[i=>o,i,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

695 
{* because @{term "Equal(x,y) \<equiv> Inl(Inr(\<langle>x,y\<rangle>))"}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

696 
"is_Equal(M,x,y,Z) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

697 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inr(M,p,u) & is_Inl(M,u,Z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

698 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

699 
lemma (in M_triv_axioms) Equal_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

700 
"[M(x); M(y); M(Z)] ==> is_Equal(M,x,y,Z) <> (Z = Equal(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

701 
by (simp add: is_Equal_def Equal_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

702 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

703 
lemma (in M_triv_axioms) Equal_in_M_iff [iff]: "M(Equal(x,y)) <> M(x) & M(y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

704 
by (simp add: Equal_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

705 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

706 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

707 
is_Nand :: "[i=>o,i,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

708 
{* because @{term "Nand(x,y) \<equiv> Inr(Inl(\<langle>x,y\<rangle>))"}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

709 
"is_Nand(M,x,y,Z) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

710 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inr(M,u,Z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

711 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

712 
lemma (in M_triv_axioms) Nand_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

713 
"[M(x); M(y); M(Z)] ==> is_Nand(M,x,y,Z) <> (Z = Nand(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

714 
by (simp add: is_Nand_def Nand_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

715 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

716 
lemma (in M_triv_axioms) Nand_in_M_iff [iff]: "M(Nand(x,y)) <> M(x) & M(y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

717 
by (simp add: Nand_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

718 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

719 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

720 
is_Forall :: "[i=>o,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

721 
{* because @{term "Forall(x) \<equiv> Inr(Inr(p))"}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

722 
"is_Forall(M,p,Z) == \<exists>u[M]. is_Inr(M,p,u) & is_Inr(M,u,Z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

723 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

724 
lemma (in M_triv_axioms) Forall_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

725 
"[M(x); M(Z)] ==> is_Forall(M,x,Z) <> (Z = Forall(x))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

726 
by (simp add: is_Forall_def Forall_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

727 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

728 
lemma (in M_triv_axioms) Forall_in_M_iff [iff]: "M(Forall(x)) <> M(x)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

729 
by (simp add: Forall_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

730 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

731 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

732 
subsection {*Absoluteness for @{term formula_rec}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

733 

13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

734 
subsubsection{*@{term is_formula_case}: relativization of @{term formula_case}*} 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

735 

7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

736 
constdefs 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

737 

7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

738 
is_formula_case :: 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

739 
"[i=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i]=>o, i, i] => o" 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

740 
{*no constraint on nonformulas*} 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

741 
"is_formula_case(M, is_a, is_b, is_c, is_d, p, z) == 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

742 
(\<forall>x[M]. \<forall>y[M]. x\<in>nat > y\<in>nat > is_Member(M,x,y,p) > is_a(x,y,z)) & 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

743 
(\<forall>x[M]. \<forall>y[M]. x\<in>nat > y\<in>nat > is_Equal(M,x,y,p) > is_b(x,y,z)) & 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

744 
(\<forall>x[M]. \<forall>y[M]. x\<in>formula > y\<in>formula > 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

745 
is_Nand(M,x,y,p) > is_c(x,y,z)) & 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

746 
(\<forall>x[M]. x\<in>formula > is_Forall(M,x,p) > is_d(x,z))" 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

747 

7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

748 
lemma (in M_datatypes) formula_case_abs [simp]: 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

749 
"[ Relativize2(M,nat,nat,is_a,a); Relativize2(M,nat,nat,is_b,b); 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

750 
Relativize2(M,formula,formula,is_c,c); Relativize1(M,formula,is_d,d); 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

751 
p \<in> formula; M(z) ] 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

752 
==> is_formula_case(M,is_a,is_b,is_c,is_d,p,z) <> 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

753 
z = formula_case(a,b,c,d,p)" 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

754 
apply (simp add: formula_into_M is_formula_case_def) 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

755 
apply (erule formula.cases) 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

756 
apply (simp_all add: Relativize1_def Relativize2_def) 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

757 
done 
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

758 

7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

759 

13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

760 
subsubsection{*@{term quasiformula}: For CaseSplitting with @{term formula_case'}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

761 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

762 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

763 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

764 
quasiformula :: "i => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

765 
"quasiformula(p) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

766 
(\<exists>x y. p = Member(x,y))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

767 
(\<exists>x y. p = Equal(x,y))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

768 
(\<exists>x y. p = Nand(x,y))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

769 
(\<exists>x. p = Forall(x))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

770 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

771 
is_quasiformula :: "[i=>o,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

772 
"is_quasiformula(M,p) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

773 
(\<exists>x[M]. \<exists>y[M]. is_Member(M,x,y,p))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

774 
(\<exists>x[M]. \<exists>y[M]. is_Equal(M,x,y,p))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

775 
(\<exists>x[M]. \<exists>y[M]. is_Nand(M,x,y,p))  
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

776 
(\<exists>x[M]. is_Forall(M,x,p))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

777 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

778 
lemma [iff]: "quasiformula(Member(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

779 
by (simp add: quasiformula_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

780 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

781 
lemma [iff]: "quasiformula(Equal(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

782 
by (simp add: quasiformula_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

783 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

784 
lemma [iff]: "quasiformula(Nand(x,y))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

785 
by (simp add: quasiformula_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

786 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

787 
lemma [iff]: "quasiformula(Forall(x))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

788 
by (simp add: quasiformula_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

789 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

790 
lemma formula_imp_quasiformula: "p \<in> formula ==> quasiformula(p)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

791 
by (erule formula.cases, simp_all) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

792 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

793 
lemma (in M_triv_axioms) quasiformula_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

794 
"M(z) ==> is_quasiformula(M,z) <> quasiformula(z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

795 
by (auto simp add: is_quasiformula_def quasiformula_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

796 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

797 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

798 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

799 
formula_case' :: "[[i,i]=>i, [i,i]=>i, [i,i]=>i, i=>i, i] => i" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

800 
{*A version of @{term formula_case} that's always defined.*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

801 
"formula_case'(a,b,c,d,p) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

802 
if quasiformula(p) then formula_case(a,b,c,d,p) else 0" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

803 

13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

804 
is_formula_case' :: 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

805 
"[i=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i,i]=>o, [i,i]=>o, i, i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

806 
{*Returns 0 for nonformulas*} 
13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

807 
"is_formula_case'(M, is_a, is_b, is_c, is_d, p, z) == 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

808 
(\<forall>x[M]. \<forall>y[M]. is_Member(M,x,y,p) > is_a(x,y,z)) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

809 
(\<forall>x[M]. \<forall>y[M]. is_Equal(M,x,y,p) > is_b(x,y,z)) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

810 
(\<forall>x[M]. \<forall>y[M]. is_Nand(M,x,y,p) > is_c(x,y,z)) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

811 
(\<forall>x[M]. is_Forall(M,x,p) > is_d(x,z)) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

812 
(is_quasiformula(M,p)  empty(M,z))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

813 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

814 
subsubsection{*@{term formula_case'}, the Modified Version of @{term formula_case}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

815 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

816 
lemma formula_case'_Member [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

817 
"formula_case'(a,b,c,d,Member(x,y)) = a(x,y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

818 
by (simp add: formula_case'_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

819 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

820 
lemma formula_case'_Equal [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

821 
"formula_case'(a,b,c,d,Equal(x,y)) = b(x,y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

822 
by (simp add: formula_case'_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

823 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

824 
lemma formula_case'_Nand [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

825 
"formula_case'(a,b,c,d,Nand(x,y)) = c(x,y)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

826 
by (simp add: formula_case'_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

827 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

828 
lemma formula_case'_Forall [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

829 
"formula_case'(a,b,c,d,Forall(x)) = d(x)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

830 
by (simp add: formula_case'_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

831 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

832 
lemma non_formula_case: "~ quasiformula(x) ==> formula_case'(a,b,c,d,x) = 0" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

833 
by (simp add: quasiformula_def formula_case'_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

834 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

835 
lemma formula_case'_eq_formula_case [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

836 
"p \<in> formula ==>formula_case'(a,b,c,d,p) = formula_case(a,b,c,d,p)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

837 
by (erule formula.cases, simp_all) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

838 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

839 
lemma (in M_axioms) formula_case'_closed [intro,simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

840 
"[M(p); \<forall>x[M]. \<forall>y[M]. M(a(x,y)); 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

841 
\<forall>x[M]. \<forall>y[M]. M(b(x,y)); 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

842 
\<forall>x[M]. \<forall>y[M]. M(c(x,y)); 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

843 
\<forall>x[M]. M(d(x))] ==> M(formula_case'(a,b,c,d,p))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

844 
apply (case_tac "quasiformula(p)") 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

845 
apply (simp add: quasiformula_def, force) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

846 
apply (simp add: non_formula_case) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

847 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

848 

13418
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

849 
text{*Compared with @{text formula_case_closed'}, the premise on @{term p} is 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

850 
stronger while the other premises are weaker, incorporating typing 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

851 
information.*} 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

852 
lemma (in M_datatypes) formula_case_closed [intro,simp]: 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

853 
"[p \<in> formula; 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

854 
\<forall>x[M]. \<forall>y[M]. x\<in>nat > y\<in>nat > M(a(x,y)); 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

855 
\<forall>x[M]. \<forall>y[M]. x\<in>nat > y\<in>nat > M(b(x,y)); 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

856 
\<forall>x[M]. \<forall>y[M]. x\<in>formula > y\<in>formula > M(c(x,y)); 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

857 
\<forall>x[M]. x\<in>formula > M(d(x))] ==> M(formula_case(a,b,c,d,p))" 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

858 
by (erule formula.cases, simp_all) 
7c0ba9dba978
tweaks, aiming towards relativization of "satisfies"
paulson
parents:
13409
diff
changeset

859 

13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

860 
lemma (in M_triv_axioms) formula_case'_abs [simp]: 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

861 
"[ relativize2(M,is_a,a); relativize2(M,is_b,b); 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

862 
relativize2(M,is_c,c); relativize1(M,is_d,d); M(p); M(z) ] 
13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

863 
==> is_formula_case'(M,is_a,is_b,is_c,is_d,p,z) <> 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

864 
z = formula_case'(a,b,c,d,p)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

865 
apply (case_tac "quasiformula(p)") 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

866 
prefer 2 
13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

867 
apply (simp add: is_formula_case'_def non_formula_case) 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

868 
apply (force simp add: quasiformula_def) 
13423
7ec771711c09
More lemmas, working towards relativization of "satisfies"
paulson
parents:
13422
diff
changeset

869 
apply (simp add: quasiformula_def is_formula_case'_def) 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

870 
apply (elim disjE exE) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

871 
apply (simp_all add: relativize1_def relativize2_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

872 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

873 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

874 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

875 
subsubsection{*Towards Absoluteness of @{term formula_rec}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

876 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

877 
consts depth :: "i=>i" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

878 
primrec 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

879 
"depth(Member(x,y)) = 0" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

880 
"depth(Equal(x,y)) = 0" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

881 
"depth(Nand(p,q)) = succ(depth(p) \<union> depth(q))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

882 
"depth(Forall(p)) = succ(depth(p))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

883 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

884 
lemma depth_type [TC]: "p \<in> formula ==> depth(p) \<in> nat" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

885 
by (induct_tac p, simp_all) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

886 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

887 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

888 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

889 
formula_N :: "i => i" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

890 
"formula_N(n) == (\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X)) ^ n (0)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

891 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

892 
lemma Member_in_formula_N [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

893 
"Member(x,y) \<in> formula_N(succ(n)) <> x \<in> nat & y \<in> nat" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

894 
by (simp add: formula_N_def Member_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

895 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

896 
lemma Equal_in_formula_N [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

897 
"Equal(x,y) \<in> formula_N(succ(n)) <> x \<in> nat & y \<in> nat" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

898 
by (simp add: formula_N_def Equal_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

899 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

900 
lemma Nand_in_formula_N [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

901 
"Nand(x,y) \<in> formula_N(succ(n)) <> x \<in> formula_N(n) & y \<in> formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

902 
by (simp add: formula_N_def Nand_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

903 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

904 
lemma Forall_in_formula_N [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

905 
"Forall(x) \<in> formula_N(succ(n)) <> x \<in> formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

906 
by (simp add: formula_N_def Forall_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

907 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

908 
text{*These two aren't simprules because they reveal the underlying 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

909 
formula representation.*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

910 
lemma formula_N_0: "formula_N(0) = 0" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

911 
by (simp add: formula_N_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

912 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

913 
lemma formula_N_succ: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

914 
"formula_N(succ(n)) = 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

915 
((nat*nat) + (nat*nat)) + (formula_N(n) * formula_N(n) + formula_N(n))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

916 
by (simp add: formula_N_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

917 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

918 
lemma formula_N_imp_formula: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

919 
"[ p \<in> formula_N(n); n \<in> nat ] ==> p \<in> formula" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

920 
by (force simp add: formula_eq_Union formula_N_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

921 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

922 
lemma formula_N_imp_depth_lt [rule_format]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

923 
"n \<in> nat ==> \<forall>p \<in> formula_N(n). depth(p) < n" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

924 
apply (induct_tac n) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

925 
apply (auto simp add: formula_N_0 formula_N_succ 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

926 
depth_type formula_N_imp_formula Un_least_lt_iff 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

927 
Member_def [symmetric] Equal_def [symmetric] 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

928 
Nand_def [symmetric] Forall_def [symmetric]) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

929 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

930 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

931 
lemma formula_imp_formula_N [rule_format]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

932 
"p \<in> formula ==> \<forall>n\<in>nat. depth(p) < n > p \<in> formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

933 
apply (induct_tac p) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

934 
apply (simp_all add: succ_Un_distrib Un_least_lt_iff) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

935 
apply (force elim: natE)+ 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

936 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

937 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

938 
lemma formula_N_imp_eq_depth: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

939 
"[n \<in> nat; p \<notin> formula_N(n); p \<in> formula_N(succ(n))] 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

940 
==> n = depth(p)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

941 
apply (rule le_anti_sym) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

942 
prefer 2 apply (simp add: formula_N_imp_depth_lt) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

943 
apply (frule formula_N_imp_formula, simp) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

944 
apply (simp add: not_lt_iff_le [symmetric]) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

945 
apply (blast intro: formula_imp_formula_N) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

946 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

947 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

948 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

949 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

950 
lemma formula_N_mono [rule_format]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

951 
"[ m \<in> nat; n \<in> nat ] ==> m\<le>n > formula_N(m) \<subseteq> formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

952 
apply (rule_tac m = m and n = n in diff_induct) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

953 
apply (simp_all add: formula_N_0 formula_N_succ, blast) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

954 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

955 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

956 
lemma formula_N_distrib: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

957 
"[ m \<in> nat; n \<in> nat ] ==> formula_N(m \<union> n) = formula_N(m) \<union> formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

958 
apply (rule_tac i = m and j = n in Ord_linear_le, auto) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

959 
apply (simp_all add: subset_Un_iff [THEN iffD1] subset_Un_iff2 [THEN iffD1] 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

960 
le_imp_subset formula_N_mono) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

961 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

962 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

963 
text{*Express @{term formula_rec} without using @{term rank} or @{term Vset}, 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

964 
neither of which is absolute.*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

965 
lemma (in M_triv_axioms) formula_rec_eq: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

966 
"p \<in> formula ==> 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

967 
formula_rec(a,b,c,d,p) = 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

968 
transrec (succ(depth(p)), 
13409
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

969 
\<lambda>x h. Lambda (formula, 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

970 
formula_case' (a, b, 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

971 
\<lambda>u v. c(u, v, h ` succ(depth(u)) ` u, 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

972 
h ` succ(depth(v)) ` v), 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

973 
\<lambda>u. d(u, h ` succ(depth(u)) ` u)))) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

974 
` p" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

975 
apply (induct_tac p) 
13409
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

976 
txt{*Base case for @{term Member}*} 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

977 
apply (subst transrec, simp add: formula.intros) 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

978 
txt{*Base case for @{term Equal}*} 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

979 
apply (subst transrec, simp add: formula.intros) 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

980 
txt{*Inductive step for @{term Nand}*} 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

981 
apply (subst transrec) 
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

982 
apply (simp add: succ_Un_distrib formula.intros) 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

983 
txt{*Inductive step for @{term Forall}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

984 
apply (subst transrec) 
13409
d4ea094c650e
Relativization and Separation for the function "nth"
paulson
parents:
13398
diff
changeset

985 
apply (simp add: formula_imp_formula_N formula.intros) 
13398
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

986 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

987 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

988 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

989 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

990 
is_formula_N :: "[i=>o,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

991 
"is_formula_N(M,n,Z) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

992 
\<exists>zero[M]. \<exists>sn[M]. \<exists>msn[M]. 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

993 
empty(M,zero) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

994 
successor(M,n,sn) & membership(M,sn,msn) & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

995 
is_wfrec(M, iterates_MH(M, is_formula_functor(M),zero), msn, n, Z)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

996 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

997 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

998 
lemma (in M_datatypes) formula_N_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

999 
"[n\<in>nat; M(Z)] 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1000 
==> is_formula_N(M,n,Z) <> Z = formula_N(n)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1001 
apply (insert formula_replacement1) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1002 
apply (simp add: is_formula_N_def formula_N_def relativize1_def nat_into_M 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1003 
iterates_abs [of "is_formula_functor(M)" _ 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1004 
"\<lambda>X. ((nat*nat) + (nat*nat)) + (X*X + X)"]) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1005 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1006 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1007 
lemma (in M_datatypes) formula_N_closed [intro,simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1008 
"n\<in>nat ==> M(formula_N(n))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1009 
apply (insert formula_replacement1) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1010 
apply (simp add: is_formula_N_def formula_N_def relativize1_def nat_into_M 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1011 
iterates_closed [of "is_formula_functor(M)"]) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1012 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1013 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1014 
subsection{*Absoluteness for the Formula Operator @{term depth}*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1015 
constdefs 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1016 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1017 
is_depth :: "[i=>o,i,i] => o" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1018 
"is_depth(M,p,n) == 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1019 
\<exists>sn[M]. \<exists>formula_n[M]. \<exists>formula_sn[M]. 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1020 
is_formula_N(M,n,formula_n) & p \<notin> formula_n & 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1021 
successor(M,n,sn) & is_formula_N(M,sn,formula_sn) & p \<in> formula_sn" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1022 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1023 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1024 
lemma (in M_datatypes) depth_abs [simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1025 
"[p \<in> formula; n \<in> nat] ==> is_depth(M,p,n) <> n = depth(p)" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1026 
apply (subgoal_tac "M(p) & M(n)") 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1027 
prefer 2 apply (blast dest: transM) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1028 
apply (simp add: is_depth_def) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1029 
apply (blast intro: formula_imp_formula_N nat_into_Ord formula_N_imp_eq_depth 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1030 
dest: formula_N_imp_depth_lt) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1031 
done 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1032 

1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1033 
text{*Proof is trivial since @{term depth} returns natural numbers.*} 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1034 
lemma (in M_triv_axioms) depth_closed [intro,simp]: 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1035 
"p \<in> formula ==> M(depth(p))" 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1036 
by (simp add: nat_into_M) 
1cadd412da48
Towards relativization and absoluteness of formula_rec
paulson
parents:
13397
diff
changeset

1037 

13268  1038 
end 