src/ZF/UNITY/Monotonicity.thy
author wenzelm
Mon, 11 Sep 2023 19:30:48 +0200
changeset 78659 b5f3d1051b13
parent 76217 8655344f1cf6
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     1
(*  Title:      ZF/UNITY/Monotonicity.thy
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     2
    Author:     Sidi O Ehmety, Cambridge University Computer Laboratory
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     3
    Copyright   2002  University of Cambridge
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     4
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26059
diff changeset
     5
Monotonicity of an operator (meta-function) with respect to arbitrary
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26059
diff changeset
     6
set relations.
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     7
*)
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
     8
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
     9
section\<open>Monotonicity of an Operator WRT a Relation\<close>
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    10
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    11
theory Monotonicity imports GenPrefix MultisetSum
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    12
begin
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    13
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    14
definition
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    15
  mono1 :: "[i, i, i, i, i\<Rightarrow>i] \<Rightarrow> o"  where
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    16
  "mono1(A, r, B, s, f) \<equiv>
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    17
    (\<forall>x \<in> A. \<forall>y \<in> A. \<langle>x,y\<rangle> \<in> r \<longrightarrow> <f(x), f(y)> \<in> s) \<and> (\<forall>x \<in> A. f(x) \<in> B)"
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    18
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    19
  (* monotonicity of a 2-place meta-function f *)
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    20
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    21
definition
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    22
  mono2 :: "[i, i, i, i, i, i, [i,i]\<Rightarrow>i] \<Rightarrow> o"  where
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    23
  "mono2(A, r, B, s, C, t, f) \<equiv> 
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    24
    (\<forall>x \<in> A. \<forall>y \<in> A. \<forall>u \<in> B. \<forall>v \<in> B.
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    25
              \<langle>x,y\<rangle> \<in> r \<and> \<langle>u,v\<rangle> \<in> s \<longrightarrow> <f(x,u), f(y,v)> \<in> t) \<and>
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    26
    (\<forall>x \<in> A. \<forall>y \<in> B. f(x,y) \<in> C)"
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    27
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    28
 (* Internalized relations on sets and multisets *)
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    29
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    30
definition
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    31
  SetLe :: "i \<Rightarrow>i"  where
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    32
  "SetLe(A) \<equiv> {\<langle>x,y\<rangle> \<in> Pow(A)*Pow(A). x \<subseteq> y}"
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    33
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    34
definition
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    35
  MultLe :: "[i,i] \<Rightarrow>i"  where
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    36
  "MultLe(A, r) \<equiv> multirel(A, r - id(A)) \<union> id(Mult(A))"
14052
e9c9f69e4f63 some new ZF/UNITY material from Sidi Ehmety
paulson
parents:
diff changeset
    37
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    38
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    39
lemma mono1D: 
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    40
  "\<lbrakk>mono1(A, r, B, s, f); \<langle>x, y\<rangle> \<in> r; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> <f(x), f(y)> \<in> s"
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    41
by (unfold mono1_def, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    42
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    43
lemma mono2D: 
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    44
     "\<lbrakk>mono2(A, r, B, s, C, t, f);  
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    45
         \<langle>x, y\<rangle> \<in> r; \<langle>u,v\<rangle> \<in> s; x \<in> A; y \<in> A; u \<in> B; v \<in> B\<rbrakk> 
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    46
      \<Longrightarrow> <f(x, u), f(y,v)> \<in> t"
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    47
by (unfold mono2_def, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    48
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    49
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    50
(** Monotonicity of take **)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    51
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    52
lemma take_mono_left_lemma:
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    53
     "\<lbrakk>i \<le> j; xs \<in> list(A); i \<in> nat; j \<in> nat\<rbrakk> 
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    54
      \<Longrightarrow> <take(i, xs), take(j, xs)> \<in> prefix(A)"
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    55
apply (case_tac "length (xs) \<le> i")
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    56
 apply (subgoal_tac "length (xs) \<le> j")
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    57
  apply (simp)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    58
 apply (blast intro: le_trans)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    59
apply (drule not_lt_imp_le, auto)
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    60
apply (case_tac "length (xs) \<le> j")
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    61
 apply (auto simp add: take_prefix)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    62
apply (drule not_lt_imp_le, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    63
apply (drule_tac m = i in less_imp_succ_add, auto)
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    64
apply (subgoal_tac "i #+ k \<le> length (xs) ")
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    65
 apply (simp add: take_add prefix_iff take_type drop_type)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    66
apply (blast intro: leI)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    67
done
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    68
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    69
lemma take_mono_left:
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    70
     "\<lbrakk>i \<le> j; xs \<in> list(A); j \<in> nat\<rbrakk>
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    71
      \<Longrightarrow> <take(i, xs), take(j, xs)> \<in> prefix(A)"
26059
b67a225b50fd removed unnecessary theory qualifiers;
wenzelm
parents: 26056
diff changeset
    72
by (blast intro: le_in_nat take_mono_left_lemma) 
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    73
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    74
lemma take_mono_right:
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    75
     "\<lbrakk>\<langle>xs,ys\<rangle> \<in> prefix(A); i \<in> nat\<rbrakk> 
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    76
      \<Longrightarrow> <take(i, xs), take(i, ys)> \<in> prefix(A)"
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    77
by (auto simp add: prefix_iff)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    78
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    79
lemma take_mono:
76215
a642599ffdea More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents: 76214
diff changeset
    80
     "\<lbrakk>i \<le> j; \<langle>xs, ys\<rangle> \<in> prefix(A); j \<in> nat\<rbrakk>
76213
e44d86131648 Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    81
      \<Longrightarrow> <take(i, xs), take(j, ys)> \<in> prefix(A)"
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    82
apply (rule_tac b = "take (j, xs) " in prefix_trans)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    83
apply (auto dest: prefix_type [THEN subsetD] intro: take_mono_left take_mono_right)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    84
done
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    85
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    86
lemma mono_take [iff]:
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    87
     "mono2(nat, Le, list(A), prefix(A), list(A), prefix(A), take)"
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    88
apply (unfold mono2_def Le_def, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    89
apply (blast intro: take_mono)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    90
done
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    91
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    92
(** Monotonicity of length **)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    93
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    94
lemmas length_mono = prefix_length_le
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    95
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    96
lemma mono_length [iff]:
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    97
     "mono1(list(A), prefix(A), nat, Le, length)"
76216
9fc34f76b4e8 getting rid of apply (unfold ...)
paulson <lp15@cam.ac.uk>
parents: 76215
diff changeset
    98
  unfolding mono1_def
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
    99
apply (auto dest: prefix_length_le simp add: Le_def)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   100
done
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   101
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   102
(** Monotonicity of \<union> **)
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   103
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   104
lemma mono_Un [iff]: 
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 60770
diff changeset
   105
     "mono2(Pow(A), SetLe(A), Pow(A), SetLe(A), Pow(A), SetLe(A), (Un))"
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   106
by (unfold mono2_def SetLe_def, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   107
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   108
(* Monotonicity of multiset union *)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   109
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   110
lemma mono_munion [iff]: 
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   111
     "mono2(Mult(A), MultLe(A,r), Mult(A), MultLe(A, r), Mult(A), MultLe(A, r), munion)"
76217
8655344f1cf6 More obsolete "unfold" calls
paulson <lp15@cam.ac.uk>
parents: 76216
diff changeset
   112
  unfolding mono2_def MultLe_def
14093
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   113
apply (auto simp add: Mult_iff_multiset)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   114
apply (blast intro: munion_multirel_mono munion_multirel_mono1 munion_multirel_mono2 multiset_into_Mult)+
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   115
done
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   116
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   117
lemma mono_succ [iff]: "mono1(nat, Le, nat, Le, succ)"
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   118
by (unfold mono1_def Le_def, auto)
24382760fd89 converting more theories to Isar scripts, and tidying
paulson
parents: 14052
diff changeset
   119
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 60770
diff changeset
   120
end