src/ZF/Resid/Residuals.thy
author wenzelm
Sun, 07 May 2006 00:44:50 +0200
changeset 19586 a14871b57387
parent 16417 9bc16273c2d4
child 22808 a7daa74e2980
permissions -rw-r--r--
removed 'concl is' pattern;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      Residuals.thy
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Ole Rasmussen
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     4
    Copyright   1995  University of Cambridge
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     5
    Logic Image: ZF
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     6
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     7
*)
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
     8
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 15481
diff changeset
     9
theory Residuals imports Substitution begin
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    10
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    11
consts
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    12
  Sres          :: "i"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    13
  residuals     :: "[i,i,i]=>i"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    14
  "|>"          :: "[i,i]=>i"     (infixl 70)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    15
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    16
translations
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    17
  "residuals(u,v,w)"  == "<u,v,w> \<in> Sres"
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    18
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    19
inductive
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
    20
  domains       "Sres" <= "redexes*redexes*redexes"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    21
  intros
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    22
    Res_Var:    "n \<in> nat ==> residuals(Var(n),Var(n),Var(n))"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    23
    Res_Fun:    "[|residuals(u,v,w)|]==>   
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    24
                     residuals(Fun(u),Fun(v),Fun(w))"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    25
    Res_App:    "[|residuals(u1,v1,w1);   
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    26
                   residuals(u2,v2,w2); b \<in> bool|]==>   
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    27
                 residuals(App(b,u1,u2),App(0,v1,v2),App(b,w1,w2))"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    28
    Res_redex:  "[|residuals(u1,v1,w1);   
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    29
                   residuals(u2,v2,w2); b \<in> bool|]==>   
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    30
                 residuals(App(b,Fun(u1),u2),App(1,Fun(v1),v2),w2/w1)"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    31
  type_intros    subst_type nat_typechecks redexes.intros bool_typechecks
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    32
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    33
defs
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    34
  res_func_def:  "u |> v == THE w. residuals(u,v,w)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    35
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    36
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
    37
subsection{*Setting up rule lists*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    38
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    39
declare Sres.intros [intro]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    40
declare Sreg.intros [intro]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    41
declare subst_type [intro]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    42
12610
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    43
inductive_cases [elim!]:
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    44
  "residuals(Var(n),Var(n),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    45
  "residuals(Fun(t),Fun(u),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    46
  "residuals(App(b, u1, u2), App(0, v1, v2),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    47
  "residuals(App(b, u1, u2), App(1, Fun(v1), v2),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    48
  "residuals(Var(n),u,v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    49
  "residuals(Fun(t),u,v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    50
  "residuals(App(b, u1, u2), w,v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    51
  "residuals(u,Var(n),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    52
  "residuals(u,Fun(t),v)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    53
  "residuals(w,App(b, u1, u2),v)"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    54
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    55
12610
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    56
inductive_cases [elim!]:
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    57
  "Var(n) <== u"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    58
  "Fun(n) <== u"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    59
  "u <== Fun(n)"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    60
  "App(1,Fun(t),a) <== u"
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    61
  "App(0,t,a) <== u"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    62
12610
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    63
inductive_cases [elim!]:
8b9845807f77 tuned document sources;
wenzelm
parents: 12593
diff changeset
    64
  "Fun(t) \<in> redexes"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    65
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    66
declare Sres.intros [simp]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    67
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
    68
subsection{*residuals is a  partial function*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    69
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    70
lemma residuals_function [rule_format]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    71
     "residuals(u,v,w) ==> \<forall>w1. residuals(u,v,w1) --> w1 = w"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    72
by (erule Sres.induct, force+)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    73
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    74
lemma residuals_intro [rule_format]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    75
     "u~v ==> regular(v) --> (\<exists>w. residuals(u,v,w))"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    76
by (erule Scomp.induct, force+)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    77
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    78
lemma comp_resfuncD:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    79
     "[| u~v;  regular(v) |] ==> residuals(u, v, THE w. residuals(u, v, w))"
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
    80
apply (frule residuals_intro, assumption, clarify)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    81
apply (subst the_equality)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    82
apply (blast intro: residuals_function)+
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    83
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    84
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
    85
subsection{*Residual function*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    86
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    87
lemma res_Var [simp]: "n \<in> nat ==> Var(n) |> Var(n) = Var(n)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    88
by (unfold res_func_def, blast)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    89
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    90
lemma res_Fun [simp]: 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    91
    "[|s~t; regular(t)|]==> Fun(s) |> Fun(t) = Fun(s |> t)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    92
apply (unfold res_func_def)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    93
apply (blast intro: comp_resfuncD residuals_function) 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    94
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    95
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    96
lemma res_App [simp]: 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    97
    "[|s~u; regular(u); t~v; regular(v); b \<in> bool|]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    98
     ==> App(b,s,t) |> App(0,u,v) = App(b, s |> u, t |> v)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
    99
apply (unfold res_func_def) 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   100
apply (blast dest!: comp_resfuncD intro: residuals_function)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   101
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   102
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   103
lemma res_redex [simp]: 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   104
    "[|s~u; regular(u); t~v; regular(v); b \<in> bool|]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   105
     ==> App(b,Fun(s),t) |> App(1,Fun(u),v) = (t |> v)/ (s |> u)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   106
apply (unfold res_func_def)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   107
apply (blast elim!: redexes.free_elims dest!: comp_resfuncD 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   108
             intro: residuals_function)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   109
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   110
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   111
lemma resfunc_type [simp]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   112
     "[|s~t; regular(t)|]==> regular(t) --> s |> t \<in> redexes"
13612
55d32e76ef4e Adapted to new simplifier.
berghofe
parents: 13339
diff changeset
   113
  by (erule Scomp.induct, auto)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   114
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   115
subsection{*Commutation theorem*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   116
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   117
lemma sub_comp [simp]: "u<==v ==> u~v"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   118
by (erule Ssub.induct, simp_all)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   119
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   120
lemma sub_preserve_reg [rule_format, simp]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   121
     "u<==v  ==> regular(v) --> regular(u)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   122
by (erule Ssub.induct, auto)
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
   123
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   124
lemma residuals_lift_rec: "[|u~v; k \<in> nat|]==> regular(v)--> (\<forall>n \<in> nat.   
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   125
         lift_rec(u,n) |> lift_rec(v,n) = lift_rec(u |> v,n))"
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   126
apply (erule Scomp.induct, safe)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   127
apply (simp_all add: lift_rec_Var subst_Var lift_subst)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   128
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   129
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   130
lemma residuals_subst_rec:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   131
     "u1~u2 ==>  \<forall>v1 v2. v1~v2 --> regular(v2) --> regular(u2) --> 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   132
                  (\<forall>n \<in> nat. subst_rec(v1,u1,n) |> subst_rec(v2,u2,n) =  
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   133
                    subst_rec(v1 |> v2, u1 |> u2,n))"
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   134
apply (erule Scomp.induct, safe)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   135
apply (simp_all add: lift_rec_Var subst_Var residuals_lift_rec)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   136
apply (drule_tac psi = "\<forall>x.?P (x) " in asm_rl)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   137
apply (simp add: substitution)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   138
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   139
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   140
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   141
lemma commutation [simp]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   142
     "[|u1~u2; v1~v2; regular(u2); regular(v2)|]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   143
      ==> (v1/u1) |> (v2/u2) = (v1 |> v2)/(u1 |> u2)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   144
by (simp add: residuals_subst_rec)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   145
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   146
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   147
subsection{*Residuals are comp and regular*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   148
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   149
lemma residuals_preserve_comp [rule_format, simp]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   150
     "u~v ==> \<forall>w. u~w --> v~w --> regular(w) --> (u|>w) ~ (v|>w)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   151
by (erule Scomp.induct, force+)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   152
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   153
lemma residuals_preserve_reg [rule_format, simp]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   154
     "u~v ==> regular(u) --> regular(v) --> regular(u|>v)"
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   155
apply (erule Scomp.induct, auto)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   156
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   157
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   158
subsection{*Preservation lemma*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   159
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   160
lemma union_preserve_comp: "u~v ==> v ~ (u un v)"
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   161
by (erule Scomp.induct, simp_all)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   162
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   163
lemma preservation [rule_format]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   164
     "u ~ v ==> regular(v) --> u|>v = (u un v)|>v"
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   165
apply (erule Scomp.induct, safe)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   166
apply (drule_tac [3] psi = "Fun (?u) |> ?v = ?w" in asm_rl)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   167
apply (auto simp add: union_preserve_comp comp_sym_iff)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   168
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   169
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   170
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   171
declare sub_comp [THEN comp_sym, simp]
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   172
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   173
subsection{*Prism theorem*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   174
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   175
(* Having more assumptions than needed -- removed below  *)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   176
lemma prism_l [rule_format]:
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   177
     "v<==u ==>  
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   178
       regular(u) --> (\<forall>w. w~v --> w~u -->   
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   179
                            w |> u = (w|>v) |> (u|>v))"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   180
by (erule Ssub.induct, force+)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   181
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   182
lemma prism: "[|v <== u; regular(u); w~v|] ==> w |> u = (w|>v) |> (u|>v)"
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   183
apply (rule prism_l)
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   184
apply (rule_tac [4] comp_trans, auto)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   185
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   186
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   187
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   188
subsection{*Levy's Cube Lemma*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   189
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   190
lemma cube: "[|u~v; regular(v); regular(u); w~u|]==>   
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   191
           (w|>u) |> (v|>u) = (w|>v) |> (u|>v)"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   192
apply (subst preservation [of u], assumption, assumption)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   193
apply (subst preservation [of v], erule comp_sym, assumption)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   194
apply (subst prism [symmetric, of v])
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   195
apply (simp add: union_r comp_sym_iff)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   196
apply (simp add: union_preserve_regular comp_sym_iff)
13339
0f89104dd377 Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents: 12610
diff changeset
   197
apply (erule comp_trans, assumption)
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   198
apply (simp add: prism [symmetric] union_l union_preserve_regular 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   199
                 comp_sym_iff union_sym)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   200
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   201
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   202
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 13612
diff changeset
   203
subsection{*paving theorem*}
12593
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   204
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   205
lemma paving: "[|w~u; w~v; regular(u); regular(v)|]==>  
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   206
           \<exists>uv vu. (w|>u) |> vu = (w|>v) |> uv & (w|>u)~vu & 
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   207
             regular(vu) & (w|>v)~uv & regular(uv) "
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   208
apply (subgoal_tac "u~v")
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   209
apply (safe intro!: exI)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   210
apply (rule cube)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   211
apply (simp_all add: comp_sym_iff)
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   212
apply (blast intro: residuals_preserve_comp comp_trans comp_sym)+
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   213
done
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   214
cd35fe5947d4 Resid converted to Isar/ZF
paulson
parents: 11319
diff changeset
   215
1048
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
   216
end
5ba0314f8214 New example by Ole Rasmussen
lcp
parents:
diff changeset
   217