src/HOLCF/Lift.ML
author wenzelm
Mon, 07 Jul 1997 09:05:16 +0200
changeset 3502 ec22ba0a26ec
parent 3457 a8ab7c64817c
child 3655 0531f2c64c91
permissions -rw-r--r--
added -w option;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     1
open Lift;
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     2
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     3
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     4
    section"Continuity Proofs for flift1, flift2, if";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     5
(* need the instance into flat *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     6
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     7
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     8
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
     9
(* flift1 is continuous in its argument itself*)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    10
goal thy "cont (lift_case UU f)"; 
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    11
by (rtac flatdom_strict2cont 1);
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    12
by (Simp_tac 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    13
qed"cont_flift1_arg";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    14
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    15
(* flift1 is continuous in a variable that occurs only 
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    16
   in the Def branch *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    17
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    18
goal thy "!!f. [| !! a.cont (%y. (f y) a) |] ==> \
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    19
\          cont (%y. lift_case UU (f y))";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    20
by (rtac cont2cont_CF1L_rev 1);
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    21
by (strip_tac 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    22
by (res_inst_tac [("x","y")] Lift_cases 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    23
by (Asm_simp_tac 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    24
by (fast_tac (HOL_cs addss !simpset) 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    25
qed"cont_flift1_not_arg";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    26
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    27
(* flift1 is continuous in a variable that occurs either 
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    28
   in the Def branch or in the argument *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    29
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    30
goal thy "!!f. [| !! a.cont (%y. (f y) a); cont g|] ==> \
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    31
\   cont (%y. lift_case UU (f y) (g y))";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    32
by (rtac cont2cont_app 1);
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    33
back();
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    34
by (safe_tac set_cs);
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    35
by (rtac cont_flift1_not_arg 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    36
by (Auto_tac());
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    37
by (rtac cont_flift1_arg 1);
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    38
qed"cont_flift1_arg_and_not_arg";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    39
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    40
(* flift2 is continuous in its argument itself *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    41
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    42
goal thy "cont (lift_case UU (%y. Def (f y)))";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3324
diff changeset
    43
by (rtac flatdom_strict2cont 1);
3324
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    44
by (Simp_tac 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    45
qed"cont_flift2_arg";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    46
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    47
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    48
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    49
(*    Extension of cont_tac and installation of simplifier    *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    50
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    51
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    52
bind_thm("cont2cont_CF1L_rev2",allI RS cont2cont_CF1L_rev);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    53
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    54
val cont_lemmas_ext = [cont_flift1_arg,cont_flift2_arg,
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    55
                       cont_flift1_arg_and_not_arg,cont2cont_CF1L_rev2, 
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    56
                       cont_fapp_app,cont_fapp_app_app,cont_if];
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    57
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    58
val cont_lemmas2 =  cont_lemmas1 @ cont_lemmas_ext;
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    59
                 
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    60
Addsimps cont_lemmas_ext;         
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    61
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    62
fun cont_tac  i = resolve_tac cont_lemmas2 i;
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    63
fun cont_tacR i = REPEAT (cont_tac i);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    64
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    65
fun cont_tacRs i = simp_tac (!simpset addsimps [flift1_def,flift2_def]) i THEN
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    66
                  REPEAT (cont_tac i);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    67
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    68
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    69
simpset := !simpset addSolver (K (DEPTH_SOLVE_1 o cont_tac));
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    70
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    71
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    72
              section"flift1, flift2";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    73
(* ---------------------------------------------------------- *)
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    74
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    75
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    76
goal thy "flift1 f`(Def x) = (f x)";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    77
by (simp_tac (!simpset addsimps [flift1_def]) 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    78
qed"flift1_Def";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    79
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    80
goal thy "flift2 f`(Def x) = Def (f x)";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    81
by (simp_tac (!simpset addsimps [flift2_def]) 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    82
qed"flift2_Def";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    83
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    84
goal thy "flift1 f`UU = UU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    85
by (simp_tac (!simpset addsimps [flift1_def]) 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    86
qed"flift1_UU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    87
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    88
goal thy "flift2 f`UU = UU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    89
by (simp_tac (!simpset addsimps [flift2_def]) 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    90
qed"flift2_UU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    91
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    92
Addsimps [flift1_Def,flift2_Def,flift1_UU,flift2_UU];
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    93
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    94
goal thy "!!x. x~=UU ==> (flift2 f)`x~=UU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    95
by (def_tac 1);
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    96
qed"flift2_nUU";
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    97
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    98
Addsimps [flift2_nUU];
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
    99
6b26b886ff69 Eliminated the prediates flat,chfin
slotosch
parents:
diff changeset
   100