src/ZF/Constructible/L_axioms.thy
author paulson
Mon, 08 Jul 2002 17:51:56 +0200
changeset 13316 d16629fd0f95
parent 13314 84b9de3cbc91
child 13323 2c287f50c9f3
permissions -rw-r--r--
more and simpler separation proofs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
     1
header {*The Class L Satisfies the ZF Axioms*}
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     2
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
     3
theory L_axioms = Formula + Relative + Reflection + MetaExists:
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     4
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     5
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     6
text {* The class L satisfies the premises of locale @{text M_axioms} *}
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     7
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     8
lemma transL: "[| y\<in>x; L(x) |] ==> L(y)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
     9
apply (insert Transset_Lset) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    10
apply (simp add: Transset_def L_def, blast) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    11
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    12
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    13
lemma nonempty: "L(0)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    14
apply (simp add: L_def) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    15
apply (blast intro: zero_in_Lset) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    16
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    17
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    18
lemma upair_ax: "upair_ax(L)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    19
apply (simp add: upair_ax_def upair_def, clarify)
13299
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    20
apply (rule_tac x="{x,y}" in rexI)  
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    21
apply (simp_all add: doubleton_in_L) 
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    22
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    23
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    24
lemma Union_ax: "Union_ax(L)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    25
apply (simp add: Union_ax_def big_union_def, clarify)
13299
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    26
apply (rule_tac x="Union(x)" in rexI)  
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    27
apply (simp_all add: Union_in_L, auto) 
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    28
apply (blast intro: transL) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    29
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    30
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    31
lemma power_ax: "power_ax(L)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    32
apply (simp add: power_ax_def powerset_def Relative.subset_def, clarify)
13299
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    33
apply (rule_tac x="{y \<in> Pow(x). L(y)}" in rexI)  
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    34
apply (simp_all add: LPow_in_L, auto)
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    35
apply (blast intro: transL) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    36
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    37
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    38
subsubsection{*For L to satisfy Replacement *}
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    39
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    40
(*Can't move these to Formula unless the definition of univalent is moved
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    41
there too!*)
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    42
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    43
lemma LReplace_in_Lset:
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    44
     "[|X \<in> Lset(i); univalent(L,X,Q); Ord(i)|] 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    45
      ==> \<exists>j. Ord(j) & Replace(X, %x y. Q(x,y) & L(y)) \<subseteq> Lset(j)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    46
apply (rule_tac x="\<Union>y \<in> Replace(X, %x y. Q(x,y) & L(y)). succ(lrank(y))" 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    47
       in exI)
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    48
apply simp
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    49
apply clarify 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    50
apply (rule_tac a="x" in UN_I)  
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    51
 apply (simp_all add: Replace_iff univalent_def) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    52
apply (blast dest: transL L_I) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    53
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    54
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    55
lemma LReplace_in_L: 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    56
     "[|L(X); univalent(L,X,Q)|] 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    57
      ==> \<exists>Y. L(Y) & Replace(X, %x y. Q(x,y) & L(y)) \<subseteq> Y"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    58
apply (drule L_D, clarify) 
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    59
apply (drule LReplace_in_Lset, assumption+)
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    60
apply (blast intro: L_I Lset_in_Lset_succ)
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    61
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    62
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    63
lemma replacement: "replacement(L,P)"
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    64
apply (simp add: replacement_def, clarify)
13268
240509babf00 more use of relativized quantifiers
paulson
parents: 13223
diff changeset
    65
apply (frule LReplace_in_L, assumption+, clarify) 
13299
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    66
apply (rule_tac x=Y in rexI)   
3a932abf97e8 More use of relativized quantifiers
paulson
parents: 13298
diff changeset
    67
apply (simp_all add: Replace_iff univalent_def, blast) 
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    68
done
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
    69
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    70
subsection{*Instantiation of the locale @{text M_triv_axioms}*}
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    71
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    72
lemma Lset_mono_le: "mono_le_subset(Lset)"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    73
by (simp add: mono_le_subset_def le_imp_subset Lset_mono) 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    74
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    75
lemma Lset_cont: "cont_Ord(Lset)"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    76
by (simp add: cont_Ord_def Limit_Lset_eq OUnion_def Limit_is_Ord) 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    77
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    78
lemmas Pair_in_Lset = Formula.Pair_in_LLimit;
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    79
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    80
lemmas L_nat = Ord_in_L [OF Ord_nat];
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    81
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    82
ML
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    83
{*
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    84
val transL = thm "transL";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    85
val nonempty = thm "nonempty";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    86
val upair_ax = thm "upair_ax";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    87
val Union_ax = thm "Union_ax";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    88
val power_ax = thm "power_ax";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    89
val replacement = thm "replacement";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    90
val L_nat = thm "L_nat";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    91
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    92
fun kill_flex_triv_prems st = Seq.hd ((REPEAT_FIRST assume_tac) st);
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    93
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    94
fun trivaxL th =
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    95
    kill_flex_triv_prems 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    96
       ([transL, nonempty, upair_ax, Union_ax, power_ax, replacement, L_nat] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    97
        MRS (inst "M" "L" th));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    98
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
    99
bind_thm ("ball_abs", trivaxL (thm "M_triv_axioms.ball_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   100
bind_thm ("rall_abs", trivaxL (thm "M_triv_axioms.rall_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   101
bind_thm ("bex_abs", trivaxL (thm "M_triv_axioms.bex_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   102
bind_thm ("rex_abs", trivaxL (thm "M_triv_axioms.rex_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   103
bind_thm ("ball_iff_equiv", trivaxL (thm "M_triv_axioms.ball_iff_equiv"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   104
bind_thm ("M_equalityI", trivaxL (thm "M_triv_axioms.M_equalityI"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   105
bind_thm ("empty_abs", trivaxL (thm "M_triv_axioms.empty_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   106
bind_thm ("subset_abs", trivaxL (thm "M_triv_axioms.subset_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   107
bind_thm ("upair_abs", trivaxL (thm "M_triv_axioms.upair_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   108
bind_thm ("upair_in_M_iff", trivaxL (thm "M_triv_axioms.upair_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   109
bind_thm ("singleton_in_M_iff", trivaxL (thm "M_triv_axioms.singleton_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   110
bind_thm ("pair_abs", trivaxL (thm "M_triv_axioms.pair_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   111
bind_thm ("pair_in_M_iff", trivaxL (thm "M_triv_axioms.pair_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   112
bind_thm ("pair_components_in_M", trivaxL (thm "M_triv_axioms.pair_components_in_M"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   113
bind_thm ("cartprod_abs", trivaxL (thm "M_triv_axioms.cartprod_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   114
bind_thm ("union_abs", trivaxL (thm "M_triv_axioms.union_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   115
bind_thm ("inter_abs", trivaxL (thm "M_triv_axioms.inter_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   116
bind_thm ("setdiff_abs", trivaxL (thm "M_triv_axioms.setdiff_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   117
bind_thm ("Union_abs", trivaxL (thm "M_triv_axioms.Union_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   118
bind_thm ("Union_closed", trivaxL (thm "M_triv_axioms.Union_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   119
bind_thm ("Un_closed", trivaxL (thm "M_triv_axioms.Un_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   120
bind_thm ("cons_closed", trivaxL (thm "M_triv_axioms.cons_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   121
bind_thm ("successor_abs", trivaxL (thm "M_triv_axioms.successor_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   122
bind_thm ("succ_in_M_iff", trivaxL (thm "M_triv_axioms.succ_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   123
bind_thm ("separation_closed", trivaxL (thm "M_triv_axioms.separation_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   124
bind_thm ("strong_replacementI", trivaxL (thm "M_triv_axioms.strong_replacementI"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   125
bind_thm ("strong_replacement_closed", trivaxL (thm "M_triv_axioms.strong_replacement_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   126
bind_thm ("RepFun_closed", trivaxL (thm "M_triv_axioms.RepFun_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   127
bind_thm ("lam_closed", trivaxL (thm "M_triv_axioms.lam_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   128
bind_thm ("image_abs", trivaxL (thm "M_triv_axioms.image_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   129
bind_thm ("powerset_Pow", trivaxL (thm "M_triv_axioms.powerset_Pow"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   130
bind_thm ("powerset_imp_subset_Pow", trivaxL (thm "M_triv_axioms.powerset_imp_subset_Pow"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   131
bind_thm ("nat_into_M", trivaxL (thm "M_triv_axioms.nat_into_M"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   132
bind_thm ("nat_case_closed", trivaxL (thm "M_triv_axioms.nat_case_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   133
bind_thm ("Inl_in_M_iff", trivaxL (thm "M_triv_axioms.Inl_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   134
bind_thm ("Inr_in_M_iff", trivaxL (thm "M_triv_axioms.Inr_in_M_iff"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   135
bind_thm ("lt_closed", trivaxL (thm "M_triv_axioms.lt_closed"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   136
bind_thm ("transitive_set_abs", trivaxL (thm "M_triv_axioms.transitive_set_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   137
bind_thm ("ordinal_abs", trivaxL (thm "M_triv_axioms.ordinal_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   138
bind_thm ("limit_ordinal_abs", trivaxL (thm "M_triv_axioms.limit_ordinal_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   139
bind_thm ("successor_ordinal_abs", trivaxL (thm "M_triv_axioms.successor_ordinal_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   140
bind_thm ("finite_ordinal_abs", trivaxL (thm "M_triv_axioms.finite_ordinal_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   141
bind_thm ("omega_abs", trivaxL (thm "M_triv_axioms.omega_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   142
bind_thm ("number1_abs", trivaxL (thm "M_triv_axioms.number1_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   143
bind_thm ("number1_abs", trivaxL (thm "M_triv_axioms.number1_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   144
bind_thm ("number3_abs", trivaxL (thm "M_triv_axioms.number3_abs"));
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   145
*}
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   146
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   147
declare ball_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   148
declare rall_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   149
declare bex_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   150
declare rex_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   151
declare empty_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   152
declare subset_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   153
declare upair_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   154
declare upair_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   155
declare singleton_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   156
declare pair_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   157
declare pair_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   158
declare cartprod_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   159
declare union_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   160
declare inter_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   161
declare setdiff_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   162
declare Union_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   163
declare Union_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   164
declare Un_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   165
declare cons_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   166
declare successor_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   167
declare succ_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   168
declare separation_closed [intro,simp]
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   169
declare strong_replacementI
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   170
declare strong_replacement_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   171
declare RepFun_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   172
declare lam_closed [intro,simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   173
declare image_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   174
declare nat_into_M [intro]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   175
declare Inl_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   176
declare Inr_in_M_iff [iff]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   177
declare transitive_set_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   178
declare ordinal_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   179
declare limit_ordinal_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   180
declare successor_ordinal_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   181
declare finite_ordinal_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   182
declare omega_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   183
declare number1_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   184
declare number1_abs [simp] 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   185
declare number3_abs [simp]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   186
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   187
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   188
subsection{*Instantiation of the locale @{text reflection}*}
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   189
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   190
text{*instances of locale constants*}
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   191
constdefs
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   192
  L_F0 :: "[i=>o,i] => i"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   193
    "L_F0(P,y) == \<mu>b. (\<exists>z. L(z) \<and> P(<y,z>)) --> (\<exists>z\<in>Lset(b). P(<y,z>))"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   194
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   195
  L_FF :: "[i=>o,i] => i"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   196
    "L_FF(P)   == \<lambda>a. \<Union>y\<in>Lset(a). L_F0(P,y)"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   197
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   198
  L_ClEx :: "[i=>o,i] => o"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   199
    "L_ClEx(P) == \<lambda>a. Limit(a) \<and> normalize(L_FF(P),a) = a"
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   200
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   201
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   202
text{*We must use the meta-existential quantifier; otherwise the reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   203
      terms become enormous!*} 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   204
constdefs
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   205
  L_Reflects :: "[i=>o,[i,i]=>o] => prop"      ("(3REFLECTS/ [_,/ _])")
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   206
    "REFLECTS[P,Q] == (??Cl. Closed_Unbounded(Cl) &
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   207
                           (\<forall>a. Cl(a) --> (\<forall>x \<in> Lset(a). P(x) <-> Q(a,x))))"
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   208
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   209
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   210
theorem Triv_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   211
     "REFLECTS[P, \<lambda>a x. P(x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   212
apply (simp add: L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   213
apply (rule meta_exI) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   214
apply (rule Closed_Unbounded_Ord) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   215
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   216
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   217
theorem Not_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   218
     "REFLECTS[P,Q] ==> REFLECTS[\<lambda>x. ~P(x), \<lambda>a x. ~Q(a,x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   219
apply (unfold L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   220
apply (erule meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   221
apply (rule_tac x=Cl in meta_exI, simp) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   222
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   223
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   224
theorem And_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   225
     "[| REFLECTS[P,Q]; REFLECTS[P',Q'] |] 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   226
      ==> REFLECTS[\<lambda>x. P(x) \<and> P'(x), \<lambda>a x. Q(a,x) \<and> Q'(a,x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   227
apply (unfold L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   228
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   229
apply (rule_tac x="\<lambda>a. Cl(a) \<and> Cla(a)" in meta_exI) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   230
apply (simp add: Closed_Unbounded_Int, blast) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   231
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   232
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   233
theorem Or_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   234
     "[| REFLECTS[P,Q]; REFLECTS[P',Q'] |] 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   235
      ==> REFLECTS[\<lambda>x. P(x) \<or> P'(x), \<lambda>a x. Q(a,x) \<or> Q'(a,x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   236
apply (unfold L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   237
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   238
apply (rule_tac x="\<lambda>a. Cl(a) \<and> Cla(a)" in meta_exI) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   239
apply (simp add: Closed_Unbounded_Int, blast) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   240
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   241
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   242
theorem Imp_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   243
     "[| REFLECTS[P,Q]; REFLECTS[P',Q'] |] 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   244
      ==> REFLECTS[\<lambda>x. P(x) --> P'(x), \<lambda>a x. Q(a,x) --> Q'(a,x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   245
apply (unfold L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   246
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   247
apply (rule_tac x="\<lambda>a. Cl(a) \<and> Cla(a)" in meta_exI) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   248
apply (simp add: Closed_Unbounded_Int, blast) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   249
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   250
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   251
theorem Iff_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   252
     "[| REFLECTS[P,Q]; REFLECTS[P',Q'] |] 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   253
      ==> REFLECTS[\<lambda>x. P(x) <-> P'(x), \<lambda>a x. Q(a,x) <-> Q'(a,x)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   254
apply (unfold L_Reflects_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   255
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   256
apply (rule_tac x="\<lambda>a. Cl(a) \<and> Cla(a)" in meta_exI) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   257
apply (simp add: Closed_Unbounded_Int, blast) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   258
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   259
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   260
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   261
theorem Ex_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   262
     "REFLECTS[\<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))]
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   263
      ==> REFLECTS[\<lambda>x. \<exists>z. L(z) \<and> P(x,z), \<lambda>a x. \<exists>z\<in>Lset(a). Q(a,x,z)]"
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   264
apply (unfold L_Reflects_def L_ClEx_def L_FF_def L_F0_def L_def) 
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   265
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   266
apply (rule meta_exI)
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   267
apply (rule reflection.Ex_reflection [OF Lset_mono_le Lset_cont Pair_in_Lset],
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   268
       assumption+)
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   269
done
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   270
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   271
theorem All_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   272
     "REFLECTS[\<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))]
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   273
      ==> REFLECTS[\<lambda>x. \<forall>z. L(z) --> P(x,z), \<lambda>a x. \<forall>z\<in>Lset(a). Q(a,x,z)]" 
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   274
apply (unfold L_Reflects_def L_ClEx_def L_FF_def L_F0_def L_def) 
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   275
apply (elim meta_exE) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   276
apply (rule meta_exI)
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   277
apply (rule reflection.All_reflection [OF Lset_mono_le Lset_cont Pair_in_Lset],
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   278
       assumption+)
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   279
done
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   280
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   281
theorem Rex_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   282
     "REFLECTS[ \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))]
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   283
      ==> REFLECTS[\<lambda>x. \<exists>z[L]. P(x,z), \<lambda>a x. \<exists>z\<in>Lset(a). Q(a,x,z)]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   284
apply (unfold rex_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   285
apply (intro And_reflection Ex_reflection, assumption)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   286
done
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   287
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   288
theorem Rall_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   289
     "REFLECTS[\<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))]
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   290
      ==> REFLECTS[\<lambda>x. \<forall>z[L]. P(x,z), \<lambda>a x. \<forall>z\<in>Lset(a). Q(a,x,z)]" 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   291
apply (unfold rall_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   292
apply (intro Imp_reflection All_reflection, assumption)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   293
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   294
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   295
lemmas FOL_reflection = 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   296
        Triv_reflection Not_reflection And_reflection Or_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   297
        Imp_reflection Iff_reflection Ex_reflection All_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   298
        Rex_reflection Rall_reflection
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   299
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   300
lemma ReflectsD:
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   301
     "[|REFLECTS[P,Q]; Ord(i)|] 
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   302
      ==> \<exists>j. i<j & (\<forall>x \<in> Lset(j). P(x) <-> Q(j,x))"
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   303
apply (unfold L_Reflects_def Closed_Unbounded_def) 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   304
apply (elim meta_exE, clarify) 
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   305
apply (blast dest!: UnboundedD) 
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   306
done
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   307
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   308
lemma ReflectsE:
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   309
     "[| REFLECTS[P,Q]; Ord(i);
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   310
         !!j. [|i<j;  \<forall>x \<in> Lset(j). P(x) <-> Q(j,x)|] ==> R |]
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   311
      ==> R"
13316
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
   312
apply (drule ReflectsD, assumption, blast) 
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   313
done
13291
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   314
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   315
lemma Collect_mem_eq: "{x\<in>A. x\<in>B} = A \<inter> B";
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   316
by blast
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   317
a73ab154f75c towards proving separation for L
paulson
parents: 13269
diff changeset
   318
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   319
subsection{*Internalized formulas for some relativized ones*}
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   320
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   321
lemmas setclass_simps = rall_setclass_is_ball rex_setclass_is_bex
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   322
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   323
subsubsection{*Some numbers to help write de Bruijn indices*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   324
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   325
syntax
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   326
    "3" :: i   ("3")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   327
    "4" :: i   ("4")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   328
    "5" :: i   ("5")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   329
    "6" :: i   ("6")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   330
    "7" :: i   ("7")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   331
    "8" :: i   ("8")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   332
    "9" :: i   ("9")
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   333
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   334
translations
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   335
   "3"  == "succ(2)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   336
   "4"  == "succ(3)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   337
   "5"  == "succ(4)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   338
   "6"  == "succ(5)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   339
   "7"  == "succ(6)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   340
   "8"  == "succ(7)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   341
   "9"  == "succ(8)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   342
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   343
subsubsection{*Unordered pairs*}
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   344
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   345
constdefs upair_fm :: "[i,i,i]=>i"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   346
    "upair_fm(x,y,z) == 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   347
       And(Member(x,z), 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   348
           And(Member(y,z),
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   349
               Forall(Implies(Member(0,succ(z)), 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   350
                              Or(Equal(0,succ(x)), Equal(0,succ(y)))))))"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   351
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   352
lemma upair_type [TC]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   353
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> upair_fm(x,y,z) \<in> formula"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   354
by (simp add: upair_fm_def) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   355
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   356
lemma arity_upair_fm [simp]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   357
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   358
      ==> arity(upair_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   359
by (simp add: upair_fm_def succ_Un_distrib [symmetric] Un_ac) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   360
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   361
lemma sats_upair_fm [simp]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   362
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   363
    ==> sats(A, upair_fm(x,y,z), env) <-> 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   364
            upair(**A, nth(x,env), nth(y,env), nth(z,env))"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   365
by (simp add: upair_fm_def upair_def)
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   366
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   367
lemma upair_iff_sats:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   368
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   369
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   370
       ==> upair(**A, x, y, z) <-> sats(A, upair_fm(i,j,k), env)"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   371
by (simp add: sats_upair_fm)
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   372
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   373
text{*Useful? At least it refers to "real" unordered pairs*}
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   374
lemma sats_upair_fm2 [simp]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   375
   "[| x \<in> nat; y \<in> nat; z < length(env); env \<in> list(A); Transset(A)|]
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   376
    ==> sats(A, upair_fm(x,y,z), env) <-> 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   377
        nth(z,env) = {nth(x,env), nth(y,env)}"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   378
apply (frule lt_length_in_nat, assumption)  
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   379
apply (simp add: upair_fm_def Transset_def, auto) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   380
apply (blast intro: nth_type) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   381
done
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   382
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   383
theorem upair_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   384
     "REFLECTS[\<lambda>x. upair(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   385
               \<lambda>i x. upair(**Lset(i),f(x),g(x),h(x))]" 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   386
apply (simp add: upair_def)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   387
apply (intro FOL_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   388
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   389
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   390
subsubsection{*Ordered pairs*}
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   391
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   392
constdefs pair_fm :: "[i,i,i]=>i"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   393
    "pair_fm(x,y,z) == 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   394
       Exists(And(upair_fm(succ(x),succ(x),0),
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   395
              Exists(And(upair_fm(succ(succ(x)),succ(succ(y)),0),
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   396
                         upair_fm(1,0,succ(succ(z)))))))"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   397
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   398
lemma pair_type [TC]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   399
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> pair_fm(x,y,z) \<in> formula"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   400
by (simp add: pair_fm_def) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   401
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   402
lemma arity_pair_fm [simp]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   403
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   404
      ==> arity(pair_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   405
by (simp add: pair_fm_def succ_Un_distrib [symmetric] Un_ac) 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   406
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   407
lemma sats_pair_fm [simp]:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   408
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   409
    ==> sats(A, pair_fm(x,y,z), env) <-> 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   410
        pair(**A, nth(x,env), nth(y,env), nth(z,env))"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   411
by (simp add: pair_fm_def pair_def)
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   412
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   413
lemma pair_iff_sats:
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   414
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   415
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   416
       ==> pair(**A, x, y, z) <-> sats(A, pair_fm(i,j,k), env)"
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   417
by (simp add: sats_pair_fm)
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   418
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   419
theorem pair_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   420
     "REFLECTS[\<lambda>x. pair(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   421
               \<lambda>i x. pair(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   422
apply (simp only: pair_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   423
apply (intro FOL_reflection upair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   424
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   425
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   426
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   427
subsubsection{*Binary Unions*}
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   428
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   429
constdefs union_fm :: "[i,i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   430
    "union_fm(x,y,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   431
       Forall(Iff(Member(0,succ(z)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   432
                  Or(Member(0,succ(x)),Member(0,succ(y)))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   433
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   434
lemma union_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   435
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> union_fm(x,y,z) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   436
by (simp add: union_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   437
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   438
lemma arity_union_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   439
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   440
      ==> arity(union_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   441
by (simp add: union_fm_def succ_Un_distrib [symmetric] Un_ac) 
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   442
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   443
lemma sats_union_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   444
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   445
    ==> sats(A, union_fm(x,y,z), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   446
        union(**A, nth(x,env), nth(y,env), nth(z,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   447
by (simp add: union_fm_def union_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   448
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   449
lemma union_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   450
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   451
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   452
       ==> union(**A, x, y, z) <-> sats(A, union_fm(i,j,k), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   453
by (simp add: sats_union_fm)
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   454
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   455
theorem union_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   456
     "REFLECTS[\<lambda>x. union(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   457
               \<lambda>i x. union(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   458
apply (simp only: union_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   459
apply (intro FOL_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   460
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   461
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   462
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   463
subsubsection{*`Cons' for sets*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   464
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   465
constdefs cons_fm :: "[i,i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   466
    "cons_fm(x,y,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   467
       Exists(And(upair_fm(succ(x),succ(x),0),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   468
                  union_fm(0,succ(y),succ(z))))"
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   469
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   470
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   471
lemma cons_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   472
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> cons_fm(x,y,z) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   473
by (simp add: cons_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   474
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   475
lemma arity_cons_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   476
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   477
      ==> arity(cons_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   478
by (simp add: cons_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   479
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   480
lemma sats_cons_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   481
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   482
    ==> sats(A, cons_fm(x,y,z), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   483
        is_cons(**A, nth(x,env), nth(y,env), nth(z,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   484
by (simp add: cons_fm_def is_cons_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   485
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   486
lemma cons_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   487
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   488
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   489
       ==> is_cons(**A, x, y, z) <-> sats(A, cons_fm(i,j,k), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   490
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   491
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   492
theorem cons_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   493
     "REFLECTS[\<lambda>x. is_cons(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   494
               \<lambda>i x. is_cons(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   495
apply (simp only: is_cons_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   496
apply (intro FOL_reflection upair_reflection union_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   497
done
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   498
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   499
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   500
subsubsection{*Function Applications*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   501
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   502
constdefs fun_apply_fm :: "[i,i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   503
    "fun_apply_fm(f,x,y) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   504
       Forall(Iff(Exists(And(Member(0,succ(succ(f))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   505
                             pair_fm(succ(succ(x)), 1, 0))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   506
                  Equal(succ(y),0)))"
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   507
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   508
lemma fun_apply_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   509
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> fun_apply_fm(x,y,z) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   510
by (simp add: fun_apply_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   511
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   512
lemma arity_fun_apply_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   513
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   514
      ==> arity(fun_apply_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   515
by (simp add: fun_apply_fm_def succ_Un_distrib [symmetric] Un_ac) 
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   516
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   517
lemma sats_fun_apply_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   518
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   519
    ==> sats(A, fun_apply_fm(x,y,z), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   520
        fun_apply(**A, nth(x,env), nth(y,env), nth(z,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   521
by (simp add: fun_apply_fm_def fun_apply_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   522
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   523
lemma fun_apply_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   524
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   525
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   526
       ==> fun_apply(**A, x, y, z) <-> sats(A, fun_apply_fm(i,j,k), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   527
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   528
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   529
theorem fun_apply_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   530
     "REFLECTS[\<lambda>x. fun_apply(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   531
               \<lambda>i x. fun_apply(**Lset(i),f(x),g(x),h(x))]" 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   532
apply (simp only: fun_apply_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   533
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   534
done
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   535
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   536
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   537
subsubsection{*Variants of Satisfaction Definitions for Ordinals, etc.*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   538
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   539
text{*Differs from the one in Formula by using "ordinal" rather than "Ord"*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   540
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   541
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   542
lemma sats_subset_fm':
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   543
   "[|x \<in> nat; y \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   544
    ==> sats(A, subset_fm(x,y), env) <-> subset(**A, nth(x,env), nth(y,env))" 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   545
by (simp add: subset_fm_def subset_def) 
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   546
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   547
theorem subset_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   548
     "REFLECTS[\<lambda>x. subset(L,f(x),g(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   549
               \<lambda>i x. subset(**Lset(i),f(x),g(x))]" 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   550
apply (simp only: subset_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   551
apply (intro FOL_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   552
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   553
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   554
lemma sats_transset_fm':
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   555
   "[|x \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   556
    ==> sats(A, transset_fm(x), env) <-> transitive_set(**A, nth(x,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   557
by (simp add: sats_subset_fm' transset_fm_def transitive_set_def) 
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   558
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   559
theorem transitive_set_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   560
     "REFLECTS[\<lambda>x. transitive_set(L,f(x)),
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   561
               \<lambda>i x. transitive_set(**Lset(i),f(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   562
apply (simp only: transitive_set_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   563
apply (intro FOL_reflection subset_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   564
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   565
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   566
lemma sats_ordinal_fm':
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   567
   "[|x \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   568
    ==> sats(A, ordinal_fm(x), env) <-> ordinal(**A,nth(x,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   569
by (simp add: sats_transset_fm' ordinal_fm_def ordinal_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   570
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   571
lemma ordinal_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   572
      "[| nth(i,env) = x;  i \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   573
       ==> ordinal(**A, x) <-> sats(A, ordinal_fm(i), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   574
by (simp add: sats_ordinal_fm')
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   575
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   576
theorem ordinal_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   577
     "REFLECTS[\<lambda>x. ordinal(L,f(x)), \<lambda>i x. ordinal(**Lset(i),f(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   578
apply (simp only: ordinal_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   579
apply (intro FOL_reflection transitive_set_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   580
done
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   581
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   582
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   583
subsubsection{*Membership Relation*}
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   584
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   585
constdefs Memrel_fm :: "[i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   586
    "Memrel_fm(A,r) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   587
       Forall(Iff(Member(0,succ(r)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   588
                  Exists(And(Member(0,succ(succ(A))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   589
                             Exists(And(Member(0,succ(succ(succ(A)))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   590
                                        And(Member(1,0),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   591
                                            pair_fm(1,0,2))))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   592
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   593
lemma Memrel_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   594
     "[| x \<in> nat; y \<in> nat |] ==> Memrel_fm(x,y) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   595
by (simp add: Memrel_fm_def) 
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   596
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   597
lemma arity_Memrel_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   598
     "[| x \<in> nat; y \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   599
      ==> arity(Memrel_fm(x,y)) = succ(x) \<union> succ(y)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   600
by (simp add: Memrel_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   601
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   602
lemma sats_Memrel_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   603
   "[| x \<in> nat; y \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   604
    ==> sats(A, Memrel_fm(x,y), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   605
        membership(**A, nth(x,env), nth(y,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   606
by (simp add: Memrel_fm_def membership_def)
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   607
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   608
lemma Memrel_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   609
      "[| nth(i,env) = x; nth(j,env) = y; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   610
          i \<in> nat; j \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   611
       ==> membership(**A, x, y) <-> sats(A, Memrel_fm(i,j), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   612
by simp
13304
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   613
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   614
theorem membership_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   615
     "REFLECTS[\<lambda>x. membership(L,f(x),g(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   616
               \<lambda>i x. membership(**Lset(i),f(x),g(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   617
apply (simp only: membership_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   618
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   619
done
13304
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   620
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   621
subsubsection{*Predecessor Set*}
13304
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   622
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   623
constdefs pred_set_fm :: "[i,i,i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   624
    "pred_set_fm(A,x,r,B) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   625
       Forall(Iff(Member(0,succ(B)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   626
                  Exists(And(Member(0,succ(succ(r))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   627
                             And(Member(1,succ(succ(A))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   628
                                 pair_fm(1,succ(succ(x)),0))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   629
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   630
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   631
lemma pred_set_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   632
     "[| A \<in> nat; x \<in> nat; r \<in> nat; B \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   633
      ==> pred_set_fm(A,x,r,B) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   634
by (simp add: pred_set_fm_def) 
13304
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   635
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   636
lemma arity_pred_set_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   637
   "[| A \<in> nat; x \<in> nat; r \<in> nat; B \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   638
    ==> arity(pred_set_fm(A,x,r,B)) = succ(A) \<union> succ(x) \<union> succ(r) \<union> succ(B)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   639
by (simp add: pred_set_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   640
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   641
lemma sats_pred_set_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   642
   "[| U \<in> nat; x \<in> nat; r \<in> nat; B \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   643
    ==> sats(A, pred_set_fm(U,x,r,B), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   644
        pred_set(**A, nth(U,env), nth(x,env), nth(r,env), nth(B,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   645
by (simp add: pred_set_fm_def pred_set_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   646
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   647
lemma pred_set_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   648
      "[| nth(i,env) = U; nth(j,env) = x; nth(k,env) = r; nth(l,env) = B; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   649
          i \<in> nat; j \<in> nat; k \<in> nat; l \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   650
       ==> pred_set(**A,U,x,r,B) <-> sats(A, pred_set_fm(i,j,k,l), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   651
by (simp add: sats_pred_set_fm)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   652
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   653
theorem pred_set_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   654
     "REFLECTS[\<lambda>x. pred_set(L,f(x),g(x),h(x),b(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   655
               \<lambda>i x. pred_set(**Lset(i),f(x),g(x),h(x),b(x))]" 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   656
apply (simp only: pred_set_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   657
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   658
done
13304
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   659
43ef6c6dd906 more separation instances
paulson
parents: 13299
diff changeset
   660
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   661
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   662
subsubsection{*Domain*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   663
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   664
(* "is_domain(M,r,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   665
	\<forall>x[M]. (x \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>y[M]. pair(M,x,y,w))))" *)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   666
constdefs domain_fm :: "[i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   667
    "domain_fm(r,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   668
       Forall(Iff(Member(0,succ(z)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   669
                  Exists(And(Member(0,succ(succ(r))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   670
                             Exists(pair_fm(2,0,1))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   671
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   672
lemma domain_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   673
     "[| x \<in> nat; y \<in> nat |] ==> domain_fm(x,y) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   674
by (simp add: domain_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   675
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   676
lemma arity_domain_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   677
     "[| x \<in> nat; y \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   678
      ==> arity(domain_fm(x,y)) = succ(x) \<union> succ(y)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   679
by (simp add: domain_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   680
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   681
lemma sats_domain_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   682
   "[| x \<in> nat; y \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   683
    ==> sats(A, domain_fm(x,y), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   684
        is_domain(**A, nth(x,env), nth(y,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   685
by (simp add: domain_fm_def is_domain_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   686
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   687
lemma domain_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   688
      "[| nth(i,env) = x; nth(j,env) = y; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   689
          i \<in> nat; j \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   690
       ==> is_domain(**A, x, y) <-> sats(A, domain_fm(i,j), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   691
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   692
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   693
theorem domain_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   694
     "REFLECTS[\<lambda>x. is_domain(L,f(x),g(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   695
               \<lambda>i x. is_domain(**Lset(i),f(x),g(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   696
apply (simp only: is_domain_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   697
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   698
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   699
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   700
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   701
subsubsection{*Range*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   702
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   703
(* "is_range(M,r,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   704
	\<forall>y[M]. (y \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. pair(M,x,y,w))))" *)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   705
constdefs range_fm :: "[i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   706
    "range_fm(r,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   707
       Forall(Iff(Member(0,succ(z)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   708
                  Exists(And(Member(0,succ(succ(r))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   709
                             Exists(pair_fm(0,2,1))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   710
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   711
lemma range_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   712
     "[| x \<in> nat; y \<in> nat |] ==> range_fm(x,y) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   713
by (simp add: range_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   714
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   715
lemma arity_range_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   716
     "[| x \<in> nat; y \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   717
      ==> arity(range_fm(x,y)) = succ(x) \<union> succ(y)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   718
by (simp add: range_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   719
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   720
lemma sats_range_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   721
   "[| x \<in> nat; y \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   722
    ==> sats(A, range_fm(x,y), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   723
        is_range(**A, nth(x,env), nth(y,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   724
by (simp add: range_fm_def is_range_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   725
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   726
lemma range_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   727
      "[| nth(i,env) = x; nth(j,env) = y; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   728
          i \<in> nat; j \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   729
       ==> is_range(**A, x, y) <-> sats(A, range_fm(i,j), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   730
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   731
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   732
theorem range_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   733
     "REFLECTS[\<lambda>x. is_range(L,f(x),g(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   734
               \<lambda>i x. is_range(**Lset(i),f(x),g(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   735
apply (simp only: is_range_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   736
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   737
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   738
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   739
 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   740
subsubsection{*Image*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   741
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   742
(* "image(M,r,A,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   743
        \<forall>y[M]. (y \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,w))))" *)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   744
constdefs image_fm :: "[i,i,i]=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   745
    "image_fm(r,A,z) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   746
       Forall(Iff(Member(0,succ(z)),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   747
                  Exists(And(Member(0,succ(succ(r))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   748
                             Exists(And(Member(0,succ(succ(succ(A)))),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   749
	 			        pair_fm(0,2,1)))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   750
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   751
lemma image_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   752
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> image_fm(x,y,z) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   753
by (simp add: image_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   754
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   755
lemma arity_image_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   756
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   757
      ==> arity(image_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   758
by (simp add: image_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   759
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   760
lemma sats_image_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   761
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   762
    ==> sats(A, image_fm(x,y,z), env) <-> 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   763
        image(**A, nth(x,env), nth(y,env), nth(z,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   764
by (simp add: image_fm_def image_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   765
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   766
lemma image_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   767
      "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   768
          i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   769
       ==> image(**A, x, y, z) <-> sats(A, image_fm(i,j,k), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   770
by (simp add: sats_image_fm)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   771
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   772
theorem image_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   773
     "REFLECTS[\<lambda>x. image(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   774
               \<lambda>i x. image(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   775
apply (simp only: image_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   776
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   777
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   778
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   779
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   780
subsubsection{*The Concept of Relation*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   781
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   782
(* "is_relation(M,r) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   783
        (\<forall>z[M]. z\<in>r --> (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,z)))" *)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   784
constdefs relation_fm :: "i=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   785
    "relation_fm(r) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   786
       Forall(Implies(Member(0,succ(r)), Exists(Exists(pair_fm(1,0,2)))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   787
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   788
lemma relation_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   789
     "[| x \<in> nat |] ==> relation_fm(x) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   790
by (simp add: relation_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   791
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   792
lemma arity_relation_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   793
     "x \<in> nat ==> arity(relation_fm(x)) = succ(x)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   794
by (simp add: relation_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   795
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   796
lemma sats_relation_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   797
   "[| x \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   798
    ==> sats(A, relation_fm(x), env) <-> is_relation(**A, nth(x,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   799
by (simp add: relation_fm_def is_relation_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   800
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   801
lemma relation_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   802
      "[| nth(i,env) = x; nth(j,env) = y; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   803
          i \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   804
       ==> is_relation(**A, x) <-> sats(A, relation_fm(i), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   805
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   806
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   807
theorem is_relation_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   808
     "REFLECTS[\<lambda>x. is_relation(L,f(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   809
               \<lambda>i x. is_relation(**Lset(i),f(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   810
apply (simp only: is_relation_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   811
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   812
done
13306
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   813
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   814
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   815
subsubsection{*The Concept of Function*}
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   816
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   817
(* "is_function(M,r) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   818
	\<forall>x[M]. \<forall>y[M]. \<forall>y'[M]. \<forall>p[M]. \<forall>p'[M]. 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   819
           pair(M,x,y,p) --> pair(M,x,y',p') --> p\<in>r --> p'\<in>r --> y=y'" *)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   820
constdefs function_fm :: "i=>i"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   821
    "function_fm(r) == 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   822
       Forall(Forall(Forall(Forall(Forall(
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   823
         Implies(pair_fm(4,3,1),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   824
                 Implies(pair_fm(4,2,0),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   825
                         Implies(Member(1,r#+5),
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   826
                                 Implies(Member(0,r#+5), Equal(3,2))))))))))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   827
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   828
lemma function_type [TC]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   829
     "[| x \<in> nat |] ==> function_fm(x) \<in> formula"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   830
by (simp add: function_fm_def) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   831
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   832
lemma arity_function_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   833
     "x \<in> nat ==> arity(function_fm(x)) = succ(x)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   834
by (simp add: function_fm_def succ_Un_distrib [symmetric] Un_ac) 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   835
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   836
lemma sats_function_fm [simp]:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   837
   "[| x \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   838
    ==> sats(A, function_fm(x), env) <-> is_function(**A, nth(x,env))"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   839
by (simp add: function_fm_def is_function_def)
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   840
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   841
lemma function_iff_sats:
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   842
      "[| nth(i,env) = x; nth(j,env) = y; 
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   843
          i \<in> nat; env \<in> list(A)|]
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   844
       ==> is_function(**A, x) <-> sats(A, function_fm(i), env)"
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   845
by simp
6eebcddee32b more internalized formulas and separation proofs
paulson
parents: 13304
diff changeset
   846
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   847
theorem is_function_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   848
     "REFLECTS[\<lambda>x. is_function(L,f(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   849
               \<lambda>i x. is_function(**Lset(i),f(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   850
apply (simp only: is_function_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   851
apply (intro FOL_reflection pair_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   852
done
13298
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   853
b4f370679c65 Constructible: some separation axioms
paulson
parents: 13291
diff changeset
   854
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   855
subsubsection{*Typed Functions*}
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   856
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   857
(* "typed_function(M,A,B,r) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   858
        is_function(M,r) & is_relation(M,r) & is_domain(M,r,A) &
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   859
        (\<forall>u[M]. u\<in>r --> (\<forall>x[M]. \<forall>y[M]. pair(M,x,y,u) --> y\<in>B))" *)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   860
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   861
constdefs typed_function_fm :: "[i,i,i]=>i"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   862
    "typed_function_fm(A,B,r) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   863
       And(function_fm(r),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   864
         And(relation_fm(r),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   865
           And(domain_fm(r,A),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   866
             Forall(Implies(Member(0,succ(r)),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   867
                  Forall(Forall(Implies(pair_fm(1,0,2),Member(0,B#+3)))))))))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   868
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   869
lemma typed_function_type [TC]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   870
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> typed_function_fm(x,y,z) \<in> formula"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   871
by (simp add: typed_function_fm_def) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   872
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   873
lemma arity_typed_function_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   874
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   875
      ==> arity(typed_function_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   876
by (simp add: typed_function_fm_def succ_Un_distrib [symmetric] Un_ac) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   877
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   878
lemma sats_typed_function_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   879
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   880
    ==> sats(A, typed_function_fm(x,y,z), env) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   881
        typed_function(**A, nth(x,env), nth(y,env), nth(z,env))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   882
by (simp add: typed_function_fm_def typed_function_def)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   883
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   884
lemma typed_function_iff_sats:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   885
  "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   886
      i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   887
   ==> typed_function(**A, x, y, z) <-> sats(A, typed_function_fm(i,j,k), env)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   888
by simp
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   889
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   890
lemmas function_reflection = 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   891
        upair_reflection pair_reflection union_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   892
	cons_reflection fun_apply_reflection subset_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   893
	transitive_set_reflection ordinal_reflection membership_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   894
	pred_set_reflection domain_reflection range_reflection image_reflection
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   895
	is_relation_reflection is_function_reflection
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   896
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   897
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   898
theorem typed_function_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   899
     "REFLECTS[\<lambda>x. typed_function(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   900
               \<lambda>i x. typed_function(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   901
apply (simp only: typed_function_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   902
apply (intro FOL_reflection function_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   903
done
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   904
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   905
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   906
subsubsection{*Injections*}
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   907
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   908
(* "injection(M,A,B,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   909
	typed_function(M,A,B,f) &
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   910
        (\<forall>x[M]. \<forall>x'[M]. \<forall>y[M]. \<forall>p[M]. \<forall>p'[M]. 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   911
          pair(M,x,y,p) --> pair(M,x',y,p') --> p\<in>f --> p'\<in>f --> x=x')" *)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   912
constdefs injection_fm :: "[i,i,i]=>i"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   913
 "injection_fm(A,B,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   914
    And(typed_function_fm(A,B,f),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   915
       Forall(Forall(Forall(Forall(Forall(
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   916
         Implies(pair_fm(4,2,1),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   917
                 Implies(pair_fm(3,2,0),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   918
                         Implies(Member(1,f#+5),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   919
                                 Implies(Member(0,f#+5), Equal(4,3)))))))))))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   920
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   921
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   922
lemma injection_type [TC]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   923
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> injection_fm(x,y,z) \<in> formula"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   924
by (simp add: injection_fm_def) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   925
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   926
lemma arity_injection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   927
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   928
      ==> arity(injection_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   929
by (simp add: injection_fm_def succ_Un_distrib [symmetric] Un_ac) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   930
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   931
lemma sats_injection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   932
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   933
    ==> sats(A, injection_fm(x,y,z), env) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   934
        injection(**A, nth(x,env), nth(y,env), nth(z,env))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   935
by (simp add: injection_fm_def injection_def)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   936
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   937
lemma injection_iff_sats:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   938
  "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   939
      i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   940
   ==> injection(**A, x, y, z) <-> sats(A, injection_fm(i,j,k), env)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   941
by simp
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   942
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   943
theorem injection_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   944
     "REFLECTS[\<lambda>x. injection(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   945
               \<lambda>i x. injection(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   946
apply (simp only: injection_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   947
apply (intro FOL_reflection function_reflection typed_function_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   948
done
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   949
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   950
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   951
subsubsection{*Surjections*}
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   952
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   953
(*  surjection :: "[i=>o,i,i,i] => o"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   954
    "surjection(M,A,B,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   955
        typed_function(M,A,B,f) &
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   956
        (\<forall>y[M]. y\<in>B --> (\<exists>x[M]. x\<in>A & fun_apply(M,f,x,y)))" *)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   957
constdefs surjection_fm :: "[i,i,i]=>i"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   958
 "surjection_fm(A,B,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   959
    And(typed_function_fm(A,B,f),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   960
       Forall(Implies(Member(0,succ(B)),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   961
                      Exists(And(Member(0,succ(succ(A))),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   962
                                 fun_apply_fm(succ(succ(f)),0,1))))))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   963
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   964
lemma surjection_type [TC]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   965
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> surjection_fm(x,y,z) \<in> formula"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   966
by (simp add: surjection_fm_def) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   967
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   968
lemma arity_surjection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   969
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   970
      ==> arity(surjection_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   971
by (simp add: surjection_fm_def succ_Un_distrib [symmetric] Un_ac) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   972
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   973
lemma sats_surjection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   974
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   975
    ==> sats(A, surjection_fm(x,y,z), env) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   976
        surjection(**A, nth(x,env), nth(y,env), nth(z,env))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   977
by (simp add: surjection_fm_def surjection_def)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   978
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   979
lemma surjection_iff_sats:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   980
  "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   981
      i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   982
   ==> surjection(**A, x, y, z) <-> sats(A, surjection_fm(i,j,k), env)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   983
by simp
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   984
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   985
theorem surjection_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   986
     "REFLECTS[\<lambda>x. surjection(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   987
               \<lambda>i x. surjection(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   988
apply (simp only: surjection_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   989
apply (intro FOL_reflection function_reflection typed_function_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
   990
done
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   991
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   992
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   993
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   994
subsubsection{*Bijections*}
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   995
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   996
(*   bijection :: "[i=>o,i,i,i] => o"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   997
    "bijection(M,A,B,f) == injection(M,A,B,f) & surjection(M,A,B,f)" *)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   998
constdefs bijection_fm :: "[i,i,i]=>i"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
   999
 "bijection_fm(A,B,f) == And(injection_fm(A,B,f), surjection_fm(A,B,f))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1000
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1001
lemma bijection_type [TC]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1002
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> bijection_fm(x,y,z) \<in> formula"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1003
by (simp add: bijection_fm_def) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1004
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1005
lemma arity_bijection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1006
     "[| x \<in> nat; y \<in> nat; z \<in> nat |] 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1007
      ==> arity(bijection_fm(x,y,z)) = succ(x) \<union> succ(y) \<union> succ(z)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1008
by (simp add: bijection_fm_def succ_Un_distrib [symmetric] Un_ac) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1009
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1010
lemma sats_bijection_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1011
   "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1012
    ==> sats(A, bijection_fm(x,y,z), env) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1013
        bijection(**A, nth(x,env), nth(y,env), nth(z,env))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1014
by (simp add: bijection_fm_def bijection_def)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1015
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1016
lemma bijection_iff_sats:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1017
  "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1018
      i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1019
   ==> bijection(**A, x, y, z) <-> sats(A, bijection_fm(i,j,k), env)"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1020
by simp
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1021
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1022
theorem bijection_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1023
     "REFLECTS[\<lambda>x. bijection(L,f(x),g(x),h(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1024
               \<lambda>i x. bijection(**Lset(i),f(x),g(x),h(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1025
apply (simp only: bijection_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1026
apply (intro And_reflection injection_reflection surjection_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1027
done
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1028
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1029
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1030
subsubsection{*Order-Isomorphisms*}
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1031
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1032
(*  order_isomorphism :: "[i=>o,i,i,i,i,i] => o"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1033
   "order_isomorphism(M,A,r,B,s,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1034
        bijection(M,A,B,f) & 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1035
        (\<forall>x[M]. x\<in>A --> (\<forall>y[M]. y\<in>A -->
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1036
          (\<forall>p[M]. \<forall>fx[M]. \<forall>fy[M]. \<forall>q[M].
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1037
            pair(M,x,y,p) --> fun_apply(M,f,x,fx) --> fun_apply(M,f,y,fy) --> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1038
            pair(M,fx,fy,q) --> (p\<in>r <-> q\<in>s))))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1039
  *)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1040
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1041
constdefs order_isomorphism_fm :: "[i,i,i,i,i]=>i"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1042
 "order_isomorphism_fm(A,r,B,s,f) == 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1043
   And(bijection_fm(A,B,f), 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1044
     Forall(Implies(Member(0,succ(A)),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1045
       Forall(Implies(Member(0,succ(succ(A))),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1046
         Forall(Forall(Forall(Forall(
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1047
           Implies(pair_fm(5,4,3),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1048
             Implies(fun_apply_fm(f#+6,5,2),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1049
               Implies(fun_apply_fm(f#+6,4,1),
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1050
                 Implies(pair_fm(2,1,0), 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1051
                   Iff(Member(3,r#+6), Member(0,s#+6)))))))))))))))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1052
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1053
lemma order_isomorphism_type [TC]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1054
     "[| A \<in> nat; r \<in> nat; B \<in> nat; s \<in> nat; f \<in> nat |]  
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1055
      ==> order_isomorphism_fm(A,r,B,s,f) \<in> formula"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1056
by (simp add: order_isomorphism_fm_def) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1057
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1058
lemma arity_order_isomorphism_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1059
     "[| A \<in> nat; r \<in> nat; B \<in> nat; s \<in> nat; f \<in> nat |] 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1060
      ==> arity(order_isomorphism_fm(A,r,B,s,f)) = 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1061
          succ(A) \<union> succ(r) \<union> succ(B) \<union> succ(s) \<union> succ(f)" 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1062
by (simp add: order_isomorphism_fm_def succ_Un_distrib [symmetric] Un_ac) 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1063
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1064
lemma sats_order_isomorphism_fm [simp]:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1065
   "[| U \<in> nat; r \<in> nat; B \<in> nat; s \<in> nat; f \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1066
    ==> sats(A, order_isomorphism_fm(U,r,B,s,f), env) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1067
        order_isomorphism(**A, nth(U,env), nth(r,env), nth(B,env), 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1068
                               nth(s,env), nth(f,env))"
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1069
by (simp add: order_isomorphism_fm_def order_isomorphism_def)
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1070
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1071
lemma order_isomorphism_iff_sats:
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1072
  "[| nth(i,env) = U; nth(j,env) = r; nth(k,env) = B; nth(j',env) = s; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1073
      nth(k',env) = f; 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1074
      i \<in> nat; j \<in> nat; k \<in> nat; j' \<in> nat; k' \<in> nat; env \<in> list(A)|]
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1075
   ==> order_isomorphism(**A,U,r,B,s,f) <-> 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1076
       sats(A, order_isomorphism_fm(i,j,k,j',k'), env)" 
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1077
by simp
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1078
13314
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1079
theorem order_isomorphism_reflection:
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1080
     "REFLECTS[\<lambda>x. order_isomorphism(L,f(x),g(x),h(x),g'(x),h'(x)), 
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1081
               \<lambda>i x. order_isomorphism(**Lset(i),f(x),g(x),h(x),g'(x),h'(x))]"
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1082
apply (simp only: order_isomorphism_def setclass_simps)
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1083
apply (intro FOL_reflection function_reflection bijection_reflection)  
84b9de3cbc91 Defining a meta-existential quantifier.
paulson
parents: 13309
diff changeset
  1084
done
13309
a6adee8ea75a reflection for more internal formulas
paulson
parents: 13306
diff changeset
  1085
13316
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1086
lemmas fun_plus_reflection =
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1087
        typed_function_reflection injection_reflection surjection_reflection
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1088
        bijection_reflection order_isomorphism_reflection
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1089
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1090
lemmas fun_plus_iff_sats = upair_iff_sats pair_iff_sats union_iff_sats
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1091
	cons_iff_sats fun_apply_iff_sats ordinal_iff_sats Memrel_iff_sats
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1092
	pred_set_iff_sats domain_iff_sats range_iff_sats image_iff_sats
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1093
	relation_iff_sats function_iff_sats typed_function_iff_sats 
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1094
        injection_iff_sats surjection_iff_sats bijection_iff_sats 
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1095
        order_isomorphism_iff_sats
d16629fd0f95 more and simpler separation proofs
paulson
parents: 13314
diff changeset
  1096
13223
45be08fbdcff new theory of inner models
paulson
parents:
diff changeset
  1097
end