(* Title: ZF/Constructible/Relative.thy Author: Lawrence C Paulson, Cambridge University Computer Laboratory With modifications by E. Gunther, M. Pagano, and P. Sánchez Terraf
*)
section \<open>Relativization and Absoluteness\<close>
theory Relative imports ZF begin
subsection\<open>Relativized versions of standard set-theoretic concepts\<close>
definition
empty :: "[i\o,i] \ o" where "empty(M,z) \ \x[M]. x \ z"
definition
subset :: "[i\o,i,i] \ o" where "subset(M,A,B) \ \x[M]. x\A \ x \ B"
definition
upair :: "[i\o,i,i,i] \ o" where "upair(M,a,b,z) \ a \ z \ b \ z \ (\x[M]. x\z \ x = a \ x = b)"
definition
is_converse :: "[i\o,i,i] \ o" where "is_converse(M,r,z) \ \<forall>x[M]. x \<in> z \<longleftrightarrow>
(\<exists>w[M]. w\<in>r \<and> (\<exists>u[M]. \<exists>v[M]. pair(M,u,v,w) \<and> pair(M,v,u,x)))"
definition
pre_image :: "[i\o,i,i,i] \ o" where "pre_image(M,r,A,z) \ \<forall>x[M]. x \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r \<and> (\<exists>y[M]. y\<in>A \<and> pair(M,x,y,w)))"
definition
is_domain :: "[i\o,i,i] \ o" where "is_domain(M,r,z) \ \<forall>x[M]. x \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r \<and> (\<exists>y[M]. pair(M,x,y,w)))"
definition
image :: "[i\o,i,i,i] \ o" where "image(M,r,A,z) \ \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r \<and> (\<exists>x[M]. x\<in>A \<and> pair(M,x,y,w)))"
definition
is_range :: "[i\o,i,i] \ o" where \<comment> \<open>the cleaner \<^term>\<open>\<exists>r'[M]. is_converse(M,r,r') \<and> is_domain(M,r',z)\<close>
unfortunately needs an instance of separation in order to prove \<^term>\<open>M(converse(r))\<close>.\<close> "is_range(M,r,z) \ \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r \<and> (\<exists>x[M]. pair(M,x,y,w)))"
definition
ordinal :: "[i\o,i] \ o" where \<comment> \<open>an ordinal is a transitive set of transitive sets\<close> "ordinal(M,a) \ transitive_set(M,a) \ (\x[M]. x\a \ transitive_set(M,x))"
definition
limit_ordinal :: "[i\o,i] \ o" where \<comment> \<open>a limit ordinal is a non-empty, successor-closed ordinal\<close> "limit_ordinal(M,a) \
ordinal(M,a) \<and> \<not> empty(M,a) \<and>
(\<forall>x[M]. x\<in>a \<longrightarrow> (\<exists>y[M]. y\<in>a \<and> successor(M,x,y)))"
definition
successor_ordinal :: "[i\o,i] \ o" where \<comment> \<open>a successor ordinal is any ordinal that is neither empty nor limit\<close> "successor_ordinal(M,a) \
ordinal(M,a) \<and> \<not> empty(M,a) \<and> \<not> limit_ordinal(M,a)"
definition
finite_ordinal :: "[i\o,i] \ o" where \<comment> \<open>an ordinal is finite if neither it nor any of its elements are limit\<close> "finite_ordinal(M,a) \
ordinal(M,a) \<and> \<not> limit_ordinal(M,a) \<and>
(\<forall>x[M]. x\<in>a \<longrightarrow> \<not> limit_ordinal(M,x))"
definition
omega :: "[i\o,i] \ o" where \<comment> \<open>omega is a limit ordinal none of whose elements are limit\<close> "omega(M,a) \ limit_ordinal(M,a) \ (\x[M]. x\a \ \ limit_ordinal(M,x))"
text\<open>Useful when absoluteness reasoning has replaced the predicates by terms\<close> lemma triv_Relation1: "Relation1(M, A, \x y. y = f(x), f)" by (simp add: Relation1_def)
lemma triv_Relation2: "Relation2(M, A, B, \x y a. a = f(x,y), f)" by (simp add: Relation2_def)
definition
extensionality :: "(i\o) \ o" where "extensionality(M) \ \<forall>x[M]. \<forall>y[M]. (\<forall>z[M]. z \<in> x \<longleftrightarrow> z \<in> y) \<longrightarrow> x=y"
definition
separation :: "[i\o, i\o] \ o" where \<comment> \<open>The formula \<open>P\<close> should only involve parameters
belonging to\<open>M\<close> and all its quantifiers must be relativized to\<open>M\<close>. We do not have separation as a scheme; every instance
that we need must be assumed (and later proved) separately.\<close> "separation(M,P) \ \<forall>z[M]. \<exists>y[M]. \<forall>x[M]. x \<in> y \<longleftrightarrow> x \<in> z \<and> P(x)"
lemma"replacement(\x. x \ univ(0), P)" apply (simp add: replacement_def, clarify) oops text\<open>no idea: maybe prove by induction on the rank of A?\<close>
definition
pred_set :: "[i\o,i,i,i,i] \ o" where "pred_set(M,A,x,r,B) \ \<forall>y[M]. y \<in> B \<longleftrightarrow> (\<exists>p[M]. p\<in>r \<and> y \<in> A \<and> pair(M,y,x,p))"
definition
membership :: "[i\o,i,i] \ o" where \ \membership relation\ "membership(M,A,r) \ \<forall>p[M]. p \<in> r \<longleftrightarrow> (\<exists>x[M]. x\<in>A \<and> (\<exists>y[M]. y\<in>A \<and> x\<in>y \<and> pair(M,x,y,p)))"
subsection\<open>Introducing a Transitive Class Model\<close>
text\<open>The class M is assumed to be transitive and inhabited\<close> locale M_trans = fixes M assumes transM: "\y\x; M(x)\ \ M(y)" and M_inhabited: "\x . M(x)"
lemma (in M_trans) nonempty [simp]: "M(0)" proof - have"M(x) \ M(0)" for x proof (rule_tac P="\w. M(w) \ M(0)" in eps_induct)
{ fix x assume"\y\x. M(y) \ M(0)" "M(x)"
consider (a) "\y. y\x" | (b) "x=0" by auto then have"M(x) \ M(0)" proof cases case a thenshow ?thesis using\<open>\<forall>y\<in>x._\<close> \<open>M(x)\<close> transM by auto next case b thenshow ?thesis by simp qed
} thenshow"M(x) \ M(0)" if "\y\x. M(y) \ M(0)" for x using that by auto qed with M_inhabited show"M(0)"using M_inhabited by blast qed
text\<open>The class M is assumed to be transitive and to satisfy some
relativized ZF axioms\<close> locale M_trivial = M_trans + assumes upair_ax: "upair_ax(M)" and Union_ax: "Union_ax(M)"
lemma (in M_trans) rall_abs [simp]: "M(A) \ (\x[M]. x\A \ P(x)) \ (\x\A. P(x))" by (blast intro: transM)
lemma (in M_trans) rex_abs [simp]: "M(A) \ (\x[M]. x\A \ P(x)) \ (\x\A. P(x))" by (blast intro: transM)
text\<open>Simplifies proofs of equalities when there's an iff-equality
available for rewriting, universally quantified over M.
But it's not the only way to prove such equalities: its
premises \<^term>\<open>M(A)\<close> and \<^term>\<open>M(B)\<close> can be too strong.\<close> lemma (in M_trans) M_equalityI: "\\x. M(x) \ x\A \ x\B; M(A); M(B)\ \ A=B" by (blast dest: transM)
(*The first premise can't simply be assumed as a schema. It is essential to take care when asserting instances of Replacement. Let K be a nonconstructible subset of nat and define f(x) = x if x \<in> K and f(x)=0 otherwise. Then RepFun(nat,f) = cons(0,K), a nonconstructible set. So we cannot assume that M(X) implies M(RepFun(X,f)) even for f \<in> M -> M.
*) lemma (in M_trans) RepFun_closed: "\strong_replacement(M, \x y. y = f(x)); M(A); \x\A. M(f(x))\ \<Longrightarrow> M(RepFun(A,f))" apply (simp add: RepFun_def) done
lemma Replace_conj_eq: "{y . x \ A, x\A \ y=f(x)} = {y . x\A, y=f(x)}" by simp
text\<open>Better than \<open>RepFun_closed\<close> when having the formula \<^term>\<open>x\<in>A\<close>
makes relativization easier.\<close> lemma (in M_trans) RepFun_closed2: "\strong_replacement(M, \x y. x\A \ y = f(x)); M(A); \x\A. M(f(x))\ \<Longrightarrow> M(RepFun(A, \<lambda>x. f(x)))" apply (simp add: RepFun_def) apply (frule strong_replacement_closed, assumption) apply (auto dest: transM simp add: Replace_conj_eq univalent_def) done
subsubsection \<open>Absoluteness for \<^term>\<open>Lambda\<close>\<close>
definition
is_lambda :: "[i\o, i, [i,i]\o, i] \ o" where "is_lambda(M, A, is_b, z) \ \<forall>p[M]. p \<in> z \<longleftrightarrow>
(\<exists>u[M]. \<exists>v[M]. u\<in>A \<and> pair(M,u,v,p) \<and> is_b(u,v))"
lemma (in M_trivial) lam_closed: "\strong_replacement(M, \x y. y = ); M(A); \x\A. M(b(x))\ \<Longrightarrow> M(\<lambda>x\<in>A. b(x))" by (simp add: lam_def, blast intro: RepFun_closed dest: transM)
text\<open>Better than \<open>lam_closed\<close>: has the formula \<^term>\<open>x\<in>A\<close>\<close> lemma (in M_trivial) lam_closed2: "\strong_replacement(M, \x y. x\A \ y = \x, b(x)\);
M(A); \<forall>m[M]. m\<in>A \<longrightarrow> M(b(m))\<rbrakk> \<Longrightarrow> M(Lambda(A,b))" apply (simp add: lam_def) apply (blast intro: RepFun_closed2 dest: transM) done
subsubsection\<open>Relativization of Powerset\<close>
text\<open>What about \<open>Pow_abs\<close>? Powerset is NOT absolute!
This result is one direction of absoluteness.\<close>
lemma (in M_trans) powerset_Pow: "powerset(M, x, Pow(x))" by (simp add: powerset_def)
text\<open>But we can't prove that the powerset in \<open>M\<close> includes the
real powerset.\<close>
lemma (in M_trans) powerset_imp_subset_Pow: "\powerset(M,x,y); M(y)\ \ y \ Pow(x)" apply (simp add: powerset_def) apply (blast dest: transM) done
lemma (in M_trans) powerset_abs: assumes "M(y)" shows "powerset(M,x,y) \ y = {a\Pow(x) . M(a)}" proof (intro iffI equalityI) (* First show the converse implication by double inclusion *) assume"powerset(M,x,y)" with\<open>M(y)\<close> show"y \ {a\Pow(x) . M(a)}" using powerset_imp_subset_Pow transM by blast from\<open>powerset(M,x,y)\<close> show"{a\Pow(x) . M(a)} \ y" using transM unfolding powerset_def by auto next(* we show the direct implication *) assume "y = {a \ Pow(x) . M(a)}" then show"powerset(M, x, y)" unfolding powerset_def subset_def using transM by blast qed
subsubsection\<open>Absoluteness for the Natural Numbers\<close>
lemma (in M_trivial) nat_into_M [intro]: "n \ nat \ M(n)" by (induct n rule: nat_induct, simp_all)
(*NOT for the simplifier. The assumption M(z') is apparently necessary, but causes the error "Failed congruence proof!" It may be better to replace
is_nat_case by nat_case before attempting congruence reasoning.*) lemma is_nat_case_cong: "\a = a'; k = k'; z = z'; M(z'); \<And>x y. \<lbrakk>M(x); M(y)\<rbrakk> \<Longrightarrow> is_b(x,y) \<longleftrightarrow> is_b'(x,y)\<rbrakk> \<Longrightarrow> is_nat_case(M, a, is_b, k, z) \<longleftrightarrow> is_nat_case(M, a', is_b', k', z')" by (simp add: is_nat_case_def)
subsection\<open>Absoluteness for Ordinals\<close> text\<open>These results constitute Theorem IV 5.1 of Kunen (page 126).\<close>
lemma (in M_trans) lt_closed: "\j \ M(j)" by (blast dest: ltD intro: transM)
lemma (in M_trans) transitive_set_abs [simp]: "M(a) \ transitive_set(M,a) \ Transset(a)" by (simp add: transitive_set_def Transset_def)
lemma (in M_trans) ordinal_abs [simp]: "M(a) \ ordinal(M,a) \ Ord(a)" by (simp add: ordinal_def Ord_def)
lemma (in M_trivial) number1_abs [simp]: "M(a) \ number1(M,a) \ a = 1" by (simp add: number1_def)
lemma (in M_trivial) number2_abs [simp]: "M(a) \ number2(M,a) \ a = succ(1)" by (simp add: number2_def)
lemma (in M_trivial) number3_abs [simp]: "M(a) \ number3(M,a) \ a = succ(succ(1))" by (simp add: number3_def)
text\<open>Kunen continued to 20...\<close>
(*Could not get this to work. The \<lambda>x\<in>nat is essential because everything but the recursion variable must stay unchanged. But then the recursion equations only hold for x\<in>nat (or in some other set) and not for the whole of the class M. consts natnumber_aux :: "[i\<Rightarrow>o,i] \<Rightarrow> i"
primrec "natnumber_aux(M,0) = (\<lambda>x\<in>nat. if empty(M,x) then 1 else 0)" "natnumber_aux(M,succ(n)) = (\<lambda>x\<in>nat. if (\<exists>y[M]. natnumber_aux(M,n)`y=1 \<and> successor(M,y,x)) then 1 else 0)"
lemma (in M_trivial) [simp]: "natnumber(M,0,x) \<equiv> x=0"
*)
subsection\<open>Some instances of separation and strong replacement\<close>
locale M_basic = M_trivial + assumes Inter_separation: "M(A) \ separation(M, \x. \y[M]. y\A \ x\y)" and Diff_separation: "M(B) \ separation(M, \x. x \ B)" and cartprod_separation: "\M(A); M(B)\ \<Longrightarrow> separation(M, \<lambda>z. \<exists>x[M]. x\<in>A \<and> (\<exists>y[M]. y\<in>B \<and> pair(M,x,y,z)))" and image_separation: "\M(A); M(r)\ \<Longrightarrow> separation(M, \<lambda>y. \<exists>p[M]. p\<in>r \<and> (\<exists>x[M]. x\<in>A \<and> pair(M,x,y,p)))" and converse_separation: "M(r) \ separation(M, \<lambda>z. \<exists>p[M]. p\<in>r \<and> (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,p) \<and> pair(M,y,x,z)))" and restrict_separation: "M(A) \ separation(M, \z. \x[M]. x\A \ (\y[M]. pair(M,x,y,z)))" and comp_separation: "\M(r); M(s)\ \<Longrightarrow> separation(M, \<lambda>xz. \<exists>x[M]. \<exists>y[M]. \<exists>z[M]. \<exists>xy[M]. \<exists>yz[M].
pair(M,x,z,xz) \<and> pair(M,x,y,xy) \<and> pair(M,y,z,yz) \<and>
xy\<in>s \<and> yz\<in>r)" and pred_separation: "\M(r); M(x)\ \ separation(M, \y. \p[M]. p\r \ pair(M,y,x,p))" and Memrel_separation: "separation(M, \z. \x[M]. \y[M]. pair(M,x,y,z) \ x \ y)" and funspace_succ_replacement: "M(n) \
strong_replacement(M, \<lambda>p z. \<exists>f[M]. \<exists>b[M]. \<exists>nb[M]. \<exists>cnbf[M].
pair(M,f,b,p) \<and> pair(M,n,b,nb) \<and> is_cons(M,nb,f,cnbf) \<and>
upair(M,cnbf,cnbf,z))" and is_recfun_separation: \<comment> \<open>for well-founded recursion: used to prove \<open>is_recfun_equal\<close>\<close> "\M(r); M(f); M(g); M(a); M(b)\ \<Longrightarrow> separation(M, \<lambda>x. \<exists>xa[M]. \<exists>xb[M].
pair(M,x,a,xa) \<and> xa \<in> r \<and> pair(M,x,b,xb) \<and> xb \<in> r \<and>
(\<exists>fx[M]. \<exists>gx[M]. fun_apply(M,f,x,fx) \<and> fun_apply(M,g,x,gx) \<and>
fx \<noteq> gx))" and power_ax: "power_ax(M)"
lemma (in M_trivial) cartprod_iff_lemma: "\M(C); \u[M]. u \ C \ (\x\A. \y\B. u = {{x}, {x,y}});
powerset(M, A \<union> B, p1); powerset(M, p1, p2); M(p2)\<rbrakk> \<Longrightarrow> C = {u \<in> p2 . \<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}}" apply (simp add: powerset_def) apply (rule equalityI, clarify, simp) apply (frule transM, assumption) apply (frule transM, assumption, simp (no_asm_simp)) apply blast apply clarify apply (frule transM, assumption, force) done
lemma (in M_basic) cartprod_iff: "\M(A); M(B); M(C)\ \<Longrightarrow> cartprod(M,A,B,C) \<longleftrightarrow>
(\<exists>p1[M]. \<exists>p2[M]. powerset(M,A \<union> B,p1) \<and> powerset(M,p1,p2) \<and>
C = {z \<in> p2. \<exists>x\<in>A. \<exists>y\<in>B. z = \<langle>x,y\<rangle>})" apply (simp add: Pair_def cartprod_def, safe) defer 1 apply (simp add: powerset_def) apply blast txt\<open>Final, difficult case: the left-to-right direction of the theorem.\<close> apply (insert power_ax, simp add: power_ax_def) apply (frule_tac x="A \ B" and P="\x. rex(M,Q(x))" for Q in rspec) apply (blast, clarify) apply (drule_tac x=z and P="\x. rex(M,Q(x))" for Q in rspec) apply assumption apply (blast intro: cartprod_iff_lemma) done
lemma (in M_basic) cartprod_closed_lemma: "\M(A); M(B)\ \ \C[M]. cartprod(M,A,B,C)" apply (simp del: cartprod_abs add: cartprod_iff) apply (insert power_ax, simp add: power_ax_def) apply (frule_tac x="A \ B" and P="\x. rex(M,Q(x))" for Q in rspec) apply (blast, clarify) apply (drule_tac x=z and P="\x. rex(M,Q(x))" for Q in rspec, auto) apply (intro rexI conjI, simp+) apply (insert cartprod_separation [of A B], simp) done
text\<open>All the lemmas above are necessary because Powerset is not absolute.
I should have used Replacement instead!\<close> lemma (in M_basic) cartprod_closed [intro,simp]: "\M(A); M(B)\ \ M(A*B)" by (frule cartprod_closed_lemma, assumption, force)
lemma (in M_basic) sum_closed [intro,simp]: "\M(A); M(B)\ \ M(A+B)" by (simp add: sum_def)
lemma (in M_basic) sum_abs [simp]: "\M(A); M(B); M(Z)\ \ is_sum(M,A,B,Z) \ (Z = A+B)" by (simp add: is_sum_def sum_def singleton_0 nat_into_M)
lemma (in M_trivial) Inl_in_M_iff [iff]: "M(Inl(a)) \ M(a)" by (simp add: Inl_def)
lemma (in M_trivial) Inl_abs [simp]: "M(Z) \ is_Inl(M,a,Z) \ (Z = Inl(a))" by (simp add: is_Inl_def Inl_def)
lemma (in M_trivial) Inr_in_M_iff [iff]: "M(Inr(a)) \ M(a)" by (simp add: Inr_def)
lemma (in M_trivial) Inr_abs [simp]: "M(Z) \ is_Inr(M,a,Z) \ (Z = Inr(a))" by (simp add: is_Inr_def Inr_def)
subsubsection \<open>converse of a relation\<close>
lemma Diff_Collect_eq: "A - Collect(A,P) = Collect(A, \x. \ P(x))" by blast
lemma (in M_trans) Collect_rall_eq: "M(Y) \ Collect(A, \x. \y[M]. y\Y \ P(x,y)) =
(if Y=0 then A else (\<Inter>y \<in> Y. {x \<in> A. P(x,y)}))" by (simp,blast dest: transM)
lemma (in M_basic) separation_disj: "\separation(M,P); separation(M,Q)\ \ separation(M, \z. P(z) \ Q(z))" by (simp del: separation_closed
add: separation_iff Collect_Un_Collect_eq [symmetric])
lemma (in M_basic) separation_neg: "separation(M,P) \ separation(M, \z. \P(z))" by (simp del: separation_closed
add: separation_iff Diff_Collect_eq [symmetric])
lemma (in M_basic) separation_imp: "\separation(M,P); separation(M,Q)\ \<Longrightarrow> separation(M, \<lambda>z. P(z) \<longrightarrow> Q(z))" by (simp add: separation_neg separation_disj not_disj_iff_imp [symmetric])
text\<open>This result is a hint of how little can be done without the Reflection Theorem. The quantifier has to be bounded by a set. We also need another instance of Separation!\<close> lemma (in M_basic) separation_rall: "\M(Y); \y[M]. separation(M, \x. P(x,y)); \<forall>z[M]. strong_replacement(M, \<lambda>x y. y = {u \<in> z . P(u,x)})\<rbrakk> \<Longrightarrow> separation(M, \<lambda>x. \<forall>y[M]. y\<in>Y \<longrightarrow> P(x,y))" apply (simp del: separation_closed rall_abs
add: separation_iff Collect_rall_eq) apply (blast intro!: RepFun_closed dest: transM) done
subsubsection\<open>Functions and function space\<close>
text\<open>The assumption \<^term>\<open>M(A->B)\<close> is unusual, but essential: in
all but trivial cases, A->B cannot be expected to belong to\<^term>\<open>M\<close>.\<close> lemma (in M_trivial) is_funspace_abs [simp]: "\M(A); M(B); M(F); M(A->B)\ \ is_funspace(M,A,B,F) \ F = A->B" apply (simp add: is_funspace_def) apply (rule iffI) prefer 2 apply blast apply (rule M_equalityI) apply simp_all done
lemma (in M_basic) succ_fun_eq2: "\M(B); M(n->B)\ \
succ(n) -> B = \<Union>{z. p \<in> (n->B)*B, \<exists>f[M]. \<exists>b[M]. p = \<langle>f,b\<rangle> \<and> z = {cons(\<langle>n,b\<rangle>, f)}}" apply (simp add: succ_fun_eq) apply (blast dest: transM) done
text\<open>\<^term>\<open>M\<close> contains all finite function spaces. Needed to prove the
absoluteness of transitive closure. See the definition of \<open>rtrancl_alt\<close> in in \<open>WF_absolute.thy\<close>.\<close> lemma (in M_basic) finite_funspace_closed [intro,simp]: "\n\nat; M(B)\ \ M(n->B)" apply (induct_tac n, simp) apply (simp add: funspace_succ nat_into_M) done
subsection\<open>Relativization and Absoluteness for Boolean Operators\<close>
definition
is_bool_of_o :: "[i\o, o, i] \ o" where "is_bool_of_o(M,P,z) \ (P \ number1(M,z)) \ (\P \ empty(M,z))"
definition
is_not :: "[i\o, i, i] \ o" where "is_not(M,a,z) \ (number1(M,a) \ empty(M,z)) |
(\<not>number1(M,a) \<and> number1(M,z))"
definition
is_and :: "[i\o, i, i, i] \ o" where "is_and(M,a,b,z) \ (number1(M,a) \ z=b) |
(\<not>number1(M,a) \<and> empty(M,z))"
definition
is_or :: "[i\o, i, i, i] \ o" where "is_or(M,a,b,z) \ (number1(M,a) \ number1(M,z)) |
(\<not>number1(M,a) \<and> z=b)"
lemma (in M_trivial) bool_of_o_abs [simp]: "M(z) \ is_bool_of_o(M,P,z) \ z = bool_of_o(P)" by (simp add: is_bool_of_o_def bool_of_o_def)
lemma (in M_trivial) not_abs [simp]: "\M(a); M(z)\ \ is_not(M,a,z) \ z = not(a)" by (simp add: Bool.not_def cond_def is_not_def)
lemma (in M_trivial) and_abs [simp]: "\M(a); M(b); M(z)\ \ is_and(M,a,b,z) \ z = a and b" by (simp add: Bool.and_def cond_def is_and_def)
lemma (in M_trivial) or_abs [simp]: "\M(a); M(b); M(z)\ \ is_or(M,a,b,z) \ z = a or b" by (simp add: Bool.or_def cond_def is_or_def)
lemma (in M_trivial) bool_of_o_closed [intro,simp]: "M(bool_of_o(P))" by (simp add: bool_of_o_def)
lemma (in M_trivial) and_closed [intro,simp]: "\M(p); M(q)\ \ M(p and q)" by (simp add: and_def cond_def)
lemma (in M_trivial) or_closed [intro,simp]: "\M(p); M(q)\ \ M(p or q)" by (simp add: or_def cond_def)
lemma (in M_trivial) not_closed [intro,simp]: "M(p) \ M(not(p))" by (simp add: Bool.not_def cond_def)
subsection\<open>Relativization and Absoluteness for List Operators\<close>
definition
list_case' :: "[i, [i,i]\i, i] \ i" where \<comment> \<open>A version of \<^term>\<open>list_case\<close> that's always defined.\<close> "list_case'(a,b,xs) \ if quasilist(xs) then list_case(a,b,xs) else 0"
definition
is_list_case :: "[i\o, i, [i,i,i]\o, i, i] \ o" where \<comment> \<open>Returns 0 for non-lists\<close> "is_list_case(M, a, is_b, xs, z) \
(is_Nil(M,xs) \<longrightarrow> z=a) \<and>
(\<forall>x[M]. \<forall>l[M]. is_Cons(M,x,l,xs) \<longrightarrow> is_b(x,l,z)) \<and>
(is_quasilist(M,xs) \<or> empty(M,z))"
definition
hd' :: "i \ i" where \<comment> \<open>A version of \<^term>\<open>hd\<close> that's always defined.\<close> "hd'(xs) \ if quasilist(xs) then hd(xs) else 0"
definition
tl' :: "i \ i" where \<comment> \<open>A version of \<^term>\<open>tl\<close> that's always defined.\<close> "tl'(xs) \ if quasilist(xs) then tl(xs) else 0"
definition
is_hd :: "[i\o,i,i] \ o" where \<comment> \<open>\<^term>\<open>hd([]) = 0\<close> no constraints if not a list.
Avoiding implication prevents the simplifier's looping.\ "is_hd(M,xs,H) \
(is_Nil(M,xs) \<longrightarrow> empty(M,H)) \<and>
(\<forall>x[M]. \<forall>l[M]. \<not> is_Cons(M,x,l,xs) \<or> H=x) \<and>
(is_quasilist(M,xs) \<or> empty(M,H))"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.