reorganizing domain package code (in progress)
authorhuffman
Wed Feb 24 16:15:03 2010 -0800 (2010-02-24)
changeset 3544473f645fdd4ff
parent 35443 2e0f9516947e
child 35445 593c184977a4
reorganizing domain package code (in progress)
src/HOLCF/Domain.thy
src/HOLCF/Tools/Domain/domain_axioms.ML
src/HOLCF/Tools/Domain/domain_constructors.ML
src/HOLCF/Tools/Domain/domain_extender.ML
src/HOLCF/Tools/Domain/domain_syntax.ML
src/HOLCF/Tools/Domain/domain_theorems.ML
src/HOLCF/ex/Domain_ex.thy
src/HOLCF/ex/Stream.thy
     1.1 --- a/src/HOLCF/Domain.thy	Wed Feb 24 14:20:07 2010 -0800
     1.2 +++ b/src/HOLCF/Domain.thy	Wed Feb 24 16:15:03 2010 -0800
     1.3 @@ -9,6 +9,7 @@
     1.4  uses
     1.5    ("Tools/cont_consts.ML")
     1.6    ("Tools/cont_proc.ML")
     1.7 +  ("Tools/Domain/domain_constructors.ML")
     1.8    ("Tools/Domain/domain_library.ML")
     1.9    ("Tools/Domain/domain_syntax.ML")
    1.10    ("Tools/Domain/domain_axioms.ML")
    1.11 @@ -230,6 +231,7 @@
    1.12  
    1.13  use "Tools/cont_consts.ML"
    1.14  use "Tools/cont_proc.ML"
    1.15 +use "Tools/Domain/domain_constructors.ML"
    1.16  use "Tools/Domain/domain_library.ML"
    1.17  use "Tools/Domain/domain_syntax.ML"
    1.18  use "Tools/Domain/domain_axioms.ML"
     2.1 --- a/src/HOLCF/Tools/Domain/domain_axioms.ML	Wed Feb 24 14:20:07 2010 -0800
     2.2 +++ b/src/HOLCF/Tools/Domain/domain_axioms.ML	Wed Feb 24 16:15:03 2010 -0800
     2.3 @@ -78,19 +78,8 @@
     2.4            (dc_abs oo (copy_of_dtyp map_tab r (dtyp_of_eq eqn)) oo dc_rep))
     2.5        end;
     2.6  
     2.7 -(* -- definitions concerning the constructors, discriminators and selectors - *)
     2.8 +(* -- definitions concerning the discriminators and selectors - *)
     2.9  
    2.10 -    fun con_def m n (_,args) = let
    2.11 -      fun idxs z x arg = (if is_lazy arg then mk_up else I) (Bound(z-x));
    2.12 -      fun parms vs = mk_stuple (mapn (idxs(length vs)) 1 vs);
    2.13 -      fun inj y 1 _ = y
    2.14 -        | inj y _ 0 = mk_sinl y
    2.15 -        | inj y i j = mk_sinr (inj y (i-1) (j-1));
    2.16 -    in List.foldr /\# (dc_abs`(inj (parms args) m n)) args end;
    2.17 -          
    2.18 -    val con_defs = mapn (fn n => fn (con, _, args) =>
    2.19 -                                    (extern_name con ^"_def", %%:con == con_def (length cons) n (con,args))) 0 cons;
    2.20 -          
    2.21      val dis_defs = let
    2.22        fun ddef (con,_,_) = (dis_name con ^"_def",%%:(dis_name con) == 
    2.23                                                list_ccomb(%%:(dname^"_when"),map 
    2.24 @@ -152,7 +141,7 @@
    2.25    in (dnam,
    2.26        (if definitional then [] else [abs_iso_ax, rep_iso_ax, reach_ax]),
    2.27        (if definitional then [when_def] else [when_def, copy_def]) @
    2.28 -      con_defs @ dis_defs @ mat_defs @ pat_defs @ sel_defs @
    2.29 +      dis_defs @ mat_defs @ pat_defs @ sel_defs @
    2.30        [take_def, finite_def])
    2.31    end; (* let (calc_axioms) *)
    2.32  
    2.33 @@ -226,9 +215,11 @@
    2.34          mk_imp (proj (Bound 2) eqs n $ Bound 1 $ Bound 0,
    2.35          foldr1 mk_disj (mk_conj(Bound 1 === UU,Bound 0 === UU)
    2.36                          ::map one_con cons))));
    2.37 +(* TEMPORARILY DISABLED
    2.38      val bisim_def =
    2.39          ("bisim_def", %%:(comp_dname^"_bisim") ==
    2.40                           mk_lam("R", foldr1 mk_conj (mapn one_comp 0 eqs)));
    2.41 +TEMPORARILY DISABLED *)
    2.42  
    2.43      fun add_one (dnam, axs, dfs) =
    2.44          Sign.add_path dnam
    2.45 @@ -245,7 +236,7 @@
    2.46    in
    2.47      thy
    2.48      |> Sign.add_path comp_dnam  
    2.49 -    |> add_defs_infer (bisim_def::(if use_copy_def then [copy_def] else []))
    2.50 +    |> add_defs_infer ((*bisim_def::*)(if use_copy_def then [copy_def] else []))
    2.51      |> Sign.parent_path
    2.52      |> fold add_matchers eqs
    2.53    end; (* let (add_axioms) *)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/HOLCF/Tools/Domain/domain_constructors.ML	Wed Feb 24 16:15:03 2010 -0800
     3.3 @@ -0,0 +1,278 @@
     3.4 +(*  Title:      HOLCF/Tools/domain/domain_constructors.ML
     3.5 +    Author:     Brian Huffman
     3.6 +
     3.7 +Defines constructor functions for a given domain isomorphism
     3.8 +and proves related theorems.
     3.9 +*)
    3.10 +
    3.11 +signature DOMAIN_CONSTRUCTORS =
    3.12 +sig
    3.13 +  val add_domain_constructors :
    3.14 +      string
    3.15 +      -> typ * (binding * (bool * binding option * typ) list * mixfix) list
    3.16 +      -> term * term
    3.17 +      -> thm * thm
    3.18 +      -> theory
    3.19 +      -> { con_consts : term list,
    3.20 +           con_defs : thm list }
    3.21 +         * theory;
    3.22 +end;
    3.23 +
    3.24 +
    3.25 +structure Domain_Constructors :> DOMAIN_CONSTRUCTORS =
    3.26 +struct
    3.27 +
    3.28 +(******************************************************************************)
    3.29 +(************************** building types and terms **************************)
    3.30 +(******************************************************************************)
    3.31 +
    3.32 +
    3.33 +(*** Continuous function space ***)
    3.34 +
    3.35 +(* ->> is taken from holcf_logic.ML *)
    3.36 +fun mk_cfunT (T, U) = Type(@{type_name "->"}, [T, U]);
    3.37 +
    3.38 +infixr 6 ->>; val (op ->>) = mk_cfunT;
    3.39 +
    3.40 +fun dest_cfunT (Type(@{type_name "->"}, [T, U])) = (T, U)
    3.41 +  | dest_cfunT T = raise TYPE ("dest_cfunT", [T], []);
    3.42 +
    3.43 +fun capply_const (S, T) =
    3.44 +  Const(@{const_name Rep_CFun}, (S ->> T) --> (S --> T));
    3.45 +
    3.46 +fun cabs_const (S, T) =
    3.47 +  Const(@{const_name Abs_CFun}, (S --> T) --> (S ->> T));
    3.48 +
    3.49 +fun mk_cabs t =
    3.50 +  let val T = Term.fastype_of t
    3.51 +  in cabs_const (Term.domain_type T, Term.range_type T) $ t end
    3.52 +
    3.53 +(* builds the expression (LAM v. rhs) *)
    3.54 +fun big_lambda v rhs =
    3.55 +  cabs_const (Term.fastype_of v, Term.fastype_of rhs) $ Term.lambda v rhs;
    3.56 +
    3.57 +(* builds the expression (LAM v1 v2 .. vn. rhs) *)
    3.58 +fun big_lambdas [] rhs = rhs
    3.59 +  | big_lambdas (v::vs) rhs = big_lambda v (big_lambdas vs rhs);
    3.60 +
    3.61 +fun mk_capply (t, u) =
    3.62 +  let val (S, T) =
    3.63 +    case Term.fastype_of t of
    3.64 +        Type(@{type_name "->"}, [S, T]) => (S, T)
    3.65 +      | _ => raise TERM ("mk_capply " ^ ML_Syntax.print_list ML_Syntax.print_term [t, u], [t, u]);
    3.66 +  in capply_const (S, T) $ t $ u end;
    3.67 +
    3.68 +infix 9 ` ; val (op `) = mk_capply;
    3.69 +
    3.70 +
    3.71 +(*** Product type ***)
    3.72 +
    3.73 +fun mk_tupleT [] = HOLogic.unitT
    3.74 +  | mk_tupleT [T] = T
    3.75 +  | mk_tupleT (T :: Ts) = HOLogic.mk_prodT (T, mk_tupleT Ts);
    3.76 +
    3.77 +(* builds the expression (v1,v2,..,vn) *)
    3.78 +fun mk_tuple [] = HOLogic.unit
    3.79 +  | mk_tuple (t::[]) = t
    3.80 +  | mk_tuple (t::ts) = HOLogic.mk_prod (t, mk_tuple ts);
    3.81 +
    3.82 +(* builds the expression (%(v1,v2,..,vn). rhs) *)
    3.83 +fun lambda_tuple [] rhs = Term.lambda (Free("unit", HOLogic.unitT)) rhs
    3.84 +  | lambda_tuple (v::[]) rhs = Term.lambda v rhs
    3.85 +  | lambda_tuple (v::vs) rhs =
    3.86 +      HOLogic.mk_split (Term.lambda v (lambda_tuple vs rhs));
    3.87 +
    3.88 +
    3.89 +(*** Lifted cpo type ***)
    3.90 +
    3.91 +fun mk_upT T = Type(@{type_name "u"}, [T]);
    3.92 +
    3.93 +fun up_const T = Const(@{const_name up}, T ->> mk_upT T);
    3.94 +
    3.95 +fun mk_up t = up_const (Term.fastype_of t) ` t;
    3.96 +
    3.97 +
    3.98 +(*** Strict product type ***)
    3.99 +
   3.100 +val oneT = @{typ "one"};
   3.101 +
   3.102 +fun mk_sprodT (T, U) = Type(@{type_name "**"}, [T, U]);
   3.103 +
   3.104 +fun spair_const (T, U) =
   3.105 +  Const(@{const_name spair}, T ->> U ->> mk_sprodT (T, U));
   3.106 +
   3.107 +(* builds the expression (:t, u:) *)
   3.108 +fun mk_spair (t, u) =
   3.109 +  spair_const (Term.fastype_of t, Term.fastype_of u) ` t ` u;
   3.110 +
   3.111 +(* builds the expression (:t1,t2,..,tn:) *)
   3.112 +fun mk_stuple [] = @{term "ONE"}
   3.113 +  | mk_stuple (t::[]) = t
   3.114 +  | mk_stuple (t::ts) = mk_spair (t, mk_stuple ts);
   3.115 +
   3.116 +
   3.117 +(*** Strict sum type ***)
   3.118 +
   3.119 +fun mk_ssumT (T, U) = Type(@{type_name "++"}, [T, U]);
   3.120 +
   3.121 +fun dest_ssumT (Type(@{type_name "++"}, [T, U])) = (T, U)
   3.122 +  | dest_ssumT T = raise TYPE ("dest_ssumT", [T], []);
   3.123 +
   3.124 +fun sinl_const (T, U) = Const(@{const_name sinl}, T ->> mk_ssumT (T, U));
   3.125 +fun sinr_const (T, U) = Const(@{const_name sinr}, U ->> mk_ssumT (T, U));
   3.126 +
   3.127 +(* builds the list [sinl(t1), sinl(sinr(t2)), ... sinr(...sinr(tn))] *)
   3.128 +fun mk_sinjects ts =
   3.129 +  let
   3.130 +    val Ts = map Term.fastype_of ts;
   3.131 +    fun combine (t, T) (us, U) =
   3.132 +      let
   3.133 +        val v = sinl_const (T, U) ` t;
   3.134 +        val vs = map (fn u => sinr_const (T, U) ` u) us;
   3.135 +      in
   3.136 +        (v::vs, mk_ssumT (T, U))
   3.137 +      end
   3.138 +    fun inj [] = error "mk_sinjects: empty list"
   3.139 +      | inj ((t, T)::[]) = ([t], T)
   3.140 +      | inj ((t, T)::ts) = combine (t, T) (inj ts);
   3.141 +  in
   3.142 +    fst (inj (ts ~~ Ts))
   3.143 +  end;
   3.144 +
   3.145 +
   3.146 +(*** miscellaneous constructions ***)
   3.147 +
   3.148 +val trT = @{typ "tr"};
   3.149 +
   3.150 +val deflT = @{typ "udom alg_defl"};
   3.151 +
   3.152 +fun mapT T =
   3.153 +  let
   3.154 +    fun argTs (Type (_, Ts)) = Ts | argTs _ = [];
   3.155 +    fun auto T = T ->> T;
   3.156 +  in
   3.157 +    Library.foldr mk_cfunT (map auto (argTs T), auto T)
   3.158 +  end;
   3.159 +
   3.160 +val mk_equals = Logic.mk_equals;
   3.161 +val mk_eq = HOLogic.mk_eq;
   3.162 +val mk_trp = HOLogic.mk_Trueprop;
   3.163 +val mk_fst = HOLogic.mk_fst;
   3.164 +val mk_snd = HOLogic.mk_snd;
   3.165 +
   3.166 +fun mk_cont t =
   3.167 +  let val T = Term.fastype_of t
   3.168 +  in Const(@{const_name cont}, T --> HOLogic.boolT) $ t end;
   3.169 +
   3.170 +fun mk_fix t =
   3.171 +  let val (T, _) = dest_cfunT (Term.fastype_of t)
   3.172 +  in mk_capply (Const(@{const_name fix}, (T ->> T) ->> T), t) end;
   3.173 +
   3.174 +fun ID_const T = Const (@{const_name ID}, T ->> T);
   3.175 +
   3.176 +fun cfcomp_const (T, U, V) =
   3.177 +  Const (@{const_name cfcomp}, (U ->> V) ->> (T ->> U) ->> (T ->> V));
   3.178 +
   3.179 +fun mk_cfcomp (f, g) =
   3.180 +  let
   3.181 +    val (U, V) = dest_cfunT (Term.fastype_of f);
   3.182 +    val (T, U') = dest_cfunT (Term.fastype_of g);
   3.183 +  in
   3.184 +    if U = U'
   3.185 +    then mk_capply (mk_capply (cfcomp_const (T, U, V), f), g)
   3.186 +    else raise TYPE ("mk_cfcomp", [U, U'], [f, g])
   3.187 +  end;
   3.188 +
   3.189 +fun mk_Rep_of T =
   3.190 +  Const (@{const_name Rep_of}, Term.itselfT T --> deflT) $ Logic.mk_type T;
   3.191 +
   3.192 +fun coerce_const T = Const (@{const_name coerce}, T);
   3.193 +
   3.194 +fun isodefl_const T =
   3.195 +  Const (@{const_name isodefl}, (T ->> T) --> deflT --> HOLogic.boolT);
   3.196 +
   3.197 +(* splits a cterm into the right and lefthand sides of equality *)
   3.198 +fun dest_eqs t = HOLogic.dest_eq (HOLogic.dest_Trueprop t);
   3.199 +
   3.200 +fun mk_eqs (t, u) = HOLogic.mk_Trueprop (HOLogic.mk_eq (t, u));
   3.201 +
   3.202 +(*** miscellaneous ***)
   3.203 +
   3.204 +fun declare_consts
   3.205 +    (decls : (binding * typ * mixfix) list)
   3.206 +    (thy : theory)
   3.207 +    : term list * theory =
   3.208 +  let
   3.209 +    fun con (b, T, mx) = Const (Sign.full_name thy b, T);
   3.210 +    val thy = Cont_Consts.add_consts decls thy;
   3.211 +  in
   3.212 +    (map con decls, thy)
   3.213 +  end;
   3.214 +
   3.215 +fun define_consts
   3.216 +    (specs : (binding * term * mixfix) list)
   3.217 +    (thy : theory)
   3.218 +    : (term list * thm list) * theory =
   3.219 +  let
   3.220 +    fun mk_decl (b, t, mx) = (b, Term.fastype_of t, mx);
   3.221 +    val decls = map mk_decl specs;
   3.222 +    val thy = Cont_Consts.add_consts decls thy;
   3.223 +    fun mk_const (b, T, mx) = Const (Sign.full_name thy b, T);
   3.224 +    val consts = map mk_const decls;
   3.225 +    fun mk_def c (b, t, mx) =
   3.226 +      (Binding.suffix_name "_def" b, Logic.mk_equals (c, t));
   3.227 +    val defs = map2 mk_def consts specs;
   3.228 +    val (def_thms, thy) =
   3.229 +      PureThy.add_defs false (map Thm.no_attributes defs) thy;
   3.230 +  in
   3.231 +    ((consts, def_thms), thy)
   3.232 +  end;
   3.233 +
   3.234 +(*** argument preprocessing ***)
   3.235 +
   3.236 +type arg = (bool * binding option * typ) * string;
   3.237 +
   3.238 +
   3.239 +
   3.240 +(******************************* main function ********************************)
   3.241 +
   3.242 +fun add_domain_constructors
   3.243 +    (dname : string)
   3.244 +    (lhsT : typ,
   3.245 +     cons : (binding * (bool * binding option * typ) list * mixfix) list)
   3.246 +    (rep_const : term, abs_const : term)
   3.247 +    (rep_iso_thm : thm, abs_iso_thm : thm)
   3.248 +    (thy : theory) =
   3.249 +  let
   3.250 +    (* TODO: re-enable this *)
   3.251 +    (* val thy = Sign.add_path dname thy; *)
   3.252 +
   3.253 +    (* define constructor functions *)
   3.254 +    val ((con_consts, con_def_thms), thy) =
   3.255 +      let
   3.256 +        fun prep_con (bind, args, mx) =
   3.257 +          (bind, args ~~ Datatype_Prop.make_tnames (map #3 args), mx);
   3.258 +        fun var_of ((lazy, sel, T), name) = Free (name, T);
   3.259 +        fun is_lazy ((lazy, sel, T), name) = lazy;
   3.260 +        val cons' = map prep_con cons;
   3.261 +        fun one_arg arg = (if is_lazy arg then mk_up else I) (var_of arg);
   3.262 +        fun one_con (bind, args, mx) = mk_stuple (map one_arg args);
   3.263 +        fun mk_abs t = abs_const ` t;
   3.264 +        val rhss = map mk_abs (mk_sinjects (map one_con cons'));
   3.265 +        fun mk_def (bind, args, mx) rhs =
   3.266 +          (bind, big_lambdas (map var_of args) rhs, mx);
   3.267 +      in
   3.268 +        define_consts (map2 mk_def cons' rhss) thy
   3.269 +      end;
   3.270 +
   3.271 +    (* TODO: re-enable this *)
   3.272 +    (* val thy = Sign.parent_path thy; *)
   3.273 +
   3.274 +    val result =
   3.275 +      { con_consts = con_consts,
   3.276 +        con_defs = con_def_thms };
   3.277 +  in
   3.278 +    (result, thy)
   3.279 +  end;
   3.280 +
   3.281 +end;
     4.1 --- a/src/HOLCF/Tools/Domain/domain_extender.ML	Wed Feb 24 14:20:07 2010 -0800
     4.2 +++ b/src/HOLCF/Tools/Domain/domain_extender.ML	Wed Feb 24 16:15:03 2010 -0800
     4.3 @@ -167,7 +167,9 @@
     4.4      val thy = thy' |> Domain_Axioms.add_axioms false comp_dnam eqs;
     4.5      val ((rewss, take_rews), theorems_thy) =
     4.6          thy
     4.7 -          |> fold_map (fn eq => Domain_Theorems.theorems (eq, eqs)) eqs
     4.8 +          |> fold_map (fn (eq, (x,cs)) =>
     4.9 +                Domain_Theorems.theorems (eq, eqs) (Type x, cs))
    4.10 +             (eqs ~~ eqs')
    4.11            ||>> Domain_Theorems.comp_theorems (comp_dnam, eqs);
    4.12    in
    4.13      theorems_thy
    4.14 @@ -238,7 +240,9 @@
    4.15      val thy = thy' |> Domain_Axioms.add_axioms true comp_dnam eqs;
    4.16      val ((rewss, take_rews), theorems_thy) =
    4.17          thy
    4.18 -          |> fold_map (fn eq => Domain_Theorems.theorems (eq, eqs)) eqs
    4.19 +          |> fold_map (fn (eq, (x,cs)) =>
    4.20 +               Domain_Theorems.theorems (eq, eqs) (Type x, cs))
    4.21 +             (eqs ~~ eqs')
    4.22            ||>> Domain_Theorems.comp_theorems (comp_dnam, eqs);
    4.23    in
    4.24      theorems_thy
     5.1 --- a/src/HOLCF/Tools/Domain/domain_syntax.ML	Wed Feb 24 14:20:07 2010 -0800
     5.2 +++ b/src/HOLCF/Tools/Domain/domain_syntax.ML	Wed Feb 24 16:15:03 2010 -0800
     5.3 @@ -70,8 +70,6 @@
     5.4            Binding.name ("match_" ^ strip_esc (Binding.name_of con));
     5.5        fun pat_name_ con =
     5.6            Binding.name (strip_esc (Binding.name_of con) ^ "_pat");
     5.7 -      fun con (name,args,mx) =
     5.8 -          (name, List.foldr (op ->>) dtype (map third args), mx);
     5.9        fun dis (con,args,mx) =
    5.10            (dis_name_ con, dtype->>trT,
    5.11             Mixfix(escape ("is_" ^ Binding.name_of con), [], Syntax.max_pri));
    5.12 @@ -100,7 +98,6 @@
    5.13               mk_patT (dtype, mk_ctupleT (map (freetvar "t") (1 upto length args))),
    5.14             Mixfix(escape (Binding.name_of con ^ "_pat"), [], Syntax.max_pri));
    5.15      in
    5.16 -    val consts_con = map con cons';
    5.17      val consts_dis = map dis cons';
    5.18      val consts_mat = map mat cons';
    5.19      val consts_pat = map pat cons';
    5.20 @@ -172,7 +169,7 @@
    5.21          if definitional then [] else [const_rep, const_abs, const_copy];
    5.22  
    5.23    in (optional_consts @ [const_when] @ 
    5.24 -      consts_con @ consts_dis @ consts_mat @ consts_pat @ consts_sel @
    5.25 +      consts_dis @ consts_mat @ consts_pat @ consts_sel @
    5.26        [const_take, const_finite],
    5.27        (case_trans false :: case_trans true :: (abscon_trans false @ abscon_trans true @ Case_trans)))
    5.28    end; (* let *)
     6.1 --- a/src/HOLCF/Tools/Domain/domain_theorems.ML	Wed Feb 24 14:20:07 2010 -0800
     6.2 +++ b/src/HOLCF/Tools/Domain/domain_theorems.ML	Wed Feb 24 16:15:03 2010 -0800
     6.3 @@ -9,7 +9,11 @@
     6.4  
     6.5  signature DOMAIN_THEOREMS =
     6.6  sig
     6.7 -  val theorems: Domain_Library.eq * Domain_Library.eq list -> theory -> thm list * theory;
     6.8 +  val theorems:
     6.9 +    Domain_Library.eq * Domain_Library.eq list
    6.10 +    -> typ * (binding * (bool * binding option * typ) list * mixfix) list
    6.11 +    -> theory -> thm list * theory;
    6.12 +
    6.13    val comp_theorems: bstring * Domain_Library.eq list -> theory -> thm list * theory;
    6.14    val quiet_mode: bool Unsynchronized.ref;
    6.15    val trace_domain: bool Unsynchronized.ref;
    6.16 @@ -135,11 +139,13 @@
    6.17  
    6.18  val dist_eqI = @{lemma "!!x::'a::po. ~ x << y ==> x ~= y" by (blast dest!: below_antisym_inverse)}
    6.19  
    6.20 -fun theorems (((dname, _), cons) : eq, eqs : eq list) thy =
    6.21 +fun theorems
    6.22 +    (((dname, _), cons) : eq, eqs : eq list)
    6.23 +    (dom_eqn : typ * (binding * (bool * binding option * typ) list * mixfix) list)
    6.24 +    (thy : theory) =
    6.25  let
    6.26  
    6.27  val _ = message ("Proving isomorphism properties of domain "^dname^" ...");
    6.28 -val pg = pg' thy;
    6.29  val map_tab = Domain_Isomorphism.get_map_tab thy;
    6.30  
    6.31  
    6.32 @@ -152,7 +158,6 @@
    6.33    val ax_rep_iso  = ga "rep_iso"  dname;
    6.34    val ax_when_def = ga "when_def" dname;
    6.35    fun get_def mk_name (con, _, _) = ga (mk_name con^"_def") dname;
    6.36 -  val axs_con_def = map (get_def extern_name) cons;
    6.37    val axs_dis_def = map (get_def dis_name) cons;
    6.38    val axs_mat_def = map (get_def mat_name) cons;
    6.39    val axs_pat_def = map (get_def pat_name) cons;
    6.40 @@ -167,8 +172,35 @@
    6.41    val ax_copy_def = ga "copy_def" dname;
    6.42  end; (* local *)
    6.43  
    6.44 +(* ----- define constructors ------------------------------------------------ *)
    6.45 +
    6.46 +val lhsT = fst dom_eqn;
    6.47 +
    6.48 +val rhsT =
    6.49 +  let
    6.50 +    fun mk_arg_typ (lazy, sel, T) = if lazy then mk_uT T else T;
    6.51 +    fun mk_con_typ (bind, args, mx) =
    6.52 +        if null args then oneT else foldr1 mk_sprodT (map mk_arg_typ args);
    6.53 +    fun mk_eq_typ (_, cons) = foldr1 mk_ssumT (map mk_con_typ cons);
    6.54 +  in
    6.55 +    mk_eq_typ dom_eqn
    6.56 +  end;
    6.57 +
    6.58 +val rep_const = Const(dname^"_rep", lhsT ->> rhsT);
    6.59 +
    6.60 +val abs_const = Const(dname^"_abs", rhsT ->> lhsT);
    6.61 +
    6.62 +val (result, thy) =
    6.63 +  Domain_Constructors.add_domain_constructors
    6.64 +    (Long_Name.base_name dname) dom_eqn
    6.65 +    (rep_const, abs_const) (ax_rep_iso, ax_abs_iso) thy;
    6.66 +
    6.67 +val axs_con_def = #con_defs result;
    6.68 +
    6.69  (* ----- theorems concerning the isomorphism -------------------------------- *)
    6.70  
    6.71 +val pg = pg' thy;
    6.72 +
    6.73  val dc_abs  = %%:(dname^"_abs");
    6.74  val dc_rep  = %%:(dname^"_rep");
    6.75  val dc_copy = %%:(dname^"_copy");
    6.76 @@ -711,7 +743,9 @@
    6.77    val axs_take_def   = map (ga "take_def"  ) dnames;
    6.78    val axs_finite_def = map (ga "finite_def") dnames;
    6.79    val ax_copy2_def   =      ga "copy_def"  comp_dnam;
    6.80 +(* TEMPORARILY DISABLED
    6.81    val ax_bisim_def   =      ga "bisim_def" comp_dnam;
    6.82 +TEMPORARILY DISABLED *)
    6.83  end;
    6.84  
    6.85  local
    6.86 @@ -1031,6 +1065,7 @@
    6.87  
    6.88  (* ----- theorem concerning coinduction ------------------------------------- *)
    6.89  
    6.90 +(* COINDUCTION TEMPORARILY DISABLED
    6.91  local
    6.92    val xs = mapn (fn n => K (x_name n)) 1 dnames;
    6.93    fun bnd_arg n i = Bound(2*(n_eqs - n)-i-1);
    6.94 @@ -1081,6 +1116,7 @@
    6.95          take_lemmas;
    6.96      in pg [] goal (K tacs) end;
    6.97  end; (* local *)
    6.98 +COINDUCTION TEMPORARILY DISABLED *)
    6.99  
   6.100  val inducts = Project_Rule.projections (ProofContext.init thy) ind;
   6.101  fun ind_rule (dname, rule) = ((Binding.empty, [rule]), [Induct.induct_type dname]);
   6.102 @@ -1092,8 +1128,8 @@
   6.103             ((Binding.name "take_lemmas", take_lemmas ), []),
   6.104             ((Binding.name "finites"    , finites     ), []),
   6.105             ((Binding.name "finite_ind" , [finite_ind]), []),
   6.106 -           ((Binding.name "ind"        , [ind]       ), []),
   6.107 -           ((Binding.name "coind"      , [coind]     ), [])]
   6.108 +           ((Binding.name "ind"        , [ind]       ), [])(*,
   6.109 +           ((Binding.name "coind"      , [coind]     ), [])*)]
   6.110         |> (if induct_failed then I
   6.111             else snd o PureThy.add_thmss (map ind_rule (dnames ~~ inducts)))
   6.112         |> Sign.parent_path |> pair take_rews
     7.1 --- a/src/HOLCF/ex/Domain_ex.thy	Wed Feb 24 14:20:07 2010 -0800
     7.2 +++ b/src/HOLCF/ex/Domain_ex.thy	Wed Feb 24 16:15:03 2010 -0800
     7.3 @@ -122,7 +122,7 @@
     7.4  text {* Rules about constructors *}
     7.5  term Leaf
     7.6  term Node
     7.7 -thm tree.Leaf_def tree.Node_def
     7.8 +thm Leaf_def Node_def
     7.9  thm tree.exhaust
    7.10  thm tree.casedist
    7.11  thm tree.compacts
    7.12 @@ -175,9 +175,11 @@
    7.13  thm tree.finites
    7.14  
    7.15  text {* Rules about bisimulation predicate *}
    7.16 +(* COINDUCTION TEMPORARILY DISABLED
    7.17  term tree_bisim
    7.18  thm tree.bisim_def
    7.19  thm tree.coind
    7.20 +COINDUCTION TEMPORARILY DISABLED *)
    7.21  
    7.22  text {* Induction rule *}
    7.23  thm tree.ind
     8.1 --- a/src/HOLCF/ex/Stream.thy	Wed Feb 24 14:20:07 2010 -0800
     8.2 +++ b/src/HOLCF/ex/Stream.thy	Wed Feb 24 16:15:03 2010 -0800
     8.3 @@ -273,6 +273,7 @@
     8.4  
     8.5  section "coinduction"
     8.6  
     8.7 +(* COINDUCTION TEMPORARILY DISABLED
     8.8  lemma stream_coind_lemma2: "!s1 s2. R s1 s2 --> ft$s1 = ft$s2 &  R (rt$s1) (rt$s2) ==> stream_bisim R"
     8.9   apply (simp add: stream.bisim_def,clarsimp)
    8.10   apply (case_tac "x=UU",clarsimp)
    8.11 @@ -286,6 +287,7 @@
    8.12   apply (erule_tac x="a && y" in allE)
    8.13   apply (erule_tac x="aa && ya" in allE) back
    8.14  by auto
    8.15 +COINDUCTION TEMPORARILY DISABLED *)
    8.16  
    8.17  
    8.18