src/HOLCF/ex/loeckx.ML
author regensbu
Thu, 29 Jun 1995 16:28:40 +0200
changeset 1168 74be52691d62
parent 896 56b9c2626e81
child 1461 6bcb44e4d6e5
permissions -rw-r--r--
The curried version of HOLCF is now just called HOLCF. The old uncurried version is no longer supported

(* $Id$ *)
(* Elegant proof for continuity of fixed-point operator *)
(* Loeckx & Sieber S.88                                 *)

val prems = goalw Fix.thy [Ifix_def]
"Ifix F= lub (range (%i.%G.iterate i G UU)) F";
by (rtac (thelub_fun RS ssubst) 1);
by (rtac ch2ch_fun 1);
back();
by (rtac refl 2);
by (rtac is_chainI 1);
by (strip_tac 1);
by (rtac (less_fun RS iffD2) 1);
by (strip_tac 1);
by (rtac (less_fun RS iffD2) 1);
by (strip_tac 1);
by (rtac (is_chain_iterate RS is_chainE RS spec) 1);
val loeckx_sieber = result();

(* 

Idea: (%i.%G.iterate i G UU) is a chain of continuous functions and
      Ifix is the lub of this chain. Hence Ifix is continuous.

----- The proof  in HOLCF ----------------------- 

Since we already proved the theorem

val cont_lubcfun = prove_goal Cfun2.thy 
	"is_chain ?F ==> cont (%x. lub (range (%j. ?F j`x)))"


it suffices to prove:

Ifix  = (%f.lub (range (%j. (LAM f. iterate j f UU)`f)))

and 

cont (%f.lub (range (%j. (LAM f. iterate j f UU)`f)))

Note that if we use the term 

%i.%G.iterate i G UU instead of (%j.(LAM f. iterate j f UU))

we cannot use the theorem cont_lubcfun    

*)

val prems = goal Fix.thy  "cont(Ifix)";
by (res_inst_tac 
 [("t","Ifix"),("s","(%f.lub(range(%j.(LAM f. iterate j f UU)`f)))")]
  ssubst 1);
by (rtac ext 1);
by (rewrite_goals_tac [Ifix_def] );
by (subgoal_tac 
  "range(% i.iterate i f UU) = range(%j.(LAM f. iterate j f UU)`f)" 1);
by (etac arg_cong 1);
by (subgoal_tac 
	"(% i.iterate i f UU) = (%j.(LAM f. iterate j f UU)`f)" 1);
by (etac arg_cong 1);
by (rtac ext 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac refl 1);
by (rtac cont_lubcfun 1);
by (rtac is_chainI 1);
by (strip_tac 1);
by (rtac less_cfun2 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac (is_chain_iterate RS is_chainE RS spec) 1);
val cont_Ifix2 = result();

(* the proof in little steps *)

val prems = goal Fix.thy  
"(% i.iterate i f UU) = (%j.(LAM f. iterate j f UU)`f)";
by (rtac ext 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac refl 1);
val fix_lemma1 = result();

val prems = goal Fix.thy  
" Ifix = (%f.lub(range(%j.(LAM f.iterate j f UU)`f)))";
by (rtac ext 1);
by (rewrite_goals_tac [Ifix_def] ); 
by (rtac (fix_lemma1 RS ssubst) 1);
by (rtac refl 1);
val fix_lemma2 = result();

(*
- cont_lubcfun;
val it = "is_chain ?F ==> cont (%x. lub (range (%j. ?F j`x)))" : thm   

*)

val prems = goal Fix.thy "cont Ifix";
by (rtac ( fix_lemma2  RS ssubst) 1);
by (rtac cont_lubcfun 1);
by (rtac is_chainI 1);
by (strip_tac 1);
by (rtac less_cfun2 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac (beta_cfun RS ssubst) 1);
by (rtac  cont2cont_CF1L 1);
by (rtac cont_iterate 1);
by (rtac (is_chain_iterate RS is_chainE RS spec) 1);
val cont_Ifix2 = result();