author  wenzelm 
Wed, 27 Mar 2013 16:38:25 +0100  
changeset 51553  63327f679cff 
parent 46823  57bf0cecb366 
child 60770  240563fbf41d 
permissions  rwrr 
13505  1 
(* Title: ZF/Constructible/Internalize.thy 
2 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory 

3 
*) 

4 

16417  5 
theory Internalize imports L_axioms Datatype_absolute begin 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

6 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

7 
subsection{*Internalized Forms of Data Structuring Operators*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

8 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

9 
subsubsection{*The Formula @{term is_Inl}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

10 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

11 
(* is_Inl(M,a,z) == \<exists>zero[M]. empty(M,zero) & pair(M,zero,a,z) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

12 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

13 
Inl_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

14 
"Inl_fm(a,z) == Exists(And(empty_fm(0), pair_fm(0,succ(a),succ(z))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

15 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

16 
lemma Inl_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

17 
"[ x \<in> nat; z \<in> nat ] ==> Inl_fm(x,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

18 
by (simp add: Inl_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

19 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

20 
lemma sats_Inl_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

21 
"[ x \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  22 
==> sats(A, Inl_fm(x,z), env) \<longleftrightarrow> is_Inl(##A, nth(x,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

23 
by (simp add: Inl_fm_def is_Inl_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

24 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

25 
lemma Inl_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

26 
"[ nth(i,env) = x; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

27 
i \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  28 
==> is_Inl(##A, x, z) \<longleftrightarrow> sats(A, Inl_fm(i,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

29 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

30 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

31 
theorem Inl_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

32 
"REFLECTS[\<lambda>x. is_Inl(L,f(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

33 
\<lambda>i x. is_Inl(##Lset(i),f(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

34 
apply (simp only: is_Inl_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

35 
apply (intro FOL_reflections function_reflections) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

36 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

37 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

38 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

39 
subsubsection{*The Formula @{term is_Inr}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

40 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

41 
(* is_Inr(M,a,z) == \<exists>n1[M]. number1(M,n1) & pair(M,n1,a,z) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

42 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

43 
Inr_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

44 
"Inr_fm(a,z) == Exists(And(number1_fm(0), pair_fm(0,succ(a),succ(z))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

45 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

46 
lemma Inr_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

47 
"[ x \<in> nat; z \<in> nat ] ==> Inr_fm(x,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

48 
by (simp add: Inr_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

49 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

50 
lemma sats_Inr_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

51 
"[ x \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  52 
==> sats(A, Inr_fm(x,z), env) \<longleftrightarrow> is_Inr(##A, nth(x,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

53 
by (simp add: Inr_fm_def is_Inr_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

54 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

55 
lemma Inr_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

56 
"[ nth(i,env) = x; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

57 
i \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  58 
==> is_Inr(##A, x, z) \<longleftrightarrow> sats(A, Inr_fm(i,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

59 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

60 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

61 
theorem Inr_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

62 
"REFLECTS[\<lambda>x. is_Inr(L,f(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

63 
\<lambda>i x. is_Inr(##Lset(i),f(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

64 
apply (simp only: is_Inr_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

65 
apply (intro FOL_reflections function_reflections) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

66 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

67 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

68 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

69 
subsubsection{*The Formula @{term is_Nil}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

70 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

71 
(* is_Nil(M,xs) == \<exists>zero[M]. empty(M,zero) & is_Inl(M,zero,xs) *) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

72 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

73 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

74 
Nil_fm :: "i=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

75 
"Nil_fm(x) == Exists(And(empty_fm(0), Inl_fm(0,succ(x))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

76 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

77 
lemma Nil_type [TC]: "x \<in> nat ==> Nil_fm(x) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

78 
by (simp add: Nil_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

79 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

80 
lemma sats_Nil_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

81 
"[ x \<in> nat; env \<in> list(A)] 
46823  82 
==> sats(A, Nil_fm(x), env) \<longleftrightarrow> is_Nil(##A, nth(x,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

83 
by (simp add: Nil_fm_def is_Nil_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

84 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

85 
lemma Nil_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

86 
"[ nth(i,env) = x; i \<in> nat; env \<in> list(A)] 
46823  87 
==> is_Nil(##A, x) \<longleftrightarrow> sats(A, Nil_fm(i), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

88 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

89 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

90 
theorem Nil_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

91 
"REFLECTS[\<lambda>x. is_Nil(L,f(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

92 
\<lambda>i x. is_Nil(##Lset(i),f(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

93 
apply (simp only: is_Nil_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

94 
apply (intro FOL_reflections function_reflections Inl_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

95 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

96 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

97 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

98 
subsubsection{*The Formula @{term is_Cons}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

99 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

100 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

101 
(* "is_Cons(M,a,l,Z) == \<exists>p[M]. pair(M,a,l,p) & is_Inr(M,p,Z)" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

102 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

103 
Cons_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

104 
"Cons_fm(a,l,Z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

105 
Exists(And(pair_fm(succ(a),succ(l),0), Inr_fm(0,succ(Z))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

106 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

107 
lemma Cons_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

108 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> Cons_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

109 
by (simp add: Cons_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

110 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

111 
lemma sats_Cons_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

112 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  113 
==> sats(A, Cons_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

114 
is_Cons(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

115 
by (simp add: Cons_fm_def is_Cons_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

116 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

117 
lemma Cons_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

118 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

119 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  120 
==>is_Cons(##A, x, y, z) \<longleftrightarrow> sats(A, Cons_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

121 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

122 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

123 
theorem Cons_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

124 
"REFLECTS[\<lambda>x. is_Cons(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

125 
\<lambda>i x. is_Cons(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

126 
apply (simp only: is_Cons_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

127 
apply (intro FOL_reflections pair_reflection Inr_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

128 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

129 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

130 
subsubsection{*The Formula @{term is_quasilist}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

131 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

132 
(* is_quasilist(M,xs) == is_Nil(M,z)  (\<exists>x[M]. \<exists>l[M]. is_Cons(M,x,l,z))" *) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

133 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

134 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

135 
quasilist_fm :: "i=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

136 
"quasilist_fm(x) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

137 
Or(Nil_fm(x), Exists(Exists(Cons_fm(1,0,succ(succ(x))))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

138 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

139 
lemma quasilist_type [TC]: "x \<in> nat ==> quasilist_fm(x) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

140 
by (simp add: quasilist_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

141 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

142 
lemma sats_quasilist_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

143 
"[ x \<in> nat; env \<in> list(A)] 
46823  144 
==> sats(A, quasilist_fm(x), env) \<longleftrightarrow> is_quasilist(##A, nth(x,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

145 
by (simp add: quasilist_fm_def is_quasilist_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

146 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

147 
lemma quasilist_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

148 
"[ nth(i,env) = x; i \<in> nat; env \<in> list(A)] 
46823  149 
==> is_quasilist(##A, x) \<longleftrightarrow> sats(A, quasilist_fm(i), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

150 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

151 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

152 
theorem quasilist_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

153 
"REFLECTS[\<lambda>x. is_quasilist(L,f(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

154 
\<lambda>i x. is_quasilist(##Lset(i),f(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

155 
apply (simp only: is_quasilist_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

156 
apply (intro FOL_reflections Nil_reflection Cons_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

157 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

158 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

159 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

160 
subsection{*Absoluteness for the Function @{term nth}*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

161 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

162 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

163 
subsubsection{*The Formula @{term is_hd}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

164 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

165 
(* "is_hd(M,xs,H) == 
46823  166 
(is_Nil(M,xs) \<longrightarrow> empty(M,H)) & 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

167 
(\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs)  H=x) & 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

168 
(is_quasilist(M,xs)  empty(M,H))" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

169 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

170 
hd_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

171 
"hd_fm(xs,H) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

172 
And(Implies(Nil_fm(xs), empty_fm(H)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

173 
And(Forall(Forall(Or(Neg(Cons_fm(1,0,xs#+2)), Equal(H#+2,1)))), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

174 
Or(quasilist_fm(xs), empty_fm(H))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

175 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

176 
lemma hd_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

177 
"[ x \<in> nat; y \<in> nat ] ==> hd_fm(x,y) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

178 
by (simp add: hd_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

179 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

180 
lemma sats_hd_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

181 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 
46823  182 
==> sats(A, hd_fm(x,y), env) \<longleftrightarrow> is_hd(##A, nth(x,env), nth(y,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

183 
by (simp add: hd_fm_def is_hd_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

184 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

185 
lemma hd_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

186 
"[ nth(i,env) = x; nth(j,env) = y; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

187 
i \<in> nat; j \<in> nat; env \<in> list(A)] 
46823  188 
==> is_hd(##A, x, y) \<longleftrightarrow> sats(A, hd_fm(i,j), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

189 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

190 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

191 
theorem hd_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

192 
"REFLECTS[\<lambda>x. is_hd(L,f(x),g(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

193 
\<lambda>i x. is_hd(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

194 
apply (simp only: is_hd_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

195 
apply (intro FOL_reflections Nil_reflection Cons_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

196 
quasilist_reflection empty_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

197 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

198 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

199 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

200 
subsubsection{*The Formula @{term is_tl}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

201 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

202 
(* "is_tl(M,xs,T) == 
46823  203 
(is_Nil(M,xs) \<longrightarrow> T=xs) & 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

204 
(\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs)  T=l) & 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

205 
(is_quasilist(M,xs)  empty(M,T))" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

206 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

207 
tl_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

208 
"tl_fm(xs,T) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

209 
And(Implies(Nil_fm(xs), Equal(T,xs)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

210 
And(Forall(Forall(Or(Neg(Cons_fm(1,0,xs#+2)), Equal(T#+2,0)))), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

211 
Or(quasilist_fm(xs), empty_fm(T))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

212 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

213 
lemma tl_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

214 
"[ x \<in> nat; y \<in> nat ] ==> tl_fm(x,y) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

215 
by (simp add: tl_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

216 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

217 
lemma sats_tl_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

218 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 
46823  219 
==> sats(A, tl_fm(x,y), env) \<longleftrightarrow> is_tl(##A, nth(x,env), nth(y,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

220 
by (simp add: tl_fm_def is_tl_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

221 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

222 
lemma tl_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

223 
"[ nth(i,env) = x; nth(j,env) = y; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

224 
i \<in> nat; j \<in> nat; env \<in> list(A)] 
46823  225 
==> is_tl(##A, x, y) \<longleftrightarrow> sats(A, tl_fm(i,j), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

226 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

227 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

228 
theorem tl_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

229 
"REFLECTS[\<lambda>x. is_tl(L,f(x),g(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

230 
\<lambda>i x. is_tl(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

231 
apply (simp only: is_tl_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

232 
apply (intro FOL_reflections Nil_reflection Cons_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

233 
quasilist_reflection empty_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

234 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

235 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

236 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

237 
subsubsection{*The Operator @{term is_bool_of_o}*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

238 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

239 
(* is_bool_of_o :: "[i=>o, o, i] => o" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

240 
"is_bool_of_o(M,P,z) == (P & number1(M,z))  (~P & empty(M,z))" *) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

241 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

242 
text{*The formula @{term p} has no free variables.*} 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

243 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

244 
bool_of_o_fm :: "[i, i]=>i" where 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

245 
"bool_of_o_fm(p,z) == 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

246 
Or(And(p,number1_fm(z)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

247 
And(Neg(p),empty_fm(z)))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

248 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

249 
lemma is_bool_of_o_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

250 
"[ p \<in> formula; z \<in> nat ] ==> bool_of_o_fm(p,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

251 
by (simp add: bool_of_o_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

252 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

253 
lemma sats_bool_of_o_fm: 
46823  254 
assumes p_iff_sats: "P \<longleftrightarrow> sats(A, p, env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

255 
shows 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

256 
"[z \<in> nat; env \<in> list(A)] 
46823  257 
==> sats(A, bool_of_o_fm(p,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

258 
is_bool_of_o(##A, P, nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

259 
by (simp add: bool_of_o_fm_def is_bool_of_o_def p_iff_sats [THEN iff_sym]) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

260 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

261 
lemma is_bool_of_o_iff_sats: 
46823  262 
"[ P \<longleftrightarrow> sats(A, p, env); nth(k,env) = z; k \<in> nat; env \<in> list(A)] 
263 
==> is_bool_of_o(##A, P, z) \<longleftrightarrow> sats(A, bool_of_o_fm(p,k), env)" 

13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

264 
by (simp add: sats_bool_of_o_fm) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

265 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

266 
theorem bool_of_o_reflection: 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

267 
"REFLECTS [P(L), \<lambda>i. P(##Lset(i))] ==> 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

268 
REFLECTS[\<lambda>x. is_bool_of_o(L, P(L,x), f(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

269 
\<lambda>i x. is_bool_of_o(##Lset(i), P(##Lset(i),x), f(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

270 
apply (simp (no_asm) only: is_bool_of_o_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

271 
apply (intro FOL_reflections function_reflections, assumption+) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

272 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

273 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

274 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

275 
subsection{*More Internalizations*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

276 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

277 
subsubsection{*The Operator @{term is_lambda}*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

278 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

279 
text{*The two arguments of @{term p} are always 1, 0. Remember that 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

280 
@{term p} will be enclosed by three quantifiers.*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

281 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

282 
(* is_lambda :: "[i=>o, i, [i,i]=>o, i] => o" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

283 
"is_lambda(M, A, is_b, z) == 
46823  284 
\<forall>p[M]. p \<in> z \<longleftrightarrow> 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

285 
(\<exists>u[M]. \<exists>v[M]. u\<in>A & pair(M,u,v,p) & is_b(u,v))" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

286 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

287 
lambda_fm :: "[i, i, i]=>i" where 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

288 
"lambda_fm(p,A,z) == 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

289 
Forall(Iff(Member(0,succ(z)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

290 
Exists(Exists(And(Member(1,A#+3), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

291 
And(pair_fm(1,0,2), p))))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

292 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

293 
text{*We call @{term p} with arguments x, y by equating them with 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

294 
the corresponding quantified variables with de Bruijn indices 1, 0.*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

295 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

296 
lemma is_lambda_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

297 
"[ p \<in> formula; x \<in> nat; y \<in> nat ] 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

298 
==> lambda_fm(p,x,y) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

299 
by (simp add: lambda_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

300 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

301 
lemma sats_lambda_fm: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

302 
assumes is_b_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

303 
"!!a0 a1 a2. 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

304 
[a0\<in>A; a1\<in>A; a2\<in>A] 
46823  305 
==> is_b(a1, a0) \<longleftrightarrow> sats(A, p, Cons(a0,Cons(a1,Cons(a2,env))))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

306 
shows 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

307 
"[x \<in> nat; y \<in> nat; env \<in> list(A)] 
46823  308 
==> sats(A, lambda_fm(p,x,y), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

309 
is_lambda(##A, nth(x,env), is_b, nth(y,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

310 
by (simp add: lambda_fm_def is_lambda_def is_b_iff_sats [THEN iff_sym]) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

311 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

312 
theorem is_lambda_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

313 
assumes is_b_reflection: 
13702  314 
"!!f g h. REFLECTS[\<lambda>x. is_b(L, f(x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

315 
\<lambda>i x. is_b(##Lset(i), f(x), g(x), h(x))]" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

316 
shows "REFLECTS[\<lambda>x. is_lambda(L, A(x), is_b(L,x), f(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

317 
\<lambda>i x. is_lambda(##Lset(i), A(x), is_b(##Lset(i),x), f(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

318 
apply (simp (no_asm_use) only: is_lambda_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

319 
apply (intro FOL_reflections is_b_reflection pair_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

320 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

321 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

322 
subsubsection{*The Operator @{term is_Member}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

323 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

324 
(* "is_Member(M,x,y,Z) == 
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

325 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inl(M,u,Z)" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

326 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

327 
Member_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

328 
"Member_fm(x,y,Z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

329 
Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

330 
And(Inl_fm(1,0), Inl_fm(0,Z#+2)))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

331 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

332 
lemma is_Member_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

333 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> Member_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

334 
by (simp add: Member_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

335 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

336 
lemma sats_Member_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

337 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  338 
==> sats(A, Member_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

339 
is_Member(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

340 
by (simp add: Member_fm_def is_Member_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

341 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

342 
lemma Member_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

343 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

344 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  345 
==> is_Member(##A, x, y, z) \<longleftrightarrow> sats(A, Member_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

346 
by (simp add: sats_Member_fm) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

347 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

348 
theorem Member_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

349 
"REFLECTS[\<lambda>x. is_Member(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

350 
\<lambda>i x. is_Member(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

351 
apply (simp only: is_Member_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

352 
apply (intro FOL_reflections pair_reflection Inl_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

353 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

354 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

355 
subsubsection{*The Operator @{term is_Equal}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

356 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

357 
(* "is_Equal(M,x,y,Z) == 
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

358 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inr(M,p,u) & is_Inl(M,u,Z)" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

359 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

360 
Equal_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

361 
"Equal_fm(x,y,Z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

362 
Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

363 
And(Inr_fm(1,0), Inl_fm(0,Z#+2)))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

364 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

365 
lemma is_Equal_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

366 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> Equal_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

367 
by (simp add: Equal_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

368 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

369 
lemma sats_Equal_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

370 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  371 
==> sats(A, Equal_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

372 
is_Equal(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

373 
by (simp add: Equal_fm_def is_Equal_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

374 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

375 
lemma Equal_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

376 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

377 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  378 
==> is_Equal(##A, x, y, z) \<longleftrightarrow> sats(A, Equal_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

379 
by (simp add: sats_Equal_fm) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

380 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

381 
theorem Equal_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

382 
"REFLECTS[\<lambda>x. is_Equal(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

383 
\<lambda>i x. is_Equal(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

384 
apply (simp only: is_Equal_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

385 
apply (intro FOL_reflections pair_reflection Inl_reflection Inr_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

386 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

387 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

388 
subsubsection{*The Operator @{term is_Nand}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

389 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

390 
(* "is_Nand(M,x,y,Z) == 
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

391 
\<exists>p[M]. \<exists>u[M]. pair(M,x,y,p) & is_Inl(M,p,u) & is_Inr(M,u,Z)" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

392 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

393 
Nand_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

394 
"Nand_fm(x,y,Z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

395 
Exists(Exists(And(pair_fm(x#+2,y#+2,1), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

396 
And(Inl_fm(1,0), Inr_fm(0,Z#+2)))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

397 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

398 
lemma is_Nand_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

399 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> Nand_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

400 
by (simp add: Nand_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

401 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

402 
lemma sats_Nand_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

403 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  404 
==> sats(A, Nand_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

405 
is_Nand(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

406 
by (simp add: Nand_fm_def is_Nand_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

407 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

408 
lemma Nand_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

409 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

410 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  411 
==> is_Nand(##A, x, y, z) \<longleftrightarrow> sats(A, Nand_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

412 
by (simp add: sats_Nand_fm) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

413 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

414 
theorem Nand_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

415 
"REFLECTS[\<lambda>x. is_Nand(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

416 
\<lambda>i x. is_Nand(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

417 
apply (simp only: is_Nand_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

418 
apply (intro FOL_reflections pair_reflection Inl_reflection Inr_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

419 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

420 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

421 
subsubsection{*The Operator @{term is_Forall}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

422 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

423 
(* "is_Forall(M,p,Z) == \<exists>u[M]. is_Inr(M,p,u) & is_Inr(M,u,Z)" *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

424 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

425 
Forall_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

426 
"Forall_fm(x,Z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

427 
Exists(And(Inr_fm(succ(x),0), Inr_fm(0,succ(Z))))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

428 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

429 
lemma is_Forall_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

430 
"[ x \<in> nat; y \<in> nat ] ==> Forall_fm(x,y) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

431 
by (simp add: Forall_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

432 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

433 
lemma sats_Forall_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

434 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 
46823  435 
==> sats(A, Forall_fm(x,y), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

436 
is_Forall(##A, nth(x,env), nth(y,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

437 
by (simp add: Forall_fm_def is_Forall_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

438 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

439 
lemma Forall_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

440 
"[ nth(i,env) = x; nth(j,env) = y; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

441 
i \<in> nat; j \<in> nat; env \<in> list(A)] 
46823  442 
==> is_Forall(##A, x, y) \<longleftrightarrow> sats(A, Forall_fm(i,j), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

443 
by (simp add: sats_Forall_fm) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

444 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

445 
theorem Forall_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

446 
"REFLECTS[\<lambda>x. is_Forall(L,f(x),g(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

447 
\<lambda>i x. is_Forall(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

448 
apply (simp only: is_Forall_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

449 
apply (intro FOL_reflections pair_reflection Inr_reflection) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

450 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

451 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

452 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

453 
subsubsection{*The Operator @{term is_and}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

454 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

455 
(* is_and(M,a,b,z) == (number1(M,a) & z=b)  
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

456 
(~number1(M,a) & empty(M,z)) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

457 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

458 
and_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

459 
"and_fm(a,b,z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

460 
Or(And(number1_fm(a), Equal(z,b)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

461 
And(Neg(number1_fm(a)),empty_fm(z)))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

462 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

463 
lemma is_and_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

464 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> and_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

465 
by (simp add: and_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

466 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

467 
lemma sats_and_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

468 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  469 
==> sats(A, and_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

470 
is_and(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

471 
by (simp add: and_fm_def is_and_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

472 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

473 
lemma is_and_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

474 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

475 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  476 
==> is_and(##A, x, y, z) \<longleftrightarrow> sats(A, and_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

477 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

478 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

479 
theorem is_and_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

480 
"REFLECTS[\<lambda>x. is_and(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

481 
\<lambda>i x. is_and(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

482 
apply (simp only: is_and_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

483 
apply (intro FOL_reflections function_reflections) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

484 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

485 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

486 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

487 
subsubsection{*The Operator @{term is_or}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

488 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

489 
(* is_or(M,a,b,z) == (number1(M,a) & number1(M,z))  
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

490 
(~number1(M,a) & z=b) *) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

491 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

492 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

493 
or_fm :: "[i,i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

494 
"or_fm(a,b,z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

495 
Or(And(number1_fm(a), number1_fm(z)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

496 
And(Neg(number1_fm(a)), Equal(z,b)))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

497 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

498 
lemma is_or_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

499 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> or_fm(x,y,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

500 
by (simp add: or_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

501 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

502 
lemma sats_or_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

503 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  504 
==> sats(A, or_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

505 
is_or(##A, nth(x,env), nth(y,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

506 
by (simp add: or_fm_def is_or_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

507 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

508 
lemma is_or_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

509 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

510 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  511 
==> is_or(##A, x, y, z) \<longleftrightarrow> sats(A, or_fm(i,j,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

512 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

513 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

514 
theorem is_or_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

515 
"REFLECTS[\<lambda>x. is_or(L,f(x),g(x),h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

516 
\<lambda>i x. is_or(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

517 
apply (simp only: is_or_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

518 
apply (intro FOL_reflections function_reflections) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

519 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

520 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

521 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

522 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

523 
subsubsection{*The Operator @{term is_not}, Internalized*} 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

524 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

525 
(* is_not(M,a,z) == (number1(M,a) & empty(M,z))  
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

526 
(~number1(M,a) & number1(M,z)) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

527 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

528 
not_fm :: "[i,i]=>i" where 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

529 
"not_fm(a,z) == 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

530 
Or(And(number1_fm(a), empty_fm(z)), 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

531 
And(Neg(number1_fm(a)), number1_fm(z)))" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

532 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

533 
lemma is_not_type [TC]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

534 
"[ x \<in> nat; z \<in> nat ] ==> not_fm(x,z) \<in> formula" 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

535 
by (simp add: not_fm_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

536 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

537 
lemma sats_is_not_fm [simp]: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

538 
"[ x \<in> nat; z \<in> nat; env \<in> list(A)] 
46823  539 
==> sats(A, not_fm(x,z), env) \<longleftrightarrow> is_not(##A, nth(x,env), nth(z,env))" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

540 
by (simp add: not_fm_def is_not_def) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

541 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

542 
lemma is_not_iff_sats: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

543 
"[ nth(i,env) = x; nth(k,env) = z; 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

544 
i \<in> nat; k \<in> nat; env \<in> list(A)] 
46823  545 
==> is_not(##A, x, z) \<longleftrightarrow> sats(A, not_fm(i,k), env)" 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

546 
by simp 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

547 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

548 
theorem is_not_reflection: 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

549 
"REFLECTS[\<lambda>x. is_not(L,f(x),g(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

550 
\<lambda>i x. is_not(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

551 
apply (simp only: is_not_def) 
13496
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

552 
apply (intro FOL_reflections function_reflections) 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

553 
done 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

554 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

555 

6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

556 
lemmas extra_reflections = 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

557 
Inl_reflection Inr_reflection Nil_reflection Cons_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

558 
quasilist_reflection hd_reflection tl_reflection bool_of_o_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

559 
is_lambda_reflection Member_reflection Equal_reflection Nand_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

560 
Forall_reflection is_and_reflection is_or_reflection is_not_reflection 
6f0c57def6d5
In ZF/Constructible, moved many results from Satisfies_absolute, etc., to
paulson
parents:
diff
changeset

561 

13503  562 
subsection{*WellFounded Recursion!*} 
563 

13506  564 
subsubsection{*The Operator @{term M_is_recfun}*} 
13503  565 

566 
text{*Alternative definition, minimizing nesting of quantifiers around MH*} 

567 
lemma M_is_recfun_iff: 

46823  568 
"M_is_recfun(M,MH,r,a,f) \<longleftrightarrow> 
569 
(\<forall>z[M]. z \<in> f \<longleftrightarrow> 

13503  570 
(\<exists>x[M]. \<exists>f_r_sx[M]. \<exists>y[M]. 
571 
MH(x, f_r_sx, y) & pair(M,x,y,z) & 

572 
(\<exists>xa[M]. \<exists>sx[M]. \<exists>r_sx[M]. 

573 
pair(M,x,a,xa) & upair(M,x,x,sx) & 

574 
pre_image(M,r,sx,r_sx) & restriction(M,f,r_sx,f_r_sx) & 

575 
xa \<in> r)))" 

576 
apply (simp add: M_is_recfun_def) 

577 
apply (rule rall_cong, blast) 

578 
done 

579 

580 

581 
(* M_is_recfun :: "[i=>o, [i,i,i]=>o, i, i, i] => o" 

582 
"M_is_recfun(M,MH,r,a,f) == 

46823  583 
\<forall>z[M]. z \<in> f \<longleftrightarrow> 
13503  584 
2 1 0 
585 
new def (\<exists>x[M]. \<exists>f_r_sx[M]. \<exists>y[M]. 

586 
MH(x, f_r_sx, y) & pair(M,x,y,z) & 

587 
(\<exists>xa[M]. \<exists>sx[M]. \<exists>r_sx[M]. 

588 
pair(M,x,a,xa) & upair(M,x,x,sx) & 

589 
pre_image(M,r,sx,r_sx) & restriction(M,f,r_sx,f_r_sx) & 

590 
xa \<in> r)" 

591 
*) 

592 

593 
text{*The three arguments of @{term p} are always 2, 1, 0 and z*} 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

594 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

595 
is_recfun_fm :: "[i, i, i, i]=>i" where 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

596 
"is_recfun_fm(p,r,a,f) == 
13503  597 
Forall(Iff(Member(0,succ(f)), 
598 
Exists(Exists(Exists( 

599 
And(p, 

600 
And(pair_fm(2,0,3), 

601 
Exists(Exists(Exists( 

32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

602 
And(pair_fm(5,a#+7,2), 
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

603 
And(upair_fm(5,5,1), 
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

604 
And(pre_image_fm(r#+7,1,0), 
69916a850301
eliminated hard tabulators, guessing at each author's individual tabwidth;
wenzelm
parents:
21404
diff
changeset

605 
And(restriction_fm(f#+7,0,4), Member(2,r#+7)))))))))))))))" 
13503  606 

607 
lemma is_recfun_type [TC]: 

608 
"[ p \<in> formula; x \<in> nat; y \<in> nat; z \<in> nat ] 

609 
==> is_recfun_fm(p,x,y,z) \<in> formula" 

610 
by (simp add: is_recfun_fm_def) 

611 

612 

613 
lemma sats_is_recfun_fm: 

614 
assumes MH_iff_sats: 

615 
"!!a0 a1 a2 a3. 

616 
[a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A] 

46823  617 
==> MH(a2, a1, a0) \<longleftrightarrow> sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3,env)))))" 
13503  618 
shows 
619 
"[x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 

46823  620 
==> sats(A, is_recfun_fm(p,x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

621 
M_is_recfun(##A, MH, nth(x,env), nth(y,env), nth(z,env))" 
13503  622 
by (simp add: is_recfun_fm_def M_is_recfun_iff MH_iff_sats [THEN iff_sym]) 
623 

624 
lemma is_recfun_iff_sats: 

625 
assumes MH_iff_sats: 

626 
"!!a0 a1 a2 a3. 

627 
[a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A] 

46823  628 
==> MH(a2, a1, a0) \<longleftrightarrow> sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3,env)))))" 
13503  629 
shows 
630 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

631 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 

46823  632 
==> M_is_recfun(##A, MH, x, y, z) \<longleftrightarrow> sats(A, is_recfun_fm(p,i,j,k), env)" 
13503  633 
by (simp add: sats_is_recfun_fm [OF MH_iff_sats]) 
634 

635 
text{*The additional variable in the premise, namely @{term f'}, is essential. 

636 
It lets @{term MH} depend upon @{term x}, which seems often necessary. 

637 
The same thing occurs in @{text is_wfrec_reflection}.*} 

638 
theorem is_recfun_reflection: 

639 
assumes MH_reflection: 

640 
"!!f' f g h. REFLECTS[\<lambda>x. MH(L, f'(x), f(x), g(x), h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

641 
\<lambda>i x. MH(##Lset(i), f'(x), f(x), g(x), h(x))]" 
13503  642 
shows "REFLECTS[\<lambda>x. M_is_recfun(L, MH(L,x), f(x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

643 
\<lambda>i x. M_is_recfun(##Lset(i), MH(##Lset(i),x), f(x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

644 
apply (simp (no_asm_use) only: M_is_recfun_def) 
13503  645 
apply (intro FOL_reflections function_reflections 
646 
restriction_reflection MH_reflection) 

647 
done 

648 

649 
subsubsection{*The Operator @{term is_wfrec}*} 

650 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

651 
text{*The three arguments of @{term p} are always 2, 1, 0; 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

652 
@{term p} is enclosed by 5 quantifiers.*} 
13503  653 

654 
(* is_wfrec :: "[i=>o, i, [i,i,i]=>o, i, i] => o" 

655 
"is_wfrec(M,MH,r,a,z) == 

656 
\<exists>f[M]. M_is_recfun(M,MH,r,a,f) & MH(a,f,z)" *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

657 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

658 
is_wfrec_fm :: "[i, i, i, i]=>i" where 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

659 
"is_wfrec_fm(p,r,a,z) == 
13503  660 
Exists(And(is_recfun_fm(p, succ(r), succ(a), 0), 
661 
Exists(Exists(Exists(Exists( 

662 
And(Equal(2,a#+5), And(Equal(1,4), And(Equal(0,z#+5), p)))))))))" 

663 

664 
text{*We call @{term p} with arguments a, f, z by equating them with 

665 
the corresponding quantified variables with de Bruijn indices 2, 1, 0.*} 

666 

667 
text{*There's an additional existential quantifier to ensure that the 

668 
environments in both calls to MH have the same length.*} 

669 

670 
lemma is_wfrec_type [TC]: 

671 
"[ p \<in> formula; x \<in> nat; y \<in> nat; z \<in> nat ] 

672 
==> is_wfrec_fm(p,x,y,z) \<in> formula" 

673 
by (simp add: is_wfrec_fm_def) 

674 

675 
lemma sats_is_wfrec_fm: 

676 
assumes MH_iff_sats: 

677 
"!!a0 a1 a2 a3 a4. 

678 
[a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A; a4\<in>A] 

46823  679 
==> MH(a2, a1, a0) \<longleftrightarrow> sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3,Cons(a4,env))))))" 
13503  680 
shows 
681 
"[x \<in> nat; y < length(env); z < length(env); env \<in> list(A)] 

46823  682 
==> sats(A, is_wfrec_fm(p,x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

683 
is_wfrec(##A, MH, nth(x,env), nth(y,env), nth(z,env))" 
13503  684 
apply (frule_tac x=z in lt_length_in_nat, assumption) 
685 
apply (frule lt_length_in_nat, assumption) 

686 
apply (simp add: is_wfrec_fm_def sats_is_recfun_fm is_wfrec_def MH_iff_sats [THEN iff_sym], blast) 

687 
done 

688 

689 

690 
lemma is_wfrec_iff_sats: 

691 
assumes MH_iff_sats: 

692 
"!!a0 a1 a2 a3 a4. 

693 
[a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A; a4\<in>A] 

46823  694 
==> MH(a2, a1, a0) \<longleftrightarrow> sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3,Cons(a4,env))))))" 
13503  695 
shows 
696 
"[nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

697 
i \<in> nat; j < length(env); k < length(env); env \<in> list(A)] 

46823  698 
==> is_wfrec(##A, MH, x, y, z) \<longleftrightarrow> sats(A, is_wfrec_fm(p,i,j,k), env)" 
13503  699 
by (simp add: sats_is_wfrec_fm [OF MH_iff_sats]) 
700 

701 
theorem is_wfrec_reflection: 

702 
assumes MH_reflection: 

703 
"!!f' f g h. REFLECTS[\<lambda>x. MH(L, f'(x), f(x), g(x), h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

704 
\<lambda>i x. MH(##Lset(i), f'(x), f(x), g(x), h(x))]" 
13503  705 
shows "REFLECTS[\<lambda>x. is_wfrec(L, MH(L,x), f(x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

706 
\<lambda>i x. is_wfrec(##Lset(i), MH(##Lset(i),x), f(x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

707 
apply (simp (no_asm_use) only: is_wfrec_def) 
13503  708 
apply (intro FOL_reflections MH_reflection is_recfun_reflection) 
709 
done 

710 

711 

712 
subsection{*For Datatypes*} 

713 

714 
subsubsection{*Binary Products, Internalized*} 

715 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

716 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

717 
cartprod_fm :: "[i,i,i]=>i" where 
13503  718 
(* "cartprod(M,A,B,z) == 
46823  719 
\<forall>u[M]. u \<in> z \<longleftrightarrow> (\<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>B & pair(M,x,y,u)))" *) 
13503  720 
"cartprod_fm(A,B,z) == 
721 
Forall(Iff(Member(0,succ(z)), 

722 
Exists(And(Member(0,succ(succ(A))), 

723 
Exists(And(Member(0,succ(succ(succ(B)))), 

724 
pair_fm(1,0,2)))))))" 

725 

726 
lemma cartprod_type [TC]: 

727 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> cartprod_fm(x,y,z) \<in> formula" 

728 
by (simp add: cartprod_fm_def) 

729 

730 
lemma sats_cartprod_fm [simp]: 

731 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 

46823  732 
==> sats(A, cartprod_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

733 
cartprod(##A, nth(x,env), nth(y,env), nth(z,env))" 
13503  734 
by (simp add: cartprod_fm_def cartprod_def) 
735 

736 
lemma cartprod_iff_sats: 

737 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

738 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 

46823  739 
==> cartprod(##A, x, y, z) \<longleftrightarrow> sats(A, cartprod_fm(i,j,k), env)" 
13503  740 
by (simp add: sats_cartprod_fm) 
741 

742 
theorem cartprod_reflection: 

743 
"REFLECTS[\<lambda>x. cartprod(L,f(x),g(x),h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

744 
\<lambda>i x. cartprod(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

745 
apply (simp only: cartprod_def) 
13503  746 
apply (intro FOL_reflections pair_reflection) 
747 
done 

748 

749 

750 
subsubsection{*Binary Sums, Internalized*} 

751 

752 
(* "is_sum(M,A,B,Z) == 

753 
\<exists>A0[M]. \<exists>n1[M]. \<exists>s1[M]. \<exists>B1[M]. 

754 
3 2 1 0 

755 
number1(M,n1) & cartprod(M,n1,A,A0) & upair(M,n1,n1,s1) & 

756 
cartprod(M,s1,B,B1) & union(M,A0,B1,Z)" *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

757 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

758 
sum_fm :: "[i,i,i]=>i" where 
13503  759 
"sum_fm(A,B,Z) == 
760 
Exists(Exists(Exists(Exists( 

761 
And(number1_fm(2), 

762 
And(cartprod_fm(2,A#+4,3), 

763 
And(upair_fm(2,2,1), 

764 
And(cartprod_fm(1,B#+4,0), union_fm(3,0,Z#+4)))))))))" 

765 

766 
lemma sum_type [TC]: 

767 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> sum_fm(x,y,z) \<in> formula" 

768 
by (simp add: sum_fm_def) 

769 

770 
lemma sats_sum_fm [simp]: 

771 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 

46823  772 
==> sats(A, sum_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

773 
is_sum(##A, nth(x,env), nth(y,env), nth(z,env))" 
13503  774 
by (simp add: sum_fm_def is_sum_def) 
775 

776 
lemma sum_iff_sats: 

777 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

778 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 

46823  779 
==> is_sum(##A, x, y, z) \<longleftrightarrow> sats(A, sum_fm(i,j,k), env)" 
13503  780 
by simp 
781 

782 
theorem sum_reflection: 

783 
"REFLECTS[\<lambda>x. is_sum(L,f(x),g(x),h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

784 
\<lambda>i x. is_sum(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

785 
apply (simp only: is_sum_def) 
13503  786 
apply (intro FOL_reflections function_reflections cartprod_reflection) 
787 
done 

788 

789 

790 
subsubsection{*The Operator @{term quasinat}*} 

791 

792 
(* "is_quasinat(M,z) == empty(M,z)  (\<exists>m[M]. successor(M,m,z))" *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

793 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

794 
quasinat_fm :: "i=>i" where 
13503  795 
"quasinat_fm(z) == Or(empty_fm(z), Exists(succ_fm(0,succ(z))))" 
796 

797 
lemma quasinat_type [TC]: 

798 
"x \<in> nat ==> quasinat_fm(x) \<in> formula" 

799 
by (simp add: quasinat_fm_def) 

800 

801 
lemma sats_quasinat_fm [simp]: 

802 
"[ x \<in> nat; env \<in> list(A)] 

46823  803 
==> sats(A, quasinat_fm(x), env) \<longleftrightarrow> is_quasinat(##A, nth(x,env))" 
13503  804 
by (simp add: quasinat_fm_def is_quasinat_def) 
805 

806 
lemma quasinat_iff_sats: 

807 
"[ nth(i,env) = x; nth(j,env) = y; 

808 
i \<in> nat; env \<in> list(A)] 

46823  809 
==> is_quasinat(##A, x) \<longleftrightarrow> sats(A, quasinat_fm(i), env)" 
13503  810 
by simp 
811 

812 
theorem quasinat_reflection: 

813 
"REFLECTS[\<lambda>x. is_quasinat(L,f(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

814 
\<lambda>i x. is_quasinat(##Lset(i),f(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

815 
apply (simp only: is_quasinat_def) 
13503  816 
apply (intro FOL_reflections function_reflections) 
817 
done 

818 

819 

820 
subsubsection{*The Operator @{term is_nat_case}*} 

821 
text{*I could not get it to work with the more natural assumption that 

822 
@{term is_b} takes two arguments. Instead it must be a formula where 1 and 0 

823 
stand for @{term m} and @{term b}, respectively.*} 

824 

825 
(* is_nat_case :: "[i=>o, i, [i,i]=>o, i, i] => o" 

826 
"is_nat_case(M, a, is_b, k, z) == 

46823  827 
(empty(M,k) \<longrightarrow> z=a) & 
828 
(\<forall>m[M]. successor(M,m,k) \<longrightarrow> is_b(m,z)) & 

13503  829 
(is_quasinat(M,k)  empty(M,z))" *) 
830 
text{*The formula @{term is_b} has free variables 1 and 0.*} 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

831 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

832 
is_nat_case_fm :: "[i, i, i, i]=>i" where 
13503  833 
"is_nat_case_fm(a,is_b,k,z) == 
834 
And(Implies(empty_fm(k), Equal(z,a)), 

835 
And(Forall(Implies(succ_fm(0,succ(k)), 

836 
Forall(Implies(Equal(0,succ(succ(z))), is_b)))), 

837 
Or(quasinat_fm(k), empty_fm(z))))" 

838 

839 
lemma is_nat_case_type [TC]: 

840 
"[ is_b \<in> formula; 

841 
x \<in> nat; y \<in> nat; z \<in> nat ] 

842 
==> is_nat_case_fm(x,is_b,y,z) \<in> formula" 

843 
by (simp add: is_nat_case_fm_def) 

844 

845 
lemma sats_is_nat_case_fm: 

846 
assumes is_b_iff_sats: 

46823  847 
"!!a. a \<in> A ==> is_b(a,nth(z, env)) \<longleftrightarrow> 
13503  848 
sats(A, p, Cons(nth(z,env), Cons(a, env)))" 
849 
shows 

850 
"[x \<in> nat; y \<in> nat; z < length(env); env \<in> list(A)] 

46823  851 
==> sats(A, is_nat_case_fm(x,p,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

852 
is_nat_case(##A, nth(x,env), is_b, nth(y,env), nth(z,env))" 
13503  853 
apply (frule lt_length_in_nat, assumption) 
854 
apply (simp add: is_nat_case_fm_def is_nat_case_def is_b_iff_sats [THEN iff_sym]) 

855 
done 

856 

857 
lemma is_nat_case_iff_sats: 

46823  858 
"[ (!!a. a \<in> A ==> is_b(a,z) \<longleftrightarrow> 
13503  859 
sats(A, p, Cons(z, Cons(a,env)))); 
860 
nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

861 
i \<in> nat; j \<in> nat; k < length(env); env \<in> list(A)] 

46823  862 
==> is_nat_case(##A, x, is_b, y, z) \<longleftrightarrow> sats(A, is_nat_case_fm(i,p,j,k), env)" 
13503  863 
by (simp add: sats_is_nat_case_fm [of A is_b]) 
864 

865 

866 
text{*The second argument of @{term is_b} gives it direct access to @{term x}, 

867 
which is essential for handling free variable references. Without this 

868 
argument, we cannot prove reflection for @{term iterates_MH}.*} 

869 
theorem is_nat_case_reflection: 

870 
assumes is_b_reflection: 

871 
"!!h f g. REFLECTS[\<lambda>x. is_b(L, h(x), f(x), g(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

872 
\<lambda>i x. is_b(##Lset(i), h(x), f(x), g(x))]" 
13503  873 
shows "REFLECTS[\<lambda>x. is_nat_case(L, f(x), is_b(L,x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

874 
\<lambda>i x. is_nat_case(##Lset(i), f(x), is_b(##Lset(i), x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

875 
apply (simp (no_asm_use) only: is_nat_case_def) 
13503  876 
apply (intro FOL_reflections function_reflections 
877 
restriction_reflection is_b_reflection quasinat_reflection) 

878 
done 

879 

880 

881 
subsection{*The Operator @{term iterates_MH}, Needed for Iteration*} 

882 

883 
(* iterates_MH :: "[i=>o, [i,i]=>o, i, i, i, i] => o" 

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

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

886 
n, z)" *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

887 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

888 
iterates_MH_fm :: "[i, i, i, i, i]=>i" where 
13503  889 
"iterates_MH_fm(isF,v,n,g,z) == 
890 
is_nat_case_fm(v, 

891 
Exists(And(fun_apply_fm(succ(succ(succ(g))),2,0), 

892 
Forall(Implies(Equal(0,2), isF)))), 

893 
n, z)" 

894 

895 
lemma iterates_MH_type [TC]: 

896 
"[ p \<in> formula; 

897 
v \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat ] 

898 
==> iterates_MH_fm(p,v,x,y,z) \<in> formula" 

899 
by (simp add: iterates_MH_fm_def) 

900 

901 
lemma sats_iterates_MH_fm: 

902 
assumes is_F_iff_sats: 

903 
"!!a b c d. [ a \<in> A; b \<in> A; c \<in> A; d \<in> A] 

46823  904 
==> is_F(a,b) \<longleftrightarrow> 
13503  905 
sats(A, p, Cons(b, Cons(a, Cons(c, Cons(d,env)))))" 
906 
shows 

907 
"[v \<in> nat; x \<in> nat; y \<in> nat; z < length(env); env \<in> list(A)] 

46823  908 
==> sats(A, iterates_MH_fm(p,v,x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

909 
iterates_MH(##A, is_F, nth(v,env), nth(x,env), nth(y,env), nth(z,env))" 
13503  910 
apply (frule lt_length_in_nat, assumption) 
911 
apply (simp add: iterates_MH_fm_def iterates_MH_def sats_is_nat_case_fm 

912 
is_F_iff_sats [symmetric]) 

913 
apply (rule is_nat_case_cong) 

914 
apply (simp_all add: setclass_def) 

915 
done 

916 

917 
lemma iterates_MH_iff_sats: 

918 
assumes is_F_iff_sats: 

919 
"!!a b c d. [ a \<in> A; b \<in> A; c \<in> A; d \<in> A] 

46823  920 
==> is_F(a,b) \<longleftrightarrow> 
13503  921 
sats(A, p, Cons(b, Cons(a, Cons(c, Cons(d,env)))))" 
922 
shows 

923 
"[ nth(i',env) = v; nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

924 
i' \<in> nat; i \<in> nat; j \<in> nat; k < length(env); env \<in> list(A)] 

46823  925 
==> iterates_MH(##A, is_F, v, x, y, z) \<longleftrightarrow> 
13503  926 
sats(A, iterates_MH_fm(p,i',i,j,k), env)" 
927 
by (simp add: sats_iterates_MH_fm [OF is_F_iff_sats]) 

928 

929 
text{*The second argument of @{term p} gives it direct access to @{term x}, 

930 
which is essential for handling free variable references. Without this 

931 
argument, we cannot prove reflection for @{term list_N}.*} 

932 
theorem iterates_MH_reflection: 

933 
assumes p_reflection: 

934 
"!!f g h. REFLECTS[\<lambda>x. p(L, h(x), f(x), g(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

935 
\<lambda>i x. p(##Lset(i), h(x), f(x), g(x))]" 
13503  936 
shows "REFLECTS[\<lambda>x. iterates_MH(L, p(L,x), e(x), f(x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

937 
\<lambda>i x. iterates_MH(##Lset(i), p(##Lset(i),x), e(x), f(x), g(x), h(x))]" 
13503  938 
apply (simp (no_asm_use) only: iterates_MH_def) 
939 
apply (intro FOL_reflections function_reflections is_nat_case_reflection 

940 
restriction_reflection p_reflection) 

941 
done 

942 

943 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

944 
subsubsection{*The Operator @{term is_iterates}*} 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

945 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

946 
text{*The three arguments of @{term p} are always 2, 1, 0; 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

947 
@{term p} is enclosed by 9 (??) quantifiers.*} 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

948 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

949 
(* "is_iterates(M,isF,v,n,Z) == 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

950 
\<exists>sn[M]. \<exists>msn[M]. successor(M,n,sn) & membership(M,sn,msn) & 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

951 
1 0 is_wfrec(M, iterates_MH(M,isF,v), msn, n, Z)"*) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

952 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

953 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

954 
is_iterates_fm :: "[i, i, i, i]=>i" where 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

955 
"is_iterates_fm(p,v,n,Z) == 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

956 
Exists(Exists( 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

957 
And(succ_fm(n#+2,1), 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

958 
And(Memrel_fm(1,0), 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

959 
is_wfrec_fm(iterates_MH_fm(p, v#+7, 2, 1, 0), 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

960 
0, n#+2, Z#+2)))))" 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

961 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

962 
text{*We call @{term p} with arguments a, f, z by equating them with 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

963 
the corresponding quantified variables with de Bruijn indices 2, 1, 0.*} 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

964 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

965 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

966 
lemma is_iterates_type [TC]: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

967 
"[ p \<in> formula; x \<in> nat; y \<in> nat; z \<in> nat ] 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

968 
==> is_iterates_fm(p,x,y,z) \<in> formula" 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

969 
by (simp add: is_iterates_fm_def) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

970 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

971 
lemma sats_is_iterates_fm: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

972 
assumes is_F_iff_sats: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

973 
"!!a b c d e f g h i j k. 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

974 
[ a \<in> A; b \<in> A; c \<in> A; d \<in> A; e \<in> A; f \<in> A; 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

975 
g \<in> A; h \<in> A; i \<in> A; j \<in> A; k \<in> A] 
46823  976 
==> is_F(a,b) \<longleftrightarrow> 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

977 
sats(A, p, Cons(b, Cons(a, Cons(c, Cons(d, Cons(e, Cons(f, 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

978 
Cons(g, Cons(h, Cons(i, Cons(j, Cons(k, env))))))))))))" 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

979 
shows 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

980 
"[x \<in> nat; y < length(env); z < length(env); env \<in> list(A)] 
46823  981 
==> sats(A, is_iterates_fm(p,x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

982 
is_iterates(##A, is_F, nth(x,env), nth(y,env), nth(z,env))" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

983 
apply (frule_tac x=z in lt_length_in_nat, assumption) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

984 
apply (frule lt_length_in_nat, assumption) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

985 
apply (simp add: is_iterates_fm_def is_iterates_def sats_is_nat_case_fm 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

986 
is_F_iff_sats [symmetric] sats_is_wfrec_fm sats_iterates_MH_fm) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

987 
done 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

988 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

989 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

990 
lemma is_iterates_iff_sats: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

991 
assumes is_F_iff_sats: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

992 
"!!a b c d e f g h i j k. 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

993 
[ a \<in> A; b \<in> A; c \<in> A; d \<in> A; e \<in> A; f \<in> A; 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

994 
g \<in> A; h \<in> A; i \<in> A; j \<in> A; k \<in> A] 
46823  995 
==> is_F(a,b) \<longleftrightarrow> 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

996 
sats(A, p, Cons(b, Cons(a, Cons(c, Cons(d, Cons(e, Cons(f, 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

997 
Cons(g, Cons(h, Cons(i, Cons(j, Cons(k, env))))))))))))" 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

998 
shows 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

999 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1000 
i \<in> nat; j < length(env); k < length(env); env \<in> list(A)] 
46823  1001 
==> is_iterates(##A, is_F, x, y, z) \<longleftrightarrow> 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1002 
sats(A, is_iterates_fm(p,i,j,k), env)" 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1003 
by (simp add: sats_is_iterates_fm [OF is_F_iff_sats]) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1004 

95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1005 
text{*The second argument of @{term p} gives it direct access to @{term x}, 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1006 
which is essential for handling free variable references. Without this 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1007 
argument, we cannot prove reflection for @{term list_N}.*} 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1008 
theorem is_iterates_reflection: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1009 
assumes p_reflection: 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1010 
"!!f g h. REFLECTS[\<lambda>x. p(L, h(x), f(x), g(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1011 
\<lambda>i x. p(##Lset(i), h(x), f(x), g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1012 
shows "REFLECTS[\<lambda>x. is_iterates(L, p(L,x), f(x), g(x), h(x)), 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1013 
\<lambda>i x. is_iterates(##Lset(i), p(##Lset(i),x), f(x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1014 
apply (simp (no_asm_use) only: is_iterates_def) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1015 
apply (intro FOL_reflections function_reflections p_reflection 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1016 
is_wfrec_reflection iterates_MH_reflection) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1017 
done 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1018 

13503  1019 

1020 
subsubsection{*The Formula @{term is_eclose_n}, Internalized*} 

1021 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1022 
(* is_eclose_n(M,A,n,Z) == is_iterates(M, big_union(M), A, n, Z) *) 
13503  1023 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1024 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1025 
eclose_n_fm :: "[i,i,i]=>i" where 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1026 
"eclose_n_fm(A,n,Z) == is_iterates_fm(big_union_fm(1,0), A, n, Z)" 
13503  1027 

1028 
lemma eclose_n_fm_type [TC]: 

1029 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> eclose_n_fm(x,y,z) \<in> formula" 

1030 
by (simp add: eclose_n_fm_def) 

1031 

1032 
lemma sats_eclose_n_fm [simp]: 

1033 
"[ x \<in> nat; y < length(env); z < length(env); env \<in> list(A)] 

46823  1034 
==> sats(A, eclose_n_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1035 
is_eclose_n(##A, nth(x,env), nth(y,env), nth(z,env))" 
13503  1036 
apply (frule_tac x=z in lt_length_in_nat, assumption) 
1037 
apply (frule_tac x=y in lt_length_in_nat, assumption) 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1038 
apply (simp add: eclose_n_fm_def is_eclose_n_def 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1039 
sats_is_iterates_fm) 
13503  1040 
done 
1041 

1042 
lemma eclose_n_iff_sats: 

1043 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

1044 
i \<in> nat; j < length(env); k < length(env); env \<in> list(A)] 

46823  1045 
==> is_eclose_n(##A, x, y, z) \<longleftrightarrow> sats(A, eclose_n_fm(i,j,k), env)" 
13503  1046 
by (simp add: sats_eclose_n_fm) 
1047 

1048 
theorem eclose_n_reflection: 

1049 
"REFLECTS[\<lambda>x. is_eclose_n(L, f(x), g(x), h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1050 
\<lambda>i x. is_eclose_n(##Lset(i), f(x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1051 
apply (simp only: is_eclose_n_def) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1052 
apply (intro FOL_reflections function_reflections is_iterates_reflection) 
13503  1053 
done 
1054 

1055 

1056 
subsubsection{*Membership in @{term "eclose(A)"}*} 

1057 

1058 
(* mem_eclose(M,A,l) == 

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

1060 
finite_ordinal(M,n) & is_eclose_n(M,A,n,eclosen) & l \<in> eclosen *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1061 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1062 
mem_eclose_fm :: "[i,i]=>i" where 
13503  1063 
"mem_eclose_fm(x,y) == 
1064 
Exists(Exists( 

1065 
And(finite_ordinal_fm(1), 

1066 
And(eclose_n_fm(x#+2,1,0), Member(y#+2,0)))))" 

1067 

1068 
lemma mem_eclose_type [TC]: 

1069 
"[ x \<in> nat; y \<in> nat ] ==> mem_eclose_fm(x,y) \<in> formula" 

1070 
by (simp add: mem_eclose_fm_def) 

1071 

1072 
lemma sats_mem_eclose_fm [simp]: 

1073 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 

46823  1074 
==> sats(A, mem_eclose_fm(x,y), env) \<longleftrightarrow> mem_eclose(##A, nth(x,env), nth(y,env))" 
13503  1075 
by (simp add: mem_eclose_fm_def mem_eclose_def) 
1076 

1077 
lemma mem_eclose_iff_sats: 

1078 
"[ nth(i,env) = x; nth(j,env) = y; 

1079 
i \<in> nat; j \<in> nat; env \<in> list(A)] 

46823  1080 
==> mem_eclose(##A, x, y) \<longleftrightarrow> sats(A, mem_eclose_fm(i,j), env)" 
13503  1081 
by simp 
1082 

1083 
theorem mem_eclose_reflection: 

1084 
"REFLECTS[\<lambda>x. mem_eclose(L,f(x),g(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1085 
\<lambda>i x. mem_eclose(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1086 
apply (simp only: mem_eclose_def) 
13503  1087 
apply (intro FOL_reflections finite_ordinal_reflection eclose_n_reflection) 
1088 
done 

1089 

1090 

1091 
subsubsection{*The Predicate ``Is @{term "eclose(A)"}''*} 

1092 

46823  1093 
(* is_eclose(M,A,Z) == \<forall>l[M]. l \<in> Z \<longleftrightarrow> mem_eclose(M,A,l) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1094 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1095 
is_eclose_fm :: "[i,i]=>i" where 
13503  1096 
"is_eclose_fm(A,Z) == 
1097 
Forall(Iff(Member(0,succ(Z)), mem_eclose_fm(succ(A),0)))" 

1098 

1099 
lemma is_eclose_type [TC]: 

1100 
"[ x \<in> nat; y \<in> nat ] ==> is_eclose_fm(x,y) \<in> formula" 

1101 
by (simp add: is_eclose_fm_def) 

1102 

1103 
lemma sats_is_eclose_fm [simp]: 

1104 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 

46823  1105 
==> sats(A, is_eclose_fm(x,y), env) \<longleftrightarrow> is_eclose(##A, nth(x,env), nth(y,env))" 
13503  1106 
by (simp add: is_eclose_fm_def is_eclose_def) 
1107 

1108 
lemma is_eclose_iff_sats: 

1109 
"[ nth(i,env) = x; nth(j,env) = y; 

1110 
i \<in> nat; j \<in> nat; env \<in> list(A)] 

46823  1111 
==> is_eclose(##A, x, y) \<longleftrightarrow> sats(A, is_eclose_fm(i,j), env)" 
13503  1112 
by simp 
1113 

1114 
theorem is_eclose_reflection: 

1115 
"REFLECTS[\<lambda>x. is_eclose(L,f(x),g(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1116 
\<lambda>i x. is_eclose(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1117 
apply (simp only: is_eclose_def) 
13503  1118 
apply (intro FOL_reflections mem_eclose_reflection) 
1119 
done 

1120 

1121 

1122 
subsubsection{*The List Functor, Internalized*} 

1123 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1124 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1125 
list_functor_fm :: "[i,i,i]=>i" where 
13503  1126 
(* "is_list_functor(M,A,X,Z) == 
1127 
\<exists>n1[M]. \<exists>AX[M]. 

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

1129 
"list_functor_fm(A,X,Z) == 

1130 
Exists(Exists( 

1131 
And(number1_fm(1), 

1132 
And(cartprod_fm(A#+2,X#+2,0), sum_fm(1,0,Z#+2)))))" 

1133 

1134 
lemma list_functor_type [TC]: 

1135 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> list_functor_fm(x,y,z) \<in> formula" 

1136 
by (simp add: list_functor_fm_def) 

1137 

1138 
lemma sats_list_functor_fm [simp]: 

1139 
"[ x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)] 

46823  1140 
==> sats(A, list_functor_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1141 
is_list_functor(##A, nth(x,env), nth(y,env), nth(z,env))" 
13503  1142 
by (simp add: list_functor_fm_def is_list_functor_def) 
1143 

1144 
lemma list_functor_iff_sats: 

1145 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

1146 
i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)] 

46823  1147 
==> is_list_functor(##A, x, y, z) \<longleftrightarrow> sats(A, list_functor_fm(i,j,k), env)" 
13503  1148 
by simp 
1149 

1150 
theorem list_functor_reflection: 

1151 
"REFLECTS[\<lambda>x. is_list_functor(L,f(x),g(x),h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1152 
\<lambda>i x. is_list_functor(##Lset(i),f(x),g(x),h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1153 
apply (simp only: is_list_functor_def) 
13503  1154 
apply (intro FOL_reflections number1_reflection 
1155 
cartprod_reflection sum_reflection) 

1156 
done 

1157 

1158 

1159 
subsubsection{*The Formula @{term is_list_N}, Internalized*} 

1160 

1161 
(* "is_list_N(M,A,n,Z) == 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1162 
\<exists>zero[M]. empty(M,zero) & 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1163 
is_iterates(M, is_list_functor(M,A), zero, n, Z)" *) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1164 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1165 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1166 
list_N_fm :: "[i,i,i]=>i" where 
13503  1167 
"list_N_fm(A,n,Z) == 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1168 
Exists( 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1169 
And(empty_fm(0), 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1170 
is_iterates_fm(list_functor_fm(A#+9#+3,1,0), 0, n#+1, Z#+1)))" 
13503  1171 

1172 
lemma list_N_fm_type [TC]: 

1173 
"[ x \<in> nat; y \<in> nat; z \<in> nat ] ==> list_N_fm(x,y,z) \<in> formula" 

1174 
by (simp add: list_N_fm_def) 

1175 

1176 
lemma sats_list_N_fm [simp]: 

1177 
"[ x \<in> nat; y < length(env); z < length(env); env \<in> list(A)] 

46823  1178 
==> sats(A, list_N_fm(x,y,z), env) \<longleftrightarrow> 
13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1179 
is_list_N(##A, nth(x,env), nth(y,env), nth(z,env))" 
13503  1180 
apply (frule_tac x=z in lt_length_in_nat, assumption) 
1181 
apply (frule_tac x=y in lt_length_in_nat, assumption) 

13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1182 
apply (simp add: list_N_fm_def is_list_N_def sats_is_iterates_fm) 
13503  1183 
done 
1184 

1185 
lemma list_N_iff_sats: 

1186 
"[ nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 

1187 
i \<in> nat; j < length(env); k < length(env); env \<in> list(A)] 

46823  1188 
==> is_list_N(##A, x, y, z) \<longleftrightarrow> sats(A, list_N_fm(i,j,k), env)" 
13503  1189 
by (simp add: sats_list_N_fm) 
1190 

1191 
theorem list_N_reflection: 

1192 
"REFLECTS[\<lambda>x. is_list_N(L, f(x), g(x), h(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1193 
\<lambda>i x. is_list_N(##Lset(i), f(x), g(x), h(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1194 
apply (simp only: is_list_N_def) 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1195 
apply (intro FOL_reflections function_reflections 
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1196 
is_iterates_reflection list_functor_reflection) 
13503  1197 
done 
1198 

1199 

1200 

1201 
subsubsection{*The Predicate ``Is A List''*} 

1202 

1203 
(* mem_list(M,A,l) == 

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

1205 
finite_ordinal(M,n) & is_list_N(M,A,n,listn) & l \<in> listn *) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1206 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1207 
mem_list_fm :: "[i,i]=>i" where 
13503  1208 
"mem_list_fm(x,y) == 
1209 
Exists(Exists( 

1210 
And(finite_ordinal_fm(1), 

1211 
And(list_N_fm(x#+2,1,0), Member(y#+2,0)))))" 

1212 

1213 
lemma mem_list_type [TC]: 

1214 
"[ x \<in> nat; y \<in> nat ] ==> mem_list_fm(x,y) \<in> formula" 

1215 
by (simp add: mem_list_fm_def) 

1216 

1217 
lemma sats_mem_list_fm [simp]: 

1218 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 

46823  1219 
==> sats(A, mem_list_fm(x,y), env) \<longleftrightarrow> mem_list(##A, nth(x,env), nth(y,env))" 
13503  1220 
by (simp add: mem_list_fm_def mem_list_def) 
1221 

1222 
lemma mem_list_iff_sats: 

1223 
"[ nth(i,env) = x; nth(j,env) = y; 

1224 
i \<in> nat; j \<in> nat; env \<in> list(A)] 

46823  1225 
==> mem_list(##A, x, y) \<longleftrightarrow> sats(A, mem_list_fm(i,j), env)" 
13503  1226 
by simp 
1227 

1228 
theorem mem_list_reflection: 

1229 
"REFLECTS[\<lambda>x. mem_list(L,f(x),g(x)), 

13807
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
paulson
parents:
13702
diff
changeset

1230 
\<lambda>i x. mem_list(##Lset(i),f(x),g(x))]" 
13655
95b95cdb4704
Tidying up. New primitives is_iterates and is_iterates_fm.
paulson
parents:
13651
diff
changeset

1231 
apply (simp only: mem_list_def) 
13503  1232 
apply (intro FOL_reflections finite_ordinal_reflection list_N_reflection) 
1233 
done 

1234 

1235 

1236 
subsubsection{*The Predicate ``Is @{term "list(A)"}''*} 

1237 

46823  1238 
(* is_list(M,A,Z) == \<forall>l[M]. l \<in> Z \<longleftrightarrow> mem_list(M,A,l) *) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1239 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21233
diff
changeset

1240 
is_list_fm :: "[i,i]=>i" where 
13503  1241 
"is_list_fm(A,Z) == 
1242 
Forall(Iff(Member(0,succ(Z)), mem_list_fm(succ(A),0)))" 

1243 

1244 
lemma is_list_type [TC]: 

1245 
"[ x \<in> nat; y \<in> nat ] ==> is_list_fm(x,y) \<in> formula" 

1246 
by (simp add: is_list_fm_def) 

1247 

1248 
lemma sats_is_list_fm [simp]: 

1249 
"[ x \<in> nat; y \<in> nat; env \<in> list(A)] 

46823  1250 
==> sats(A, is_list_fm(x,y), env) \<longleftrightarrow> is_list(##A, nth(x,env), nth(y,env))" 
13503  1251 
by (simp add: is_list_fm_def is_list_def) 
1252 
