src/ZF/Finite.thy
author paulson
Fri, 29 Oct 2004 15:16:02 +0200
changeset 15270 8b3f707a78a7
parent 14883 ca000a495448
child 16417 9bc16273c2d4
permissions -rw-r--r--
fixed reference to renamed theorem
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/Finite.thy
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     5
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
     6
prove:  b: Fin(A) ==> inj(b,b) <= surj(b,b)
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
     8
13328
703de709a64b better document preparation
paulson
parents: 13269
diff changeset
     9
header{*Finite Powerset Operator and Finite Function Space*}
703de709a64b better document preparation
paulson
parents: 13269
diff changeset
    10
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    11
theory Finite = Inductive + Epsilon + Nat:
9491
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    12
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    13
(*The natural numbers as a datatype*)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    14
rep_datatype
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    15
  elimination    natE
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    16
  induction	 nat_induct
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    17
  case_eqns	 nat_case_0 nat_case_succ
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    18
  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
    19
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6053
diff changeset
    20
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    21
consts
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    22
  Fin       :: "i=>i"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    23
  FiniteFun :: "[i,i]=>i"         ("(_ -||>/ _)" [61, 60] 60)
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    24
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
    25
inductive
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
    26
  domains   "Fin(A)" <= "Pow(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    27
  intros
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    28
    emptyI:  "0 : Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    29
    consI:   "[| a: A;  b: Fin(A) |] ==> cons(a,b) : Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    30
  type_intros  empty_subsetI cons_subsetI PowI
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    31
  type_elims   PowD [THEN revcut_rl]
534
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    32
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    33
inductive
cd8bec47e175 ZF/Finite: added the finite function space, A-||>B
lcp
parents: 516
diff changeset
    34
  domains   "FiniteFun(A,B)" <= "Fin(A*B)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    35
  intros
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    36
    emptyI:  "0 : A -||> B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    37
    consI:   "[| a: A;  b: B;  h: A -||> B;  a ~: domain(h) |]
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    38
              ==> cons(<a,b>,h) : A -||> B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    39
  type_intros Fin.intros
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    40
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    41
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
    42
subsection {* Finite Powerset Operator *}
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    43
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    44
lemma Fin_mono: "A<=B ==> Fin(A) <= Fin(B)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    45
apply (unfold Fin.defs)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    46
apply (rule lfp_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    47
apply (rule Fin.bnd_mono)+
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    48
apply blast
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    49
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    50
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    51
(* A : Fin(B) ==> A <= B *)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    52
lemmas FinD = Fin.dom_subset [THEN subsetD, THEN PowD, standard]
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    53
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    54
(** Induction on finite sets **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    55
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    56
(*Discharging x~:y entails extra work*)
13524
604d0f3622d6 *** empty log message ***
wenzelm
parents: 13356
diff changeset
    57
lemma Fin_induct [case_names 0 cons, induct set: Fin]:
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    58
    "[| b: Fin(A);
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    59
        P(0);
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    60
        !!x y. [| x: A;  y: Fin(A);  x~:y;  P(y) |] ==> P(cons(x,y))
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    61
     |] ==> P(b)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    62
apply (erule Fin.induct, simp)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    63
apply (case_tac "a:b")
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    64
 apply (erule cons_absorb [THEN ssubst], assumption) (*backtracking!*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    65
apply simp
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    66
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    67
13203
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    68
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    69
(** Simplification for Fin **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    70
declare Fin.intros [simp]
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    71
13203
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    72
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
    73
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
    74
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    75
(*The union of two finite sets is finite.*)
13203
fac77a839aa2 Tidying up. Mainly moving proofs from Main.thy to other (Isar) theory files.
paulson
parents: 13194
diff changeset
    76
lemma Fin_UnI [simp]: "[| b: Fin(A);  c: Fin(A) |] ==> b Un c : Fin(A)"
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    77
apply (erule Fin_induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    78
apply (simp_all add: Un_cons)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    79
done
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
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    82
(*The union of a set of finite sets is finite.*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    83
lemma Fin_UnionI: "C : Fin(Fin(A)) ==> Union(C) : Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    84
by (erule Fin_induct, simp_all)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    85
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    86
(*Every subset of a finite set is finite.*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    87
lemma Fin_subset_lemma [rule_format]: "b: Fin(A) ==> \<forall>z. z<=b --> z: Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    88
apply (erule Fin_induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    89
apply (simp add: subset_empty_iff)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    90
apply (simp add: subset_cons_iff distrib_simps, safe)
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
    91
apply (erule_tac b = z in cons_Diff [THEN subst], simp)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    92
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    93
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    94
lemma Fin_subset: "[| c<=b;  b: Fin(A) |] ==> c: Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    95
by (blast intro: Fin_subset_lemma)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    96
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    97
lemma Fin_IntI1 [intro,simp]: "b: Fin(A) ==> b Int c : Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    98
by (blast intro: Fin_subset)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
    99
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   100
lemma Fin_IntI2 [intro,simp]: "c: Fin(A) ==> b Int c : Fin(A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   101
by (blast intro: Fin_subset)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   102
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   103
lemma Fin_0_induct_lemma [rule_format]:
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   104
    "[| c: Fin(A);  b: Fin(A); P(b);
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   105
        !!x y. [| x: A;  y: Fin(A);  x:y;  P(y) |] ==> P(y-{x})
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   106
     |] ==> c<=b --> P(b-c)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   107
apply (erule Fin_induct, simp)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   108
apply (subst Diff_cons)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   109
apply (simp add: cons_subset_iff Diff_subset [THEN Fin_subset])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   110
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   111
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   112
lemma Fin_0_induct:
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   113
    "[| b: Fin(A);
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   114
        P(b);
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   115
        !!x y. [| x: A;  y: Fin(A);  x:y;  P(y) |] ==> P(y-{x})
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   116
     |] ==> P(0)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   117
apply (rule Diff_cancel [THEN subst])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   118
apply (blast intro: Fin_0_induct_lemma) 
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   119
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   120
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   121
(*Functions from a finite ordinal*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   122
lemma nat_fun_subset_Fin: "n: nat ==> n->A <= Fin(nat*A)"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   123
apply (induct_tac "n")
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   124
apply (simp add: subset_iff)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   125
apply (simp add: succ_def mem_not_refl [THEN cons_fun_eq])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   126
apply (fast intro!: Fin.consI)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   127
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   128
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   129
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
   130
subsection{*Finite Function Space*}
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   131
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   132
lemma FiniteFun_mono:
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   133
    "[| A<=C;  B<=D |] ==> A -||> B  <=  C -||> D"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   134
apply (unfold FiniteFun.defs)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   135
apply (rule lfp_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   136
apply (rule FiniteFun.bnd_mono)+
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   137
apply (intro Fin_mono Sigma_mono basic_monos, assumption+)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   138
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   139
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   140
lemma FiniteFun_mono1: "A<=B ==> A -||> A  <=  B -||> B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   141
by (blast dest: FiniteFun_mono)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   142
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   143
lemma FiniteFun_is_fun: "h: A -||>B ==> h: domain(h) -> B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   144
apply (erule FiniteFun.induct, simp)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   145
apply (simp add: fun_extend3)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   146
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   147
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   148
lemma FiniteFun_domain_Fin: "h: A -||>B ==> domain(h) : Fin(A)"
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13203
diff changeset
   149
by (erule FiniteFun.induct, simp, simp)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   150
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   151
lemmas FiniteFun_apply_type = FiniteFun_is_fun [THEN apply_type, standard]
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   152
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   153
(*Every subset of a finite function is a finite function.*)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   154
lemma FiniteFun_subset_lemma [rule_format]:
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   155
     "b: A-||>B ==> ALL z. z<=b --> z: A-||>B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   156
apply (erule FiniteFun.induct)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   157
apply (simp add: subset_empty_iff FiniteFun.intros)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   158
apply (simp add: subset_cons_iff distrib_simps, safe)
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
   159
apply (erule_tac b = z in cons_Diff [THEN subst])
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   160
apply (drule spec [THEN mp], assumption)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   161
apply (fast intro!: FiniteFun.intros)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   162
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   163
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   164
lemma FiniteFun_subset: "[| c<=b;  b: A-||>B |] ==> c: A-||>B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   165
by (blast intro: FiniteFun_subset_lemma)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   166
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   167
(** Some further results by Sidi O. Ehmety **)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   168
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   169
lemma fun_FiniteFunI [rule_format]: "A:Fin(X) ==> ALL f. f:A->B --> f:A-||>B"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   170
apply (erule Fin.induct)
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13203
diff changeset
   171
 apply (simp add: FiniteFun.intros, clarify)
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   172
apply (case_tac "a:b")
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   173
 apply (simp add: cons_absorb)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   174
apply (subgoal_tac "restrict (f,b) : b -||> B")
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   175
 prefer 2 apply (blast intro: restrict_type2)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   176
apply (subst fun_cons_restrict_eq, assumption)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   177
apply (simp add: restrict_def lam_def)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   178
apply (blast intro: apply_funtype FiniteFun.intros 
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   179
                    FiniteFun_mono [THEN [2] rev_subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   180
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   181
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   182
lemma lam_FiniteFun: "A: Fin(X) ==> (lam x:A. b(x)) : A -||> {b(x). x:A}"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   183
by (blast intro: fun_FiniteFunI lam_funtype)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   184
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   185
lemma FiniteFun_Collect_iff:
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   186
     "f : FiniteFun(A, {y:B. P(y)})
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   187
      <-> f : FiniteFun(A,B) & (ALL x:domain(f). P(f`x))"
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   188
apply auto
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   189
apply (blast intro: FiniteFun_mono [THEN [2] rev_subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   190
apply (blast dest: Pair_mem_PiD FiniteFun_is_fun)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   191
apply (rule_tac A1="domain(f)" in 
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   192
       subset_refl [THEN [2] FiniteFun_mono, THEN subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   193
 apply (fast dest: FiniteFun_domain_Fin Fin.dom_subset [THEN subsetD])
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   194
apply (rule fun_FiniteFunI)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   195
apply (erule FiniteFun_domain_Fin)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   196
apply (rule_tac B = "range (f) " in fun_weaken_type)
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   197
 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
   198
done
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   199
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   200
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   201
subsection{*The Contents of a Singleton Set*}
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   202
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   203
constdefs
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   204
  contents :: "i=>i"
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   205
   "contents(X) == THE x. X = {x}"
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   206
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   207
lemma contents_eq [simp]: "contents ({x}) = x"
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   208
by (simp add: contents_def)
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   209
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 13784
diff changeset
   210
13194
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   211
ML
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   212
{*
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   213
val Fin_intros = thms "Fin.intros";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   214
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   215
val Fin_mono = thm "Fin_mono";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   216
val FinD = thm "FinD";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   217
val Fin_induct = thm "Fin_induct";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   218
val Fin_UnI = thm "Fin_UnI";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   219
val Fin_UnionI = thm "Fin_UnionI";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   220
val Fin_subset = thm "Fin_subset";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   221
val Fin_IntI1 = thm "Fin_IntI1";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   222
val Fin_IntI2 = thm "Fin_IntI2";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   223
val Fin_0_induct = thm "Fin_0_induct";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   224
val nat_fun_subset_Fin = thm "nat_fun_subset_Fin";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   225
val FiniteFun_mono = thm "FiniteFun_mono";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   226
val FiniteFun_mono1 = thm "FiniteFun_mono1";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   227
val FiniteFun_is_fun = thm "FiniteFun_is_fun";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   228
val FiniteFun_domain_Fin = thm "FiniteFun_domain_Fin";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   229
val FiniteFun_apply_type = thm "FiniteFun_apply_type";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   230
val FiniteFun_subset = thm "FiniteFun_subset";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   231
val fun_FiniteFunI = thm "fun_FiniteFunI";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   232
val lam_FiniteFun = thm "lam_FiniteFun";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   233
val FiniteFun_Collect_iff = thm "FiniteFun_Collect_iff";
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   234
*}
812b00ed1c03 conversion of Finite to Isar format
paulson
parents: 12214
diff changeset
   235
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents:
diff changeset
   236
end