src/HOL/WF.ML
author nipkow
Thu, 12 Oct 2000 18:38:23 +0200
changeset 10212 33fe2d701ddd
parent 10067 ab03cfd6be3a
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
     1
(*  Title:      HOL/WF.ML
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
     3
    Author:     Tobias Nipkow, with minor changes by Konrad Slind
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
     4
    Copyright   1992  University of Cambridge/1995 TU Munich
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
     6
Wellfoundedness, induction, and  recursion
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
     9
Goal "x = y ==> H x z = H y z";
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
    10
by (Asm_simp_tac 1);
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
    11
val H_cong2 = (*freeze H!*)
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
    12
	      read_instantiate [("H","H")] (result());
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
5579
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    14
val [prem] = Goalw [wf_def]
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    15
 "(!!P x. (ALL x. (ALL y. (y,x) : r --> P(y)) --> P(x)) ==> P(x)) ==> wf(r)";
5579
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    16
by (Clarify_tac 1);
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    17
by (rtac prem 1);
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    18
by (assume_tac 1);
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    19
qed "wfUNIVI";
32f99ca617b7 new: wfUNIVI
nipkow
parents: 5521
diff changeset
    20
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
(*Restriction to domain A.  If r is well-founded over A then wf(r)*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    22
val [prem1,prem2] = Goalw [wf_def]
8703
816d8f6513be Times -> <*>
nipkow
parents: 8265
diff changeset
    23
 "[| r <= A <*> A;  \
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    24
\    !!x P. [| ALL x. (ALL y. (y,x) : r --> P y) --> P x;  x:A |] ==> P x |]  \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    25
\ ==>  wf r";
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    26
by (cut_facts_tac [prem1] 1);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    27
by (blast_tac (claset() addIs [prem2]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
qed "wfI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    30
val major::prems = Goalw [wf_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
    "[| wf(r);          \
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    32
\       !!x.[| ALL y. (y,x): r --> P(y) |] ==> P(x) \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
\    |]  ==>  P(a)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
by (rtac (major RS spec RS mp RS spec) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    35
by (blast_tac (claset() addIs prems) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
qed "wf_induct";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
(*Perform induction on i, then prove the wf(r) subgoal using prems. *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
fun wf_ind_tac a prems i = 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
    EVERY [res_inst_tac [("a",a)] wf_induct i,
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    41
           rename_last_tac a ["1"] (i+1),
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    42
           ares_tac prems i];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    44
Goal "wf(r) ==> ALL x. (a,x):r --> (x,a)~:r";
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    45
by (wf_ind_tac "a" [] 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2637
diff changeset
    46
by (Blast_tac 1);
5452
b38332431a8c New theorem wf_not_sym and well-formed wf_asym
paulson
parents: 5337
diff changeset
    47
qed_spec_mp "wf_not_sym";
b38332431a8c New theorem wf_not_sym and well-formed wf_asym
paulson
parents: 5337
diff changeset
    48
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    49
(* [| wf r;  ~Z ==> (a,x) : r;  (x,a) ~: r ==> Z |] ==> Z *)
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    50
bind_thm ("wf_asym", cla_make_elim wf_not_sym);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    52
Goal "wf(r) ==> (a,a) ~: r";
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    53
by (blast_tac (claset() addEs [wf_asym]) 1);
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    54
qed "wf_not_refl";
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    55
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    56
(* [| wf r;  (a,a) ~: r ==> PROP W |] ==> PROP W *)
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    57
bind_thm ("wf_irrefl", make_elim wf_not_refl);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
    59
(*transitive closure of a wf relation is wf! *)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    60
Goal "wf(r) ==> wf(r^+)";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    61
by (stac wf_def 1);
3708
56facaebf3e3 Changed some proofs to use Clarify_tac
paulson
parents: 3457
diff changeset
    62
by (Clarify_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
(*must retain the universal formula for later use!*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
by (rtac allE 1 THEN assume_tac 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
by (etac mp 1);
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    66
by (eres_inst_tac [("a","x")] wf_induct 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
    67
by (blast_tac (claset() addEs [tranclE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
qed "wf_trancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    70
Goal "wf (r^-1) ==> wf ((r^+)^-1)";
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    71
by (stac (trancl_converse RS sym) 1);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    72
by (etac wf_trancl 1);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    73
qed "wf_converse_trancl";
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 8703
diff changeset
    74
4762
afebaa81f148 added wf_converse_trancl, adapted proof of wfrec
oheimb
parents: 4750
diff changeset
    75
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    76
(*----------------------------------------------------------------------------
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    77
 * Minimal-element characterization of well-foundedness
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    78
 *---------------------------------------------------------------------------*)
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    79
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    80
Goalw [wf_def] "wf r ==> x:Q --> (EX z:Q. ALL y. (y,z):r --> y~:Q)";
5318
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
    81
by (dtac spec 1);
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    82
by (etac (mp RS spec) 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    83
by (Blast_tac 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    84
val lemma1 = result();
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    85
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    86
Goalw [wf_def] "(ALL Q x. x:Q --> (EX z:Q. ALL y. (y,z):r --> y~:Q)) ==> wf r";
3708
56facaebf3e3 Changed some proofs to use Clarify_tac
paulson
parents: 3457
diff changeset
    87
by (Clarify_tac 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    88
by (dres_inst_tac [("x", "{x. ~ P x}")] spec 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    89
by (Blast_tac 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    90
val lemma2 = result();
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    91
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
    92
Goal "wf r = (ALL Q x. x:Q --> (EX z:Q. ALL y. (y,z):r --> y~:Q))";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    93
by (blast_tac (claset() addSIs [lemma1, lemma2]) 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    94
qed "wf_eq_minimal";
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
    95
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
    96
(*---------------------------------------------------------------------------
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
    97
 * Wellfoundedness of subsets
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
    98
 *---------------------------------------------------------------------------*)
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
    99
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   100
Goal "[| wf(r);  p<=r |] ==> wf(p)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   101
by (full_simp_tac (simpset() addsimps [wf_eq_minimal]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   102
by (Fast_tac 1);
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   103
qed "wf_subset";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   104
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   105
(*---------------------------------------------------------------------------
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   106
 * Wellfoundedness of the empty relation.
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   107
 *---------------------------------------------------------------------------*)
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   108
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4821
diff changeset
   109
Goal "wf({})";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   110
by (simp_tac (simpset() addsimps [wf_def]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   111
qed "wf_empty";
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   112
AddIffs [wf_empty];
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   113
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   114
(*---------------------------------------------------------------------------
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   115
 * Wellfoundedness of `insert'
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   116
 *---------------------------------------------------------------------------*)
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   117
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4821
diff changeset
   118
Goal "wf(insert (y,x) r) = (wf(r) & (x,y) ~: r^*)";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   119
by (rtac iffI 1);
4350
1983e4054fd8 updated for latest Blast_tac, which treats equality differently
paulson
parents: 4153
diff changeset
   120
 by (blast_tac (claset() addEs [wf_trancl RS wf_irrefl] 
1983e4054fd8 updated for latest Blast_tac, which treats equality differently
paulson
parents: 4153
diff changeset
   121
	addIs [rtrancl_into_trancl1,wf_subset,impOfSubs rtrancl_mono]) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   122
by (asm_full_simp_tac (simpset() addsimps [wf_eq_minimal]) 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   123
by Safe_tac;
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   124
by (EVERY1[rtac allE, assume_tac, etac impE, Blast_tac]);
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   125
by (etac bexE 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   126
by (rename_tac "a" 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   127
by (case_tac "a = x" 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   128
 by (res_inst_tac [("x","a")]bexI 2);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   129
  by (assume_tac 3);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   130
 by (Blast_tac 2);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   131
by (case_tac "y:Q" 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   132
 by (Blast_tac 2);
4059
59c1422c9da5 New Blast_tac (and minor tidying...)
paulson
parents: 3919
diff changeset
   133
by (res_inst_tac [("x","{z. z:Q & (z,y) : r^*}")] allE 1);
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   134
 by (assume_tac 1);
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   135
by (thin_tac "ALL Q. (EX x. x : Q) --> ?P Q" 1);	(*essential for speed*)
4350
1983e4054fd8 updated for latest Blast_tac, which treats equality differently
paulson
parents: 4153
diff changeset
   136
(*Blast_tac with new substOccur fails*)
1983e4054fd8 updated for latest Blast_tac, which treats equality differently
paulson
parents: 4153
diff changeset
   137
by (best_tac (claset() addIs [rtrancl_into_rtrancl2]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   138
qed "wf_insert";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   139
AddIffs [wf_insert];
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   140
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   141
(*---------------------------------------------------------------------------
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   142
 * Wellfoundedness of `disjoint union'
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   143
 *---------------------------------------------------------------------------*)
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   144
5330
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   145
(*Intuition behind this proof for the case of binary union:
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   146
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   147
  Goal: find an (R u S)-min element of a nonempty subset A.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   148
  by case distinction:
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   149
  1. There is a step a -R-> b with a,b : A.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   150
     Pick an R-min element z of the (nonempty) set {a:A | EX b:A. a -R-> b}.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   151
     By definition, there is z':A s.t. z -R-> z'. Because z is R-min in the
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   152
     subset, z' must be R-min in A. Because z' has an R-predecessor, it cannot
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   153
     have an S-successor and is thus S-min in A as well.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   154
  2. There is no such step.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   155
     Pick an S-min element of A. In this case it must be an R-min
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   156
     element of A as well.
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   157
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   158
*)
8c9fadda81f4 added comment
paulson
parents: 5318
diff changeset
   159
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   160
Goal "[| ALL i:I. wf(r i); \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   161
\        ALL i:I. ALL j:I. r i ~= r j --> Domain(r i) Int Range(r j) = {} & \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   162
\                                         Domain(r j) Int Range(r i) = {} \
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   163
\     |] ==> wf(UN i:I. r i)";
5318
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   164
by (asm_full_simp_tac (HOL_basic_ss addsimps [wf_eq_minimal]) 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   165
by (Clarify_tac 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   166
by (rename_tac "A a" 1);
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   167
by (case_tac "EX i:I. EX a:A. EX b:A. (b,a) : r i" 1);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   168
 by (Asm_full_simp_tac 2);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   169
 by (Best_tac 2);  (*much faster than Blast_tac*)
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   170
by (Clarify_tac 1);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   171
by (EVERY1[dtac bspec, assume_tac,
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   172
	   eres_inst_tac [("x","{a. a:A & (EX b:A. (b,a) : r i)}")] allE]);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   173
by (EVERY1[etac allE, etac impE]);
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   174
 by (ALLGOALS Blast_tac);
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   175
qed "wf_UN";
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   176
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   177
Goalw [Union_def]
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   178
 "[| ALL r:R. wf r; \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   179
\    ALL r:R. ALL s:R. r ~= s --> Domain r Int Range s = {} & \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   180
\                                 Domain s Int Range r = {} \
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   181
\ |] ==> wf(Union R)";
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   182
by (blast_tac (claset() addIs [wf_UN]) 1);
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   183
qed "wf_Union";
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   184
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   185
Goal "[| wf r; wf s; Domain r Int Range s = {}; Domain s Int Range r = {} \
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   186
\     |] ==> wf(r Un s)";
5318
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   187
by (rtac (simplify (simpset()) (read_instantiate[("R","{r,s}")]wf_Union)) 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   188
by (Blast_tac 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   189
by (Blast_tac 1);
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   190
qed "wf_Un";
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   191
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   192
(*---------------------------------------------------------------------------
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   193
 * Wellfoundedness of `image'
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   194
 *---------------------------------------------------------------------------*)
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   195
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   196
Goal "[| wf r; inj f |] ==> wf(prod_fun f f `` r)";
5318
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   197
by (asm_full_simp_tac (HOL_basic_ss addsimps [wf_eq_minimal]) 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   198
by (Clarify_tac 1);
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   199
by (case_tac "EX p. f p : Q" 1);
5318
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   200
by (eres_inst_tac [("x","{p. f p : Q}")]allE 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   201
by (fast_tac (claset() addDs [injD]) 1);
72bf8039b53f expandshort
paulson
parents: 5316
diff changeset
   202
by (Blast_tac 1);
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   203
qed "wf_prod_fun_image";
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5278
diff changeset
   204
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   205
(*** acyclic ***)
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   206
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   207
Goalw [acyclic_def] "ALL x. (x, x) ~: r^+ ==> acyclic r";
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   208
by (assume_tac 1);
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   209
qed "acyclicI";
4750
f83cd6a06676 added acyclicI
oheimb
parents: 4746
diff changeset
   210
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   211
Goalw [acyclic_def] "wf r ==> acyclic r";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   212
by (blast_tac (claset() addEs [wf_trancl RS wf_irrefl]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   213
qed "wf_acyclic";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   214
5452
b38332431a8c New theorem wf_not_sym and well-formed wf_asym
paulson
parents: 5337
diff changeset
   215
Goalw [acyclic_def] "acyclic(insert (y,x) r) = (acyclic r & (x,y) ~: r^*)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   216
by (simp_tac (simpset() addsimps [trancl_insert]) 1);
5452
b38332431a8c New theorem wf_not_sym and well-formed wf_asym
paulson
parents: 5337
diff changeset
   217
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   218
qed "acyclic_insert";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   219
AddIffs [acyclic_insert];
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 3320
diff changeset
   220
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4821
diff changeset
   221
Goalw [acyclic_def] "acyclic(r^-1) = acyclic r";
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4686
diff changeset
   222
by (simp_tac (simpset() addsimps [trancl_converse]) 1);
a5dcd7e4a37d inverse -> converse
paulson
parents: 4686
diff changeset
   223
qed "acyclic_converse";
8265
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   224
AddIffs [acyclic_converse];
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   225
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   226
Goalw [acyclic_def,antisym_def] "acyclic r ==> antisym(r^*)";
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   227
by(blast_tac (claset() addEs [rtranclE]
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   228
     addIs [rtrancl_into_trancl1,rtrancl_trancl_trancl]) 1);
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   229
qed "acyclic_impl_antisym_rtrancl";
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   230
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   231
(* Other direction:
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   232
acyclic = no loops
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   233
antisym = only self loops
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   234
Goalw [acyclic_def,antisym_def] "antisym(r^* ) ==> acyclic(r - Id)";
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   235
==> "antisym(r^* ) = acyclic(r - Id)";
187cada50e19 A few lemmas and some Adds.
nipkow
parents: 7570
diff changeset
   236
*)
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   237
6433
228237ec56e5 Added new thms.
nipkow
parents: 5579
diff changeset
   238
Goalw [acyclic_def] "[| acyclic s; r <= s |] ==> acyclic r";
6814
d96d4977f94e expandshort
paulson
parents: 6433
diff changeset
   239
by (blast_tac (claset() addIs [trancl_mono]) 1);
6433
228237ec56e5 Added new thms.
nipkow
parents: 5579
diff changeset
   240
qed "acyclic_subset";
228237ec56e5 Added new thms.
nipkow
parents: 5579
diff changeset
   241
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   242
(** cut **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   243
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   244
(*This rewrite rule works upon formulae; thus it requires explicit use of
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   245
  H_cong to expose the equality*)
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   246
Goalw [cut_def] "(cut f r x = cut g r x) = (ALL y. (y,x):r --> f(y)=g(y))";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4350
diff changeset
   247
by (simp_tac (HOL_ss addsimps [expand_fun_eq]) 1);
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   248
qed "cuts_eq";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   249
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   250
Goalw [cut_def] "(x,a):r ==> (cut f r a)(x) = f(x)";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1485
diff changeset
   251
by (asm_simp_tac HOL_ss 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   252
qed "cut_apply";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   253
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   254
(*** is_recfun ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   255
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4821
diff changeset
   256
Goalw [is_recfun_def,cut_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   257
    "[| is_recfun r H a f;  ~(b,a):r |] ==> f(b) = arbitrary";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   258
by (etac ssubst 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1485
diff changeset
   259
by (asm_simp_tac HOL_ss 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   260
qed "is_recfun_undef";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   261
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   262
(*** NOTE! some simplifications need a different Solver!! ***)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   263
fun indhyp_tac hyps =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   264
    (cut_facts_tac hyps THEN'
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   265
       DEPTH_SOLVE_1 o (ares_tac [TrueI] ORELSE'
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   266
                        eresolve_tac [transD, mp, allE]));
7570
a9391550eea1 Mod because of new solver interface.
nipkow
parents: 7499
diff changeset
   267
val wf_super_ss = HOL_ss addSolver (mk_solver "WF" indhyp_tac);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   268
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   269
Goalw [is_recfun_def,cut_def]
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   270
    "[| wf(r);  trans(r);  is_recfun r H a f;  is_recfun r H b g |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 950
diff changeset
   271
    \ (x,a):r --> (x,b):r --> f(x)=g(x)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
by (etac wf_induct 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   273
by (REPEAT (rtac impI 1 ORELSE etac ssubst 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
by (asm_simp_tac (wf_super_ss addcongs [if_cong]) 1);
1485
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1475
diff changeset
   275
qed_spec_mp "is_recfun_equal";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   276
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   277
9422
4b6bc2b347e5 avoid referencing thy value;
wenzelm
parents: 9181
diff changeset
   278
val prems as [wfr,transr,recfa,recgb,_] = goalw (the_context ()) [cut_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   279
    "[| wf(r);  trans(r); \
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   280
\       is_recfun r H a f;  is_recfun r H b g;  (b,a):r |] ==> \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   281
\    cut f r b = g";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   282
val gundef = recgb RS is_recfun_undef
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   283
and fisg   = recgb RS (recfa RS (transr RS (wfr RS is_recfun_equal)));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   284
by (cut_facts_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   285
by (rtac ext 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4350
diff changeset
   286
by (asm_simp_tac (wf_super_ss addsimps [gundef,fisg]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   287
qed "is_recfun_cut";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   289
(*** Main Existence Lemma -- Basic Properties of the_recfun ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   291
Goalw [the_recfun_def]
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   292
    "is_recfun r H a f ==> is_recfun r H a (the_recfun r H a)";
9970
dfe4747c8318 the final renaming: selectI -> someI
paulson
parents: 9422
diff changeset
   293
by (eres_inst_tac [("P", "is_recfun r H a")] someI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   294
qed "is_the_recfun";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   295
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   296
Goal "[| wf(r);  trans(r) |] ==> is_recfun r H a (the_recfun r H a)";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   297
by (wf_ind_tac "a" [] 1);
4821
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   298
by (res_inst_tac [("f","cut (%y. H (the_recfun r H y) y) r a1")]
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   299
                 is_the_recfun 1);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   300
by (rewtac is_recfun_def);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   301
by (stac cuts_eq 1);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   302
by (Clarify_tac 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   303
by (rtac H_cong2 1);
4821
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   304
by (subgoal_tac
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   305
         "the_recfun r H y = cut(%x. H(cut(the_recfun r H y) r x) x) r y" 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   306
 by (Blast_tac 2);
4821
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   307
by (etac ssubst 1);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   308
by (simp_tac (HOL_ss addsimps [cuts_eq]) 1);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   309
by (Clarify_tac 1);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   310
by (stac cut_apply 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   311
 by (fast_tac (claset() addDs [transD]) 1);
4821
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   312
by (fold_tac [is_recfun_def]);
bfbaea156f43 Modifications due to improved simplifier.
nipkow
parents: 4762
diff changeset
   313
by (asm_simp_tac (wf_super_ss addsimps[is_recfun_cut]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   314
qed "unfold_the_recfun";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   315
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   316
Goal "[| wf r; trans r; (x,a) : r; (x,b) : r |] \
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   317
\     ==> the_recfun r H a x = the_recfun r H b x";
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   318
by (best_tac (claset() addIs [is_recfun_equal, unfold_the_recfun]) 1);
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   319
qed "the_recfun_equal";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   320
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   321
(** Removal of the premise trans(r) **)
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   322
val th = rewrite_rule[is_recfun_def]
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   323
                     (trans_trancl RSN (2,(wf_trancl RS unfold_the_recfun)));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   324
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4821
diff changeset
   325
Goalw [wfrec_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   326
    "wf(r) ==> wfrec r H a = H (cut (wfrec r H) r a) a";
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   327
by (rtac H_cong2 1);
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   328
by (simp_tac (HOL_ss addsimps [cuts_eq]) 1);
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   329
by (rtac allI 1);
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   330
by (rtac impI 1);
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   331
by (res_inst_tac [("a1","a")] (th RS ssubst) 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   332
by (assume_tac 1);
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7249
diff changeset
   333
by (ftac wf_trancl 1);
23e090051cb8 isatool expandshort;
wenzelm
parents: 7249
diff changeset
   334
by (ftac r_into_trancl 1);
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   335
by (asm_simp_tac (HOL_ss addsimps [cut_apply]) 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   336
by (rtac H_cong2 1);    (*expose the equality of cuts*)
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   337
by (simp_tac (HOL_ss addsimps [cuts_eq, cut_apply, r_into_trancl]) 1);
7249
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   338
by (blast_tac (claset() addIs [the_recfun_equal, transD, trans_trancl, 
4886664d7033 tidied some proofs
paulson
parents: 6814
diff changeset
   339
			       r_into_trancl]) 1);
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   340
qed "wfrec";
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   341
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   342
(*---------------------------------------------------------------------------
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   343
 * This form avoids giant explosions in proofs.  NOTE USE OF == 
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   344
 *---------------------------------------------------------------------------*)
10067
ab03cfd6be3a tidied, removing obsolete "goal" commands
paulson
parents: 9970
diff changeset
   345
Goal "[| f==wfrec r H;  wf(r) |] ==> f(a) = H (cut f r a) a";
ab03cfd6be3a tidied, removing obsolete "goal" commands
paulson
parents: 9970
diff changeset
   346
by Auto_tac;
ab03cfd6be3a tidied, removing obsolete "goal" commands
paulson
parents: 9970
diff changeset
   347
by (blast_tac (claset() addIs [wfrec]) 1);   
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   348
qed "def_wfrec";
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1465
diff changeset
   349
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   350
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   351
(**** TFL variants ****)
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   352
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   353
Goal "ALL R. wf R --> \
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   354
\      (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))";
3708
56facaebf3e3 Changed some proofs to use Clarify_tac
paulson
parents: 3457
diff changeset
   355
by (Clarify_tac 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   356
by (res_inst_tac [("r","R"),("P","P"), ("a","x")] wf_induct 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   357
by (assume_tac 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   358
by (Blast_tac 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   359
qed"tfl_wf_induct";
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   360
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   361
Goal "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)";
3708
56facaebf3e3 Changed some proofs to use Clarify_tac
paulson
parents: 3457
diff changeset
   362
by (Clarify_tac 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   363
by (rtac cut_apply 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   364
by (assume_tac 1);
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   365
qed"tfl_cut_apply";
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   366
9181
25f993973fac fixed some weak elim rules, and tidied
paulson
parents: 9108
diff changeset
   367
Goal "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)";
3708
56facaebf3e3 Changed some proofs to use Clarify_tac
paulson
parents: 3457
diff changeset
   368
by (Clarify_tac 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   369
by (etac wfrec 1);
3198
295287618e30 New proofs for TFL
paulson
parents: 2935
diff changeset
   370
qed "tfl_wfrec";