src/HOL/ex/PiSets.ML
author paulson
Wed, 11 Nov 1998 15:44:24 +0100
changeset 5845 eb183b062eae
parent 5521 7970832271cc
child 5856 5fb5a626f3b9
permissions -rw-r--r--
Big simplification of proofs. Deleted lots of unnecessary theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/ex/PiSets.thy
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     3
    Author:     Florian Kammueller, University of Cambridge
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     4
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     5
Pi sets and their application.
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     6
*)
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     7
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
     8
(*** -> and Pi ***)
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
     9
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    10
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    11
val prems = Goalw [Pi_def]
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    12
"[| !!x. x: A ==> f x: B x; !!x. x ~: A  ==> f(x) = (@ y. True)|] \
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    13
\    ==> f: Pi A B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    14
by (auto_tac (claset(), simpset() addsimps prems));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    15
qed "Pi_I";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    16
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    17
val prems = Goal 
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    18
"[| !!x. x: A ==> f x: B; !!x. x ~: A  ==> f(x) = (@ y. True)|] ==> f: A -> B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    19
by (blast_tac (claset() addIs Pi_I::prems) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    20
qed "funcsetI";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    21
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    22
Goalw [Pi_def] "[|f: Pi A B; x: A|] ==> f x: B x";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    23
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    24
qed "Pi_mem";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    25
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    26
Goalw [Pi_def] "[|f: A -> B; x: A|] ==> f x: B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    27
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    28
qed "funcset_mem";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    29
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    30
Goalw [Pi_def] "[|f: Pi A B; x~: A|] ==> f x = (@ y. True)";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    31
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    32
qed "apply_arb";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    33
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    34
Goalw [Pi_def] "[| f: Pi A B; g: Pi A B; ! x: A. f x = g x |] ==> f = g";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    35
by (rtac ext 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    36
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    37
val Pi_extensionality = ballI RSN (3, result());
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    38
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    39
(*** compose ***)
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    40
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    41
Goalw [Pi_def, compose_def, restrict_def]
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    42
     "[| f: A -> B; g: B -> C |]==> compose A g f: A -> C";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    43
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    44
qed "funcset_compose";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    45
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    46
Goal "[| f: A -> B; g: B -> C; h: C -> D |]\
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    47
\     ==> compose A h (compose A g f) = compose A (compose B h g) f";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    48
by (res_inst_tac [("A","A")] Pi_extensionality 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    49
by (blast_tac (claset() addIs [funcset_compose]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    50
by (blast_tac (claset() addIs [funcset_compose]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    51
by (rewrite_goals_tac [Pi_def, compose_def, restrict_def]);  
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    52
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    53
qed "compose_assoc";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    54
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    55
Goal "[| f: A -> B; g: B -> C; x: A |]==> compose A g f x = g(f(x))";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    56
by (asm_full_simp_tac (simpset() addsimps [compose_def, restrict_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    57
qed "compose_eq";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    58
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    59
Goal "[| f : A -> B; f `` A = B; g: B -> C; g `` B = C |]\
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    60
\     ==> compose A g f `` A = C";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    61
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    62
	      simpset() addsimps [image_def, compose_eq]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    63
qed "surj_compose";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    64
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    65
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    66
Goal "[| f : A -> B; g: B -> C; f `` A = B; inj_on f A; inj_on g B |]\
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    67
\     ==> inj_on (compose A g f) A";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    68
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    69
	      simpset() addsimps [inj_on_def, compose_eq]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    70
qed "inj_on_compose";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    71
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    72
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    73
(*** restrict / lam ***)
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    74
Goal "[| f `` A <= B |] ==> (lam x: A. f x) : A -> B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    75
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    76
	      simpset() addsimps [restrict_def, Pi_def]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    77
qed "restrict_in_funcset";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    78
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    79
val prems = Goalw [restrict_def, Pi_def]
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    80
     "(!!x. x: A ==> f x: B x) ==> (lam x: A. f x) : Pi A B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    81
by (asm_simp_tac (simpset() addsimps prems) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    82
qed "restrictI";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    83
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    84
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    85
Goal "x: A ==> (lam y: A. f y) x = f x";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    86
by (asm_simp_tac (simpset() addsimps [restrict_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    87
qed "restrict_apply1";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    88
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    89
Goal "[| x: A; f : A -> B |] ==> (lam y: A. f y) x : B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    90
by (asm_full_simp_tac (simpset() addsimps [restrict_apply1,Pi_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    91
qed "restrict_apply1_mem";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    92
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    93
Goal "x ~: A ==> (lam y: A. f y) x =  (@ y. True)";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    94
by (asm_simp_tac (simpset() addsimps [restrict_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    95
qed "restrict_apply2";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    96
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
    97
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    98
val prems = Goal
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
    99
    "(!!x. x: A ==> f x = g x) ==> (lam x: A. f x) = (lam x: A. g x)";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   100
by (rtac ext 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   101
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   102
	      simpset() addsimps prems@[restrict_def, Pi_def]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   103
qed "restrict_ext";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   104
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   105
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   106
(*** Inverse ***)
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   107
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   108
Goal "[|f `` A = B;  x: B |] ==> ? y: A. f y = x";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   109
by (Blast_tac 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   110
qed "surj_image";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   111
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   112
Goalw [Inv_def] "[| f `` A = B; f : A -> B |] \
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   113
\                ==> (lam x: B. (Inv A f) x) : B -> A";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   114
by (fast_tac (claset() addIs [restrict_in_funcset, selectI2]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   115
qed "Inv_funcset";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   116
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   117
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   118
Goal "[| f: A -> B;  inj_on f A;  f `` A = B;  x: A |] \
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   119
\     ==> (lam y: B. (Inv A f) y) (f x) = x";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   120
by (asm_simp_tac (simpset() addsimps [restrict_apply1, funcset_mem]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   121
by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   122
by (rtac selectI2 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   123
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   124
qed "Inv_f_f";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   125
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   126
Goal "[| f: A -> B;  f `` A = B;  x: B |] \
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   127
\     ==> f ((lam y: B. (Inv A f y)) x) = x";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   128
by (asm_simp_tac (simpset() addsimps [Inv_def, restrict_apply1]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   129
by (fast_tac (claset() addIs [selectI2]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   130
qed "f_Inv_f";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   131
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   132
Goal "[| f: A -> B;  inj_on f A;  f `` A = B |]\
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   133
\     ==> compose A (lam y:B. (Inv A f) y) f = (lam x: A. x)";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   134
by (rtac Pi_extensionality 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   135
by (blast_tac (claset() addIs [funcset_compose, Inv_funcset]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   136
by (blast_tac (claset() addIs [restrict_in_funcset]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   137
by (asm_simp_tac
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   138
    (simpset() addsimps [restrict_apply1, compose_def, Inv_f_f]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   139
qed "compose_Inv_id";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   140
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   141
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   142
(*** Pi and its application @@ ***)
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   143
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   144
Goalw [Pi_def] "[| B(x) = {};  x: A |] ==> (PI x: A. B x) = {}";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   145
by Auto_tac;
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   146
qed "Pi_eq_empty";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   147
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   148
Goal "[| (PI x: A. B x) ~= {};  x: A |] ==> B(x) ~= {}";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   149
by (blast_tac (HOL_cs addIs [Pi_eq_empty]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   150
qed "Pi_total1";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   151
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   152
Goal "[| a : A; Pi A B ~= {} |] ==> (Pi A B) @@ a = B(a)";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   153
by (auto_tac (claset(), simpset() addsimps [Fset_apply_def, Pi_def]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   154
by (rename_tac "g z" 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   155
by (res_inst_tac [("x","%y. if  (y = a) then z else g y")] exI 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   156
by (auto_tac (claset(), simpset() addsimps [split_if_mem1, split_if_eq1]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   157
qed "Fset_beta";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   158
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   159
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   160
(*** Bijection between Pi in terms of => and Pi in terms of Sigma ***)
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   161
Goal "f: Pi A B ==> PiBij A B f <= Sigma A B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   162
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   163
	      simpset() addsimps [PiBij_def,Pi_def,restrict_apply1]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   164
qed "PiBij_subset_Sigma";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   165
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   166
Goal "f: Pi A B ==> (! x: A. (?! y. (x, y): (PiBij A B f)))";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   167
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   168
	      simpset() addsimps [PiBij_def,restrict_apply1]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   169
qed "PiBij_unique";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   170
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   171
Goal "f: Pi A B ==> PiBij A B f : Graph A B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   172
by (asm_simp_tac (simpset() addsimps [Graph_def,PiBij_unique,
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   173
				      PiBij_subset_Sigma]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   174
qed "PiBij_in_Graph";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   175
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   176
Goalw [PiBij_def, Graph_def] "PiBij A B:  Pi A B -> Graph A B";
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   177
by (rtac restrictI 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   178
by (auto_tac (claset(), simpset() addsimps [Pi_def]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   179
qed "PiBij_func";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   180
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   181
Goal "inj_on (PiBij A B) (Pi A B)";
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   182
by (rtac inj_onI 1);
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   183
by (rtac Pi_extensionality 1);			
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   184
by (assume_tac 1);
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   185
by (assume_tac 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   186
by (rotate_tac 1 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   187
by (asm_full_simp_tac (simpset() addsimps [PiBij_def,restrict_apply1]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   188
by (blast_tac (claset() addEs [equalityE]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   189
qed "inj_PiBij";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   190
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   191
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   192
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   193
Goal "PiBij A B `` (Pi A B) = Graph A B";
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   194
by (rtac equalityI 1);
5521
7970832271cc added wrapper for bspec
oheimb
parents: 5318
diff changeset
   195
by (force_tac (claset(), simpset() addsimps [image_def,PiBij_in_Graph]) 1);
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   196
by (rtac subsetI 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   197
by (asm_full_simp_tac (simpset() addsimps [image_def]) 1);
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   198
by (res_inst_tac [("x","lam a: A. @ y. (a, y): x")] bexI 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   199
 by (rtac restrictI 2);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   200
 by (res_inst_tac [("P", "%xa. (a, xa) : x")] ex1E 2);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   201
  by (force_tac (claset(), simpset() addsimps [Graph_def]) 2);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   202
 by (full_simp_tac (simpset() addsimps [Graph_def]) 2);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   203
  by (stac select_equality 2);
5521
7970832271cc added wrapper for bspec
oheimb
parents: 5318
diff changeset
   204
   by (assume_tac 2);
7970832271cc added wrapper for bspec
oheimb
parents: 5318
diff changeset
   205
  by (Blast_tac 2);
7970832271cc added wrapper for bspec
oheimb
parents: 5318
diff changeset
   206
 by (Blast_tac 2);
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   207
(* x = PiBij A B (lam a:A. @ y. (a, y) : x) *)
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   208
by (full_simp_tac (simpset() addsimps [PiBij_def,Graph_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   209
by (stac restrict_apply1 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   210
 by (rtac restrictI 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   211
 by (blast_tac (claset() addSDs [[select_eq_Ex, ex1_implies_ex] MRS iffD2]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   212
(** LEVEL 17 **)
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   213
by (rtac equalityI 1);
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   214
by (rtac subsetI 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   215
by (split_all_tac 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   216
by (subgoal_tac "a: A" 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   217
by (Blast_tac 2);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   218
by (asm_full_simp_tac (simpset() addsimps [restrict_apply1]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   219
(*Blast_tac: PROOF FAILED for depth 5*)
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   220
by (fast_tac (claset() addSIs [select1_equality RS sym]) 1);
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   221
(* {(xa,y). xa : A & y = (lam a:A. @ y. (a, y) : x) xa} <= x   *)
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   222
by (Clarify_tac 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   223
by (asm_full_simp_tac (simpset() addsimps [restrict_apply1]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   224
by (fast_tac (claset() addIs [selectI2]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   225
qed "surj_PiBij";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   226
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   227
Goal "f: Pi A B ==> \
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   228
\     (lam y: Graph A B. (Inv (Pi A B)(PiBij A B)) y)(PiBij A B f) = f";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   229
by (asm_simp_tac
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   230
    (simpset() addsimps [Inv_f_f, PiBij_func, inj_PiBij, surj_PiBij]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   231
qed "PiBij_bij1";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   232
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   233
Goal "[| f: Graph A B  |] ==> \
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   234
\    (PiBij A B) ((lam y: (Graph A B). (Inv (Pi A B)(PiBij A B)) y) f) = f";
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   235
by (rtac (PiBij_func RS f_Inv_f) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   236
by (asm_full_simp_tac (simpset() addsimps [surj_PiBij]) 1);
5318
72bf8039b53f expandshort
paulson
parents: 5250
diff changeset
   237
by (assume_tac 1);
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   238
qed "PiBij_bij2";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   239
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   240
Goal "Pi {} B = {f. !x. f x = (@ y. True)}";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   241
by (asm_full_simp_tac (simpset() addsimps [Pi_def]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   242
qed "empty_Pi";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   243
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   244
Goal "(% x. (@ y. True)) : Pi {} B";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   245
by (simp_tac (simpset() addsimps [empty_Pi]) 1);
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   246
qed "empty_Pi_func";
5250
1bff4b1e5ba9 added LocaleGroup, PiSets examples;
wenzelm
parents:
diff changeset
   247
5845
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   248
val [major] = Goalw [Pi_def] "(!!x. x: A ==> B x <= C x) ==> Pi A B <= Pi A C";
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   249
by (auto_tac (claset(),
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   250
	      simpset() addsimps [impOfSubs major]));
eb183b062eae Big simplification of proofs.
paulson
parents: 5521
diff changeset
   251
qed "Pi_mono";