src/ZF/Finite.thy
author wenzelm
Wed, 27 Mar 2013 16:38:25 +0100
changeset 51553 63327f679cff
parent 46953 2b6e55924af3
child 58871 c399ae4b836f
permissions -rw-r--r--
more ambitious Goal.skip_proofs: covers Goal.prove forms as well, and do not insist in quick_and_dirty (for the sake of Isabelle/jEdit);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/Finite.thy
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     4
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
     5
prove:  b \<in> Fin(A) ==> inj(b,b) \<subseteq> surj(b,b)
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     6
*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
13328
703de709a64b better document preparation
paulson
parents: 13269
diff changeset
     8
header{*Finite Powerset Operator and Finite Function Space*}
703de709a64b better document preparation
paulson
parents: 13269
diff changeset
     9
26056
6a0801279f4c Made theory names in ZF disjoint from HOL theory names to allow loading both developments
krauss
parents: 24893
diff changeset
    10
theory Finite imports Inductive_ZF Epsilon Nat_ZF begin
9491
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    11
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    12
(*The natural numbers as a datatype*)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    13
rep_datatype
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    14
  elimination    natE
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26056
diff changeset
    15
  induction      nat_induct
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26056
diff changeset
    16
  case_eqns      nat_case_0 nat_case_succ
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    17
  recursor_eqns  recursor_0 recursor_succ
9491
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    18
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    19
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    20
consts
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    21
  Fin       :: "i=>i"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    22
  FiniteFun :: "[i,i]=>i"         ("(_ -||>/ _)" [61, 60] 60)
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    23
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
    24
inductive
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    25
  domains   "Fin(A)" \<subseteq> "Pow(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    26
  intros
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    27
    emptyI:  "0 \<in> Fin(A)"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    28
    consI:   "[| a \<in> A;  b \<in> Fin(A) |] ==> cons(a,b) \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    29
  type_intros  empty_subsetI cons_subsetI PowI
46471
2289a3869c88 prefer high-level elim_format;
wenzelm
parents: 45602
diff changeset
    30
  type_elims   PowD [elim_format]
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    31
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    32
inductive
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    33
  domains   "FiniteFun(A,B)" \<subseteq> "Fin(A*B)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    34
  intros
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    35
    emptyI:  "0 \<in> A -||> B"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    36
    consI:   "[| a \<in> A;  b \<in> B;  h \<in> A -||> B;  a \<notin> domain(h) |]
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    37
              ==> cons(<a,b>,h) \<in> A -||> B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    38
  type_intros Fin.intros
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    39
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    40
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
    41
subsection {* Finite Powerset Operator *}
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    42
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    43
lemma Fin_mono: "A<=B ==> Fin(A) \<subseteq> Fin(B)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    44
apply (unfold Fin.defs)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    45
apply (rule lfp_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    46
apply (rule Fin.bnd_mono)+
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    47
apply blast
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    48
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    49
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    50
(* @{term"A \<in> Fin(B) ==> A \<subseteq> B"} *)
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 32960
diff changeset
    51
lemmas FinD = Fin.dom_subset [THEN subsetD, THEN PowD]
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    52
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    53
(** Induction on finite sets **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    54
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    55
(*Discharging @{term"x\<notin>y"} entails extra work*)
13524
604d0f3622d6 *** empty log message ***
wenzelm
parents: 13356
diff changeset
    56
lemma Fin_induct [case_names 0 cons, induct set: Fin]:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    57
    "[| b \<in> Fin(A);
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    58
        P(0);
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    59
        !!x y. [| x \<in> A;  y \<in> Fin(A);  x\<notin>y;  P(y) |] ==> P(cons(x,y))
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    60
     |] ==> P(b)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    61
apply (erule Fin.induct, simp)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    62
apply (case_tac "a \<in> b")
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    63
 apply (erule cons_absorb [THEN ssubst], assumption) (*backtracking!*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    64
apply simp
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    65
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    66
13203
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    67
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    68
(** Simplification for Fin **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    69
declare Fin.intros [simp]
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    70
13203
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    71
lemma Fin_0: "Fin(0) = {0}"
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    72
by (blast intro: Fin.emptyI dest: FinD)
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    73
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    74
(*The union of two finite sets is finite.*)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    75
lemma Fin_UnI [simp]: "[| b \<in> Fin(A);  c \<in> Fin(A) |] ==> b \<union> c \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    76
apply (erule Fin_induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    77
apply (simp_all add: Un_cons)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    78
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    79
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    80
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    81
(*The union of a set of finite sets is finite.*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
    82
lemma Fin_UnionI: "C \<in> Fin(Fin(A)) ==> \<Union>(C) \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    83
by (erule Fin_induct, simp_all)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    84
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    85
(*Every subset of a finite set is finite.*)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    86
lemma Fin_subset_lemma [rule_format]: "b \<in> Fin(A) ==> \<forall>z. z<=b \<longrightarrow> z \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    87
apply (erule Fin_induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    88
apply (simp add: subset_empty_iff)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    89
apply (simp add: subset_cons_iff distrib_simps, safe)
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
    90
apply (erule_tac b = z in cons_Diff [THEN subst], simp)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    91
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    92
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    93
lemma Fin_subset: "[| c<=b;  b \<in> Fin(A) |] ==> c \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    94
by (blast intro: Fin_subset_lemma)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    95
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    96
lemma Fin_IntI1 [intro,simp]: "b \<in> Fin(A) ==> b \<inter> c \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    97
by (blast intro: Fin_subset)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    98
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
    99
lemma Fin_IntI2 [intro,simp]: "c \<in> Fin(A) ==> b \<inter> c \<in> Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   100
by (blast intro: Fin_subset)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   101
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   102
lemma Fin_0_induct_lemma [rule_format]:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   103
    "[| c \<in> Fin(A);  b \<in> Fin(A); P(b);
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   104
        !!x y. [| x \<in> A;  y \<in> Fin(A);  x \<in> y;  P(y) |] ==> P(y-{x})
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   105
     |] ==> c<=b \<longrightarrow> P(b-c)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   106
apply (erule Fin_induct, simp)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   107
apply (subst Diff_cons)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   108
apply (simp add: cons_subset_iff Diff_subset [THEN Fin_subset])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   109
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   110
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   111
lemma Fin_0_induct:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   112
    "[| b \<in> Fin(A);
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   113
        P(b);
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   114
        !!x y. [| x \<in> A;  y \<in> Fin(A);  x \<in> y;  P(y) |] ==> P(y-{x})
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   115
     |] ==> P(0)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   116
apply (rule Diff_cancel [THEN subst])
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   117
apply (blast intro: Fin_0_induct_lemma)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   118
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   119
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   120
(*Functions from a finite ordinal*)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   121
lemma nat_fun_subset_Fin: "n \<in> nat ==> n->A \<subseteq> Fin(nat*A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   122
apply (induct_tac "n")
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   123
apply (simp add: subset_iff)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   124
apply (simp add: succ_def mem_not_refl [THEN cons_fun_eq])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   125
apply (fast intro!: Fin.consI)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   126
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   127
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   128
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
   129
subsection{*Finite Function Space*}
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   130
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   131
lemma FiniteFun_mono:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   132
    "[| A<=C;  B<=D |] ==> A -||> B  \<subseteq>  C -||> D"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   133
apply (unfold FiniteFun.defs)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   134
apply (rule lfp_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   135
apply (rule FiniteFun.bnd_mono)+
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   136
apply (intro Fin_mono Sigma_mono basic_monos, assumption+)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   137
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   138
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   139
lemma FiniteFun_mono1: "A<=B ==> A -||> A  \<subseteq>  B -||> B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   140
by (blast dest: FiniteFun_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   141
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   142
lemma FiniteFun_is_fun: "h \<in> A -||>B ==> h \<in> domain(h) -> B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   143
apply (erule FiniteFun.induct, simp)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   144
apply (simp add: fun_extend3)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   145
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   146
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   147
lemma FiniteFun_domain_Fin: "h \<in> A -||>B ==> domain(h) \<in> Fin(A)"
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13203
diff changeset
   148
by (erule FiniteFun.induct, simp, simp)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   149
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 32960
diff changeset
   150
lemmas FiniteFun_apply_type = FiniteFun_is_fun [THEN apply_type]
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   151
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   152
(*Every subset of a finite function is a finite function.*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   153
lemma FiniteFun_subset_lemma [rule_format]:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   154
     "b \<in> A-||>B ==> \<forall>z. z<=b \<longrightarrow> z \<in> A-||>B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   155
apply (erule FiniteFun.induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   156
apply (simp add: subset_empty_iff FiniteFun.intros)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   157
apply (simp add: subset_cons_iff distrib_simps, safe)
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
   158
apply (erule_tac b = z in cons_Diff [THEN subst])
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   159
apply (drule spec [THEN mp], assumption)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   160
apply (fast intro!: FiniteFun.intros)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   161
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   162
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   163
lemma FiniteFun_subset: "[| c<=b;  b \<in> A-||>B |] ==> c \<in> A-||>B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   164
by (blast intro: FiniteFun_subset_lemma)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   165
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   166
(** Some further results by Sidi O. Ehmety **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   167
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   168
lemma fun_FiniteFunI [rule_format]: "A \<in> Fin(X) ==> \<forall>f. f \<in> A->B \<longrightarrow> f \<in> A-||>B"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   169
apply (erule Fin.induct)
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13203
diff changeset
   170
 apply (simp add: FiniteFun.intros, clarify)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   171
apply (case_tac "a \<in> b")
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   172
 apply (simp add: cons_absorb)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   173
apply (subgoal_tac "restrict (f,b) \<in> b -||> B")
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   174
 prefer 2 apply (blast intro: restrict_type2)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   175
apply (subst fun_cons_restrict_eq, assumption)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   176
apply (simp add: restrict_def lam_def)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   177
apply (blast intro: apply_funtype FiniteFun.intros
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   178
                    FiniteFun_mono [THEN [2] rev_subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   179
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   180
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   181
lemma lam_FiniteFun: "A \<in> Fin(X) ==> (\<lambda>x\<in>A. b(x)) \<in> A -||> {b(x). x \<in> A}"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   182
by (blast intro: fun_FiniteFunI lam_funtype)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   183
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   184
lemma FiniteFun_Collect_iff:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46821
diff changeset
   185
     "f \<in> FiniteFun(A, {y \<in> B. P(y)})
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   186
      \<longleftrightarrow> f \<in> FiniteFun(A,B) & (\<forall>x\<in>domain(f). P(f`x))"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   187
apply auto
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   188
apply (blast intro: FiniteFun_mono [THEN [2] rev_subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   189
apply (blast dest: Pair_mem_PiD FiniteFun_is_fun)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46471
diff changeset
   190
apply (rule_tac A1="domain(f)" in
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   191
       subset_refl [THEN [2] FiniteFun_mono, THEN subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   192
 apply (fast dest: FiniteFun_domain_Fin Fin.dom_subset [THEN subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   193
apply (rule fun_FiniteFunI)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   194
apply (erule FiniteFun_domain_Fin)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   195
apply (rule_tac B = "range (f) " in fun_weaken_type)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   196
 apply (blast dest: FiniteFun_is_fun range_of_fun range_type apply_equality)+
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   197
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   198
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   199
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   200
subsection{*The Contents of a Singleton Set*}
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   201
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
   202
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
   203
  contents :: "i=>i"  where
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   204
   "contents(X) == THE x. X = {x}"
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   205
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   206
lemma contents_eq [simp]: "contents ({x}) = x"
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   207
by (simp add: contents_def)
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   208
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
   209
end