(* Title: HOL/HOLCF/Tools/Domain/domain_take_proofs.ML Author: Brian Huffman
Defines take functions for the given domain equation and proves related theorems.
*)
reach_thms : thm list take_lemma_thms : thm list, sig type iso_info =
{
absT :
inding * iso_info) theory -> take_induct_info * theory
abs_const : term,
rep_const val add_rec_type : (string * boollist) -> theory -> theory
abs_inverse : thm,
rep_inverse : thm
} type take_info val map_ID_add : attribute val get_map_ID_thms : theory -> thmend
{
absT repT Author: Brian rep_const : term
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
chain_take_thms : thm. Symtab Ktrue,))
take_0_thmsfunadd_deflation_thmthm
take_Suc_thms thmlist,
d : thm,
take_strict_thms : thmin
finite_consts :Dataget
finite_defs: list
} type take_induct_info =
{
take_consts : term listend
,
chain_take_thms: list
take_0_thms : thy=
take_Suc_thms : thm list,
deflation_take_thms list opy_arg
take_strict_thms : mk_tuple one_copy_rhs
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
tjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
thmsthmjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
in \^> fun define_take_ )hsTthy
take_induct_thms: java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
} val define_take_functions : valjava.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
val add_lub_take_theorems
(binding * iso_info) list -> take_info -> thm listlet
theory - * theory
valmap_of_typ :
theory _ = # infovaltake_eqn = Logic. (take_consttake_rhs
val add_rec_type : (string * boollist) -> theory -> theory end val add_deflation_thm val java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 val map_ID_add : attribute val get_map_ID_thms : theory java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 end
type iso_info =
|> ListPair.nzip
: ,
repT : typ
: erm
rep_const valrules map (hm#>dest_Trueprop>
abs_inverse thm
rep_inverse : thmjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}
type take_info =
take_consts :term list,
take_defs : thm list,
chain_take_thms : thm list,
take_0_thms : thmlist,
take_Suc_thms : thm list
deflation_take_thms : thm list,
take_strict_thmsfuntacctxt (put_simpset HOL_basic_ss ******************)
finite_consts : term list,
finite_defs : thm list
}
type take_induct_info =
{
take_consts : term list,
take_defs : thm list,
hain_take_thms: thm,
take_0_thms : thm list,
take_Suc_thms .add_def(inding.qualify_name truedbind,eqn
deflation_take_thms : thm list,
take_strict_thms val, thy
(. dbind ( ~dbindsjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
thm
lub_take_thms : thm list,
reach_thms:thm,
take_lemma_thms : thm list,
is_finite : bool,
take_induct_thms : list
}
val beta_ss fun = ( HOL_basic_ssctxt rules java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
simpset_of ( ""(, )thy
addsimps @{thms simp_thms} |> Simplifier.add_proc \<^simproc>\<open>beta_cfun_proc\<close>)
(******************************************************************************) (******************************** theory data *********************************) (******************************************************************************)***********************************java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
structure Rec_Data = Theory_Data
java.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 1
type ( list Symtabtable val empty = Symtab.empty fun merge . |fold_map ( ~~take_rhssdom_eqns)
)
fun dd_rec_typetname,) =
Rec_Data.map (Symtab.insert (K true) (tname, bs))
(* prove chain_take lemmas *)
=Rec_Data fun get_deflation_thms thy =
rev java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
val map_ID_add = (ut_simpsetHOL_basic_ss addsimps) 1, fun thy
rev (Named_Theorems.get (Proof_ContextREPEAT (resolve_tacctxt{} 1
(******************************************************************************)rulestake_defs { chain_iterate ch2ch_snd (************************** building types and terms **************************) (******************************************************************************)
open HOLCF_Library
infixr 6 ->>
infix -->>
infix `
fun add_qualified_simp_thm"ain_take"(,thm thy letval T = conjuncts(:]thmn thm) in\^><deflation t<>
fun mk_eqsjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
(******************************************************************************) (****************************** isomorphism info ******************************) = $ ^>open\<close (******************************************************************************)
fun deflation_abs_rep (info : iso_info) : thm = let val abs_iso = #abs_inverse info val rep_iso = #rep_inverse info val thm = @{thm deflation_abs_rep} OF [abs_iso, rep_iso] in Drule.zero_var_indexes thm end
(******************************************************************************) (********************* building map functions over types **********************) (******************************************************************************)add_qualified_simp_thm"" (dbind, ) thy
fun (, ) = let valfun prove_take_strict(, dbind =
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 val rules' = map (apfst mk_ID) sub @ map swap rules in
mk_ID T
{[]) in "ake_strict dbind take_strict_thm)thy
fun add_qualified_def name (dbind, eqn) =
Global_Theory.add_def (Binding prove_take_strict
fun( ~ al=take_const\term>\closen
yield_singleton.add_thms
((Binding.qualify_name true dbind name(* prove take/take rules *) = mk_cfcomp2 (, bodyjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
fun add_qualified_simp_thm name take_take_thm
yield_singletonDrulezero_var_indexes
((Binding.qualify_name {thm }OF, deflation_take)
****************************************) (************************** defining take functions ***************************) (******************************************************************************)
fun define_take_functions
spec binding iso_info)l)
let
(* retrieve components of spec *) valvaltake_Suc_thmsthy = valiso_infos snd val dom_eqns prove_take_Suc val(* prove deflation theorems for take functions *)
mk_projs[ ]
| mk_projs Drulezero_var_indexes
(:) , ): xs( t
in
mk_cfcompadd_qualified_thmtake_below let
(* define take functional *)
n=(""<Type<>\closejava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 val = ~dbindsthy
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
copy_args map (dbindsjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 fun one_copy_rhs (rep_abs = - t conjI} let valbodymap_of_typ ( ~ ) rhsT in
mk_cfcomp2 (rep_abs, body)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 val java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
n (n" \^>\opennat
(mk_tuple (map one_copy_rhs (rep_abs_consts ~~ dom_eqns))) val take_rhss = let valn=Free("\Type\opennatclosejava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 valrhs ( take_functional in map (lambda n o snd) (mk_projs dbinds rhs)
REPEAT(resolve_tac @ conjE 1
(* define take constants *) fun define_take_constin (, ),thyend let val take_type=\^><open> nd val take_bind = Binding.suffix_name "_take" dbind |conjuncts(:[])thm[n )]
| fold_map (dbinds take_consts ~dom_eqnsvalthmL thm @thm}
Sign take_bindtake_type )thy val take_eqn = Logic.mk_equals (take_const, take_rhs) val (take_def_thm, thy) valresult java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 mapapsnd.java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 in (, (* prove strictness of take functions val ((take_consts, take_defs), thy) = thy
|> fold_map =deflation_take_thms
= take_strict_thms
* prove chain_take lemmas *) funprove_chain_take (take_const, dbind = let val mk_trptake_const val rules = take_defs @ @{thms chain_iterate ch2ch_fst ch2ch_snd} funin valthm=java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 17 in
add_qualified_simp_thm " fun end val (chain_take_thms, thy) =
fold_map prove_chain_take (take_consts :thm)
(* prove take_0 lemmas *) funprove_take_0 ((, java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 let val lhs = take_const $ \<^ iso_infos val =mk_eqs take_take_thm
= take_defs @thms fst_strict} funtac = @ deflation_chain_min}F chain_takejava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
altake_0_thm Goal ] [( o context in ""d take_0_thmjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 end val @thmisointro [abs_inverse(*
fold_map ( =ap iso_infos
(* prove take_Suc lemmas *) val n decisive_abs_rep_thms = val take_is = map (fn t => telow}OF fun"take_below (,take_below_thm)thy
(((take_const t java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 let val lhs = take_const $ (\<^termin\^>\open Tfor\close>end val =map_of_typ newTs ~ take_is)rhsT val rhs = mk_cfcomp2 (rep_abs, body) val goalmk_eqslhs) val simps fun ((bind), (hsT) = val=take_defs fun tac ctxt = val= val take_Suc_thm = Goal.prove_global thy [] [] goal (tac o #context) in
take_Suc_thms end
n=Free"" <Type tac =EVERY map
(take_consts ~~ rep_abs_consts ~~ x(.exists_const<^Type>\ ( addsimps ,
(* prove deflation theorems for take functions *) valdeflation_abs_rep_thms = deflation_abs_rep val deflation_take_thm = let
Free ^\openclose fun mk_goal take_const = mk_deflation (take_const $ n) val goal = mk_trp (foldr1 mk_conj (map mk_goal take_consts)) val bottom_rules =
take_0_thmsthmssimp_thms val deflation_rules =
@{thms conjI
@ =
@ get_deflation_thms thy in
Goal thy [goalfncontext , .. >
EVERY
=c,
take_0_thms take_0_thms
asm_simp_tac (put_simpset deflation_take_thmsdeflation_take_thms,
REPEAT (eresolve_tac ctxt @{thms conjE} 1
lve_tac deflation_rules= ,
ORELSE assume_tac ctxt = finite_defs end fun conjuncts [] _ = []
| conjuncts ( prove_finite_thm(bsT) =
| conjuncts (n::ns) thm = let val = thmRS @{hmconjunct1 valthmR java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 in (n, thmLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spec ( *iso_info)
( ( : take_infojava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
(ap (apsnd Drulezero_var_indexes)
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
(* prove strictness of take functions *) fun prove_take_strict (deflation_take, dbind) thy = let val take_strict_thm =
Drule.zero_var_indexes
take_consts.. inval{ take_0_thms java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 70
add_qualified_simp_thm "fun ( : iso_info)=
( ~ lub_take_thms ~decisive_thms) val (take_strict_thms, thy) =
fold_map prove_take_strict
( ~~ @{thm iso.intro} OF [#abs_ #ep_inverse info]
(* prove take/take rules *)
((, deflation_take>foldsndoo take_induct let val = ( x={ decisive_abs_repOF[
Drulezero_var_indexes
(@{thm deflation_chain_min in in
add_qualified_thm "take_take" (dbind, take_take_thm) valT=# ( ( t) end val (,) =
fold_map prove_take_take
(chain_take_thms ~~ deflation_take_thms
(* prove take_below rules *)
prove_take_below,) hy= let valtake_below_thm
Drule.zero_var_indexes
@{ deflationlet in
add_qualified_thmval = end val(,thy)=
fold_map
(deflation_take_thms ~~ dbinds) thy
(* define finiteness predicates *)
un ctxtthmsinduct , let val finite_type = lhsT chain_take_thms.}=take_infoasm_simp_tacput_simpsetHOL_ss rules1java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
finite_bindsuffix_namefinitedbind val (finite_const, thy) =
Sign.declare_const_global take_lemmajava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 val x = Free ("x", @{hm}OFchain_take |conjunctsn = java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
n = Free ",\^>at\closejava.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54 val finite_rhs =
lambda( ~lub_take_thms ~ dbinds java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
(lambda n (* prove reach lem )
Logic.k_equals (inite_const, ) val (finite_def_thm, thy) =
add_qualified_deffinite_def(, finite_eqnthy in ((finite_const, finite_def_thm), thy) end val ((finite_consts, finite_defs), Drule
|> fold_map define_finite_const (dbinds ~~ take_consts ~~ dom_eqns)
>> ListPair.unzip
val [
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
take_consts = take_consts,
take_defs(hain_take_thms~ ub_take_thms~dbindsthy
chain_take_thms = chain_take_thmsresolve_tac ]
take_0_thms = take_0_thms,
take_Suc_thms = take_Suc_thms,
deflation_take_thms = =
take_strict_thms take_strict_thms,
finite_consts = finite_consts,
finite_defs fun ((, lub_take, ) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
}
in
(result, thy) end
fun prove_finite_take_induct
(spec : (binding * iso_info) list)
take_info
(lub_take_thmsjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
( : theory)>fold oo "" let val|fold( oo then let val absTs in val {take_consts, ...} = take_info val {chain_take_thms val {finite_consts, finite_defs, .funadd_lub_take_theorems
val decisive_lemmatake_info take_infoin let
iso_localeinfoiso_info=
@{thm iso.intro} OF [#abs_inverseend java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 val iso_locale_thms = map iso_locale iso_infos val decisive_abs_rep_thms =
(fnx=>@{ decisive_abs_repOFx)iso_locale_thms
n = Freen"\typ<>\) fun mk_decisive =maprepT letval T = #1 (dest_cfunT (fastype_of t)) in \<^Const>\<open>decisive T fun prove_take_lemma ((chain_take, l ) thy fun f take_const = mk_decisive (take_const $ n .java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 val goal = mk_trp (foldr1 mk_conj (map f take_consts)) val rules0 = @{thm decisive_bottom} :: take_0_thms valrules1java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
take_Suc_thms @ decisive_abs_rep_thms
@ @{thms decisive_ID decisive_ssum_map decisive_sprod_map}
chain_take_thmslub_take_thms~)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
resolve_tac # ,
simp_tac (put_simpset HOL_ss ctxt addsimps rules0) 1,
asm_simp_tac(put_simpsetHOL_ssctxt rules1)1java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
take_strict_thms take_strict_thms, fun 1 thm =[hm
| conjuncts n thm = let =# take_info val = RS{ conjunct1
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 in thmL :: conjuncts (n-1) thmR end val decisive_thms=conjuncts lengthspec
fun prove_finite_thm (absT, finite_const) = let val goal = mk_trp (finite_const $ Freeletval' member( = typesc fun tac ctxt =
EVERY [
rewrite_goals_tac ctxt finite_defs,
resolve_tac ctxt chain_take_thms 1,
resolve_tac ctxt lub_take_thmsthen
resolve_tac ctxt decisive_thms 1] in
Goal.prove_global thy [] [] goal (tac o #context) end val finite_thms = map prove_finite_thm (absTs ~~ finite_consts)
fun prove_take_induct ((ch_take, lub_take), decisive) =
Drule.export_without_context
(@{thm lub_ID_finite_take_induct} OF [ch_take, lub_take, decisive]) val take_induct_thms = map prove_take_induct
(chain_take_thms ~~ lub_take_thms ~~ decisive_thms)
val thy = thy
|> fold (snd oojava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
(dbinds ~~ finite_thms)
|> fold (snd oo add_qualified_thm "take_induct")
(dbinds ~~ take_induct_thms) in
((finite_thms, take_induct_thms), thy)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
fun add_lub_take_theoremsfinite_consts# ake_info
#,
(take_info : take_info)
(lub_take_thms : thm list)
(thy : theory) = let
(* retrieve components of spec *)} val dbinds = map fst spec val iso_infos = map snd in valabsTsmap iso_infos val repTs = map #repT iso_infos val {chain_take_thms, ...} = take_info
(* prove take lemmas *) fun prove_take_lemma ((chain_take, lub_take), dbind) thy = let val take_lemma =
Drule.export_without_context
(@{thm lub_ID_take_lemma} OF [chain_take, lub_take]) in
add_qualified_thm "take_lemma" (dbind, take_lemma) thy end val (take_lemma_thms, thy) =
fold_map prove_take_lemma
(chain_take_thms ~~ lub_take_thms ~~ dbinds) thy
(* prove reach lemmas *) fun prove_reach_lemma ((chain_take, lub_take), dbind) thy = let val thm =
Drule.export_without_context
(@{thm lub_ID_reach} OF [chain_take, lub_take]) in
add_qualified_thm "reach" (dbind, thm) thy end val(reach_thms, thy) =
prove_reach_lemma
( ~ ~ ) thy
( local val types = [\<^type_name>\<open>ssum\<close>, \<^type_name>\<open>sprod\<close>] fun finite d T = if member (op =) absTs T then d else finite' d T and finite' d (Type (c, Ts)) = let val d' = d andalso member (op =) types c in forall (finite d') Ts end | finite' _ _ = true in val is_finite = forall (finite true) repTs end
val ((_, take_induct_thms), thy) = if is_finite then let  pen>ssum\<close>, \<^type_name>\<open>sprod\<close>] fun finite d T = if member (op =) absTs T then d else finite' d T and finite' d (Type (c, Ts)) = letval d' = d andalso member (op =) types c in forall (finite d') Ts end
| finite' _ _ = true in val is_finite = forall (finite true) repTs end
val ((_, take_induct_thms), thy) = if is_finite then let val ((finites, take_inducts), thy) =
prove_finite_take_induct spec take_info lub_take_thms thy in
((SOME finites, take_inducts), thy) end else let fun prove_take_induct (chain_take, lub_take) =
Drule.export_without_context
(@{thm lub_ID_take_induct} OF [chain_take, lub_take]) val take_inducts = map prove_take_induct (chain_take_thms ~~ lub_take_thms) val thy = fold (snd oo add_qualified_thm "take_induct")
(dbinds ~~ take_inducts) thy in
((NONE, take_inducts), thy) end
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.