<commit_before>(*  Title: 	ZF/mono
    ID:         $Id$
    Author: 	<NAME>, Cambridge University Computer Laboratory
    Copyright   1993  University of Cambridge

Monotonicity of various operations (for lattice properties see subset.ML)
*)

(** Replacement, in its various formulations **)

(*Not easy to express monotonicity in P, since any "bigger" predicate
  would have to be single-valued*)
goal ZF.thy "!!A B. A<=B ==> Replace(A,P) <= Replace(B,P)";
by (fast_tac (ZF_cs addSEs [ReplaceE]) 1);
qed "Replace_mono";

goal ZF.thy "!!A B. A<=B ==> {f(x). x:A} <= {f(x). x:B}";
by (fast_tac ZF_cs 1);
qed "RepFun_mono";

goal ZF.thy "!!A B. A<=B ==> Pow(A) <= Pow(B)";
by (fast_tac ZF_cs 1);
qed "Pow_mono";

goal ZF.thy "!!A B. A<=B ==> Union(A) <= Union(B)";
by (fast_tac ZF_cs 1);
qed "Union_mono";

val prems = goal ZF.thy
    "[| A<=C;  !!x. x:A ==> B(x)<=D(x) \
\    |] ==> (UN x:A. B(x)) <= (UN x:C. D(x))";
by (fast_tac (ZF_cs addIs (prems RL [subsetD])) 1);
qed "UN_mono";

(*Intersection is ANTI-monotonic.  There are TWO premises! *)
goal ZF.thy "!!A B. [| A<=B;  a:A |] ==> Inter(B) <= Inter(A)";
by (fast_tac ZF_cs 1);
qed "Inter_anti_mono";

goal ZF.thy "!!C D. C<=D ==> cons(a,C) <= cons(a,D)";
by (fast_tac ZF_cs 1);
qed "cons_mono";

goal ZF.thy "!!A B C D. [| A<=C;  B<=D |] ==> A Un B <= C Un D";
by (fast_tac ZF_cs 1);
qed "Un_mono";

goal ZF.thy "!!A B C D. [| A<=C;  B<=D |] ==> A Int B <= C Int D";
by (fast_tac ZF_cs 1);
qed "Int_mono";

goal ZF.thy "!!A B C D. [| A<=C;  D<=B |] ==> A-B <= C-D";
by (fast_tac ZF_cs 1);
qed "Diff_mono";

(** Standard products, sums and function spaces **)

goal ZF.thy "!!A B C D. [| A<=C;  ALL x:A. B(x) <= D(x) |] ==> \
\                       Sigma(A,B) <= Sigma(C,D)";
by (fast_tac ZF_cs 1);
qed "Sigma_mono_lemma";
val Sigma_mono = ballI RSN (2,Sigma_mono_lemma);

goalw Sum.thy sum_defs "!!A B C D. [| A<=C;  B<=D |] ==> A+B <= C+D";
by (REPEAT (ares_tac [subset_refl,Un_mono,Sigma_mono] 1));
qed "sum_mono";

(*Note that B->A and C->A are typically disjoint!*)
goal ZF.thy "!!A B C. B<=C ==> A->B <= A->C";
by (fast_tac (ZF_cs addIs [lam_type] addEs [Pi_lamE]) 1);
qed "Pi_mono";

goalw ZF.thy [lam_def] "!!A B. A<=B ==> Lambda(A,c) <= Lambda(B,c)";
by (etac RepFun_mono 1);
qed "lam_mono";

(** Quine-inspired ordered pairs, products, injections and sums **)

goalw QPair.thy [QPair_def] "!!a b c d. [| a<=c;  b<=d |] ==> <a;b> <= <c;d>";
by (REPEAT (ares_tac [sum_mono] 1));
qed "QPair_mono";

goal QPair.thy "!!A B C D. [| A<=C;  ALL x:A. B(x) <= D(x) |] ==>  \
\                          QSigma(A,B) <= QSigma(C,D)";
by (fast_tac qpair_cs 1);
qed "QSigma_mono_lemma";
val QSigma_mono = ballI RSN (2,QSigma_mono_lemma);

goalw QPair.thy [QInl_def] "!!a b. a<=b ==> QInl(a) <= QInl(b)";
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
qed "QInl_mono";

goalw QPair.thy [QInr_def] "!!a b. a<=b ==> QInr(a) <= QInr(b)";
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
qed "QInr_mono";

goal QPair.thy "!!A B C D. [| A<=C;  B<=D |] ==> A <+> B <= C <+> D";
by (fast_tac qsum_cs 1);
qed "qsum_mono";


(** Converse, domain, range, field **)

goal ZF.thy "!!r s. r<=s ==> converse(r) <= converse(s)";
by (fast_tac ZF_cs 1);
qed "converse_mono";

goal ZF.thy "!!r s. r<=s ==> domain(r)<=domain(s)";
by (fast_tac ZF_cs 1);
qed "domain_mono";

val domain_rel_subset = 
	[domain_mono, domain_subset] MRS subset_trans |> standard;

goal ZF.thy "!!r s. r<=s ==> range(r)<=range(s)";
by (fast_tac ZF_cs 1);
qed "range_mono";

val range_rel_subset = 
	[range_mono, range_subset] MRS subset_trans |> standard;

goal ZF.thy "!!r s. r<=s ==> field(r)<=field(s)";
by (fast_tac ZF_cs 1);
qed "field_mono";

goal ZF.thy "!!r A. r <= A*A ==> field(r) <= A";
by (etac (field_mono RS subset_trans) 1);
by (fast_tac ZF_cs 1);<commit_msg>Used bind_thm to store domain_rel_subset and range_rel_subset<commit_after>(*  Title: 	ZF/mono
    ID:         $Id$
    Author: 	<NAME>, Cambridge University Computer Laboratory
    Copyright   1993  University of Cambridge

Monotonicity of various operations (for lattice properties see subset.ML)
*)

(** Replacement, in its various formulations **)

(*Not easy to express monotonicity in P, since any "bigger" predicate
  would have to be single-valued*)
goal ZF.thy "!!A B. A<=B ==> Replace(A,P) <= Replace(B,P)";
by (fast_tac (ZF_cs addSEs [ReplaceE]) 1);
qed "Replace_mono";

goal ZF.thy "!!A B. A<=B ==> {f(x). x:A} <= {f(x). x:B}";
by (fast_tac ZF_cs 1);
qed "RepFun_mono";

goal ZF.thy "!!A B. A<=B ==> Pow(A) <= Pow(B)";
by (fast_tac ZF_cs 1);
qed "Pow_mono";

goal ZF.thy "!!A B. A<=B ==> Union(A) <= Union(B)";
by (fast_tac ZF_cs 1);
qed "Union_mono";

val prems = goal ZF.thy
    "[| A<=C;  !!x. x:A ==> B(x)<=D(x) \
\    |] ==> (UN x:A. B(x)) <= (UN x:C. D(x))";
by (fast_tac (ZF_cs addIs (prems RL [subsetD])) 1);
qed "UN_mono";

(*Intersection is ANTI-monotonic.  There are TWO premises! *)
goal ZF.thy "!!A B. [| A<=B;  a:A |] ==> Inter(B) <= Inter(A)";
by (fast_tac ZF_cs 1);
qed "Inter_anti_mono";

goal ZF.thy "!!C D. C<=D ==> cons(a,C) <= cons(a,D)";
by (fast_tac ZF_cs 1);
qed "cons_mono";

goal ZF.thy "!!A B C D. [| A<=C;  B<=D |] ==> A Un B <= C Un D";
by (fast_tac ZF_cs 1);
qed "Un_mono";

goal ZF.thy "!!A B C D. [| A<=C;  B<=D |] ==> A Int B <= C Int D";
by (fast_tac ZF_cs 1);
qed "Int_mono";

goal ZF.thy "!!A B C D. [| A<=C;  D<=B |] ==> A-B <= C-D";
by (fast_tac ZF_cs 1);
qed "Diff_mono";

(** Standard products, sums and function spaces **)

goal ZF.thy "!!A B C D. [| A<=C;  ALL x:A. B(x) <= D(x) |] ==> \
\                       Sigma(A,B) <= Sigma(C,D)";
by (fast_tac ZF_cs 1);
qed "Sigma_mono_lemma";
val Sigma_mono = ballI RSN (2,Sigma_mono_lemma);

goalw Sum.thy sum_defs "!!A B C D. [| A<=C;  B<=D |] ==> A+B <= C+D";
by (REPEAT (ares_tac [subset_refl,Un_mono,Sigma_mono] 1));
qed "sum_mono";

(*Note that B->A and C->A are typically disjoint!*)
goal ZF.thy "!!A B C. B<=C ==> A->B <= A->C";
by (fast_tac (ZF_cs addIs [lam_type] addEs [Pi_lamE]) 1);
qed "Pi_mono";

goalw ZF.thy [lam_def] "!!A B. A<=B ==> Lambda(A,c) <= Lambda(B,c)";
by (etac RepFun_mono 1);
qed "lam_mono";

(** Quine-inspired ordered pairs, products, injections and sums **)

goalw QPair.thy [QPair_def] "!!a b c d. [| a<=c;  b<=d |] ==> <a;b> <= <c;d>";
by (REPEAT (ares_tac [sum_mono] 1));
qed "QPair_mono";

goal QPair.thy "!!A B C D. [| A<=C;  ALL x:A. B(x) <= D(x) |] ==>  \
\                          QSigma(A,B) <= QSigma(C,D)";
by (fast_tac qpair_cs 1);
qed "QSigma_mono_lemma";
val QSigma_mono = ballI RSN (2,QSigma_mono_lemma);

goalw QPair.thy [QInl_def] "!!a b. a<=b ==> QInl(a) <= QInl(b)";
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
qed "QInl_mono";

goalw QPair.thy [QInr_def] "!!a b. a<=b ==> QInr(a) <= QInr(b)";
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
qed "QInr_mono";

goal QPair.thy "!!A B C D. [| A<=C;  B<=D |] ==> A <+> B <= C <+> D";
by (fast_tac qsum_cs 1);
qed "qsum_mono";


(** Converse, domain, range, field **)

goal ZF.thy "!!r s. r<=s ==> converse(r) <= converse(s)";
by (fast_tac ZF_cs 1);
qed "converse_mono";

goal ZF.thy "!!r s. r<=s ==> domain(r)<=domain(s)";
by (fast_tac ZF_cs 1);
qed "domain_mono";

bind_thm ("domain_rel_subset", [domain_mono, domain_subset] MRS subset_trans);

goal ZF.thy "!!r s. r<=s ==> range(r)<=range(s)";
by (fast_tac ZF_cs 1);
qed "range_mono";

bind_thm ("range_rel_subset", [range_mono, range_subset] MRS subset_trans);

goal ZF.thy "!!r s. r<=s ==> field(r)<=field(s)";
by (fast_tac ZF_cs 1);
qed "field_mono";

goal ZF.thy "!!r A. r <= A*A ==> field(r) <= A";
by (etac (field_mono RS subset_trans) 1);
by (fast_tac ZF_cs 1);
{'fraction_non_alphanumeric': 0.2187254130605822, 'fraction_numerical': 0.008130081300813009, 'mean_word_length': 3.8672622846202938, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773760', 'n_tokens_mistral': 3743, 'n_tokens_neox': 3624, 'n_words': 983}