src/ZF/ex/Comb.ML
author clasohm
Tue, 30 Jan 1996 13:42:57 +0100
changeset 1461 6bcb44e4d6e5
parent 782 200a16083201
child 1692 5324be24a5fa
permissions -rw-r--r--
expanded tabs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     1
(*  Title:      ZF/ex/comb.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     3
    Author:     Lawrence C Paulson
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
     6
Combinatory Logic example: the Church-Rosser Theorem
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
     7
Curiously, combinators do not include free variables.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
     8
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
     9
Example taken from
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    10
    J. Camilleri and T. F. Melham.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    11
    Reasoning with Inductively Defined Relations in the HOL Theorem Prover.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    12
    Report 265, University of Cambridge Computer Laboratory, 1992.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    13
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    14
HOL system proofs may be found in
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    15
/usr/groups/theory/hvg-aftp/contrib/rule-induction/cl.ml
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    16
*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    17
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    18
open Comb;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    19
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    20
val [_,_,comb_Ap] = comb.intrs;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    21
val Ap_E = comb.mk_cases comb.con_defs "p#q : comb";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    22
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    23
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    24
(*** Results about Contraction ***)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    25
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    26
bind_thm ("contract_induct",
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    27
    (contract.mutual_induct RS spec RS spec RSN (2,rev_mp)));
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    28
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    29
(*For type checking: replaces a-1->b by a,b:comb *)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    30
val contract_combE2 = contract.dom_subset RS subsetD RS SigmaE2;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    31
val contract_combD1 = contract.dom_subset RS subsetD RS SigmaD1;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    32
val contract_combD2 = contract.dom_subset RS subsetD RS SigmaD2;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    33
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    34
goal Comb.thy "field(contract) = comb";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    35
by (fast_tac (ZF_cs addIs [equalityI,contract.K] addSEs [contract_combE2]) 1);
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 515
diff changeset
    36
qed "field_contract_eq";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    37
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    38
bind_thm ("reduction_refl",
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    39
    (field_contract_eq RS equalityD2 RS subsetD RS rtrancl_refl));
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    40
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    41
bind_thm ("rtrancl_into_rtrancl2",
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    42
    (r_into_rtrancl RS (trans_rtrancl RS transD)));
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    43
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    44
val reduction_rls = [reduction_refl, contract.K, contract.S, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    45
                     contract.K RS rtrancl_into_rtrancl2,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    46
                     contract.S RS rtrancl_into_rtrancl2,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    47
                     contract.Ap1 RS rtrancl_into_rtrancl2,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    48
                     contract.Ap2 RS rtrancl_into_rtrancl2];
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    49
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    50
(*Example only: not used*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    51
goalw Comb.thy [I_def] "!!p. p:comb ==> I#p ---> p";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    52
by (REPEAT (ares_tac (comb.intrs @ reduction_rls) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    53
qed "reduce_I";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    54
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    55
goalw Comb.thy [I_def] "I: comb";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    56
by (REPEAT (ares_tac comb.intrs 1));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 515
diff changeset
    57
qed "comb_I";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    58
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    59
(** Non-contraction results **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    61
(*Derive a case for each combinator constructor*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    62
val K_contractE = contract.mk_cases comb.con_defs "K -1-> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    63
val S_contractE = contract.mk_cases comb.con_defs "S -1-> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    64
val Ap_contractE = contract.mk_cases comb.con_defs "p#q -1-> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    65
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    66
val contract_cs =
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    67
    ZF_cs addSIs comb.intrs
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    68
          addIs  contract.intrs
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    69
          addSEs [contract_combD1,contract_combD2]     (*type checking*)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    70
          addSEs [K_contractE, S_contractE, Ap_contractE]
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    71
          addSEs comb.free_SEs;
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    72
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    73
goalw Comb.thy [I_def] "!!r. I -1-> r ==> P";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    74
by (fast_tac contract_cs 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    75
qed "I_contract_E";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    76
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    77
goal Comb.thy "!!p r. K#p -1-> r ==> (EX q. r = K#q & p -1-> q)";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    78
by (fast_tac contract_cs 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    79
qed "K1_contractD";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    80
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    81
goal Comb.thy "!!p r. [| p ---> q;  r: comb |] ==> p#r ---> q#r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    82
by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    83
by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    84
by (etac rtrancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    85
by (fast_tac (contract_cs addIs reduction_rls) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    86
by (etac (trans_rtrancl RS transD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    87
by (fast_tac (contract_cs addIs reduction_rls) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    88
qed "Ap_reduce1";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    89
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    90
goal Comb.thy "!!p r. [| p ---> q;  r: comb |] ==> r#p ---> r#q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    91
by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    92
by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    93
by (etac rtrancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    94
by (fast_tac (contract_cs addIs reduction_rls) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    95
by (etac (trans_rtrancl RS transD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    96
by (fast_tac (contract_cs addIs reduction_rls) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    97
qed "Ap_reduce2";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    98
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    99
(** Counterexample to the diamond property for -1-> **)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   100
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   101
goal Comb.thy "K#I#(I#I) -1-> I";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   102
by (REPEAT (ares_tac [contract.K, comb_I, comb_Ap] 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   103
qed "KIII_contract1";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   104
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   105
goalw Comb.thy [I_def] "K#I#(I#I) -1-> K#I#((K#I)#(K#I))";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   106
by (DEPTH_SOLVE (resolve_tac (comb.intrs @ contract.intrs) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   107
qed "KIII_contract2";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   108
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   109
goal Comb.thy "K#I#((K#I)#(K#I)) -1-> I";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   110
by (REPEAT (ares_tac (comb.intrs @ [contract.K, comb_I]) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   111
qed "KIII_contract3";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   112
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   113
goalw Comb.thy [diamond_def] "~ diamond(contract)";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   114
by (fast_tac (ZF_cs addIs [KIII_contract1,KIII_contract2,KIII_contract3]
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   115
                    addSEs [I_contract_E]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   116
qed "not_diamond_contract";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   117
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   120
(*** Results about Parallel Contraction ***)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   121
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   122
bind_thm ("parcontract_induct",
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   123
    (parcontract.mutual_induct RS spec RS spec RSN (2,rev_mp)));
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   124
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   125
(*For type checking: replaces a=1=>b by a,b:comb *)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   126
val parcontract_combE2 = parcontract.dom_subset RS subsetD RS SigmaE2;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   127
val parcontract_combD1 = parcontract.dom_subset RS subsetD RS SigmaD1;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   128
val parcontract_combD2 = parcontract.dom_subset RS subsetD RS SigmaD2;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   129
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   130
goal Comb.thy "field(parcontract) = comb";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   131
by (fast_tac (ZF_cs addIs [equalityI, parcontract.K] 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   132
                    addSEs [parcontract_combE2]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   133
qed "field_parcontract_eq";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   134
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   135
(*Derive a case for each combinator constructor*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   136
val K_parcontractE = parcontract.mk_cases comb.con_defs "K =1=> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   137
val S_parcontractE = parcontract.mk_cases comb.con_defs "S =1=> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   138
val Ap_parcontractE = parcontract.mk_cases comb.con_defs "p#q =1=> r";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   139
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   140
val parcontract_cs =
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   141
    ZF_cs addSIs comb.intrs
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   142
          addIs  parcontract.intrs
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   143
          addSEs [Ap_E, K_parcontractE, S_parcontractE, 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   144
                  Ap_parcontractE]
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   145
          addSEs [parcontract_combD1, parcontract_combD2]     (*type checking*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   146
          addSEs comb.free_SEs;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   147
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   148
(*** Basic properties of parallel contraction ***)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   149
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   150
goal Comb.thy "!!p r. K#p =1=> r ==> (EX p'. r = K#p' & p =1=> p')";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   151
by (fast_tac parcontract_cs 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   152
qed "K1_parcontractD";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   153
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   154
goal Comb.thy "!!p r. S#p =1=> r ==> (EX p'. r = S#p' & p =1=> p')";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   155
by (fast_tac parcontract_cs 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   156
qed "S1_parcontractD";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   157
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   158
goal Comb.thy
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   159
 "!!p q r. S#p#q =1=> r ==> (EX p' q'. r = S#p'#q' & p =1=> p' & q =1=> q')";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   160
by (fast_tac (parcontract_cs addSDs [S1_parcontractD]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   161
qed "S2_parcontractD";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   162
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   163
(*Church-Rosser property for parallel contraction*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   164
goalw Comb.thy [diamond_def] "diamond(parcontract)";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   165
by (rtac (impI RS allI RS allI) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   166
by (etac parcontract_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   167
by (ALLGOALS 
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   168
    (fast_tac (parcontract_cs addSDs [K1_parcontractD,S2_parcontractD])));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   169
qed "diamond_parcontract";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   170
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   171
(*** Transitive closure preserves the Church-Rosser property ***)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   173
goalw Comb.thy [diamond_def]
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   174
    "!!x y r. [| diamond(r);  <x,y>:r^+ |] ==> \
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   175
\    ALL y'. <x,y'>:r --> (EX z. <y',z>: r^+ & <y,z>: r)";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   176
by (etac trancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   177
by (fast_tac (ZF_cs addIs [r_into_trancl]) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   178
by (slow_best_tac (ZF_cs addSDs [spec RS mp]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   179
                         addIs  [r_into_trancl, trans_trancl RS transD]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   180
qed "diamond_trancl_lemma";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   181
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   182
val diamond_lemmaE = diamond_trancl_lemma RS spec RS mp RS exE;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   183
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   184
val [major] = goal Comb.thy "diamond(r) ==> diamond(r^+)";
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   185
by (rewtac diamond_def);  (*unfold only in goal, not in premise!*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   186
by (rtac (impI RS allI RS allI) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   187
by (etac trancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   188
by (ALLGOALS
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   189
    (slow_best_tac (ZF_cs addIs [r_into_trancl, trans_trancl RS transD]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   190
                          addEs [major RS diamond_lemmaE])));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   191
qed "diamond_trancl";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   192
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   193
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   194
(*** Equivalence of p--->q and p===>q ***)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   195
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   196
goal Comb.thy "!!p q. p-1->q ==> p=1=>q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   197
by (etac contract_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   198
by (ALLGOALS (fast_tac (parcontract_cs)));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   199
qed "contract_imp_parcontract";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   200
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   201
goal Comb.thy "!!p q. p--->q ==> p===>q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   202
by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   203
by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   204
by (etac rtrancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   205
by (fast_tac (parcontract_cs addIs [r_into_trancl]) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   206
by (fast_tac (ZF_cs addIs [contract_imp_parcontract, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   207
                           r_into_trancl, trans_trancl RS transD]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   208
qed "reduce_imp_parreduce";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   209
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   211
goal Comb.thy "!!p q. p=1=>q ==> p--->q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   212
by (etac parcontract_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   213
by (fast_tac (contract_cs addIs reduction_rls) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   214
by (fast_tac (contract_cs addIs reduction_rls) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   215
by (fast_tac (contract_cs addIs reduction_rls) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   216
by (rtac (trans_rtrancl RS transD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   217
by (ALLGOALS 
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   218
    (fast_tac 
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   219
     (contract_cs addIs [Ap_reduce1, Ap_reduce2]
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   220
                  addSEs [parcontract_combD1,parcontract_combD2])));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 515
diff changeset
   221
qed "parcontract_imp_reduce";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   222
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   223
goal Comb.thy "!!p q. p===>q ==> p--->q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   224
by (forward_tac [trancl_type RS subsetD RS SigmaD1] 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   225
by (dtac (field_parcontract_eq RS equalityD1 RS subsetD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   226
by (etac trancl_induct 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   227
by (etac parcontract_imp_reduce 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   228
by (etac (trans_rtrancl RS transD) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   229
by (etac parcontract_imp_reduce 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   230
qed "parreduce_imp_reduce";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   231
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   232
goal Comb.thy "p===>q <-> p--->q";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   233
by (REPEAT (ares_tac [iffI, parreduce_imp_reduce, reduce_imp_parreduce] 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   234
qed "parreduce_iff_reduce";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   235
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   236
writeln"Reached end of file.";