diff --git a/thys/Forcing/Forces_Definition.thy b/thys/Forcing/Forces_Definition.thy --- a/thys/Forcing/Forces_Definition.thy +++ b/thys/Forcing/Forces_Definition.thy @@ -1,1793 +1,1793 @@ section\The definition of \<^term>\forces\\ theory Forces_Definition imports Arities FrecR Synthetic_Definition begin text\This is the core of our development.\ subsection\The relation \<^term>\frecrel\\ definition frecrelP :: "[i\o,i] \ o" where "frecrelP(M,xy) \ (\x[M]. \y[M]. pair(M,x,y,xy) \ is_frecR(M,x,y))" definition frecrelP_fm :: "i \ i" where - "frecrelP_fm(a) \ Exists(Exists(And(pair_fm(1,0,a#+2),frecR_fm(0,1))))" + "frecrelP_fm(a) \ Exists(Exists(And(pair_fm(1,0,a#+2),frecR_fm(1,0))))" lemma arity_frecrelP_fm : "a\nat \ arity(frecrelP_fm(a)) = succ(a)" unfolding frecrelP_fm_def using arity_frecR_fm arity_pair_fm pred_Un_distrib by simp lemma frecrelP_fm_type[TC] : "a\nat \ frecrelP_fm(a)\formula" unfolding frecrelP_fm_def by simp lemma sats_frecrelP_fm : assumes "a\nat" "env\list(A)" shows "sats(A,frecrelP_fm(a),env) \ frecrelP(##A,nth(a, env))" unfolding frecrelP_def frecrelP_fm_def using assms by (auto simp add:frecR_fm_iff_sats[symmetric]) lemma frecrelP_iff_sats: assumes "nth(a,env) = aa" "a\ nat" "env \ list(A)" shows "frecrelP(##A,aa) \ sats(A, frecrelP_fm(a), env)" using assms by (simp add:sats_frecrelP_fm) definition is_frecrel :: "[i\o,i,i] \ o" where "is_frecrel(M,A,r) \ \A2[M]. cartprod(M,A,A,A2) \ is_Collect(M,A2, frecrelP(M) ,r)" definition frecrel_fm :: "[i,i] \ i" where "frecrel_fm(a,r) \ Exists(And(cartprod_fm(a#+1,a#+1,0),Collect_fm(0,frecrelP_fm(0),r#+1)))" lemma frecrel_fm_type[TC] : "\a\nat;b\nat\ \ frecrel_fm(a,b)\formula" unfolding frecrel_fm_def by simp lemma arity_frecrel_fm : assumes "a\nat" "b\nat" shows "arity(frecrel_fm(a,b)) = succ(a) \ succ(b)" unfolding frecrel_fm_def using assms arity_Collect_fm arity_cartprod_fm arity_frecrelP_fm pred_Un_distrib by auto lemma sats_frecrel_fm : assumes "a\nat" "r\nat" "env\list(A)" shows "sats(A,frecrel_fm(a,r),env) \ is_frecrel(##A,nth(a, env),nth(r, env))" unfolding is_frecrel_def frecrel_fm_def using assms by (simp add:sats_Collect_fm sats_frecrelP_fm) lemma is_frecrel_iff_sats: assumes "nth(a,env) = aa" "nth(r,env) = rr" "a\ nat" "r\ nat" "env \ list(A)" shows "is_frecrel(##A, aa,rr) \ sats(A, frecrel_fm(a,r), env)" using assms by (simp add:sats_frecrel_fm) definition names_below :: "i \ i \ i" where "names_below(P,x) \ 2\ecloseN(x)\ecloseN(x)\P" lemma names_belowsD: assumes "x \ names_below(P,z)" obtains f n1 n2 p where "x = \f,n1,n2,p\" "f\2" "n1\ecloseN(z)" "n2\ecloseN(z)" "p\P" using assms unfolding names_below_def by auto definition is_names_below :: "[i\o,i,i,i] \ o" where "is_names_below(M,P,x,nb) \ \p1[M]. \p0[M]. \t[M]. \ec[M]. is_ecloseN(M,ec,x) \ number2(M,t) \ cartprod(M,ec,P,p0) \ cartprod(M,ec,p0,p1) \ cartprod(M,t,p1,nb)" definition number2_fm :: "i\i" where "number2_fm(a) \ Exists(And(number1_fm(0), succ_fm(0,succ(a))))" lemma number2_fm_type[TC] : "a\nat \ number2_fm(a) \ formula" unfolding number2_fm_def by simp lemma number2arity__fm : "a\nat \ arity(number2_fm(a)) = succ(a)" unfolding number2_fm_def using number1arity__fm arity_succ_fm nat_union_abs2 pred_Un_distrib by simp lemma sats_number2_fm [simp]: "\ x \ nat; env \ list(A) \ \ sats(A, number2_fm(x), env) \ number2(##A, nth(x,env))" by (simp add: number2_fm_def number2_def) definition is_names_below_fm :: "[i,i,i] \ i" where "is_names_below_fm(P,x,nb) \ Exists(Exists(Exists(Exists( And(ecloseN_fm(0,x #+ 4),And(number2_fm(1), And(cartprod_fm(0,P #+ 4,2),And(cartprod_fm(0,2,3),cartprod_fm(1,3,nb#+4)))))))))" lemma arity_is_names_below_fm : "\P\nat;x\nat;nb\nat\ \ arity(is_names_below_fm(P,x,nb)) = succ(P) \ succ(x) \ succ(nb)" unfolding is_names_below_fm_def using arity_cartprod_fm number2arity__fm arity_ecloseN_fm nat_union_abs2 pred_Un_distrib by auto lemma is_names_below_fm_type[TC]: "\P\nat;x\nat;nb\nat\ \ is_names_below_fm(P,x,nb)\formula" unfolding is_names_below_fm_def by simp lemma sats_is_names_below_fm : assumes "P\nat" "x\nat" "nb\nat" "env\list(A)" shows "sats(A,is_names_below_fm(P,x,nb),env) \ is_names_below(##A,nth(P, env),nth(x, env),nth(nb, env))" unfolding is_names_below_fm_def is_names_below_def using assms by simp definition is_tuple :: "[i\o,i,i,i,i,i] \ o" where "is_tuple(M,z,t1,t2,p,t) \ \t1t2p[M]. \t2p[M]. pair(M,t2,p,t2p) \ pair(M,t1,t2p,t1t2p) \ pair(M,z,t1t2p,t)" definition is_tuple_fm :: "[i,i,i,i,i] \ i" where "is_tuple_fm(z,t1,t2,p,tup) = Exists(Exists(And(pair_fm(t2 #+ 2,p #+ 2,0), And(pair_fm(t1 #+ 2,0,1),pair_fm(z #+ 2,1,tup #+ 2)))))" lemma arity_is_tuple_fm : "\ z\nat ; t1\nat ; t2\nat ; p\nat ; tup\nat \ \ arity(is_tuple_fm(z,t1,t2,p,tup)) = \ {succ(z),succ(t1),succ(t2),succ(p),succ(tup)}" unfolding is_tuple_fm_def using arity_pair_fm nat_union_abs1 nat_union_abs2 pred_Un_distrib by auto lemma is_tuple_fm_type[TC] : "z\nat \ t1\nat \ t2\nat \ p\nat \ tup\nat \ is_tuple_fm(z,t1,t2,p,tup)\formula" unfolding is_tuple_fm_def by simp lemma sats_is_tuple_fm : assumes "z\nat" "t1\nat" "t2\nat" "p\nat" "tup\nat" "env\list(A)" shows "sats(A,is_tuple_fm(z,t1,t2,p,tup),env) \ is_tuple(##A,nth(z, env),nth(t1, env),nth(t2, env),nth(p, env),nth(tup, env))" unfolding is_tuple_def is_tuple_fm_def using assms by simp lemma is_tuple_iff_sats: assumes "nth(a,env) = aa" "nth(b,env) = bb" "nth(c,env) = cc" "nth(d,env) = dd" "nth(e,env) = ee" "a\nat" "b\nat" "c\nat" "d\nat" "e\nat" "env \ list(A)" shows "is_tuple(##A,aa,bb,cc,dd,ee) \ sats(A, is_tuple_fm(a,b,c,d,e), env)" using assms by (simp add: sats_is_tuple_fm) subsection\Definition of \<^term>\forces\ for equality and membership\ (* p ||- \ = \ \ \\. \\domain(\) \ domain(\) \ (\q\P. \q,p\\leq \ ((q ||- \\\) \ (q ||- \\\)) ) *) definition eq_case :: "[i,i,i,i,i,i] \ o" where "eq_case(t1,t2,p,P,leq,f) \ \s. s\domain(t1) \ domain(t2) \ (\q. q\P \ \q,p\\leq \ (f`\1,s,t1,q\=1 \ f`\1,s,t2,q\ =1))" definition is_eq_case :: "[i\o,i,i,i,i,i,i] \ o" where "is_eq_case(M,t1,t2,p,P,leq,f) \ \s[M]. (\d[M]. is_domain(M,t1,d) \ s\d) \ (\d[M]. is_domain(M,t2,d) \ s\d) \ (\q[M]. q\P \ (\qp[M]. pair(M,q,p,qp) \ qp\leq) \ (\ost1q[M]. \ost2q[M]. \o[M]. \vf1[M]. \vf2[M]. is_tuple(M,o,s,t1,q,ost1q) \ is_tuple(M,o,s,t2,q,ost2q) \ number1(M,o) \ fun_apply(M,f,ost1q,vf1) \ fun_apply(M,f,ost2q,vf2) \ (vf1 = o \ vf2 = o)))" (* p ||- \ \ \ \ \v\P. \v,p\\leq \ (\q\P. \q,v\\leq \ (\\. \r\P. \\,r\\\ \ \q,r\\leq \ q ||- \ = \)) *) definition mem_case :: "[i,i,i,i,i,i] \ o" where "mem_case(t1,t2,p,P,leq,f) \ \v\P. \v,p\\leq \ (\q. \s. \r. r\P \ q\P \ \q,v\\leq \ \s,r\ \ t2 \ \q,r\\leq \ f`\0,t1,s,q\ = 1)" definition is_mem_case :: "[i\o,i,i,i,i,i,i] \ o" where "is_mem_case(M,t1,t2,p,P,leq,f) \ \v[M]. \vp[M]. v\P \ pair(M,v,p,vp) \ vp\leq \ (\q[M]. \s[M]. \r[M]. \qv[M]. \sr[M]. \qr[M]. \z[M]. \zt1sq[M]. \o[M]. r\ P \ q\P \ pair(M,q,v,qv) \ pair(M,s,r,sr) \ pair(M,q,r,qr) \ empty(M,z) \ is_tuple(M,z,t1,s,q,zt1sq) \ number1(M,o) \ qv\leq \ sr\t2 \ qr\leq \ fun_apply(M,f,zt1sq,o))" schematic_goal sats_is_mem_case_fm_auto: assumes "n1\nat" "n2\nat" "p\nat" "P\nat" "leq\nat" "f\nat" "env\list(A)" shows "is_mem_case(##A, nth(n1, env),nth(n2, env),nth(p, env),nth(P, env), nth(leq, env),nth(f,env)) \ sats(A,?imc_fm(n1,n2,p,P,leq,f),env)" unfolding is_mem_case_def by (insert assms ; (rule sep_rules' is_tuple_iff_sats | simp)+) synthesize "mem_case_fm" from_schematic sats_is_mem_case_fm_auto lemma arity_mem_case_fm : assumes "n1\nat" "n2\nat" "p\nat" "P\nat" "leq\nat" "f\nat" shows "arity(mem_case_fm(n1,n2,p,P,leq,f)) = succ(n1) \ succ(n2) \ succ(p) \ succ(P) \ succ(leq) \ succ(f)" unfolding mem_case_fm_def using assms arity_pair_fm arity_is_tuple_fm number1arity__fm arity_fun_apply_fm arity_empty_fm pred_Un_distrib by auto schematic_goal sats_is_eq_case_fm_auto: assumes "n1\nat" "n2\nat" "p\nat" "P\nat" "leq\nat" "f\nat" "env\list(A)" shows "is_eq_case(##A, nth(n1, env),nth(n2, env),nth(p, env),nth(P, env), nth(leq, env),nth(f,env)) \ sats(A,?iec_fm(n1,n2,p,P,leq,f),env)" unfolding is_eq_case_def by (insert assms ; (rule sep_rules' is_tuple_iff_sats | simp)+) synthesize "eq_case_fm" from_schematic sats_is_eq_case_fm_auto lemma arity_eq_case_fm : assumes "n1\nat" "n2\nat" "p\nat" "P\nat" "leq\nat" "f\nat" shows "arity(eq_case_fm(n1,n2,p,P,leq,f)) = succ(n1) \ succ(n2) \ succ(p) \ succ(P) \ succ(leq) \ succ(f)" unfolding eq_case_fm_def using assms arity_pair_fm arity_is_tuple_fm number1arity__fm arity_fun_apply_fm arity_empty_fm arity_domain_fm pred_Un_distrib by auto definition Hfrc :: "[i,i,i,i] \ o" where "Hfrc(P,leq,fnnc,f) \ \ft. \n1. \n2. \c. c\P \ fnnc = \ft,n1,n2,c\ \ ( ft = 0 \ eq_case(n1,n2,c,P,leq,f) \ ft = 1 \ mem_case(n1,n2,c,P,leq,f))" definition is_Hfrc :: "[i\o,i,i,i,i] \ o" where "is_Hfrc(M,P,leq,fnnc,f) \ \ft[M]. \n1[M]. \n2[M]. \co[M]. co\P \ is_tuple(M,ft,n1,n2,co,fnnc) \ ( (empty(M,ft) \ is_eq_case(M,n1,n2,co,P,leq,f)) \ (number1(M,ft) \ is_mem_case(M,n1,n2,co,P,leq,f)))" definition Hfrc_fm :: "[i,i,i,i] \ i" where "Hfrc_fm(P,leq,fnnc,f) \ Exists(Exists(Exists(Exists( And(Member(0,P #+ 4),And(is_tuple_fm(3,2,1,0,fnnc #+ 4), - Or(And(empty_fm(3),eq_case_fm(leq #+ 4,1,2,0,f #+ 4,P #+ 4)), - And(number1_fm(3),mem_case_fm(leq #+ 4,1,2,0,f #+ 4,P #+ 4)))))))))" + Or(And(empty_fm(3),eq_case_fm(2,1,0,P #+ 4,leq #+ 4,f #+ 4)), + And(number1_fm(3),mem_case_fm(2,1,0,P #+ 4,leq #+ 4,f #+ 4)))))))))" lemma Hfrc_fm_type[TC] : "\P\nat;leq\nat;fnnc\nat;f\nat\ \ Hfrc_fm(P,leq,fnnc,f)\formula" unfolding Hfrc_fm_def by simp lemma arity_Hfrc_fm : assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" shows "arity(Hfrc_fm(P,leq,fnnc,f)) = succ(P) \ succ(leq) \ succ(fnnc) \ succ(f)" unfolding Hfrc_fm_def using assms arity_is_tuple_fm arity_mem_case_fm arity_eq_case_fm arity_empty_fm number1arity__fm pred_Un_distrib by auto lemma sats_Hfrc_fm: assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" "env\list(A)" shows "sats(A,Hfrc_fm(P,leq,fnnc,f),env) \ is_Hfrc(##A,nth(P, env), nth(leq, env), nth(fnnc, env),nth(f, env))" unfolding is_Hfrc_def Hfrc_fm_def using assms by (simp add: sats_is_tuple_fm eq_case_fm_iff_sats[symmetric] mem_case_fm_iff_sats[symmetric]) lemma Hfrc_iff_sats: assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" "env\list(A)" "nth(P,env) = PP" "nth(leq,env) = lleq" "nth(fnnc,env) = ffnnc" "nth(f,env) = ff" shows "is_Hfrc(##A, PP, lleq,ffnnc,ff) \ sats(A,Hfrc_fm(P,leq,fnnc,f),env)" using assms by (simp add:sats_Hfrc_fm) definition is_Hfrc_at :: "[i\o,i,i,i,i,i] \ o" where "is_Hfrc_at(M,P,leq,fnnc,f,z) \ (empty(M,z) \ \ is_Hfrc(M,P,leq,fnnc,f)) \ (number1(M,z) \ is_Hfrc(M,P,leq,fnnc,f))" definition Hfrc_at_fm :: "[i,i,i,i,i] \ i" where "Hfrc_at_fm(P,leq,fnnc,f,z) \ Or(And(empty_fm(z),Neg(Hfrc_fm(P,leq,fnnc,f))), And(number1_fm(z),Hfrc_fm(P,leq,fnnc,f)))" lemma arity_Hfrc_at_fm : assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" "z\nat" shows "arity(Hfrc_at_fm(P,leq,fnnc,f,z)) = succ(P) \ succ(leq) \ succ(fnnc) \ succ(f) \ succ(z)" unfolding Hfrc_at_fm_def using assms arity_Hfrc_fm arity_empty_fm number1arity__fm pred_Un_distrib by auto lemma Hfrc_at_fm_type[TC] : "\P\nat;leq\nat;fnnc\nat;f\nat;z\nat\ \ Hfrc_at_fm(P,leq,fnnc,f,z)\formula" unfolding Hfrc_at_fm_def by simp lemma sats_Hfrc_at_fm: assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" "z\nat" "env\list(A)" shows "sats(A,Hfrc_at_fm(P,leq,fnnc,f,z),env) \ is_Hfrc_at(##A,nth(P, env), nth(leq, env), nth(fnnc, env),nth(f, env),nth(z, env))" unfolding is_Hfrc_at_def Hfrc_at_fm_def using assms sats_Hfrc_fm by simp lemma is_Hfrc_at_iff_sats: assumes "P\nat" "leq\nat" "fnnc\nat" "f\nat" "z\nat" "env\list(A)" "nth(P,env) = PP" "nth(leq,env) = lleq" "nth(fnnc,env) = ffnnc" "nth(f,env) = ff" "nth(z,env) = zz" shows "is_Hfrc_at(##A, PP, lleq,ffnnc,ff,zz) \ sats(A,Hfrc_at_fm(P,leq,fnnc,f,z),env)" using assms by (simp add:sats_Hfrc_at_fm) lemma arity_tran_closure_fm : "\x\nat;f\nat\ \ arity(trans_closure_fm(x,f)) = succ(x) \ succ(f)" unfolding trans_closure_fm_def using arity_omega_fm arity_field_fm arity_typed_function_fm arity_pair_fm arity_empty_fm arity_fun_apply_fm arity_composition_fm arity_succ_fm nat_union_abs2 pred_Un_distrib by auto subsection\The well-founded relation \<^term>\forcerel\\ definition forcerel :: "i \ i \ i" where "forcerel(P,x) \ frecrel(names_below(P,x))^+" definition is_forcerel :: "[i\o,i,i,i] \ o" where "is_forcerel(M,P,x,z) \ \r[M]. \nb[M]. tran_closure(M,r,z) \ (is_names_below(M,P,x,nb) \ is_frecrel(M,nb,r))" definition forcerel_fm :: "i\ i \ i \ i" where - "forcerel_fm(p,x,z) \ Exists(Exists(And(trans_closure_fm(z#+2,1), + "forcerel_fm(p,x,z) \ Exists(Exists(And(trans_closure_fm(1, z#+2), And(is_names_below_fm(p#+2,x#+2,0),frecrel_fm(0,1)))))" lemma arity_forcerel_fm: "\p\nat;x\nat;z\nat\ \ arity(forcerel_fm(p,x,z)) = succ(p) \ succ(x) \ succ(z)" unfolding forcerel_fm_def using arity_frecrel_fm arity_tran_closure_fm arity_is_names_below_fm pred_Un_distrib by auto lemma forcerel_fm_type[TC]: "\p\nat;x\nat;z\nat\ \ forcerel_fm(p,x,z)\formula" unfolding forcerel_fm_def by simp lemma sats_forcerel_fm: assumes "p\nat" "x\nat" "z\nat" "env\list(A)" shows "sats(A,forcerel_fm(p,x,z),env) \ is_forcerel(##A,nth(p,env),nth(x, env),nth(z, env))" proof - - have "sats(A,trans_closure_fm(z #+ 2,1),Cons(nb,Cons(r,env))) \ + have "sats(A,trans_closure_fm(1,z #+ 2),Cons(nb,Cons(r,env))) \ tran_closure(##A, r, nth(z, env))" if "r\A" "nb\A" for r nb using that assms trans_closure_fm_iff_sats[of 1 "[nb,r]@env" _ "z#+2",symmetric] by simp moreover have "sats(A, is_names_below_fm(succ(succ(p)), succ(succ(x)), 0), Cons(nb, Cons(r, env))) \ is_names_below(##A, nth(p,env), nth(x, env), nb)" if "r\A" "nb\A" for nb r using assms that sats_is_names_below_fm[of "p #+ 2" "x #+ 2" 0 "[nb,r]@env"] by simp moreover have "sats(A, frecrel_fm(0, 1), Cons(nb, Cons(r, env))) \ is_frecrel(##A, nb, r)" if "r\A" "nb\A" for r nb using assms that sats_frecrel_fm[of 0 1 "[nb,r]@env"] by simp ultimately show ?thesis using assms unfolding is_forcerel_def forcerel_fm_def by simp qed subsection\\<^term>\frc_at\, forcing for atomic formulas\ definition frc_at :: "[i,i,i] \ i" where "frc_at(P,leq,fnnc) \ wfrec(frecrel(names_below(P,fnnc)),fnnc, \x f. bool_of_o(Hfrc(P,leq,x,f)))" definition is_frc_at :: "[i\o,i,i,i,i] \ o" where "is_frc_at(M,P,leq,x,z) \ \r[M]. is_forcerel(M,P,x,r) \ is_wfrec(M,is_Hfrc_at(M,P,leq),r,x,z)" definition frc_at_fm :: "[i,i,i,i] \ i" where "frc_at_fm(p,l,x,z) \ Exists(And(forcerel_fm(succ(p),succ(x),0), is_wfrec_fm(Hfrc_at_fm(6#+p,6#+l,2,1,0),0,succ(x),succ(z))))" lemma frc_at_fm_type [TC] : "\p\nat;l\nat;x\nat;z\nat\ \ frc_at_fm(p,l,x,z)\formula" unfolding frc_at_fm_def by simp lemma arity_frc_at_fm : assumes "p\nat" "l\nat" "x\nat" "z\nat" shows "arity(frc_at_fm(p,l,x,z)) = succ(p) \ succ(l) \ succ(x) \ succ(z)" proof - let ?\ = "Hfrc_at_fm(6 #+ p, 6 #+ l, 2, 1, 0)" from assms have "arity(?\) = (7#+p) \ (7#+l)" "?\ \ formula" using arity_Hfrc_at_fm nat_simp_union by auto with assms have W: "arity(is_wfrec_fm(?\, 0, succ(x), succ(z))) = 2#+p \ (2#+l) \ (2#+x) \ (2#+z)" using arity_is_wfrec_fm[OF \?\\_\ _ _ _ _ \arity(?\) = _\] pred_Un_distrib pred_succ_eq nat_union_abs1 by auto from assms have "arity(forcerel_fm(succ(p),succ(x),0)) = succ(succ(p)) \ succ(succ(x))" using arity_forcerel_fm nat_simp_union by auto with W assms show ?thesis unfolding frc_at_fm_def using arity_forcerel_fm pred_Un_distrib by auto qed lemma sats_frc_at_fm : assumes "p\nat" "l\nat" "i\nat" "j\nat" "env\list(A)" "i < length(env)" "j < length(env)" shows "sats(A,frc_at_fm(p,l,i,j),env) \ is_frc_at(##A,nth(p,env),nth(l,env),nth(i,env),nth(j,env))" proof - { fix r pp ll assume "r\A" have 0:"is_Hfrc_at(##A,nth(p,env),nth(l,env),a2, a1, a0) \ sats(A, Hfrc_at_fm(6#+p,6#+l,2,1,0), [a0,a1,a2,a3,a4,r]@env)" if "a0\A" "a1\A" "a2\A" "a3\A" "a4\A" for a0 a1 a2 a3 a4 using that assms \r\A\ is_Hfrc_at_iff_sats[of "6#+p" "6#+l" 2 1 0 "[a0,a1,a2,a3,a4,r]@env" A] by simp have "sats(A,is_wfrec_fm(Hfrc_at_fm(6 #+ p, 6 #+ l, 2, 1, 0), 0, succ(i), succ(j)),[r]@env) \ is_wfrec(##A, is_Hfrc_at(##A, nth(p,env), nth(l,env)), r,nth(i, env), nth(j, env))" using assms \r\A\ sats_is_wfrec_fm[OF 0[simplified]] by simp } moreover have "sats(A, forcerel_fm(succ(p), succ(i), 0), Cons(r, env)) \ is_forcerel(##A,nth(p,env),nth(i,env),r)" if "r\A" for r using assms sats_forcerel_fm that by simp ultimately show ?thesis unfolding is_frc_at_def frc_at_fm_def using assms by simp qed definition forces_eq' :: "[i,i,i,i,i] \ o" where "forces_eq'(P,l,p,t1,t2) \ frc_at(P,l,\0,t1,t2,p\) = 1" definition forces_mem' :: "[i,i,i,i,i] \ o" where "forces_mem'(P,l,p,t1,t2) \ frc_at(P,l,\1,t1,t2,p\) = 1" definition forces_neq' :: "[i,i,i,i,i] \ o" where "forces_neq'(P,l,p,t1,t2) \ \ (\q\P. \q,p\\l \ forces_eq'(P,l,q,t1,t2))" definition forces_nmem' :: "[i,i,i,i,i] \ o" where "forces_nmem'(P,l,p,t1,t2) \ \ (\q\P. \q,p\\l \ forces_mem'(P,l,q,t1,t2))" definition is_forces_eq' :: "[i\o,i,i,i,i,i] \ o" where "is_forces_eq'(M,P,l,p,t1,t2) \ \o[M]. \z[M]. \t[M]. number1(M,o) \ empty(M,z) \ is_tuple(M,z,t1,t2,p,t) \ is_frc_at(M,P,l,t,o)" definition is_forces_mem' :: "[i\o,i,i,i,i,i] \ o" where "is_forces_mem'(M,P,l,p,t1,t2) \ \o[M]. \t[M]. number1(M,o) \ is_tuple(M,o,t1,t2,p,t) \ is_frc_at(M,P,l,t,o)" definition is_forces_neq' :: "[i\o,i,i,i,i,i] \ o" where "is_forces_neq'(M,P,l,p,t1,t2) \ \ (\q[M]. q\P \ (\qp[M]. pair(M,q,p,qp) \ qp\l \ is_forces_eq'(M,P,l,q,t1,t2)))" definition is_forces_nmem' :: "[i\o,i,i,i,i,i] \ o" where "is_forces_nmem'(M,P,l,p,t1,t2) \ \ (\q[M]. \qp[M]. q\P \ pair(M,q,p,qp) \ qp\l \ is_forces_mem'(M,P,l,q,t1,t2))" definition forces_eq_fm :: "[i,i,i,i,i] \ i" where "forces_eq_fm(p,l,q,t1,t2) \ Exists(Exists(Exists(And(number1_fm(2),And(empty_fm(1), And(is_tuple_fm(1,t1#+3,t2#+3,q#+3,0),frc_at_fm(p#+3,l#+3,0,2) ))))))" definition forces_mem_fm :: "[i,i,i,i,i] \ i" where "forces_mem_fm(p,l,q,t1,t2) \ Exists(Exists(And(number1_fm(1), And(is_tuple_fm(1,t1#+2,t2#+2,q#+2,0),frc_at_fm(p#+2,l#+2,0,1)))))" definition forces_neq_fm :: "[i,i,i,i,i] \ i" where "forces_neq_fm(p,l,q,t1,t2) \ Neg(Exists(Exists(And(Member(1,p#+2), And(pair_fm(1,q#+2,0),And(Member(0,l#+2),forces_eq_fm(p#+2,l#+2,1,t1#+2,t2#+2)))))))" definition forces_nmem_fm :: "[i,i,i,i,i] \ i" where "forces_nmem_fm(p,l,q,t1,t2) \ Neg(Exists(Exists(And(Member(1,p#+2), And(pair_fm(1,q#+2,0),And(Member(0,l#+2),forces_mem_fm(p#+2,l#+2,1,t1#+2,t2#+2)))))))" lemma forces_eq_fm_type [TC]: "\ p\nat;l\nat;q\nat;t1\nat;t2\nat\ \ forces_eq_fm(p,l,q,t1,t2) \ formula" unfolding forces_eq_fm_def by simp lemma forces_mem_fm_type [TC]: "\ p\nat;l\nat;q\nat;t1\nat;t2\nat\ \ forces_mem_fm(p,l,q,t1,t2) \ formula" unfolding forces_mem_fm_def by simp lemma forces_neq_fm_type [TC]: "\ p\nat;l\nat;q\nat;t1\nat;t2\nat\ \ forces_neq_fm(p,l,q,t1,t2) \ formula" unfolding forces_neq_fm_def by simp lemma forces_nmem_fm_type [TC]: "\ p\nat;l\nat;q\nat;t1\nat;t2\nat\ \ forces_nmem_fm(p,l,q,t1,t2) \ formula" unfolding forces_nmem_fm_def by simp lemma arity_forces_eq_fm : "p\nat \ l\nat \ q\nat \ t1 \ nat \ t2 \ nat \ arity(forces_eq_fm(p,l,q,t1,t2)) = succ(t1) \ succ(t2) \ succ(q) \ succ(p) \ succ(l)" unfolding forces_eq_fm_def using number1arity__fm arity_empty_fm arity_is_tuple_fm arity_frc_at_fm pred_Un_distrib by auto lemma arity_forces_mem_fm : "p\nat \ l\nat \ q\nat \ t1 \ nat \ t2 \ nat \ arity(forces_mem_fm(p,l,q,t1,t2)) = succ(t1) \ succ(t2) \ succ(q) \ succ(p) \ succ(l)" unfolding forces_mem_fm_def using number1arity__fm arity_empty_fm arity_is_tuple_fm arity_frc_at_fm pred_Un_distrib by auto lemma sats_forces_eq'_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" shows "sats(M,forces_eq_fm(p,l,q,t1,t2),env) \ is_forces_eq'(##M,nth(p,env),nth(l,env),nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_eq_fm_def is_forces_eq'_def using assms sats_is_tuple_fm sats_frc_at_fm by simp lemma sats_forces_mem'_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" shows "sats(M,forces_mem_fm(p,l,q,t1,t2),env) \ is_forces_mem'(##M,nth(p,env),nth(l,env),nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_mem_fm_def is_forces_mem'_def using assms sats_is_tuple_fm sats_frc_at_fm by simp lemma sats_forces_neq'_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" shows "sats(M,forces_neq_fm(p,l,q,t1,t2),env) \ is_forces_neq'(##M,nth(p,env),nth(l,env),nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_neq_fm_def is_forces_neq'_def using assms sats_forces_eq'_fm sats_is_tuple_fm sats_frc_at_fm by simp lemma sats_forces_nmem'_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" shows "sats(M,forces_nmem_fm(p,l,q,t1,t2),env) \ is_forces_nmem'(##M,nth(p,env),nth(l,env),nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_nmem_fm_def is_forces_nmem'_def using assms sats_forces_mem'_fm sats_is_tuple_fm sats_frc_at_fm by simp context forcing_data begin (* Absoluteness of components *) lemma fst_abs [simp]: "\x\M; y\M \ \ is_fst(##M,x,y) \ y = fst(x)" unfolding fst_def is_fst_def using pair_in_M_iff zero_in_M by (auto;rule_tac the_0 the_0[symmetric],auto) lemma snd_abs [simp]: "\x\M; y\M \ \ is_snd(##M,x,y) \ y = snd(x)" unfolding snd_def is_snd_def using pair_in_M_iff zero_in_M by (auto;rule_tac the_0 the_0[symmetric],auto) lemma ftype_abs[simp] : "\x\M; y\M \ \ is_ftype(##M,x,y) \ y = ftype(x)" unfolding ftype_def is_ftype_def by simp lemma name1_abs[simp] : "\x\M; y\M \ \ is_name1(##M,x,y) \ y = name1(x)" unfolding name1_def is_name1_def by (rule hcomp_abs[OF fst_abs];simp_all add:fst_snd_closed) lemma snd_snd_abs: "\x\M; y\M \ \ is_snd_snd(##M,x,y) \ y = snd(snd(x))" unfolding is_snd_snd_def by (rule hcomp_abs[OF snd_abs];simp_all add:fst_snd_closed) lemma name2_abs[simp]: "\x\M; y\M \ \ is_name2(##M,x,y) \ y = name2(x)" unfolding name2_def is_name2_def by (rule hcomp_abs[OF fst_abs snd_snd_abs];simp_all add:fst_snd_closed) lemma cond_of_abs[simp]: "\x\M; y\M \ \ is_cond_of(##M,x,y) \ y = cond_of(x)" unfolding cond_of_def is_cond_of_def by (rule hcomp_abs[OF snd_abs snd_snd_abs];simp_all add:fst_snd_closed) lemma tuple_abs[simp]: "\z\M;t1\M;t2\M;p\M;t\M\ \ is_tuple(##M,z,t1,t2,p,t) \ t = \z,t1,t2,p\" unfolding is_tuple_def using tuples_in_M by simp lemma oneN_in_M[simp]: "1\M" by (simp flip: setclass_iff) lemma twoN_in_M : "2\M" by (simp flip: setclass_iff) lemma comp_in_M: "p \ q \ p\M" "p \ q \ q\M" using leq_in_M transitivity[of _ leq] pair_in_M_iff by auto (* Absoluteness of Hfrc *) lemma eq_case_abs [simp]: assumes "t1\M" "t2\M" "p\M" "f\M" shows "is_eq_case(##M,t1,t2,p,P,leq,f) \ eq_case(t1,t2,p,P,leq,f)" proof - have "q \ p \ q\M" for q using comp_in_M by simp moreover have "\s,y\\t \ s\domain(t)" if "t\M" for s y t using that unfolding domain_def by auto ultimately have "(\s\M. s \ domain(t1) \ s \ domain(t2) \ (\q\M. q\P \ q \ p \ (f ` \1, s, t1, q\ =1 \ f ` \1, s, t2, q\=1))) \ (\s. s \ domain(t1) \ s \ domain(t2) \ (\q. q\P \ q \ p \ (f ` \1, s, t1, q\ =1 \ f ` \1, s, t2, q\=1)))" using assms domain_trans[OF trans_M,of t1] domain_trans[OF trans_M,of t2] by auto then show ?thesis unfolding eq_case_def is_eq_case_def using assms pair_in_M_iff n_in_M[of 1] domain_closed tuples_in_M apply_closed leq_in_M by simp qed lemma mem_case_abs [simp]: assumes "t1\M" "t2\M" "p\M" "f\M" shows "is_mem_case(##M,t1,t2,p,P,leq,f) \ mem_case(t1,t2,p,P,leq,f)" proof { fix v assume "v\P" "v \ p" "is_mem_case(##M,t1,t2,p,P,leq,f)" moreover from this have "v\M" "\v,p\ \ M" "(##M)(v)" using transitivity[OF _ P_in_M,of v] transitivity[OF _ leq_in_M] by simp_all moreover from calculation assms obtain q r s where "r \ P \ q \ P \ \q, v\ \ M \ \s, r\ \ M \ \q, r\ \ M \ 0 \ M \ \0, t1, s, q\ \ M \ q \ v \ \s, r\ \ t2 \ q \ r \ f ` \0, t1, s, q\ = 1" unfolding is_mem_case_def by auto then have "\q s r. r \ P \ q \ P \ q \ v \ \s, r\ \ t2 \ q \ r \ f ` \0, t1, s, q\ = 1" by auto } then show "mem_case(t1, t2, p, P, leq, f)" if "is_mem_case(##M, t1, t2, p, P, leq, f)" unfolding mem_case_def using that assms by auto next { fix v assume "v \ M" "v \ P" "\v, p\ \ M" "v \ p" "mem_case(t1, t2, p, P, leq, f)" moreover from this obtain q s r where "r \ P \ q \ P \ q \ v \ \s, r\ \ t2 \ q \ r \ f ` \0, t1, s, q\ = 1" unfolding mem_case_def by auto moreover from this \t2\M\ have "r\M" "q\M" "s\M" "r \ P \ q \ P \ q \ v \ \s, r\ \ t2 \ q \ r \ f ` \0, t1, s, q\ = 1" using transitivity P_in_M domain_closed[of t2] by auto moreover note \t1\M\ ultimately have "\q\M . \s\M. \r\M. r \ P \ q \ P \ \q, v\ \ M \ \s, r\ \ M \ \q, r\ \ M \ 0 \ M \ \0, t1, s, q\ \ M \ q \ v \ \s, r\ \ t2 \ q \ r \ f ` \0, t1, s, q\ = 1" using tuples_in_M zero_in_M by auto } then show "is_mem_case(##M, t1, t2, p, P, leq, f)" if "mem_case(t1, t2, p, P, leq, f)" unfolding is_mem_case_def using assms that by auto qed lemma Hfrc_abs: "\fnnc\M; f\M\ \ is_Hfrc(##M,P,leq,fnnc,f) \ Hfrc(P,leq,fnnc,f)" unfolding is_Hfrc_def Hfrc_def using pair_in_M_iff by auto lemma Hfrc_at_abs: "\fnnc\M; f\M ; z\M\ \ is_Hfrc_at(##M,P,leq,fnnc,f,z) \ z = bool_of_o(Hfrc(P,leq,fnnc,f)) " unfolding is_Hfrc_at_def using Hfrc_abs by auto lemma components_closed : "x\M \ ftype(x)\M" "x\M \ name1(x)\M" "x\M \ name2(x)\M" "x\M \ cond_of(x)\M" unfolding ftype_def name1_def name2_def cond_of_def using fst_snd_closed by simp_all lemma ecloseN_closed: "(##M)(A) \ (##M)(ecloseN(A))" "(##M)(A) \ (##M)(eclose_n(name1,A))" "(##M)(A) \ (##M)(eclose_n(name2,A))" unfolding ecloseN_def eclose_n_def using components_closed eclose_closed singletonM Un_closed by auto lemma is_eclose_n_abs : assumes "x\M" "ec\M" shows "is_eclose_n(##M,is_name1,ec,x) \ ec = eclose_n(name1,x)" "is_eclose_n(##M,is_name2,ec,x) \ ec = eclose_n(name2,x)" unfolding is_eclose_n_def eclose_n_def using assms name1_abs name2_abs eclose_abs singletonM components_closed by auto lemma is_ecloseN_abs : "\x\M;ec\M\ \ is_ecloseN(##M,ec,x) \ ec = ecloseN(x)" unfolding is_ecloseN_def ecloseN_def using is_eclose_n_abs Un_closed union_abs ecloseN_closed by auto lemma frecR_abs : "x\M \ y\M \ frecR(x,y) \ is_frecR(##M,x,y)" unfolding frecR_def is_frecR_def using components_closed domain_closed by simp lemma frecrelP_abs : "z\M \ frecrelP(##M,z) \ (\x y. z = \x,y\ \ frecR(x,y))" using pair_in_M_iff frecR_abs unfolding frecrelP_def by auto lemma frecrel_abs: assumes "A\M" "r\M" shows "is_frecrel(##M,A,r) \ r = frecrel(A)" proof - from \A\M\ have "z\M" if "z\A\A" for z using cartprod_closed transitivity that by simp then have "Collect(A\A,frecrelP(##M)) = Collect(A\A,\z. (\x y. z = \x,y\ \ frecR(x,y)))" using Collect_cong[of "A\A" "A\A" "frecrelP(##M)"] assms frecrelP_abs by simp with assms show ?thesis unfolding is_frecrel_def def_frecrel using cartprod_closed by simp qed lemma frecrel_closed: assumes "x\M" shows "frecrel(x)\M" proof - have "Collect(x\x,\z. (\x y. z = \x,y\ \ frecR(x,y)))\M" using Collect_in_M_0p[of "frecrelP_fm(0)"] arity_frecrelP_fm sats_frecrelP_fm frecrelP_abs \x\M\ cartprod_closed by simp then show ?thesis unfolding frecrel_def Rrel_def frecrelP_def by simp qed lemma field_frecrel : "field(frecrel(names_below(P,x))) \ names_below(P,x)" unfolding frecrel_def using field_Rrel by simp lemma forcerelD : "uv \ forcerel(P,x) \ uv\ names_below(P,x) \ names_below(P,x)" unfolding forcerel_def using trancl_type field_frecrel by blast lemma wf_forcerel : "wf(forcerel(P,x))" unfolding forcerel_def using wf_trancl wf_frecrel . lemma restrict_trancl_forcerel: assumes "frecR(w,y)" shows "restrict(f,frecrel(names_below(P,x))-``{y})`w = restrict(f,forcerel(P,x)-``{y})`w" unfolding forcerel_def frecrel_def using assms restrict_trancl_Rrel[of frecR] by simp lemma names_belowI : assumes "frecR(\ft,n1,n2,p\,\a,b,c,d\)" "p\P" shows "\ft,n1,n2,p\ \ names_below(P,\a,b,c,d\)" (is "?x \ names_below(_,?y)") proof - from assms have "ft \ 2" "a \ 2" unfolding frecR_def by (auto simp add:components_simp) from assms consider (e) "n1 \ domain(b) \ domain(c) \ (n2 = b \ n2 =c)" | (m) "n1 = b \ n2 \ domain(c)" unfolding frecR_def by (auto simp add:components_simp) then show ?thesis proof cases case e then have "n1 \ eclose(b) \ n1 \ eclose(c)" using Un_iff in_dom_in_eclose by auto with e have "n1 \ ecloseN(?y)" "n2 \ ecloseN(?y)" using ecloseNI components_in_eclose by auto with \ft\2\ \p\P\ show ?thesis unfolding names_below_def by auto next case m then have "n1 \ ecloseN(?y)" "n2 \ ecloseN(?y)" using mem_eclose_trans ecloseNI in_dom_in_eclose components_in_eclose by auto with \ft\2\ \p\P\ show ?thesis unfolding names_below_def by auto qed qed lemma names_below_tr : assumes "x\ names_below(P,y)" "y\ names_below(P,z)" shows "x\ names_below(P,z)" proof - let ?A="\y . names_below(P,y)" from assms obtain fx x1 x2 px where "x = \fx,x1,x2,px\" "fx\2" "x1\ecloseN(y)" "x2\ecloseN(y)" "px\P" unfolding names_below_def by auto from assms obtain fy y1 y2 py where "y = \fy,y1,y2,py\" "fy\2" "y1\ecloseN(z)" "y2\ecloseN(z)" "py\P" unfolding names_below_def by auto from \x1\_\ \x2\_\ \y1\_\ \y2\_\ \x=_\ \y=_\ have "x1\ecloseN(z)" "x2\ecloseN(z)" using ecloseN_mono names_simp by auto with \fx\2\ \px\P\ \x=_\ have "x\?A(z)" unfolding names_below_def by simp then show ?thesis using subsetI by simp qed lemma arg_into_names_below2 : assumes "\x,y\ \ frecrel(names_below(P,z))" shows "x \ names_below(P,y)" proof - { from assms have "x\names_below(P,z)" "y\names_below(P,z)" "frecR(x,y)" unfolding frecrel_def Rrel_def by auto obtain f n1 n2 p where "x = \f,n1,n2,p\" "f\2" "n1\ecloseN(z)" "n2\ecloseN(z)" "p\P" using \x\names_below(P,z)\ unfolding names_below_def by auto moreover obtain fy m1 m2 q where "q\P" "y = \fy,m1,m2,q\" using \y\names_below(P,z)\ unfolding names_below_def by auto moreover note \frecR(x,y)\ ultimately have "x\names_below(P,y)" using names_belowI by simp } then show ?thesis . qed lemma arg_into_names_below : assumes "\x,y\ \ frecrel(names_below(P,z))" shows "x \ names_below(P,x)" proof - { from assms have "x\names_below(P,z)" unfolding frecrel_def Rrel_def by auto from \x\names_below(P,z)\ obtain f n1 n2 p where "x = \f,n1,n2,p\" "f\2" "n1\ecloseN(z)" "n2\ecloseN(z)" "p\P" unfolding names_below_def by auto then have "n1\ecloseN(x)" "n2\ecloseN(x)" using components_in_eclose by simp_all with \f\2\ \p\P\ \x = \f,n1,n2,p\\ have "x\names_below(P,x)" unfolding names_below_def by simp } then show ?thesis . qed lemma forcerel_arg_into_names_below : assumes "\x,y\ \ forcerel(P,z)" shows "x \ names_below(P,x)" using assms unfolding forcerel_def by(rule trancl_induct;auto simp add: arg_into_names_below) lemma names_below_mono : assumes "\x,y\ \ frecrel(names_below(P,z))" shows "names_below(P,x) \ names_below(P,y)" proof - from assms have "x\names_below(P,y)" using arg_into_names_below2 by simp then show ?thesis using names_below_tr subsetI by simp qed lemma frecrel_mono : assumes "\x,y\ \ frecrel(names_below(P,z))" shows "frecrel(names_below(P,x)) \ frecrel(names_below(P,y))" unfolding frecrel_def using Rrel_mono names_below_mono assms by simp lemma forcerel_mono2 : assumes "\x,y\ \ frecrel(names_below(P,z))" shows "forcerel(P,x) \ forcerel(P,y)" unfolding forcerel_def using trancl_mono frecrel_mono assms by simp lemma forcerel_mono_aux : assumes "\x,y\ \ frecrel(names_below(P, w))^+" shows "forcerel(P,x) \ forcerel(P,y)" using assms by (rule trancl_induct,simp_all add: subset_trans forcerel_mono2) lemma forcerel_mono : assumes "\x,y\ \ forcerel(P,z)" shows "forcerel(P,x) \ forcerel(P,y)" using forcerel_mono_aux assms unfolding forcerel_def by simp lemma aux: "x \ names_below(P, w) \ \x,y\ \ forcerel(P,z) \ (y \ names_below(P, w) \ \x,y\ \ forcerel(P,w))" unfolding forcerel_def proof(rule_tac a=x and b=y and P="\ y . y \ names_below(P, w) \ \x,y\ \ frecrel(names_below(P,w))^+" in trancl_induct,simp) let ?A="\ a . names_below(P, a)" let ?R="\ a . frecrel(?A(a))" let ?fR="\ a .forcerel(a)" show "u\?A(w) \ \x,u\\?R(w)^+" if "x\?A(w)" "\x,y\\?R(z)^+" "\x,u\\?R(z)" for u using that frecrelD frecrelI r_into_trancl unfolding names_below_def by simp { fix u v assume "x \ ?A(w)" "\x, y\ \ ?R(z)^+" "\x, u\ \ ?R(z)^+" "\u, v\ \ ?R(z)" "u \ ?A(w) \ \x, u\ \ ?R(w)^+" then have "v \ ?A(w) \ \x, v\ \ ?R(w)^+" proof - assume "v \?A(w)" from \\u,v\\_\ have "u\?A(v)" using arg_into_names_below2 by simp with \v \?A(w)\ have "u\?A(w)" using names_below_tr by simp with \v\_\ \\u,v\\_\ have "\u,v\\ ?R(w)" using frecrelD frecrelI r_into_trancl unfolding names_below_def by simp with \u \ ?A(w) \ \x, u\ \ ?R(w)^+\ \u\?A(w)\ have "\x, u\ \ ?R(w)^+" by simp with \\u,v\\ ?R(w)\ show "\x,v\\ ?R(w)^+" using trancl_trans r_into_trancl by simp qed } then show "v \ ?A(w) \ \x, v\ \ ?R(w)^+" if "x \ ?A(w)" "\x, y\ \ ?R(z)^+" "\x, u\ \ ?R(z)^+" "\u, v\ \ ?R(z)" "u \ ?A(w) \ \x, u\ \ ?R(w)^+" for u v using that by simp qed lemma forcerel_eq : assumes "\z,x\ \ forcerel(P,x)" shows "forcerel(P,z) = forcerel(P,x) \ names_below(P,z)\names_below(P,z)" using assms aux forcerelD forcerel_mono[of z x x] subsetI by auto lemma forcerel_below_aux : assumes "\z,x\ \ forcerel(P,x)" "\u,z\ \ forcerel(P,x)" shows "u \ names_below(P,z)" using assms(2) unfolding forcerel_def proof(rule trancl_induct) show "u \ names_below(P,y)" if " \u, y\ \ frecrel(names_below(P, x))" for y using that vimage_singleton_iff arg_into_names_below2 by simp next show "u \ names_below(P,z)" if "\u, y\ \ frecrel(names_below(P, x))^+" "\y, z\ \ frecrel(names_below(P, x))" "u \ names_below(P, y)" for y z using that arg_into_names_below2[of y z x] names_below_tr by simp qed lemma forcerel_below : assumes "\z,x\ \ forcerel(P,x)" shows "forcerel(P,x) -`` {z} \ names_below(P,z)" using vimage_singleton_iff assms forcerel_below_aux by auto lemma relation_forcerel : shows "relation(forcerel(P,z))" "trans(forcerel(P,z))" unfolding forcerel_def using relation_trancl trans_trancl by simp_all lemma Hfrc_restrict_trancl: "bool_of_o(Hfrc(P, leq, y, restrict(f,frecrel(names_below(P,x))-``{y}))) = bool_of_o(Hfrc(P, leq, y, restrict(f,(frecrel(names_below(P,x))^+)-``{y})))" unfolding Hfrc_def bool_of_o_def eq_case_def mem_case_def using restrict_trancl_forcerel frecRI1 frecRI2 frecRI3 unfolding forcerel_def by simp (* Recursive definition of forces for atomic formulas using a transitive relation *) lemma frc_at_trancl: "frc_at(P,leq,z) = wfrec(forcerel(P,z),z,\x f. bool_of_o(Hfrc(P,leq,x,f)))" unfolding frc_at_def forcerel_def using wf_eq_trancl Hfrc_restrict_trancl by simp lemma forcerelI1 : assumes "n1 \ domain(b) \ n1 \ domain(c)" "p\P" "d\P" shows "\\1, n1, b, p\, \0,b,c,d\\\ forcerel(P,\0,b,c,d\)" proof - let ?x="\1, n1, b, p\" let ?y="\0,b,c,d\" from assms have "frecR(?x,?y)" using frecRI1 by simp then have "?x\names_below(P,?y)" "?y \ names_below(P,?y)" using names_belowI assms components_in_eclose unfolding names_below_def by auto with \frecR(?x,?y)\ show ?thesis unfolding forcerel_def frecrel_def using subsetD[OF r_subset_trancl[OF relation_Rrel]] RrelI by auto qed lemma forcerelI2 : assumes "n1 \ domain(b) \ n1 \ domain(c)" "p\P" "d\P" shows "\\1, n1, c, p\, \0,b,c,d\\\ forcerel(P,\0,b,c,d\)" proof - let ?x="\1, n1, c, p\" let ?y="\0,b,c,d\" from assms have "frecR(?x,?y)" using frecRI2 by simp then have "?x\names_below(P,?y)" "?y \ names_below(P,?y)" using names_belowI assms components_in_eclose unfolding names_below_def by auto with \frecR(?x,?y)\ show ?thesis unfolding forcerel_def frecrel_def using subsetD[OF r_subset_trancl[OF relation_Rrel]] RrelI by auto qed lemma forcerelI3 : assumes "\n2, r\ \ c" "p\P" "d\P" "r \ P" shows "\\0, b, n2, p\,\1, b, c, d\\ \ forcerel(P,\1,b,c,d\)" proof - let ?x="\0, b, n2, p\" let ?y="\1, b, c, d\" from assms have "frecR(?x,?y)" using assms frecRI3 by simp then have "?x\names_below(P,?y)" "?y \ names_below(P,?y)" using names_belowI assms components_in_eclose unfolding names_below_def by auto with \frecR(?x,?y)\ show ?thesis unfolding forcerel_def frecrel_def using subsetD[OF r_subset_trancl[OF relation_Rrel]] RrelI by auto qed lemmas forcerelI = forcerelI1[THEN vimage_singleton_iff[THEN iffD2]] forcerelI2[THEN vimage_singleton_iff[THEN iffD2]] forcerelI3[THEN vimage_singleton_iff[THEN iffD2]] lemma aux_def_frc_at: assumes "z \ forcerel(P,x) -`` {x}" shows "wfrec(forcerel(P,x), z, H) = wfrec(forcerel(P,z), z, H)" proof - let ?A="names_below(P,z)" from assms have "\z,x\ \ forcerel(P,x)" using vimage_singleton_iff by simp then have "z \ ?A" using forcerel_arg_into_names_below by simp from \\z,x\ \ forcerel(P,x)\ have E:"forcerel(P,z) = forcerel(P,x) \ (?A\?A)" "forcerel(P,x) -`` {z} \ ?A" using forcerel_eq forcerel_below by auto with \z\?A\ have "wfrec(forcerel(P,x), z, H) = wfrec[?A](forcerel(P,x), z, H)" using wfrec_trans_restr[OF relation_forcerel(1) wf_forcerel relation_forcerel(2), of x z ?A] by simp then show ?thesis using E wfrec_restr_eq by simp qed subsection\Recursive expression of \<^term>\frc_at\\ lemma def_frc_at : assumes "p\P" shows "frc_at(P,leq,\ft,n1,n2,p\) = bool_of_o( p \P \ ( ft = 0 \ (\s. s\domain(n1) \ domain(n2) \ (\q. q\P \ q \ p \ (frc_at(P,leq,\1,s,n1,q\) =1 \ frc_at(P,leq,\1,s,n2,q\) =1))) \ ft = 1 \ ( \v\P. v \ p \ (\q. \s. \r. r\P \ q\P \ q \ v \ \s,r\ \ n2 \ q \ r \ frc_at(P,leq,\0,n1,s,q\) = 1))))" proof - let ?r="\y. forcerel(P,y)" and ?Hf="\x f. bool_of_o(Hfrc(P,leq,x,f))" let ?t="\y. ?r(y) -`` {y}" let ?arg="\ft,n1,n2,p\" from wf_forcerel have wfr: "\w . wf(?r(w))" .. with wfrec [of "?r(?arg)" ?arg ?Hf] have "frc_at(P,leq,?arg) = ?Hf( ?arg, \x\?r(?arg) -`` {?arg}. wfrec(?r(?arg), x, ?Hf))" using frc_at_trancl by simp also have " ... = ?Hf( ?arg, \x\?r(?arg) -`` {?arg}. frc_at(P,leq,x))" using aux_def_frc_at frc_at_trancl by simp finally show ?thesis unfolding Hfrc_def mem_case_def eq_case_def using forcerelI assms by auto qed subsection\Absoluteness of \<^term>\frc_at\\ lemma trans_forcerel_t : "trans(forcerel(P,x))" unfolding forcerel_def using trans_trancl . lemma relation_forcerel_t : "relation(forcerel(P,x))" unfolding forcerel_def using relation_trancl . lemma forcerel_in_M : assumes "x\M" shows "forcerel(P,x)\M" unfolding forcerel_def def_frecrel names_below_def proof - let ?Q = "2 \ ecloseN(x) \ ecloseN(x) \ P" have "?Q \ ?Q \ M" using \x\M\ P_in_M twoN_in_M ecloseN_closed cartprod_closed by simp moreover have "separation(##M,\z. \x y. z = \x, y\ \ frecR(x, y))" proof - have "arity(frecrelP_fm(0)) = 1" unfolding number1_fm_def frecrelP_fm_def by (simp del:FOL_sats_iff pair_abs empty_abs add: fm_defs frecR_fm_def number1_fm_def components_defs nat_simp_union) then have "separation(##M, \z. sats(M,frecrelP_fm(0) , [z]))" using separation_ax by simp moreover have "frecrelP(##M,z) \ sats(M,frecrelP_fm(0),[z])" if "z\M" for z using that sats_frecrelP_fm[of 0 "[z]"] by simp ultimately have "separation(##M,frecrelP(##M))" unfolding separation_def by simp then show ?thesis using frecrelP_abs separation_cong[of "##M" "frecrelP(##M)" "\z. \x y. z = \x, y\ \ frecR(x, y)"] by simp qed ultimately show "{z \ ?Q \ ?Q . \x y. z = \x, y\ \ frecR(x, y)}^+ \ M" using separation_closed frecrelP_abs trancl_closed by simp qed lemma relation2_Hfrc_at_abs: "relation2(##M,is_Hfrc_at(##M,P,leq),\x f. bool_of_o(Hfrc(P,leq,x,f)))" unfolding relation2_def using Hfrc_at_abs by simp lemma Hfrc_at_closed : "\x\M. \g\M. function(g) \ bool_of_o(Hfrc(P,leq,x,g))\M" unfolding bool_of_o_def using zero_in_M n_in_M[of 1] by simp lemma wfrec_Hfrc_at : assumes "X\M" shows "wfrec_replacement(##M,is_Hfrc_at(##M,P,leq),forcerel(P,X))" proof - have 0:"is_Hfrc_at(##M,P,leq,a,b,c) \ sats(M,Hfrc_at_fm(8,9,2,1,0),[c,b,a,d,e,y,x,z,P,leq,forcerel(P,X)])" if "a\M" "b\M" "c\M" "d\M" "e\M" "y\M" "x\M" "z\M" for a b c d e y x z using that P_in_M leq_in_M \X\M\ forcerel_in_M is_Hfrc_at_iff_sats[of concl:M P leq a b c 8 9 2 1 0 "[c,b,a,d,e,y,x,z,P,leq,forcerel(P,X)]"] by simp have 1:"sats(M,is_wfrec_fm(Hfrc_at_fm(8,9,2,1,0),5,1,0),[y,x,z,P,leq,forcerel(P,X)]) \ is_wfrec(##M, is_Hfrc_at(##M,P,leq),forcerel(P,X), x, y)" if "x\M" "y\M" "z\M" for x y z using that \X\M\ forcerel_in_M P_in_M leq_in_M sats_is_wfrec_fm[OF 0] by simp let ?f="Exists(And(pair_fm(1,0,2),is_wfrec_fm(Hfrc_at_fm(8,9,2,1,0),5,1,0)))" have satsf:"sats(M, ?f, [x,z,P,leq,forcerel(P,X)]) \ (\y\M. pair(##M,x,y,z) & is_wfrec(##M, is_Hfrc_at(##M,P,leq),forcerel(P,X), x, y))" if "x\M" "z\M" for x z using that 1 \X\M\ forcerel_in_M P_in_M leq_in_M by (simp del:pair_abs) have artyf:"arity(?f) = 5" unfolding is_wfrec_fm_def Hfrc_at_fm_def Hfrc_fm_def Replace_fm_def PHcheck_fm_def pair_fm_def upair_fm_def is_recfun_fm_def fun_apply_fm_def big_union_fm_def pre_image_fm_def restriction_fm_def image_fm_def fm_defs number1_fm_def eq_case_fm_def mem_case_fm_def is_tuple_fm_def by (simp add:nat_simp_union) moreover have "?f\formula" unfolding fm_defs Hfrc_at_fm_def by simp ultimately have "strong_replacement(##M,\x z. sats(M,?f,[x,z,P,leq,forcerel(P,X)]))" using replacement_ax 1 artyf \X\M\ forcerel_in_M P_in_M leq_in_M by simp then have "strong_replacement(##M,\x z. \y\M. pair(##M,x,y,z) & is_wfrec(##M, is_Hfrc_at(##M,P,leq),forcerel(P,X), x, y))" using repl_sats[of M ?f "[P,leq,forcerel(P,X)]"] satsf by (simp del:pair_abs) then show ?thesis unfolding wfrec_replacement_def by simp qed lemma names_below_abs : "\Q\M;x\M;nb\M\ \ is_names_below(##M,Q,x,nb) \ nb = names_below(Q,x)" unfolding is_names_below_def names_below_def using succ_in_M_iff zero_in_M cartprod_closed is_ecloseN_abs ecloseN_closed by auto lemma names_below_closed: "\Q\M;x\M\ \ names_below(Q,x) \ M" unfolding names_below_def using zero_in_M cartprod_closed ecloseN_closed succ_in_M_iff by simp lemma "names_below_productE" : assumes "Q \ M" "x \ M" "\A1 A2 A3 A4. A1 \ M \ A2 \ M \ A3 \ M \ A4 \ M \ R(A1 \ A2 \ A3 \ A4)" shows "R(names_below(Q,x))" unfolding names_below_def using assms zero_in_M ecloseN_closed[of x] twoN_in_M by auto lemma forcerel_abs : "\x\M;z\M\ \ is_forcerel(##M,P,x,z) \ z = forcerel(P,x)" unfolding is_forcerel_def forcerel_def using frecrel_abs names_below_abs trancl_abs P_in_M twoN_in_M ecloseN_closed names_below_closed names_below_productE[of concl:"\p. is_frecrel(##M,p,_) \ _ = frecrel(p)"] frecrel_closed by simp lemma frc_at_abs: assumes "fnnc\M" "z\M" shows "is_frc_at(##M,P,leq,fnnc,z) \ z = frc_at(P,leq,fnnc)" proof - from assms have "(\r\M. is_forcerel(##M,P,fnnc, r) \ is_wfrec(##M, is_Hfrc_at(##M, P, leq), r, fnnc, z)) \ is_wfrec(##M, is_Hfrc_at(##M, P, leq), forcerel(P,fnnc), fnnc, z)" using forcerel_abs forcerel_in_M by simp then show ?thesis unfolding frc_at_trancl is_frc_at_def using assms wfrec_Hfrc_at[of fnnc] wf_forcerel trans_forcerel_t relation_forcerel_t forcerel_in_M Hfrc_at_closed relation2_Hfrc_at_abs trans_wfrec_abs[of "forcerel(P,fnnc)" fnnc z "is_Hfrc_at(##M,P,leq)" "\x f. bool_of_o(Hfrc(P,leq,x,f))"] by (simp flip:setclass_iff) qed lemma forces_eq'_abs : "\p\M ; t1\M ; t2\M\ \ is_forces_eq'(##M,P,leq,p,t1,t2) \ forces_eq'(P,leq,p,t1,t2)" unfolding is_forces_eq'_def forces_eq'_def using frc_at_abs zero_in_M tuples_in_M by auto lemma forces_mem'_abs : "\p\M ; t1\M ; t2\M\ \ is_forces_mem'(##M,P,leq,p,t1,t2) \ forces_mem'(P,leq,p,t1,t2)" unfolding is_forces_mem'_def forces_mem'_def using frc_at_abs zero_in_M tuples_in_M by auto lemma forces_neq'_abs : assumes "p\M" "t1\M" "t2\M" shows "is_forces_neq'(##M,P,leq,p,t1,t2) \ forces_neq'(P,leq,p,t1,t2)" proof - have "q\M" if "q\P" for q using that transitivity P_in_M by simp then show ?thesis unfolding is_forces_neq'_def forces_neq'_def using assms forces_eq'_abs pair_in_M_iff by (auto,blast) qed lemma forces_nmem'_abs : assumes "p\M" "t1\M" "t2\M" shows "is_forces_nmem'(##M,P,leq,p,t1,t2) \ forces_nmem'(P,leq,p,t1,t2)" proof - have "q\M" if "q\P" for q using that transitivity P_in_M by simp then show ?thesis unfolding is_forces_nmem'_def forces_nmem'_def using assms forces_mem'_abs pair_in_M_iff by (auto,blast) qed end (* forcing_data *) subsection\Forcing for general formulas\ definition ren_forces_nand :: "i\i" where "ren_forces_nand(\) \ Exists(And(Equal(0,1),iterates(\p. incr_bv(p)`1 , 2, \)))" lemma ren_forces_nand_type[TC] : "\\formula \ ren_forces_nand(\) \formula" unfolding ren_forces_nand_def by simp lemma arity_ren_forces_nand : assumes "\\formula" shows "arity(ren_forces_nand(\)) \ succ(arity(\))" proof - consider (lt) "1)" | (ge) "\ 1 < arity(\)" by auto then show ?thesis proof cases case lt with \\\_\ have "2 < succ(arity(\))" "2)#+2" using succ_ltI by auto with \\\_\ have "arity(iterates(\p. incr_bv(p)`1,2,\)) = 2#+arity(\)" using arity_incr_bv_lemma lt by auto with \\\_\ show ?thesis unfolding ren_forces_nand_def using lt pred_Un_distrib nat_union_abs1 Un_assoc[symmetric] Un_le_compat by simp next case ge with \\\_\ have "arity(\) \ 1" "pred(arity(\)) \ 1" using not_lt_iff_le le_trans[OF le_pred] by simp_all with \\\_\ have "arity(iterates(\p. incr_bv(p)`1,2,\)) = (arity(\))" using arity_incr_bv_lemma ge by simp with \arity(\) \ 1\ \\\_\ \pred(_) \ 1\ show ?thesis unfolding ren_forces_nand_def using pred_Un_distrib nat_union_abs1 Un_assoc[symmetric] nat_union_abs2 by simp qed qed lemma sats_ren_forces_nand: "[q,P,leq,o,p] @ env \ list(M) \ \\formula \ sats(M, ren_forces_nand(\),[q,p,P,leq,o] @ env) \ sats(M, \,[q,P,leq,o] @ env)" unfolding ren_forces_nand_def using sats_incr_bv_iff [of _ _ M _ "[q]"] by simp definition ren_forces_forall :: "i\i" where "ren_forces_forall(\) \ Exists(Exists(Exists(Exists(Exists( And(Equal(0,6),And(Equal(1,7),And(Equal(2,8),And(Equal(3,9), And(Equal(4,5),iterates(\p. incr_bv(p)`5 , 5, \)))))))))))" lemma arity_ren_forces_all : assumes "\\formula" shows "arity(ren_forces_forall(\)) = 5 \ arity(\)" proof - consider (lt) "5)" | (ge) "\ 5 < arity(\)" by auto then show ?thesis proof cases case lt with \\\_\ have "5 < succ(arity(\))" "5)#+2" "5)#+3" "5)#+4" using succ_ltI by auto with \\\_\ have "arity(iterates(\p. incr_bv(p)`5,5,\)) = 5#+arity(\)" using arity_incr_bv_lemma lt by simp with \\\_\ show ?thesis unfolding ren_forces_forall_def using pred_Un_distrib nat_union_abs1 Un_assoc[symmetric] nat_union_abs2 by simp next case ge with \\\_\ have "arity(\) \ 5" "pred^5(arity(\)) \ 5" using not_lt_iff_le le_trans[OF le_pred] by simp_all with \\\_\ have "arity(iterates(\p. incr_bv(p)`5,5,\)) = arity(\)" using arity_incr_bv_lemma ge by simp with \arity(\) \ 5\ \\\_\ \pred^5(_) \ 5\ show ?thesis unfolding ren_forces_forall_def using pred_Un_distrib nat_union_abs1 Un_assoc[symmetric] nat_union_abs2 by simp qed qed lemma ren_forces_forall_type[TC] : "\\formula \ ren_forces_forall(\) \formula" unfolding ren_forces_forall_def by simp lemma sats_ren_forces_forall : "[x,P,leq,o,p] @ env \ list(M) \ \\formula \ sats(M, ren_forces_forall(\),[x,p,P,leq,o] @ env) \ sats(M, \,[p,P,leq,o,x] @ env)" unfolding ren_forces_forall_def using sats_incr_bv_iff [of _ _ M _ "[p,P,leq,o,x]"] by simp definition is_leq :: "[i\o,i,i,i] \ o" where "is_leq(A,l,q,p) \ \qp[A]. (pair(A,q,p,qp) \ qp\l)" lemma (in forcing_data) leq_abs[simp]: "\ l\M ; q\M ; p\M \ \ is_leq(##M,l,q,p) \ \q,p\\l" unfolding is_leq_def using pair_in_M_iff by simp definition leq_fm :: "[i,i,i] \ i" where "leq_fm(leq,q,p) \ Exists(And(pair_fm(q#+1,p#+1,0),Member(0,leq#+1)))" lemma arity_leq_fm : "\leq\nat;q\nat;p\nat\ \ arity(leq_fm(leq,q,p)) = succ(q) \ succ(p) \ succ(leq)" unfolding leq_fm_def using arity_pair_fm pred_Un_distrib nat_simp_union by auto lemma leq_fm_type[TC] : "\leq\nat;q\nat;p\nat\ \ leq_fm(leq,q,p)\formula" unfolding leq_fm_def by simp lemma sats_leq_fm : "\ leq\nat;q\nat;p\nat;env\list(A) \ \ sats(A,leq_fm(leq,q,p),env) \ is_leq(##A,nth(leq,env),nth(q,env),nth(p,env))" unfolding leq_fm_def is_leq_def by simp subsubsection\The primitive recursion\ consts forces' :: "i\i" primrec "forces'(Member(x,y)) = forces_mem_fm(1,2,0,x#+4,y#+4)" "forces'(Equal(x,y)) = forces_eq_fm(1,2,0,x#+4,y#+4)" "forces'(Nand(p,q)) = Neg(Exists(And(Member(0,2),And(leq_fm(3,0,1),And(ren_forces_nand(forces'(p)), ren_forces_nand(forces'(q)))))))" "forces'(Forall(p)) = Forall(ren_forces_forall(forces'(p)))" definition forces :: "i\i" where "forces(\) \ And(Member(0,1),forces'(\))" lemma forces'_type [TC]: "\\formula \ forces'(\) \ formula" by (induct \ set:formula; simp) lemma forces_type[TC] : "\\formula \ forces(\) \ formula" unfolding forces_def by simp context forcing_data begin subsection\Forcing for atomic formulas in context\ definition forces_eq :: "[i,i,i] \ o" where "forces_eq \ forces_eq'(P,leq)" definition forces_mem :: "[i,i,i] \ o" where "forces_mem \ forces_mem'(P,leq)" (* frc_at(P,leq,\0,t1,t2,p\) = 1*) definition is_forces_eq :: "[i,i,i] \ o" where "is_forces_eq \ is_forces_eq'(##M,P,leq)" (* frc_at(P,leq,\1,t1,t2,p\) = 1*) definition is_forces_mem :: "[i,i,i] \ o" where "is_forces_mem \ is_forces_mem'(##M,P,leq)" lemma def_forces_eq: "p\P \ forces_eq(p,t1,t2) \ (\s\domain(t1) \ domain(t2). \q. q\P \ q \ p \ (forces_mem(q,s,t1) \ forces_mem(q,s,t2)))" unfolding forces_eq_def forces_mem_def forces_eq'_def forces_mem'_def using def_frc_at[of p 0 t1 t2 ] unfolding bool_of_o_def by auto lemma def_forces_mem: "p\P \ forces_mem(p,t1,t2) \ (\v\P. v \ p \ (\q. \s. \r. r\P \ q\P \ q \ v \ \s,r\ \ t2 \ q \ r \ forces_eq(q,t1,s)))" unfolding forces_eq'_def forces_mem'_def forces_eq_def forces_mem_def using def_frc_at[of p 1 t1 t2] unfolding bool_of_o_def by auto lemma forces_eq_abs : "\p\M ; t1\M ; t2\M\ \ is_forces_eq(p,t1,t2) \ forces_eq(p,t1,t2)" unfolding is_forces_eq_def forces_eq_def using forces_eq'_abs by simp lemma forces_mem_abs : "\p\M ; t1\M ; t2\M\ \ is_forces_mem(p,t1,t2) \ forces_mem(p,t1,t2)" unfolding is_forces_mem_def forces_mem_def using forces_mem'_abs by simp lemma sats_forces_eq_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" "nth(p,env)=P" "nth(l,env)=leq" shows "sats(M,forces_eq_fm(p,l,q,t1,t2),env) \ is_forces_eq(nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_eq_fm_def is_forces_eq_def is_forces_eq'_def using assms sats_is_tuple_fm sats_frc_at_fm by simp lemma sats_forces_mem_fm: assumes "p\nat" "l\nat" "q\nat" "t1\nat" "t2\nat" "env\list(M)" "nth(p,env)=P" "nth(l,env)=leq" shows "sats(M,forces_mem_fm(p,l,q,t1,t2),env) \ is_forces_mem(nth(q,env),nth(t1,env),nth(t2,env))" unfolding forces_mem_fm_def is_forces_mem_def is_forces_mem'_def using assms sats_is_tuple_fm sats_frc_at_fm by simp definition forces_neq :: "[i,i,i] \ o" where "forces_neq(p,t1,t2) \ \ (\q\P. q\p \ forces_eq(q,t1,t2))" definition forces_nmem :: "[i,i,i] \ o" where "forces_nmem(p,t1,t2) \ \ (\q\P. q\p \ forces_mem(q,t1,t2))" lemma forces_neq : "forces_neq(p,t1,t2) \ forces_neq'(P,leq,p,t1,t2)" unfolding forces_neq_def forces_neq'_def forces_eq_def by simp lemma forces_nmem : "forces_nmem(p,t1,t2) \ forces_nmem'(P,leq,p,t1,t2)" unfolding forces_nmem_def forces_nmem'_def forces_mem_def by simp lemma sats_forces_Member : assumes "x\nat" "y\nat" "env\list(M)" "nth(x,env)=xx" "nth(y,env)=yy" "q\M" shows "sats(M,forces(Member(x,y)),[q,P,leq,one]@env) \ (q\P \ is_forces_mem(q,xx,yy))" unfolding forces_def using assms sats_forces_mem_fm P_in_M leq_in_M one_in_M by simp lemma sats_forces_Equal : assumes "x\nat" "y\nat" "env\list(M)" "nth(x,env)=xx" "nth(y,env)=yy" "q\M" shows "sats(M,forces(Equal(x,y)),[q,P,leq,one]@env) \ (q\P \ is_forces_eq(q,xx,yy))" unfolding forces_def using assms sats_forces_eq_fm P_in_M leq_in_M one_in_M by simp lemma sats_forces_Nand : assumes "\\formula" "\\formula" "env\list(M)" "p\M" shows "sats(M,forces(Nand(\,\)),[p,P,leq,one]@env) \ (p\P \ \(\q\M. q\P \ is_leq(##M,leq,q,p) \ (sats(M,forces'(\),[q,P,leq,one]@env) \ sats(M,forces'(\),[q,P,leq,one]@env))))" unfolding forces_def using sats_leq_fm assms sats_ren_forces_nand P_in_M leq_in_M one_in_M by simp lemma sats_forces_Neg : assumes "\\formula" "env\list(M)" "p\M" shows "sats(M,forces(Neg(\)),[p,P,leq,one]@env) \ (p\P \ \(\q\M. q\P \ is_leq(##M,leq,q,p) \ (sats(M,forces'(\),[q,P,leq,one]@env))))" unfolding Neg_def using assms sats_forces_Nand by simp lemma sats_forces_Forall : assumes "\\formula" "env\list(M)" "p\M" shows "sats(M,forces(Forall(\)),[p,P,leq,one]@env) \ p\P \ (\x\M. sats(M,forces'(\),[p,P,leq,one,x]@env))" unfolding forces_def using assms sats_ren_forces_forall P_in_M leq_in_M one_in_M by simp end (* forcing_data *) subsection\The arity of \<^term>\forces\\ lemma arity_forces_at: assumes "x \ nat" "y \ nat" shows "arity(forces(Member(x, y))) = (succ(x) \ succ(y)) #+ 4" "arity(forces(Equal(x, y))) = (succ(x) \ succ(y)) #+ 4" unfolding forces_def using assms arity_forces_mem_fm arity_forces_eq_fm succ_Un_distrib nat_simp_union by auto lemma arity_forces': assumes "\\formula" shows "arity(forces'(\)) \ arity(\) #+ 4" using assms proof (induct set:formula) case (Member x y) then show ?case using arity_forces_mem_fm succ_Un_distrib nat_simp_union by simp next case (Equal x y) then show ?case using arity_forces_eq_fm succ_Un_distrib nat_simp_union by simp next case (Nand \ \) let ?\' = "ren_forces_nand(forces'(\))" let ?\' = "ren_forces_nand(forces'(\))" have "arity(leq_fm(3, 0, 1)) = 4" using arity_leq_fm succ_Un_distrib nat_simp_union by simp have "3 \ (4#+arity(\)) \ (4#+arity(\))" (is "_ \ ?rhs") using nat_simp_union by simp from \\\_\ Nand have "pred(arity(?\')) \ ?rhs" "pred(arity(?\')) \ ?rhs" proof - from \\\_\ \\\_\ have A:"pred(arity(?\')) \ arity(forces'(\))" "pred(arity(?\')) \ arity(forces'(\))" using pred_mono[OF _ arity_ren_forces_nand] pred_succ_eq by simp_all from Nand have "3 \ arity(forces'(\)) \ arity(\) #+ 4" "3 \ arity(forces'(\)) \ arity(\) #+ 4" using Un_le by simp_all with Nand show "pred(arity(?\')) \ ?rhs" "pred(arity(?\')) \ ?rhs" using le_trans[OF A(1)] le_trans[OF A(2)] le_Un_iff by simp_all qed with Nand \_=4\ show ?case using pred_Un_distrib Un_assoc[symmetric] succ_Un_distrib nat_union_abs1 Un_leI3[OF \3 \ ?rhs\] by simp next case (Forall \) let ?\' = "ren_forces_forall(forces'(\))" show ?case proof (cases "arity(\) = 0") case True with Forall show ?thesis proof - from Forall True have "arity(forces'(\)) \ 5" using le_trans[of _ 4 5] by auto with \\\_\ have "arity(?\') \ 5" using arity_ren_forces_all[OF forces'_type[OF \\\_\]] nat_union_abs2 by auto with Forall True show ?thesis using pred_mono[OF _ \arity(?\') \ 5\] by simp qed next case False with Forall show ?thesis proof - from Forall False have "arity(?\') = 5 \ arity(forces'(\))" "arity(forces'(\)) \ 5 #+ arity(\)" "4 \ succ(succ(succ(arity(\))))" using Ord_0_lt arity_ren_forces_all le_trans[OF _ add_le_mono[of 4 5, OF _ le_refl]] by auto with \\\_\ have "5 \ arity(forces'(\)) \ 5#+arity(\)" using nat_simp_union by auto with \\\_\ \arity(?\') = 5 \ _\ show ?thesis using pred_Un_distrib succ_pred_eq[OF _ \arity(\)\0\] pred_mono[OF _ Forall(2)] Un_le[OF \4\succ(_)\] by simp qed qed qed lemma arity_forces : assumes "\\formula" shows "arity(forces(\)) \ 4#+arity(\)" unfolding forces_def using assms arity_forces' le_trans nat_simp_union by auto lemma arity_forces_le : assumes "\\formula" "n\nat" "arity(\) \ n" shows "arity(forces(\)) \ 4#+n" using assms le_trans[OF _ add_le_mono[OF le_refl[of 5] \arity(\)\_\]] arity_forces by auto end \ No newline at end of file diff --git a/thys/Forcing/Internal_ZFC_Axioms.thy b/thys/Forcing/Internal_ZFC_Axioms.thy --- a/thys/Forcing/Internal_ZFC_Axioms.thy +++ b/thys/Forcing/Internal_ZFC_Axioms.thy @@ -1,523 +1,523 @@ section\The ZFC axioms, internalized\ theory Internal_ZFC_Axioms imports Forcing_Data begin schematic_goal ZF_union_auto: "Union_ax(##A) \ (A, [] \ ?zfunion)" unfolding Union_ax_def by ((rule sep_rules | simp)+) synthesize "ZF_union_fm" from_schematic ZF_union_auto schematic_goal ZF_power_auto: "power_ax(##A) \ (A, [] \ ?zfpow)" unfolding power_ax_def powerset_def subset_def by ((rule sep_rules | simp)+) synthesize "ZF_power_fm" from_schematic ZF_power_auto schematic_goal ZF_pairing_auto: "upair_ax(##A) \ (A, [] \ ?zfpair)" unfolding upair_ax_def by ((rule sep_rules | simp)+) synthesize "ZF_pairing_fm" from_schematic ZF_pairing_auto schematic_goal ZF_foundation_auto: "foundation_ax(##A) \ (A, [] \ ?zfpow)" unfolding foundation_ax_def by ((rule sep_rules | simp)+) synthesize "ZF_foundation_fm" from_schematic ZF_foundation_auto schematic_goal ZF_extensionality_auto: "extensionality(##A) \ (A, [] \ ?zfpow)" unfolding extensionality_def by ((rule sep_rules | simp)+) synthesize "ZF_extensionality_fm" from_schematic ZF_extensionality_auto schematic_goal ZF_infinity_auto: "infinity_ax(##A) \ (A, [] \ (?\(i,j,h)))" unfolding infinity_ax_def by ((rule sep_rules | simp)+) synthesize "ZF_infinity_fm" from_schematic ZF_infinity_auto schematic_goal ZF_choice_auto: "choice_ax(##A) \ (A, [] \ (?\(i,j,h)))" unfolding choice_ax_def by ((rule sep_rules | simp)+) synthesize "ZF_choice_fm" from_schematic ZF_choice_auto syntax "_choice" :: "i" ("AC") translations "AC" \ "CONST ZF_choice_fm" lemmas ZFC_fm_defs = ZF_extensionality_fm_def ZF_foundation_fm_def ZF_pairing_fm_def ZF_union_fm_def ZF_infinity_fm_def ZF_power_fm_def ZF_choice_fm_def lemmas ZFC_fm_sats = ZF_extensionality_auto ZF_foundation_auto ZF_pairing_auto ZF_union_auto ZF_infinity_auto ZF_power_auto ZF_choice_auto definition ZF_fin :: "i" where "ZF_fin \ { ZF_extensionality_fm, ZF_foundation_fm, ZF_pairing_fm, ZF_union_fm, ZF_infinity_fm, ZF_power_fm }" definition ZFC_fin :: "i" where "ZFC_fin \ ZF_fin \ {ZF_choice_fm}" lemma ZFC_fin_type : "ZFC_fin \ formula" unfolding ZFC_fin_def ZF_fin_def ZFC_fm_defs by (auto) subsection\The Axiom of Separation, internalized\ lemma iterates_Forall_type [TC]: "\ n \ nat; p \ formula \ \ Forall^n(p) \ formula" by (induct set:nat, auto) lemma last_init_eq : assumes "l \ list(A)" "length(l) = succ(n)" shows "\ a\A. \l'\list(A). l = l'@[a]" proof- from \l\_\ \length(_) = _\ have "rev(l) \ list(A)" "length(rev(l)) = succ(n)" by simp_all then obtain a l' where "a\A" "l'\list(A)" "rev(l) = Cons(a,l')" by (cases;simp) then have "l = rev(l') @ [a]" "rev(l') \ list(A)" using rev_rev_ident[OF \l\_\] by auto with \a\_\ show ?thesis by blast qed lemma take_drop_eq : assumes "l\list(M)" shows "\ n . n < succ(length(l)) \ l = take(n,l) @ drop(n,l)" using \l\list(M)\ proof induct case Nil then show ?case by auto next case (Cons a l) then show ?case proof - { fix i assume "il\list(M)\ consider (lt) "i = 0" | (eq) "\k\nat. i = succ(k) \ k < succ(length(l))" using \l\list(M)\ le_natI nat_imp_quasinat by (cases rule:nat_cases[of i];auto) then have "take(i,Cons(a,l)) @ drop(i,Cons(a,l)) = Cons(a,l)" using Cons by (cases;auto) } then show ?thesis using Cons by auto qed qed lemma list_split : assumes "n \ succ(length(rest))" "rest \ list(M)" shows "\re\list(M). \st\list(M). rest = re @ st \ length(re) = pred(n)" proof - from assms have "pred(n) \ length(rest)" using pred_mono[OF _ \n\_\] pred_succ_eq by auto with \rest\_\ have "pred(n)\nat" "rest = take(pred(n),rest) @ drop(pred(n),rest)" (is "_ = ?re @ ?st") using take_drop_eq[OF \rest\_\] le_natI by auto then have "length(?re) = pred(n)" "?re\list(M)" "?st\list(M)" using length_take[rule_format,OF _ \pred(n)\_\] \pred(n) \ _\ \rest\_\ unfolding min_def by auto then show ?thesis using rev_bexI[of _ _ "\ re. \st\list(M). rest = re @ st \ length(re) = pred(n)"] \length(?re) = _\ \rest = _\ by auto qed lemma sats_nForall: assumes "\ \ formula" shows "n\nat \ ms \ list(M) \ M, ms \ (Forall^n(\)) \ (\rest \ list(M). length(rest) = n \ M, rest @ ms \ \)" proof (induct n arbitrary:ms set:nat) case 0 with assms show ?case by simp next case (succ n) have "(\rest\list(M). length(rest) = succ(n) \ P(rest,n)) \ (\t\M. \res\list(M). length(res) = n \ P(res @ [t],n))" if "n\nat" for n P using that last_init_eq by force from this[of _ "\rest _. (M, rest @ ms \ \)"] \n\nat\ have "(\rest\list(M). length(rest) = succ(n) \ M, rest @ ms \ \) \ (\t\M. \res\list(M). length(res) = n \ M, (res @ [t]) @ ms \ \)" by simp with assms succ(1,3) succ(2)[of "Cons(_,ms)"] show ?case using arity_sats_iff[of \ _ M "Cons(_, ms @ _)"] app_assoc by (simp) qed definition sep_body_fm :: "i \ i" where "sep_body_fm(p) \ Forall(Exists(Forall( Iff(Member(0,1),And(Member(0,2), incr_bv1^2(p))))))" lemma sep_body_fm_type [TC]: "p \ formula \ sep_body_fm(p) \ formula" by (simp add: sep_body_fm_def) lemma sats_sep_body_fm: assumes "\ \ formula" "ms\list(M)" "rest\list(M)" shows "M, rest @ ms \ sep_body_fm(\) \ separation(##M,\x. M, [x] @ rest @ ms \ \)" using assms formula_add_params1[of _ 2 _ _ "[_,_]" ] unfolding sep_body_fm_def separation_def by simp definition ZF_separation_fm :: "i \ i" where "ZF_separation_fm(p) \ Forall^(pred(arity(p)))(sep_body_fm(p))" lemma ZF_separation_fm_type [TC]: "p \ formula \ ZF_separation_fm(p) \ formula" by (simp add: ZF_separation_fm_def) lemma sats_ZF_separation_fm_iff: assumes "\\formula" shows "(M, [] \ (ZF_separation_fm(\))) \ (\env\list(M). arity(\) \ 1 #+ length(env) \ separation(##M,\x. M, [x] @ env \ \))" proof (intro iffI ballI impI) let ?n="Arith.pred(arity(\))" fix env assume "M, [] \ ZF_separation_fm(\)" assume "arity(\) \ 1 #+ length(env)" "env\list(M)" moreover from this have "arity(\) \ succ(length(env))" by simp then obtain some rest where "some\list(M)" "rest\list(M)" "env = some @ rest" "length(some) = Arith.pred(arity(\))" using list_split[OF \arity(\) \ succ(_)\ \env\_\] by force moreover from \\\_\ have "arity(\) \ succ(Arith.pred(arity(\)))" using succpred_leI by simp moreover note assms moreover assume "M, [] \ ZF_separation_fm(\)" moreover from calculation have "M, some \ sep_body_fm(\)" using sats_nForall[of "sep_body_fm(\)" ?n] unfolding ZF_separation_fm_def by simp ultimately show "separation(##M, \x. M, [x] @ env \ \)" unfolding ZF_separation_fm_def using sats_sep_body_fm[of \ "[]" M some] arity_sats_iff[of \ rest M "[_] @ some"] separation_cong[of "##M" "\x. M, Cons(x, some @ rest) \ \" _ ] by simp next \ \almost equal to the previous implication\ let ?n="Arith.pred(arity(\))" assume asm:"\env\list(M). arity(\) \ 1 #+ length(env) \ separation(##M, \x. M, [x] @ env \ \)" { fix some assume "some\list(M)" "length(some) = Arith.pred(arity(\))" moreover note \\\_\ moreover from calculation have "arity(\) \ 1 #+ length(some)" using le_trans[OF succpred_leI] succpred_leI by simp moreover from calculation and asm have "separation(##M, \x. M, [x] @ some \ \)" by blast ultimately have "M, some \ sep_body_fm(\)" using sats_sep_body_fm[of \ "[]" M some] arity_sats_iff[of \ _ M "[_,_] @ some"] strong_replacement_cong[of "##M" "\x y. M, Cons(x, Cons(y, some @ _)) \ \" _ ] by simp } with \\\_\ show "M, [] \ ZF_separation_fm(\)" using sats_nForall[of "sep_body_fm(\)" ?n] unfolding ZF_separation_fm_def by simp qed subsection\The Axiom of Replacement, internalized\ schematic_goal sats_univalent_fm_auto: assumes (* Q_iff_sats:"\a b z env aa bb. nth(a,Cons(z,env)) = aa \ nth(b,Cons(z,env)) = bb \ z\A \ aa \ A \ bb \ A \ env\ list(A) \ Q(aa,bb) \ (A, Cons(z,env) \ (Q_fm(a,b)))" \ \using only one formula\ *) Q_iff_sats:"\x y z. x \ A \ y \ A \ z\A \ Q(x,z) \ (A,Cons(z,Cons(y,Cons(x,env))) \ Q1_fm)" "\x y z. x \ A \ y \ A \ z\A \ Q(x,y) \ (A,Cons(z,Cons(y,Cons(x,env))) \ Q2_fm)" and asms: "nth(i,env) = B" "i \ nat" "env \ list(A)" shows "univalent(##A,B,Q) \ A,env \ ?ufm(i)" unfolding univalent_def by (insert asms; (rule sep_rules Q_iff_sats | simp)+) synthesize_notc "univalent_fm" from_schematic sats_univalent_fm_auto lemma univalent_fm_type [TC]: "q1\ formula \ q2\formula \ i\nat \ univalent_fm(q2,q1,i) \formula" by (simp add:univalent_fm_def) lemma sats_univalent_fm : assumes Q_iff_sats:"\x y z. x \ A \ y \ A \ z\A \ Q(x,z) \ (A,Cons(z,Cons(y,Cons(x,env))) \ Q1_fm)" "\x y z. x \ A \ y \ A \ z\A \ Q(x,y) \ (A,Cons(z,Cons(y,Cons(x,env))) \ Q2_fm)" and asms: "nth(i,env) = B" "i \ nat" "env \ list(A)" shows - "A,env \ univalent_fm(Q2_fm,Q1_fm,i) \ univalent(##A,B,Q)" + "A,env \ univalent_fm(Q1_fm,Q2_fm,i) \ univalent(##A,B,Q)" unfolding univalent_fm_def using asms sats_univalent_fm_auto[OF Q_iff_sats] by simp definition swap_vars :: "i\i" where "swap_vars(\) \ Exists(Exists(And(Equal(0,3),And(Equal(1,2),iterates(\p. incr_bv(p)`2 , 2, \)))))" lemma swap_vars_type[TC] : "\\formula \ swap_vars(\) \formula" unfolding swap_vars_def by simp lemma sats_swap_vars : "[x,y] @ env \ list(M) \ \\formula \ M, [x,y] @ env \ swap_vars(\)\ M,[y,x] @ env \ \" unfolding swap_vars_def using sats_incr_bv_iff [of _ _ M _ "[y,x]"] by simp definition univalent_Q1 :: "i \ i" where "univalent_Q1(\) \ incr_bv1(swap_vars(\))" definition univalent_Q2 :: "i \ i" where "univalent_Q2(\) \ incr_bv(swap_vars(\))`0" lemma univalent_Qs_type [TC]: assumes "\\formula" shows "univalent_Q1(\) \ formula" "univalent_Q2(\) \ formula" unfolding univalent_Q1_def univalent_Q2_def using assms by simp_all lemma sats_univalent_fm_assm: assumes "x \ A" "y \ A" "z\A" "env\ list(A)" "\ \ formula" shows "(A, ([x,z] @ env) \ \) \ (A, Cons(z,Cons(y,Cons(x,env))) \ (univalent_Q1(\)))" "(A, ([x,y] @ env) \ \) \ (A, Cons(z,Cons(y,Cons(x,env))) \ (univalent_Q2(\)))" unfolding univalent_Q1_def univalent_Q2_def using sats_incr_bv_iff[of _ _ A _ "[]"] \ \simplifies iterates of \<^term>\\x. incr_bv(x)`0\\ sats_incr_bv1_iff[of _ "Cons(x,env)" A z y] sats_swap_vars assms by simp_all definition rep_body_fm :: "i \ i" where "rep_body_fm(p) \ Forall(Implies( - univalent_fm(univalent_Q2(incr_bv(p)`2),univalent_Q1(incr_bv(p)`2),0), + univalent_fm(univalent_Q1(incr_bv(p)`2),univalent_Q2(incr_bv(p)`2),0), Exists(Forall( Iff(Member(0,1),Exists(And(Member(0,3),incr_bv(incr_bv(p)`2)`2)))))))" lemma rep_body_fm_type [TC]: "p \ formula \ rep_body_fm(p) \ formula" by (simp add: rep_body_fm_def) lemmas ZF_replacement_simps = formula_add_params1[of \ 2 _ M "[_,_]" ] sats_incr_bv_iff[of _ _ M _ "[]"] \ \simplifies iterates of \<^term>\\x. incr_bv(x)`0\\ sats_incr_bv_iff[of _ _ M _ "[_,_]"]\ \simplifies \<^term>\\x. incr_bv(x)`2\\ sats_incr_bv1_iff[of _ _ M] sats_swap_vars for \ M lemma sats_rep_body_fm: assumes "\ \ formula" "ms\list(M)" "rest\list(M)" shows "M, rest @ ms \ rep_body_fm(\) \ strong_replacement(##M,\x y. M, [x,y] @ rest @ ms \ \)" using assms ZF_replacement_simps unfolding rep_body_fm_def strong_replacement_def univalent_def unfolding univalent_fm_def univalent_Q1_def univalent_Q2_def by simp definition ZF_replacement_fm :: "i \ i" where "ZF_replacement_fm(p) \ Forall^(pred(pred(arity(p))))(rep_body_fm(p))" lemma ZF_replacement_fm_type [TC]: "p \ formula \ ZF_replacement_fm(p) \ formula" by (simp add: ZF_replacement_fm_def) lemma sats_ZF_replacement_fm_iff: assumes "\\formula" shows "(M, [] \ (ZF_replacement_fm(\))) \ (\env\list(M). arity(\) \ 2 #+ length(env) \ strong_replacement(##M,\x y. M,[x,y] @ env \ \))" proof (intro iffI ballI impI) let ?n="Arith.pred(Arith.pred(arity(\)))" fix env assume "M, [] \ ZF_replacement_fm(\)" "arity(\) \ 2 #+ length(env)" "env\list(M)" moreover from this have "arity(\) \ succ(succ(length(env)))" by (simp) moreover from calculation have "pred(arity(\)) \ succ(length(env))" using pred_mono[OF _ \arity(\)\succ(_)\] pred_succ_eq by simp moreover from calculation obtain some rest where "some\list(M)" "rest\list(M)" "env = some @ rest" "length(some) = Arith.pred(Arith.pred(arity(\)))" using list_split[OF \pred(_) \ _\ \env\_\] by auto moreover note \\\_\ moreover from this have "arity(\) \ succ(succ(Arith.pred(Arith.pred(arity(\)))))" using le_trans[OF succpred_leI] succpred_leI by simp moreover from calculation have "M, some \ rep_body_fm(\)" using sats_nForall[of "rep_body_fm(\)" ?n] unfolding ZF_replacement_fm_def by simp ultimately show "strong_replacement(##M, \x y. M, [x, y] @ env \ \)" using sats_rep_body_fm[of \ "[]" M some] arity_sats_iff[of \ rest M "[_,_] @ some"] strong_replacement_cong[of "##M" "\x y. M, Cons(x, Cons(y, some @ rest)) \ \" _ ] by simp next \ \almost equal to the previous implication\ let ?n="Arith.pred(Arith.pred(arity(\)))" assume asm:"\env\list(M). arity(\) \ 2 #+ length(env) \ strong_replacement(##M, \x y. M, [x, y] @ env \ \)" { fix some assume "some\list(M)" "length(some) = Arith.pred(Arith.pred(arity(\)))" moreover note \\\_\ moreover from calculation have "arity(\) \ 2 #+ length(some)" using le_trans[OF succpred_leI] succpred_leI by simp moreover from calculation and asm have "strong_replacement(##M, \x y. M, [x, y] @ some \ \)" by blast ultimately have "M, some \ rep_body_fm(\)" using sats_rep_body_fm[of \ "[]" M some] arity_sats_iff[of \ _ M "[_,_] @ some"] strong_replacement_cong[of "##M" "\x y. M, Cons(x, Cons(y, some @ _)) \ \" _ ] by simp } with \\\_\ show "M, [] \ ZF_replacement_fm(\)" using sats_nForall[of "rep_body_fm(\)" ?n] unfolding ZF_replacement_fm_def by simp qed definition ZF_inf :: "i" where "ZF_inf \ {ZF_separation_fm(p) . p \ formula } \ {ZF_replacement_fm(p) . p \ formula }" lemma Un_subset_formula: "A\formula \ B\formula \ A\B \ formula" by auto lemma ZF_inf_subset_formula : "ZF_inf \ formula" unfolding ZF_inf_def by auto definition ZFC :: "i" where "ZFC \ ZF_inf \ ZFC_fin" definition ZF :: "i" where "ZF \ ZF_inf \ ZF_fin" definition ZF_minus_P :: "i" where "ZF_minus_P \ ZF - { ZF_power_fm }" lemma ZFC_subset_formula: "ZFC \ formula" by (simp add:ZFC_def Un_subset_formula ZF_inf_subset_formula ZFC_fin_type) txt\Satisfaction of a set of sentences\ definition satT :: "[i,i] \ o" ("_ \ _" [36,36] 60) where "A \ \ \ \\\\. (A,[] \ \)" lemma satTI [intro!]: assumes "\\. \\\ \ A,[] \ \" shows "A \ \" using assms unfolding satT_def by simp lemma satTD [dest] :"A \ \ \ \\\ \ A,[] \ \" unfolding satT_def by simp lemma sats_ZFC_iff_sats_ZF_AC: "(N \ ZFC) \ (N \ ZF) \ (N, [] \ AC)" unfolding ZFC_def ZFC_fin_def ZF_def by auto lemma M_ZF_iff_M_satT: "M_ZF(M) \ (M \ ZF)" proof assume "M \ ZF" then have fin: "upair_ax(##M)" "Union_ax(##M)" "power_ax(##M)" "extensionality(##M)" "foundation_ax(##M)" "infinity_ax(##M)" unfolding ZF_def ZF_fin_def ZFC_fm_defs satT_def using ZFC_fm_sats[of M] by simp_all { fix \ env assume "\ \ formula" "env\list(M)" moreover from \M \ ZF\ have "\p\formula. (M, [] \ (ZF_separation_fm(p)))" "\p\formula. (M, [] \ (ZF_replacement_fm(p)))" unfolding ZF_def ZF_inf_def by auto moreover from calculation have "arity(\) \ succ(length(env)) \ separation(##M, \x. (M, Cons(x, env) \ \))" "arity(\) \ succ(succ(length(env))) \ strong_replacement(##M,\x y. sats(M,\,Cons(x,Cons(y, env))))" using sats_ZF_separation_fm_iff sats_ZF_replacement_fm_iff by simp_all } with fin show "M_ZF(M)" unfolding M_ZF_def by simp next assume \M_ZF(M)\ then have "M \ ZF_fin" unfolding M_ZF_def ZF_fin_def ZFC_fm_defs satT_def using ZFC_fm_sats[of M] by blast moreover from \M_ZF(M)\ have "\p\formula. (M, [] \ (ZF_separation_fm(p)))" "\p\formula. (M, [] \ (ZF_replacement_fm(p)))" unfolding M_ZF_def using sats_ZF_separation_fm_iff sats_ZF_replacement_fm_iff by simp_all ultimately show "M \ ZF" unfolding ZF_def ZF_inf_def by blast qed end diff --git a/thys/Forcing/Names.thy b/thys/Forcing/Names.thy --- a/thys/Forcing/Names.thy +++ b/thys/Forcing/Names.thy @@ -1,1060 +1,1060 @@ section\Names and generic extensions\ theory Names imports Forcing_Data Interface Recursion_Thms Synthetic_Definition begin definition SepReplace :: "[i, i\i, i\ o] \ i" where "SepReplace(A,b,Q) \ {y . x\A, y=b(x) \ Q(x)}" syntax "_SepReplace" :: "[i, pttrn, i, o] \ i" ("(1{_ ../ _ \ _, _})") translations "{b .. x\A, Q}" => "CONST SepReplace(A, \x. b, \x. Q)" lemma Sep_and_Replace: "{b(x) .. x\A, P(x) } = {b(x) . x\{y\A. P(y)}}" by (auto simp add:SepReplace_def) lemma SepReplace_subset : "A\A'\ {b .. x\A, Q}\{b .. x\A', Q}" by (auto simp add:SepReplace_def) lemma SepReplace_iff [simp]: "y\{b(x) .. x\A, P(x)} \ (\x\A. y=b(x) & P(x))" by (auto simp add:SepReplace_def) lemma SepReplace_dom_implies : "(\ x . x \A \ b(x) = b'(x))\ {b(x) .. x\A, Q(x)}={b'(x) .. x\A, Q(x)}" by (simp add:SepReplace_def) lemma SepReplace_pred_implies : "\x. Q(x)\ b(x) = b'(x)\ {b(x) .. x\A, Q(x)}={b'(x) .. x\A, Q(x)}" by (force simp add:SepReplace_def) subsection\The well-founded relation \<^term>\ed\\ lemma eclose_sing : "x \ eclose(a) \ x \ eclose({a})" by(rule subsetD[OF mem_eclose_subset],simp+) lemma ecloseE : assumes "x \ eclose(A)" shows "x \ A \ (\ B \ A . x \ eclose(B))" using assms proof (induct rule:eclose_induct_down) case (1 y) then show ?case using arg_into_eclose by auto next case (2 y z) from \y \ A \ (\B\A. y \ eclose(B))\ consider (inA) "y \ A" | (exB) "(\B\A. y \ eclose(B))" by auto then show ?case proof (cases) case inA then show ?thesis using 2 arg_into_eclose by auto next case exB then obtain B where "y \ eclose(B)" "B\A" by auto then show ?thesis using 2 ecloseD[of y B z] by auto qed qed lemma eclose_singE : "x \ eclose({a}) \ x = a \ x \ eclose(a)" by(blast dest: ecloseE) lemma in_eclose_sing : assumes "x \ eclose({a})" "a \ eclose(z)" shows "x \ eclose({z})" proof - from \x\eclose({a})\ consider (eq) "x=a" | (lt) "x\eclose(a)" using eclose_singE by auto then show ?thesis using eclose_sing mem_eclose_trans assms by (cases, auto) qed lemma in_dom_in_eclose : assumes "x \ domain(z)" shows "x \ eclose(z)" proof - from assms obtain y where "\x,y\ \ z" unfolding domain_def by auto then show ?thesis unfolding Pair_def using ecloseD[of "{x,x}"] ecloseD[of "{{x,x},{x,y}}"] arg_into_eclose by auto qed text\term\ed\ is the well-founded relation on which \<^term>\val\ is defined.\ definition ed :: "[i,i] \ o" where "ed(x,y) \ x \ domain(y)" definition edrel :: "i \ i" where "edrel(A) \ Rrel(ed,A)" lemma edI[intro!]: "t\domain(x) \ ed(t,x)" unfolding ed_def . lemma edD[dest!]: "ed(t,x) \ t\domain(x)" unfolding ed_def . lemma rank_ed: assumes "ed(y,x)" shows "succ(rank(y)) \ rank(x)" proof from assms obtain p where "\y,p\\x" by auto moreover obtain s where "y\s" "s\\y,p\" unfolding Pair_def by auto ultimately have "rank(y) < rank(s)" "rank(s) < rank(\y,p\)" "rank(\y,p\) < rank(x)" using rank_lt by blast+ then show "rank(y) < rank(x)" using lt_trans by blast qed lemma edrel_dest [dest]: "x \ edrel(A) \ \ a\ A. \ b \ A. x =\a,b\" by(auto simp add:ed_def edrel_def Rrel_def) lemma edrelD : "x \ edrel(A) \ \ a\ A. \ b \ A. x =\a,b\ \ a \ domain(b)" by(auto simp add:ed_def edrel_def Rrel_def) lemma edrelI [intro!]: "x\A \ y\A \ x \ domain(y) \ \x,y\\edrel(A)" by (simp add:ed_def edrel_def Rrel_def) lemma edrel_trans: "Transset(A) \ y\A \ x \ domain(y) \ \x,y\\edrel(A)" by (rule edrelI, auto simp add:Transset_def domain_def Pair_def) lemma domain_trans: "Transset(A) \ y\A \ x \ domain(y) \ x\A" by (auto simp add: Transset_def domain_def Pair_def) lemma relation_edrel : "relation(edrel(A))" by(auto simp add: relation_def) lemma field_edrel : "field(edrel(A))\A" by blast lemma edrel_sub_memrel: "edrel(A) \ trancl(Memrel(eclose(A)))" proof fix z assume "z\edrel(A)" then obtain x y where Eq1: "x\A" "y\A" "z=\x,y\" "x\domain(y)" using edrelD by blast then obtain u v where Eq2: "x\u" "u\v" "v\y" unfolding domain_def Pair_def by auto with Eq1 have Eq3: "x\eclose(A)" "y\eclose(A)" "u\eclose(A)" "v\eclose(A)" by (auto, rule_tac [3-4] ecloseD, rule_tac [3] ecloseD, simp_all add:arg_into_eclose) let ?r="trancl(Memrel(eclose(A)))" from Eq2 and Eq3 have "\x,u\\?r" "\u,v\\?r" "\v,y\\?r" by (auto simp add: r_into_trancl) then have "\x,y\\?r" by (rule_tac trancl_trans, rule_tac [2] trancl_trans, simp) with Eq1 show "z\?r" by simp qed lemma wf_edrel : "wf(edrel(A))" using wf_subset [of "trancl(Memrel(eclose(A)))"] edrel_sub_memrel wf_trancl wf_Memrel by auto lemma ed_induction: assumes "\x. \\y. ed(y,x) \ Q(y) \ \ Q(x)" shows "Q(a)" proof(induct rule: wf_induct2[OF wf_edrel[of "eclose({a})"] ,of a "eclose({a})"]) case 1 then show ?case using arg_into_eclose by simp next case 2 then show ?case using field_edrel . next case (3 x) then show ?case using assms[of x] edrelI domain_trans[OF Transset_eclose 3(1)] by blast qed lemma dom_under_edrel_eclose: "edrel(eclose({x})) -`` {x} = domain(x)" proof show "edrel(eclose({x})) -`` {x} \ domain(x)" unfolding edrel_def Rrel_def ed_def by auto next show "domain(x) \ edrel(eclose({x})) -`` {x}" unfolding edrel_def Rrel_def using in_dom_in_eclose eclose_sing arg_into_eclose by blast qed lemma ed_eclose : "\y,z\ \ edrel(A) \ y \ eclose(z)" by(drule edrelD,auto simp add:domain_def in_dom_in_eclose) lemma tr_edrel_eclose : "\y,z\ \ edrel(eclose({x}))^+ \ y \ eclose(z)" by(rule trancl_induct,(simp add: ed_eclose mem_eclose_trans)+) lemma restrict_edrel_eq : assumes "z \ domain(x)" shows "edrel(eclose({x})) \ eclose({z})\eclose({z}) = edrel(eclose({z}))" proof(intro equalityI subsetI) let ?ec="\ y . edrel(eclose({y}))" let ?ez="eclose({z})" let ?rr="?ec(x) \ ?ez \ ?ez" fix y assume yr:"y \ ?rr" with yr obtain a b where 1:"\a,b\ \ ?rr" "a \ ?ez" "b \ ?ez" "\a,b\ \ ?ec(x)" "y=\a,b\" by blast moreover from this have "a \ domain(b)" using edrelD by blast ultimately show "y \ edrel(eclose({z}))" by blast next let ?ec="\ y . edrel(eclose({y}))" let ?ez="eclose({z})" let ?rr="?ec(x) \ ?ez \ ?ez" fix y assume yr:"y \ edrel(?ez)" then obtain a b where "a \ ?ez" "b \ ?ez" "y=\a,b\" "a \ domain(b)" using edrelD by blast moreover from this assms have "z \ eclose(x)" using in_dom_in_eclose by simp moreover from assms calculation have "a \ eclose({x})" "b \ eclose({x})" using in_eclose_sing by simp_all moreover from this \a\domain(b)\ have "\a,b\ \ edrel(eclose({x}))" by blast ultimately show "y \ ?rr" by simp qed lemma tr_edrel_subset : assumes "z \ domain(x)" shows "tr_down(edrel(eclose({x})),z) \ eclose({z})" proof(intro subsetI) let ?r="\ x . edrel(eclose({x}))" fix y assume "y \ tr_down(?r(x),z)" then have "\y,z\ \ ?r(x)^+" using tr_downD by simp with assms show "y \ eclose({z})" using tr_edrel_eclose eclose_sing by simp qed context M_ctm begin lemma upairM : "x \ M \ y \ M \ {x,y} \ M" by (simp flip: setclass_iff) lemma singletonM : "a \ M \ {a} \ M" by (simp flip: setclass_iff) lemma Rep_simp : "Replace(u,\ y z . z = f(y)) = { f(y) . y \ u}" by(auto) end (* M_ctm *) subsection\Values and check-names\ context forcing_data begin definition Hcheck :: "[i,i] \ i" where "Hcheck(z,f) \ { \f`y,one\ . y \ z}" definition check :: "i \ i" where "check(x) \ transrec(x , Hcheck)" lemma checkD: "check(x) = wfrec(Memrel(eclose({x})), x, Hcheck)" unfolding check_def transrec_def .. definition rcheck :: "i \ i" where "rcheck(x) \ Memrel(eclose({x}))^+" lemma Hcheck_trancl:"Hcheck(y, restrict(f,Memrel(eclose({x}))-``{y})) = Hcheck(y, restrict(f,(Memrel(eclose({x}))^+)-``{y}))" unfolding Hcheck_def using restrict_trans_eq by simp lemma check_trancl: "check(x) = wfrec(rcheck(x), x, Hcheck)" using checkD wf_eq_trancl Hcheck_trancl unfolding rcheck_def by simp (* relation of check is in M *) lemma rcheck_in_M : "x \ M \ rcheck(x) \ M" unfolding rcheck_def by (simp flip: setclass_iff) lemma aux_def_check: "x \ y \ wfrec(Memrel(eclose({y})), x, Hcheck) = wfrec(Memrel(eclose({x})), x, Hcheck)" by (rule wfrec_eclose_eq,auto simp add: arg_into_eclose eclose_sing) lemma def_check : "check(y) = { \check(w),one\ . w \ y}" proof - let ?r="\y. Memrel(eclose({y}))" have wfr: "\w . wf(?r(w))" using wf_Memrel .. then have "check(y)= Hcheck( y, \x\?r(y) -`` {y}. wfrec(?r(y), x, Hcheck))" using wfrec[of "?r(y)" y "Hcheck"] checkD by simp also have " ... = Hcheck( y, \x\y. wfrec(?r(y), x, Hcheck))" using under_Memrel_eclose arg_into_eclose by simp also have " ... = Hcheck( y, \x\y. check(x))" using aux_def_check checkD by simp finally show ?thesis using Hcheck_def by simp qed lemma def_checkS : fixes n assumes "n \ nat" shows "check(succ(n)) = check(n) \ {\check(n),one\}" proof - have "check(succ(n)) = {\check(i),one\ . i \ succ(n)} " using def_check by blast also have "... = {\check(i),one\ . i \ n} \ {\check(n),one\}" by blast also have "... = check(n) \ {\check(n),one\}" using def_check[of n,symmetric] by simp finally show ?thesis . qed lemma field_Memrel2 : assumes "x \ M" shows "field(Memrel(eclose({x}))) \ M" proof - have "field(Memrel(eclose({x}))) \ eclose({x})" "eclose({x}) \ M" using Ordinal.Memrel_type field_rel_subset assms eclose_least[OF trans_M] by auto then show ?thesis using subset_trans by simp qed definition Hv :: "i\i\i\i" where "Hv(G,x,f) \ { f`y .. y\ domain(x), \p\P. \y,p\ \ x \ p \ G }" text\The funcion \<^term>\val\ interprets a name in \<^term>\M\ according to a (generic) filter \<^term>\G\. Note the definition in terms of the well-founded recursor.\ definition val :: "i\i\i" where "val(G,\) \ wfrec(edrel(eclose({\})), \ ,Hv(G))" lemma aux_def_val: assumes "z \ domain(x)" shows "wfrec(edrel(eclose({x})),z,Hv(G)) = wfrec(edrel(eclose({z})),z,Hv(G))" proof - let ?r="\x . edrel(eclose({x}))" have "z\eclose({z})" using arg_in_eclose_sing . moreover have "relation(?r(x))" using relation_edrel . moreover have "wf(?r(x))" using wf_edrel . moreover from assms have "tr_down(?r(x),z) \ eclose({z})" using tr_edrel_subset by simp ultimately have "wfrec(?r(x),z,Hv(G)) = wfrec[eclose({z})](?r(x),z,Hv(G))" using wfrec_restr by simp also from \z\domain(x)\ have "... = wfrec(?r(z),z,Hv(G))" using restrict_edrel_eq wfrec_restr_eq by simp finally show ?thesis . qed text\The next lemma provides the usual recursive expresion for the definition of term\val\.\ lemma def_val: "val(G,x) = {val(G,t) .. t\domain(x) , \p\P . \t,p\\x \ p \ G }" proof - let ?r="\\ . edrel(eclose({\}))" let ?f="\z\?r(x)-``{x}. wfrec(?r(x),z,Hv(G))" have "\\. wf(?r(\))" using wf_edrel by simp with wfrec [of _ x] have "val(G,x) = Hv(G,x,?f)" using val_def by simp also have " ... = Hv(G,x,\z\domain(x). wfrec(?r(x),z,Hv(G)))" using dom_under_edrel_eclose by simp also have " ... = Hv(G,x,\z\domain(x). val(G,z))" using aux_def_val val_def by simp finally show ?thesis using Hv_def SepReplace_def by simp qed lemma val_mono : "x\y \ val(G,x) \ val(G,y)" by (subst (1 2) def_val, force) text\Check-names are the canonical names for elements of the ground model. Here we show that this is the case.\ lemma valcheck : "one \ G \ one \ P \ val(G,check(y)) = y" proof (induct rule:eps_induct) case (1 y) then show ?case proof - have "check(y) = { \check(w), one\ . w \ y}" (is "_ = ?C") using def_check . then have "val(G,check(y)) = val(G, {\check(w), one\ . w \ y})" by simp also have " ... = {val(G,t) .. t\domain(?C) , \p\P . \t, p\\?C \ p \ G }" using def_val by blast also have " ... = {val(G,t) .. t\domain(?C) , \w\y. t=check(w) }" using 1 by simp also have " ... = {val(G,check(w)) . w\y }" by force finally show "val(G,check(y)) = y" using 1 by simp qed qed lemma val_of_name : "val(G,{x\A\P. Q(x)}) = {val(G,t) .. t\A , \p\P . Q(\t,p\) \ p \ G }" proof - let ?n="{x\A\P. Q(x)}" and ?r="\\ . edrel(eclose({\}))" let ?f="\z\?r(?n)-``{?n}. val(G,z)" have wfR : "wf(?r(\))" for \ by (simp add: wf_edrel) have "domain(?n) \ A" by auto { fix t assume H:"t \ domain({x \ A \ P . Q(x)})" then have "?f ` t = (if t \ ?r(?n)-``{?n} then val(G,t) else 0)" by simp moreover have "... = val(G,t)" using dom_under_edrel_eclose H if_P by auto } then have Eq1: "t \ domain({x \ A \ P . Q(x)}) \ val(G,t) = ?f` t" for t by simp have "val(G,?n) = {val(G,t) .. t\domain(?n), \p \ P . \t,p\ \ ?n \ p \ G}" by (subst def_val,simp) also have "... = {?f`t .. t\domain(?n), \p\P . \t,p\\?n \ p\G}" unfolding Hv_def by (subst SepReplace_dom_implies,auto simp add:Eq1) also have "... = { (if t\?r(?n)-``{?n} then val(G,t) else 0) .. t\domain(?n), \p\P . \t,p\\?n \ p\G}" by (simp) also have Eq2: "... = { val(G,t) .. t\domain(?n), \p\P . \t,p\\?n \ p\G}" proof - have "domain(?n) \ ?r(?n)-``{?n}" using dom_under_edrel_eclose by simp then have "\t\domain(?n). (if t\?r(?n)-``{?n} then val(G,t) else 0) = val(G,t)" by auto then show "{ (if t\?r(?n)-``{?n} then val(G,t) else 0) .. t\domain(?n), \p\P . \t,p\\?n \ p\G} = { val(G,t) .. t\domain(?n), \p\P . \t,p\\?n \ p\G}" by auto qed also have " ... = { val(G,t) .. t\A, \p\P . \t,p\\?n \ p\G}" by force finally show " val(G,?n) = { val(G,t) .. t\A, \p\P . Q(\t,p\) \ p\G}" by auto qed lemma val_of_name_alt : "val(G,{x\A\P. Q(x)}) = {val(G,t) .. t\A , \p\P\G . Q(\t,p\) }" using val_of_name by force lemma val_only_names: "val(F,\) = val(F,{x\\. \t\domain(\). \p\P. x=\t,p\})" (is "_ = val(F,?name)") proof - have "val(F,?name) = {val(F, t).. t\domain(?name), \p\P. \t, p\ \ ?name \ p \ F}" using def_val by blast also have " ... = {val(F, t). t\{y\domain(?name). \p\P. \y, p\ \ ?name \ p \ F}}" using Sep_and_Replace by simp also have " ... = {val(F, t). t\{y\domain(\). \p\P. \y, p\ \ \ \ p \ F}}" by blast also have " ... = {val(F, t).. t\domain(\), \p\P. \t, p\ \ \ \ p \ F}" using Sep_and_Replace by simp also have " ... = val(F, \)" using def_val[symmetric] by blast finally show ?thesis .. qed lemma val_only_pairs: "val(F,\) = val(F,{x\\. \t p. x=\t,p\})" proof have "val(F,\) = val(F,{x\\. \t\domain(\). \p\P. x=\t,p\})" (is "_ = val(F,?name)") using val_only_names . also have "... \ val(F,{x\\. \t p. x=\t,p\})" using val_mono[of ?name "{x\\. \t p. x=\t,p\}"] by auto finally show "val(F,\) \ val(F,{x\\. \t p. x=\t,p\})" by simp next show "val(F,{x\\. \t p. x=\t,p\}) \ val(F,\)" using val_mono[of "{x\\. \t p. x=\t,p\}"] by auto qed lemma val_subset_domain_times_range: "val(F,\) \ val(F,domain(\)\range(\))" using val_only_pairs[THEN equalityD1] val_mono[of "{x \ \ . \t p. x = \t, p\}" "domain(\)\range(\)"] by blast lemma val_subset_domain_times_P: "val(F,\) \ val(F,domain(\)\P)" using val_only_names[of F \] val_mono[of "{x\\. \t\domain(\). \p\P. x=\t,p\}" "domain(\)\P" F] by auto definition GenExt :: "i\i" ("M[_]") where "GenExt(G)\ {val(G,\). \ \ M}" lemma val_of_elem: "\\,p\ \ \ \ p\G \ p\P \ val(G,\) \ val(G,\)" proof - assume "\\,p\ \ \" then have "\\domain(\)" by auto assume "p\G" "p\P" with \\\domain(\)\ \\\,p\ \ \\ have "val(G,\) \ {val(G,t) .. t\domain(\) , \p\P . \t, p\\\ \ p \ G }" by auto then show ?thesis by (subst def_val) qed lemma elem_of_val: "x\val(G,\) \ \\\domain(\). val(G,\) = x" by (subst (asm) def_val,auto) lemma elem_of_val_pair: "x\val(G,\) \ \\. \p\G. \\,p\\\ \ val(G,\) = x" by (subst (asm) def_val,auto) lemma elem_of_val_pair': assumes "\\M" "x\val(G,\)" shows "\\\M. \p\G. \\,p\\\ \ val(G,\) = x" proof - from assms obtain \ p where "p\G" "\\,p\\\" "val(G,\) = x" using elem_of_val_pair by blast moreover from this \\\M\ have "\\M" using pair_in_M_iff[THEN iffD1, THEN conjunct1, simplified] transitivity by blast ultimately show ?thesis by blast qed lemma GenExtD: "x \ M[G] \ \\\M. x = val(G,\)" by (simp add:GenExt_def) lemma GenExtI: "x \ M \ val(G,x) \ M[G]" by (auto simp add: GenExt_def) lemma Transset_MG : "Transset(M[G])" proof - { fix vc y assume "vc \ M[G]" and "y \ vc" then obtain c where "c\M" "val(G,c)\M[G]" "y \ val(G,c)" using GenExtD by auto from \y \ val(G,c)\ obtain \ where "\\domain(c)" "val(G,\) = y" using elem_of_val by blast with trans_M \c\M\ have "y \ M[G]" using domain_trans GenExtI by blast } then show ?thesis using Transset_def by auto qed lemmas transitivity_MG = Transset_intf[OF Transset_MG] lemma check_n_M : fixes n assumes "n \ nat" shows "check(n) \ M" using \n\nat\ proof (induct n) case 0 then show ?case using zero_in_M by (subst def_check,simp) next case (succ x) have "one \ M" using one_in_P P_sub_M subsetD by simp with \check(x)\M\ have "\check(x),one\ \ M" using tuples_in_M by simp then have "{\check(x),one\} \ M" using singletonM by simp with \check(x)\M\ have "check(x) \ {\check(x),one\} \ M" using Un_closed by simp then show ?case using \x\nat\ def_checkS by simp qed definition PHcheck :: "[i,i,i,i] \ o" where "PHcheck(o,f,y,p) \ p\M \ (\fy[##M]. fun_apply(##M,f,y,fy) \ pair(##M,fy,o,p))" definition is_Hcheck :: "[i,i,i,i] \ o" where "is_Hcheck(o,z,f,hc) \ is_Replace(##M,z,PHcheck(o,f),hc)" lemma one_in_M: "one \ M" by (insert one_in_P P_in_M, simp add: transitivity) lemma def_PHcheck: assumes "z\M" "f\M" shows "Hcheck(z,f) = Replace(z,PHcheck(one,f))" proof - from assms have "\f`x,one\ \ M" "f`x\M" if "x\z" for x using tuples_in_M one_in_M transitivity that apply_closed by simp_all then have "{y . x \ z, y = \f ` x, one\} = {y . x \ z, y = \f ` x, one\ \ y\M \ f`x\M}" by simp then show ?thesis using \z\M\ \f\M\ transitivity unfolding Hcheck_def PHcheck_def RepFun_def by auto qed (* "PHcheck(o,f,y,p) \ \fy[##M]. fun_apply(##M,f,y,fy) \ pair(##M,fy,o,p)" *) definition PHcheck_fm :: "[i,i,i,i] \ i" where "PHcheck_fm(o,f,y,p) \ Exists(And(fun_apply_fm(succ(f),succ(y),0) ,pair_fm(0,succ(o),succ(p))))" lemma PHcheck_type [TC]: "\ x \ nat; y \ nat; z \ nat; u \ nat \ \ PHcheck_fm(x,y,z,u) \ formula" by (simp add:PHcheck_fm_def) lemma sats_PHcheck_fm [simp]: "\ x \ nat; y \ nat; z \ nat; u \ nat ; env \ list(M)\ \ sats(M,PHcheck_fm(x,y,z,u),env) \ PHcheck(nth(x,env),nth(y,env),nth(z,env),nth(u,env))" using zero_in_M Internalizations.nth_closed by (simp add: PHcheck_def PHcheck_fm_def) (* "is_Hcheck(o,z,f,hc) \ is_Replace(##M,z,PHcheck(o,f),hc)" *) definition is_Hcheck_fm :: "[i,i,i,i] \ i" where "is_Hcheck_fm(o,z,f,hc) \ Replace_fm(z,PHcheck_fm(succ(succ(o)),succ(succ(f)),0,1),hc)" lemma is_Hcheck_type [TC]: "\ x \ nat; y \ nat; z \ nat; u \ nat \ \ is_Hcheck_fm(x,y,z,u) \ formula" by (simp add:is_Hcheck_fm_def) lemma sats_is_Hcheck_fm [simp]: "\ x \ nat; y \ nat; z \ nat; u \ nat ; env \ list(M)\ \ sats(M,is_Hcheck_fm(x,y,z,u),env) \ is_Hcheck(nth(x,env),nth(y,env),nth(z,env),nth(u,env))" using sats_Replace_fm unfolding is_Hcheck_def is_Hcheck_fm_def by simp (* instance of replacement for hcheck *) lemma wfrec_Hcheck : assumes "X\M" shows "wfrec_replacement(##M,is_Hcheck(one),rcheck(X))" proof - have "is_Hcheck(one,a,b,c) \ sats(M,is_Hcheck_fm(8,2,1,0),[c,b,a,d,e,y,x,z,one,rcheck(x)])" if "a\M" "b\M" "c\M" "d\M" "e\M" "y\M" "x\M" "z\M" for a b c d e y x z using that one_in_M \X\M\ rcheck_in_M by simp then have 1:"sats(M,is_wfrec_fm(is_Hcheck_fm(8,2,1,0),4,1,0), [y,x,z,one,rcheck(X)]) \ is_wfrec(##M, is_Hcheck(one),rcheck(X), x, y)" if "x\M" "y\M" "z\M" for x y z using that sats_is_wfrec_fm \X\M\ rcheck_in_M one_in_M by simp let ?f="Exists(And(pair_fm(1,0,2), is_wfrec_fm(is_Hcheck_fm(8,2,1,0),4,1,0)))" have satsf:"sats(M, ?f, [x,z,one,rcheck(X)]) \ (\y\M. pair(##M,x,y,z) & is_wfrec(##M, is_Hcheck(one),rcheck(X), x, y))" if "x\M" "z\M" for x z using that 1 \X\M\ rcheck_in_M one_in_M by (simp del:pair_abs) have artyf:"arity(?f) = 4" unfolding is_wfrec_fm_def is_Hcheck_fm_def Replace_fm_def PHcheck_fm_def pair_fm_def upair_fm_def is_recfun_fm_def fun_apply_fm_def big_union_fm_def pre_image_fm_def restriction_fm_def image_fm_def by (simp add:nat_simp_union) then have "strong_replacement(##M,\x z. sats(M,?f,[x,z,one,rcheck(X)]))" using replacement_ax 1 artyf \X\M\ rcheck_in_M one_in_M by simp then have "strong_replacement(##M,\x z. \y\M. pair(##M,x,y,z) & is_wfrec(##M, is_Hcheck(one),rcheck(X), x, y))" using repl_sats[of M ?f "[one,rcheck(X)]"] satsf by (simp del:pair_abs) then show ?thesis unfolding wfrec_replacement_def by simp qed lemma repl_PHcheck : assumes "f\M" shows "strong_replacement(##M,PHcheck(one,f))" proof - have "arity(PHcheck_fm(2,3,0,1)) = 4" unfolding PHcheck_fm_def fun_apply_fm_def big_union_fm_def pair_fm_def image_fm_def upair_fm_def by (simp add:nat_simp_union) with \f\M\ have "strong_replacement(##M,\x y. sats(M,PHcheck_fm(2,3,0,1),[x,y,one,f]))" using replacement_ax one_in_M by simp with \f\M\ show ?thesis using one_in_M unfolding strong_replacement_def univalent_def by simp qed lemma univ_PHcheck : "\ z\M ; f\M \ \ univalent(##M,z,PHcheck(one,f))" unfolding univalent_def PHcheck_def by simp lemma relation2_Hcheck : "relation2(##M,is_Hcheck(one),Hcheck)" proof - have 1:"\x\z; PHcheck(one,f,x,y) \ \ (##M)(y)" if "z\M" "f\M" for z f x y using that unfolding PHcheck_def by simp have "is_Replace(##M,z,PHcheck(one,f),hc) \ hc = Replace(z,PHcheck(one,f))" if "z\M" "f\M" "hc\M" for z f hc using that Replace_abs[OF _ _ univ_PHcheck 1] by simp with def_PHcheck show ?thesis unfolding relation2_def is_Hcheck_def Hcheck_def by simp qed lemma PHcheck_closed : "\z\M ; f\M ; x\z; PHcheck(one,f,x,y) \ \ (##M)(y)" unfolding PHcheck_def by simp lemma Hcheck_closed : "\y\M. \g\M. function(g) \ Hcheck(y,g)\M" proof - have "Replace(y,PHcheck(one,f))\M" if "f\M" "y\M" for f y using that repl_PHcheck PHcheck_closed[of y f] univ_PHcheck strong_replacement_closed by (simp flip: setclass_iff) then show ?thesis using def_PHcheck by auto qed lemma wf_rcheck : "x\M \ wf(rcheck(x))" unfolding rcheck_def using wf_trancl[OF wf_Memrel] . lemma trans_rcheck : "x\M \ trans(rcheck(x))" unfolding rcheck_def using trans_trancl . lemma relation_rcheck : "x\M \ relation(rcheck(x))" unfolding rcheck_def using relation_trancl . lemma check_in_M : "x\M \ check(x) \ M" unfolding transrec_def using wfrec_Hcheck[of x] check_trancl wf_rcheck trans_rcheck relation_rcheck rcheck_in_M Hcheck_closed relation2_Hcheck trans_wfrec_closed[of "rcheck(x)" x "is_Hcheck(one)" Hcheck] by (simp flip: setclass_iff) end (* forcing_data *) (* check if this should go to Relative! *) definition is_singleton :: "[i\o,i,i] \ o" where "is_singleton(A,x,z) \ \c[A]. empty(A,c) \ is_cons(A,x,c,z)" lemma (in M_trivial) singleton_abs[simp] : "\ M(x) ; M(s) \ \ is_singleton(M,x,s) \ s = {x}" unfolding is_singleton_def using nonempty by simp definition singleton_fm :: "[i,i] \ i" where "singleton_fm(i,j) \ Exists(And(empty_fm(0), cons_fm(succ(i),0,succ(j))))" lemma singleton_type[TC] : "\ x \ nat; y \ nat \ \ singleton_fm(x,y) \ formula" unfolding singleton_fm_def by simp lemma is_singleton_iff_sats: "\ nth(i,env) = x; nth(j,env) = y; i \ nat; j\nat ; env \ list(A)\ \ is_singleton(##A,x,y) \ sats(A, singleton_fm(i,j), env)" unfolding is_singleton_def singleton_fm_def by simp context forcing_data begin (* Internalization and absoluteness of rcheck *) definition is_rcheck :: "[i,i] \ o" where "is_rcheck(x,z) \ \r\M. tran_closure(##M,r,z) \ (\ec\M. membership(##M,ec,r) \ (\s\M. is_singleton(##M,x,s) \ is_eclose(##M,s,ec)))" lemma rcheck_abs : "\ x\M ; r\M \ \ is_rcheck(x,r) \ r = rcheck(x)" unfolding rcheck_def is_rcheck_def using singletonM trancl_closed Memrel_closed eclose_closed by simp schematic_goal rcheck_fm_auto: assumes "i \ nat" "j \ nat" "env \ list(M)" shows "is_rcheck(nth(i,env),nth(j,env)) \ sats(M,?rch(i,j),env)" unfolding is_rcheck_def by (insert assms ; (rule sep_rules is_singleton_iff_sats is_eclose_iff_sats trans_closure_fm_iff_sats | simp)+) synthesize "rcheck_fm" from_schematic rcheck_fm_auto definition is_check :: "[i,i] \ o" where "is_check(x,z) \ \rch\M. is_rcheck(x,rch) \ is_wfrec(##M,is_Hcheck(one),rch,x,z)" lemma check_abs : assumes "x\M" "z\M" shows "is_check(x,z) \ z = check(x)" proof - have "is_check(x,z) \ is_wfrec(##M,is_Hcheck(one),rcheck(x),x,z)" unfolding is_check_def using assms rcheck_abs rcheck_in_M unfolding check_trancl is_check_def by simp then show ?thesis unfolding check_trancl using assms wfrec_Hcheck[of x] wf_rcheck trans_rcheck relation_rcheck rcheck_in_M Hcheck_closed relation2_Hcheck trans_wfrec_abs[of "rcheck(x)" x z "is_Hcheck(one)" Hcheck] by (simp flip: setclass_iff) qed (* \rch\M. is_rcheck(x,rch) \ is_wfrec(##M,is_Hcheck(one),rch,x,z) *) definition check_fm :: "[i,i,i] \ i" where - "check_fm(x,o,z) \ Exists(And(rcheck_fm(0,1#+x), + "check_fm(x,o,z) \ Exists(And(rcheck_fm(1#+x,0), is_wfrec_fm(is_Hcheck_fm(6#+o,2,1,0),0,1#+x,1#+z)))" lemma check_fm_type[TC] : "\x\nat;o\nat;z\nat\ \ check_fm(x,o,z)\formula" unfolding check_fm_def by simp lemma sats_check_fm : assumes "nth(o,env) = one" "x\nat" "z\nat" "o\nat" "env\list(M)" "x < length(env)" "z < length(env)" shows "sats(M, check_fm(x,o,z), env) \ is_check(nth(x,env),nth(z,env))" proof - have sats_is_Hcheck_fm: "\a0 a1 a2 a3 a4. \ a0\M; a1\M; a2\M; a3\M; a4\M \ \ is_Hcheck(one,a2, a1, a0) \ sats(M, is_Hcheck_fm(6#+o,2,1,0), [a0,a1,a2,a3,a4,r]@env)" if "r\M" for r using that one_in_M assms by simp then have "sats(M, is_wfrec_fm(is_Hcheck_fm(6#+o,2,1,0),0,1#+x,1#+z),Cons(r,env)) \ is_wfrec(##M,is_Hcheck(one),r,nth(x,env),nth(z,env))" if "r\M" for r using that assms one_in_M sats_is_wfrec_fm by simp then show ?thesis unfolding is_check_def check_fm_def using assms rcheck_in_M one_in_M rcheck_fm_iff_sats[symmetric] by simp qed lemma check_replacement: "{check(x). x\P} \ M" proof - have "arity(check_fm(0,2,1)) = 3" unfolding check_fm_def rcheck_fm_def trans_closure_fm_def is_eclose_fm_def mem_eclose_fm_def is_Hcheck_fm_def Replace_fm_def PHcheck_fm_def finite_ordinal_fm_def is_iterates_fm_def is_wfrec_fm_def is_recfun_fm_def restriction_fm_def pre_image_fm_def eclose_n_fm_def is_nat_case_fm_def quasinat_fm_def Memrel_fm_def singleton_fm_def fm_defs iterates_MH_fm_def by (simp add:nat_simp_union) moreover have "check(x)\M" if "x\P" for x using that Transset_intf[of M x P] trans_M check_in_M P_in_M by simp ultimately show ?thesis using sats_check_fm check_abs P_in_M check_in_M one_in_M Repl_in_M[of "check_fm(0,2,1)" "[one]" is_check check] by simp qed lemma pair_check : "\ p\M ; y\M \ \ (\c\M. is_check(p,c) \ pair(##M,c,p,y)) \ y = \check(p),p\" using check_abs check_in_M tuples_in_M by simp lemma M_subset_MG : "one \ G \ M \ M[G]" using check_in_M one_in_P GenExtI by (intro subsetI, subst valcheck [of G,symmetric], auto) text\The name for the generic filter\ definition G_dot :: "i" where "G_dot \ {\check(p),p\ . p\P}" lemma G_dot_in_M : "G_dot \ M" proof - let ?is_pcheck = "\x y. \ch\M. is_check(x,ch) \ pair(##M,ch,x,y)" let ?pcheck_fm = "Exists(And(check_fm(1,3,0),pair_fm(0,1,2)))" have "sats(M,?pcheck_fm,[x,y,one]) \ ?is_pcheck(x,y)" if "x\M" "y\M" for x y using sats_check_fm that one_in_M by simp moreover have "?is_pcheck(x,y) \ y = \check(x),x\" if "x\M" "y\M" for x y using that check_abs check_in_M by simp moreover have "?pcheck_fm\formula" by simp moreover have "arity(?pcheck_fm)=3" unfolding check_fm_def rcheck_fm_def trans_closure_fm_def is_eclose_fm_def mem_eclose_fm_def is_Hcheck_fm_def Replace_fm_def PHcheck_fm_def finite_ordinal_fm_def is_iterates_fm_def is_wfrec_fm_def is_recfun_fm_def restriction_fm_def pre_image_fm_def eclose_n_fm_def is_nat_case_fm_def quasinat_fm_def Memrel_fm_def singleton_fm_def fm_defs iterates_MH_fm_def by (simp add:nat_simp_union) moreover from P_in_M check_in_M tuples_in_M P_sub_M have "\check(p),p\ \ M" if "p\P" for p using that by auto ultimately show ?thesis unfolding G_dot_def using one_in_M P_in_M Repl_in_M[of ?pcheck_fm "[one]"] by simp qed lemma val_G_dot : assumes "G \ P" "one \ G" shows "val(G,G_dot) = G" proof (intro equalityI subsetI) fix x assume "x\val(G,G_dot)" then obtain \ p where "p\G" "\\,p\ \ G_dot" "val(G,\) = x" "\ = check(p)" unfolding G_dot_def using elem_of_val_pair G_dot_in_M by force with \one\G\ \G\P\ show "x \ G" using valcheck P_sub_M by auto next fix p assume "p\G" have "\check(q),q\ \ G_dot" if "q\P" for q unfolding G_dot_def using that by simp with \p\G\ \G\P\ have "val(G,check(p)) \ val(G,G_dot)" using val_of_elem G_dot_in_M by blast with \p\G\ \G\P\ \one\G\ show "p \ val(G,G_dot)" using P_sub_M valcheck by auto qed lemma G_in_Gen_Ext : assumes "G \ P" and "one \ G" shows "G \ M[G]" using assms val_G_dot GenExtI[of _ G] G_dot_in_M by force (* Move this to M_trivial *) lemma fst_snd_closed: "p\M \ fst(p) \ M \ snd(p)\ M" proof (cases "\a. \b. p = \a, b\") case False then show "fst(p) \ M \ snd(p) \ M" unfolding fst_def snd_def using zero_in_M by auto next case True then obtain a b where "p = \a, b\" by blast with True have "fst(p) = a" "snd(p) = b" unfolding fst_def snd_def by simp_all moreover assume "p\M" moreover from this have "a\M" unfolding \p = _\ Pair_def by (force intro:Transset_M[OF trans_M]) moreover from \p\M\ have "b\M" using Transset_M[OF trans_M, of "{a,b}" p] Transset_M[OF trans_M, of "b" "{a,b}"] unfolding \p = _\ Pair_def by (simp) ultimately show ?thesis by simp qed end (* forcing_data *) locale G_generic = forcing_data + fixes G :: "i" assumes generic : "M_generic(G)" begin lemma zero_in_MG : "0 \ M[G]" proof - have "0 = val(G,0)" using zero_in_M elem_of_val by auto also have "... \ M[G]" using GenExtI zero_in_M by simp finally show ?thesis . qed lemma G_nonempty: "G\0" proof - have "P\P" .. with P_in_M P_dense \P\P\ show "G \ 0" using generic unfolding M_generic_def by auto qed end (* context G_generic *) end \ No newline at end of file diff --git a/thys/Forcing/Succession_Poset.thy b/thys/Forcing/Succession_Poset.thy --- a/thys/Forcing/Succession_Poset.thy +++ b/thys/Forcing/Succession_Poset.thy @@ -1,369 +1,369 @@ section\A poset of successions\ theory Succession_Poset imports Arities Proper_Extension Synthetic_Definition Names begin subsection\The set of finite binary sequences\ text\We implement the poset for adding one Cohen real, the set $2^{<\omega}$ of of finite binary sequences.\ definition seqspace :: "i \ i" ("_^<\" [100]100) where "seqspace(B) \ \n\nat. (n\B)" lemma seqspaceI[intro]: "n\nat \ f:n\B \ f\seqspace(B)" unfolding seqspace_def by blast lemma seqspaceD[dest]: "f\seqspace(B) \ \n\nat. f:n\B" unfolding seqspace_def by blast lemma seqspace_type: "f \ B^<\ \ \n\nat. f:n\B" unfolding seqspace_def by auto schematic_goal seqspace_fm_auto: assumes "nth(i,env) = n" "nth(j,env) = z" "nth(h,env) = B" "i \ nat" "j \ nat" "h\nat" "env \ list(A)" shows "(\om\A. omega(##A,om) \ n \ om \ is_funspace(##A, n, B, z)) \ (A, env \ (?sqsprp(i,j,h)))" unfolding is_funspace_def by (insert assms ; (rule sep_rules | simp)+) synthesize "seqspace_rep_fm" from_schematic seqspace_fm_auto locale M_seqspace = M_trancl + assumes seqspace_replacement: "M(B) \ strong_replacement(M,\n z. n\nat \ is_funspace(M,n,B,z))" begin lemma seqspace_closed: "M(B) \ M(B^<\)" unfolding seqspace_def using seqspace_replacement[of B] RepFun_closed2 by simp end (* M_seqspace *) sublocale M_ctm \ M_seqspace "##M" proof (unfold_locales, simp) fix B - have "arity(seqspace_rep_fm(1,0,2)) \ 3" "seqspace_rep_fm(1,0,2)\formula" + have "arity(seqspace_rep_fm(0,1,2)) \ 3" "seqspace_rep_fm(0,1,2)\formula" unfolding seqspace_rep_fm_def using arity_pair_fm arity_omega_fm arity_typed_function_fm nat_simp_union by auto moreover assume "B\M" ultimately - have "strong_replacement(##M, \x y. M, [x, y, B] \ seqspace_rep_fm(1, 0, 2))" - using replacement_ax[of "seqspace_rep_fm(1,0,2)"] + have "strong_replacement(##M, \x y. M, [x, y, B] \ seqspace_rep_fm(0, 1, 2))" + using replacement_ax[of "seqspace_rep_fm(0,1,2)"] by simp moreover note \B\M\ moreover from this - have "univalent(##M, A, \x y. M, [x, y, B] \ seqspace_rep_fm(1, 0, 2))" + have "univalent(##M, A, \x y. M, [x, y, B] \ seqspace_rep_fm(0, 1, 2))" if "A\M" for A using that unfolding univalent_def seqspace_rep_fm_def by (auto, blast dest:transitivity) ultimately have "strong_replacement(##M, \n z. \om[##M]. omega(##M,om) \ n \ om \ is_funspace(##M, n, B, z))" using seqspace_fm_auto[of 0 "[_,_,B]" _ 1 _ 2 B M] unfolding seqspace_rep_fm_def strong_replacement_def by simp with \B\M\ show "strong_replacement(##M, \n z. n \ nat \ is_funspace(##M, n, B, z))" using M_nat by simp qed definition seq_upd :: "i \ i \ i" where "seq_upd(f,a) \ \ j \ succ(domain(f)) . if j < domain(f) then f`j else a" lemma seq_upd_succ_type : assumes "n\nat" "f\n\A" "a\A" shows "seq_upd(f,a)\ succ(n) \ A" proof - from assms have equ: "domain(f) = n" using domain_of_fun by simp { fix j assume "j\succ(domain(f))" with equ \n\_\ have "j\n" using ltI by auto with \n\_\ consider (lt) "j A" proof cases case lt with \f\_\ show ?thesis using apply_type ltD[OF lt] by simp next case eq with \a\_\ show ?thesis by auto qed } with equ show ?thesis unfolding seq_upd_def using lam_type[of "succ(domain(f))"] by auto qed lemma seq_upd_type : assumes "f\A^<\" "a\A" shows "seq_upd(f,a) \ A^<\" proof - from \f\_\ obtain y where "y\nat" "f\y\A" unfolding seqspace_def by blast with \a\A\ have "seq_upd(f,a)\succ(y)\A" using seq_upd_succ_type by simp with \y\_\ show ?thesis unfolding seqspace_def by auto qed lemma seq_upd_apply_domain [simp]: assumes "f:n\A" "n\nat" shows "seq_upd(f,a)`n = a" unfolding seq_upd_def using assms domain_of_fun by auto lemma zero_in_seqspace : shows "0 \ A^<\" unfolding seqspace_def by force definition seqleR :: "i \ i \ o" where "seqleR(f,g) \ g \ f" definition seqlerel :: "i \ i" where "seqlerel(A) \ Rrel(\x y. y \ x,A^<\)" definition seqle :: "i" where "seqle \ seqlerel(2)" lemma seqleI[intro!]: "\f,g\ \ 2^<\\2^<\ \ g \ f \ \f,g\ \ seqle" unfolding seqspace_def seqle_def seqlerel_def Rrel_def by blast lemma seqleD[dest!]: "z \ seqle \ \x y. \x,y\ \ 2^<\\2^<\ \ y \ x \ z = \x,y\" unfolding seqle_def seqlerel_def Rrel_def by blast lemma upd_leI : assumes "f\2^<\" "a\2" shows "\seq_upd(f,a),f\\seqle" (is "\?f,_\\_") proof show " \?f, f\ \ 2^<\ \ 2^<\" using assms seq_upd_type by auto next show "f \ seq_upd(f,a)" proof fix x assume "x \ f" moreover from \f \ 2^<\\ obtain n where "n\nat" "f : n \ 2" using seqspace_type by blast moreover from calculation obtain y where "y\n" "x=\y,f`y\" using Pi_memberD[of f n "\_ . 2"] by blast moreover from \f:n\2\ have "domain(f) = n" using domain_of_fun by simp ultimately show "x \ seq_upd(f,a)" unfolding seq_upd_def lam_def by (auto intro:ltI) qed qed lemma preorder_on_seqle: "preorder_on(2^<\,seqle)" unfolding preorder_on_def refl_def trans_on_def by blast lemma zero_seqle_max: "x\2^<\ \ \x,0\ \ seqle" using zero_in_seqspace by auto interpretation forcing_notion "2^<\" "seqle" "0" using preorder_on_seqle zero_seqle_max zero_in_seqspace by unfold_locales simp_all abbreviation SEQle :: "[i, i] \ o" (infixl "\s" 50) where "x \s y \ Leq(x,y)" abbreviation SEQIncompatible :: "[i, i] \ o" (infixl "\s" 50) where "x \s y \ Incompatible(x,y)" lemma seqspace_separative: assumes "f\2^<\" shows "seq_upd(f,0) \s seq_upd(f,1)" (is "?f \s ?g") proof assume "compat(?f, ?g)" then obtain h where "h \ 2^<\" "?f \ h" "?g \ h" by blast moreover from \f\_\ obtain y where "y\nat" "f:y\2" by blast moreover from this have "?f: succ(y) \ 2" "?g: succ(y) \ 2" using seq_upd_succ_type by blast+ moreover from this have "\y,?f`y\ \ ?f" "\y,?g`y\ \ ?g" using apply_Pair by auto ultimately have "\y,0\ \ h" "\y,1\ \ h" by auto moreover from \h \ 2^<\\ obtain n where "n\nat" "h:n\2" by blast ultimately show "False" using fun_is_function[of h n "\_. 2"] unfolding seqspace_def function_def by auto qed definition is_seqleR :: "[i\o,i,i] \ o" where "is_seqleR(Q,f,g) \ g \ f" definition seqleR_fm :: "i \ i" where "seqleR_fm(fg) \ Exists(Exists(And(pair_fm(0,1,fg#+2),subset_fm(1,0))))" lemma type_seqleR_fm : "fg \ nat \ seqleR_fm(fg) \ formula" unfolding seqleR_fm_def by simp lemma arity_seqleR_fm : "fg \ nat \ arity(seqleR_fm(fg)) = succ(fg)" unfolding seqleR_fm_def using arity_pair_fm arity_subset_fm nat_simp_union by simp lemma (in M_basic) seqleR_abs: assumes "M(f)" "M(g)" shows "seqleR(f,g) \ is_seqleR(M,f,g)" unfolding seqleR_def is_seqleR_def using assms apply_abs domain_abs domain_closed[OF \M(f)\] domain_closed[OF \M(g)\] by auto definition relP :: "[i\o,[i\o,i,i]\o,i] \ o" where "relP(M,r,xy) \ (\x[M]. \y[M]. pair(M,x,y,xy) \ r(M,x,y))" lemma (in M_ctm) seqleR_fm_sats : assumes "fg\nat" "env\list(M)" shows "sats(M,seqleR_fm(fg),env) \ relP(##M,is_seqleR,nth(fg, env))" unfolding seqleR_fm_def is_seqleR_def relP_def using assms trans_M sats_subset_fm pair_iff_sats by auto lemma (in M_basic) is_related_abs : assumes "\ f g . M(f) \ M(g) \ rel(f,g) \ is_rel(M,f,g)" shows "\z . M(z) \ relP(M,is_rel,z) \ (\x y. z = \x,y\ \ rel(x,y))" unfolding relP_def using pair_in_M_iff assms by auto definition is_RRel :: "[i\o,[i\o,i,i]\o,i,i] \ o" where "is_RRel(M,is_r,A,r) \ \A2[M]. cartprod(M,A,A,A2) \ is_Collect(M,A2, relP(M,is_r),r)" lemma (in M_basic) is_Rrel_abs : assumes "M(A)" "M(r)" "\ f g . M(f) \ M(g) \ rel(f,g) \ is_rel(M,f,g)" shows "is_RRel(M,is_rel,A,r) \ r = Rrel(rel,A)" proof - from \M(A)\ have "M(z)" if "z\A\A" for z using cartprod_closed transM[of z "A\A"] that by simp then have A:"relP(M, is_rel, z) \ (\x y. z = \x, y\ \ rel(x, y))" "M(z)" if "z\A\A" for z using that is_related_abs[of rel is_rel,OF assms(3)] by auto then have "Collect(A\A,relP(M,is_rel)) = Collect(A\A,\z. (\x y. z = \x,y\ \ rel(x,y)))" using Collect_cong[of "A\A" "A\A" "relP(M,is_rel)",OF _ A(1)] assms(1) assms(2) by auto with assms show ?thesis unfolding is_RRel_def Rrel_def using cartprod_closed by auto qed definition is_seqlerel :: "[i\o,i,i] \ o" where "is_seqlerel(M,A,r) \ is_RRel(M,is_seqleR,A,r)" lemma (in M_basic) seqlerel_abs : assumes "M(A)" "M(r)" shows "is_seqlerel(M,A,r) \ r = Rrel(seqleR,A)" unfolding is_seqlerel_def using is_Rrel_abs[OF \M(A)\ \M(r)\,of seqleR is_seqleR] seqleR_abs by auto definition RrelP :: "[i\i\o,i] \ i" where "RrelP(R,A) \ {z\A\A. \x y. z = \x, y\ \ R(x,y)}" lemma Rrel_eq : "RrelP(R,A) = Rrel(R,A)" unfolding Rrel_def RrelP_def by auto context M_ctm begin lemma Rrel_closed: assumes "A\M" "\ a. a \ nat \ rel_fm(a)\formula" "\ f g . (##M)(f) \ (##M)(g) \ rel(f,g) \ is_rel(##M,f,g)" "arity(rel_fm(0)) = 1" "\ a . a \ M \ sats(M,rel_fm(0),[a]) \ relP(##M,is_rel,a)" shows "(##M)(Rrel(rel,A))" proof - have "z\ M \ relP(##M, is_rel, z) \ (\x y. z = \x, y\ \ rel(x, y))" for z using assms(3) is_related_abs[of rel is_rel] by auto with assms have "Collect(A\A,\z. (\x y. z = \x,y\ \ rel(x,y))) \ M" using Collect_in_M_0p[of "rel_fm(0)" "\ A z . relP(A,is_rel,z)" "\ z.\x y. z = \x, y\ \ rel(x, y)" ] cartprod_closed by simp then show ?thesis unfolding Rrel_def by simp qed lemma seqle_in_M: "seqle \ M" using Rrel_closed seqspace_closed transitivity[OF _ nat_in_M] type_seqleR_fm[of 0] arity_seqleR_fm[of 0] seqleR_fm_sats[of 0] seqleR_abs seqlerel_abs unfolding seqle_def seqlerel_def seqleR_def by auto subsection\Cohen extension is proper\ interpretation ctm_separative "2^<\" seqle 0 proof (unfold_locales) fix f let ?q="seq_upd(f,0)" and ?r="seq_upd(f,1)" assume "f \ 2^<\" then have "?q \s f \ ?r \s f \ ?q \s ?r" using upd_leI seqspace_separative by auto moreover from calculation have "?q \ 2^<\" "?r \ 2^<\" using seq_upd_type[of f 2] by auto ultimately show "\q\2^<\. \r\2^<\. q \s f \ r \s f \ q \s r" by (rule_tac bexI)+ \ \why the heck auto-tools don't solve this?\ next show "2^<\ \ M" using nat_into_M seqspace_closed by simp next show "seqle \ M" using seqle_in_M . qed lemma cohen_extension_is_proper: "\G. M_generic(G) \ M \ GenExt(G)" using proper_extension generic_filter_existence zero_in_seqspace by force end (* M_ctm *) end \ No newline at end of file