Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  domain_take_proofs.ML   Sprache: SML

 
(*  Title:      HOL/HOLCF/Tools/Domain/domain_take_proofs.ML
    Author:     Brian Huffman

Defines take functions for the given domain equation
and proves related theorems.
*)


signature DOMAIN_TAKE_PROOFS =
sig(*  Title:      HOL/HOLCF/Tools/Domain/domain_take_proofs.MLAuthor     Brian Huffman
  type iso_info =
    {
      absT : typ,
      repT : typ,
      abs_const : term,
      rep_const : term,
      abs_inverse : thm,
      rep_inverse : thm
    }
  type take_info =
    {
      take_consts : term list,
      take_defs : thm list,
      chain_take_thms : thm list,
      take_0_thms : thm list,
      take_Suc_thms : thm list,
      deflation_take_thms : thm list,
      take_strict_thms : thm list,
      finite_consts : term list,
      finite_defs : thm list
    }
  type take_induct_info =
    {
      take_consts         : term list,
      take_defs           : thm list,
      chain_take_thms     : thm list,
      take_0_thms         : thm list,
      take_Suc_thms       : thm list,
      deflation_take_thms : thm list,
      take_strict_thms    : thm list,
      finite_consts       : term list,
      finite_defs         : thm list,
      lub_take_thms       : thm list,
      reach_thms          : thm list,
      take_lemma_thms     : thm list,
      is_finite           : bool,
      take_induct_thms    : thm list
    }
  val define_take_functions :
    (binding * iso_info) list -> theory -> take_info * theory

  val add_lub_take_theorems :
    (binding * iso_info) list -> take_info -> thm list ->
    theory -> take_induct_info * theory

  val map_of_typ :
    theory -> (typ * term) list -> typ -> term

  val add_rec_type : (string * bool list) -> theory -> theory
  val get_rec_tab : theory -> (bool list) Symtab.table
  val add_deflation_thm : thm -> theory -> theory
  val get_deflation_thms : theory -> thm list
  val map_ID_add : attribute
  val get_map_ID_thms : theory -> thm list
end

structure Domain_Take_Proofs : DOMAIN_TAKE_PROOFS =
struct

type iso_info =
  {
    absT : typ,
    repT : typ,
    abs_const : term,
    rep_const : term,
    abs_inverse : thm,
    rep_inverse : thm
  }

type take_info =
  { take_consts : term list,
    take_defs : thm list,
    chain_take_thms : thm list,
    take_0_thms : thm list,
    take_Suc_thms : thm list,
    deflation_take_thms : thm list,
    take_strict_thms : thm list,
    finite_consts : term list,
    finite_defs : thm list
  }

type take_induct_info =
  {
    take_consts         : term list,
    take_defs           : thm list,
    chain_take_thms     : thm list,
    take_0_thms         : thm list,
    take_Suc_thms       : thm list,
    deflation_take_thms : thm list,
    take_strict_thms    : thm list,
    finite_consts       : term list,
    finite_defs         : thm list,
    lub_take_thms       : thm list,
    reach_thms          : thm list,
    take_lemma_thms     : thm list,
    is_finite           : bool,
    take_induct_thms    : thm list
  }

val beta_ss =
  simpset_of (put_simpset HOL_basic_ss \<^context>
    addsimps @{thms simp_thms} |> Simplifier.add_proc \<^simproc>\<open>beta_cfun_proc\<close>)

(******************************************************************************)

(******************************** theory data *********************************)
(******************************************************************************)

structure Rec_Data = Theory_Data
(
  (* list indicates which type arguments allow indirect recursion *)
  type T = (bool list) Symtab.table
  val empty = Symtab.empty
  fun merge data = Symtab.merge (K true) data
)

fun add_rec_type (tname, bs) =
    Rec_Data.map (Symtab.insert (K true) (tname, bs))

fun add_deflation_thm thm =
    Context.theory_map (Named_Theorems.add_thm \<^named_theorems>\<open>domain_deflation\<close> thm)

val get_rec_tab = Rec_Data.get
fun get_deflation_thms thy =
  rev (Named_Theorems.get (Proof_Context.init_global thy) \<^named_theorems>\<open>domain_deflation\<close>)

val map_ID_add = Named_Theorems.add \<^named_theorems>\<open>domain_map_ID\<close>
fun get_map_ID_thms thy =
  rev (Named_Theorems.get (Proof_Context.init_global thy) \<^named_theorems>\<open>domain_map_ID\<close>)


(******************************************************************************)
(************************** building types and terms **************************)
(******************************************************************************)

open HOLCF_Library

infixr 6 ->>
infix -->>
infix 9 `

fun mk_deflation t =
  let val T = #1 (dest_cfunT (Term.fastype_of t))
  in \<^Const>\<open>deflation T for t\<close> end

fun mk_eqs (t, u) = HOLogic.mk_Trueprop (HOLogic.mk_eq (t, u))

(******************************************************************************)
(****************************** isomorphism info ******************************)
(*abs_inverse thm,

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_isorep_inverse:thm
 
    Drule.zero_var_indexes thm
  end

(******************************************************************************)
(********************* building map functions over types **********************)list
(******************************************************************************)  list

fun  thy ) sub (yp *) list)(:typ  =
  letjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    valthms =get_map_ID_thms java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
deflation_take_thmsthm,
    val rules    :  list
  in
     T
| .rewrite_term thy' ]
    |> Patternreach_thms          : list
  end

(******************************************************************************)********************************)
(********************* declaring definitions and theorems *********************)
(******************************************************************************) :

fun add_qualified_def name (dbind, eqn) =
    Global_Theory.add_def

fun  name, thm(*  Title:      HOL/HOLCF/Tools/Domain/domain_take_proofs.ML
    yield_singleton Global_Theory.add_thms
      ((Binding.qualify_name true dbind name, thm), [])

fun add_qualified_simp_thm name (dbind, thm) =
    yield_singleton Global_Theory.add_thms
      ((Binding.qualify_name true dbind name, thm), [Simplifier.simp_add])

(******************************************************************************)

(************************** defining take functions ***************************)     :typjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(******************************************************************************)  ,
    take_consts         : term list,
fun define_take_functions
    (spec : (binding * iso_info)     take_0_thms         : thm list,
( :           :term,
  let    finite_defs         : thm list,

    (* retrieve components of spec *)
    val dbinds =    is_finite           : bool,
    val      simpset_of(  \^context
take_consts: term,
    val rep_abs_consts =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 []_= ]
      | mk_projs (x::[]) t = [(x, t)]
|mk_projsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    fun mk_cfcomp2  type  bool)finite_consts  ,
mk_cfcomp  f rep_const)

    (* define take functional *)
val newTs :typ  =map dom_eqns
    val )
    val copy_arg = Free ("f", copy_arg_type)
    val copy_args
    fun one_copy_rhs (, (_ rhsT java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
      let
               :thm list,
      
        finite_consts_.java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
     end
    valval map_ID_add        take_defs           : thm     :thm,
        big_lambda
          ( (map (rep_abs_consts
    val take_rhss =
      let
        val n = Free
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      fun mk_deflation=
map          :thm,
end

    (* define take constants *)
const(,take_rhs (hsT,))thy
      let       :hm
        val take_type = \(
     (
        val (take_const, thy) =
           map_of_typ:
         take_eqn= Logicmk_equals, )
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            add_qualified_defin
      inend
     ((take_consts,take_defs ) = java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
      |> fold_map define_take_const java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
   >ListPair.nzip

    (* prove chain_take lemmas *)  =map(concl_ofHOLogic >.dest_eqjava.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
    :list
      let
    | take_0_thms list
        val rules
           =simp_tacput_simpset        fun tac ctxt = simp_tac (put_simpset HOL_basic_ss**java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
        val
      
        add_qualified_simp_thm "chain_take" ( Global_Theory(indingqualify_name   )
      end
 (chain_take_thms java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
      fold_mapprove_chain_take  )thy

    (* prove take_0 lemmas *)
    fun prove_take_0fun add_qualified_simp_thmname, thm =
      let
        val lhs    finite_defs        : list,
        val goal =                 list
        val rules     take_induct_thms     thm
tacctxtsimp_tacput_simpset  addsimpsrules)1
        val take_0_thm = Goal.prove_global thy [] [] goal (tac o #context)
      in
alified_simp_thmtake_0 dbindtake_0_thm java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
      end
    val (take_0_thmsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      fold_map prove_take_0 (take_consts (*********************************************)

    (* prove take_Suc lemmas *)
    val n 
    val take_is = map (fn t => t $ n) take_consts
    fun
          (((take_const, rep_abs
      let
        val lhs  $(<term<>Succlose>$njava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        val
        val( : (  ) list
        val goal = 
        val simps = @{    val dbinds = map fst
val =  
        fun tac ctxt = simp_tac (put_simpset beta_ss ctxt addsimps  iso_infos
        val =Goal thy]]goaltac context
      in
        add_qualified_thmtake_Suc (dbind,take_Suc_thm java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
      end
thms thy)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
      fold_map prove_take_Suc
        take_consts~rep_abs_consts ~~dbinds~dom_eqnsthy

    (* prove deflation theorems for take functions *)
    val deflation_abs_rep_thms = map deflation_abs_rep iso_infos
    val =
      let
          = ("" \^><>\close
funmk_goaltake_const  (take_const n)
        val goal = mk_trp (foldr1 mk_conj (map mk_goal take_consts))
        val bottom_rules =
                in
        val deflation_rules      
          @big_lambda copy_arg
          @deflation_abs_rep_thms
          @ get_deflation_thms thy
      in
Goal  ][  fn{ontext ,.. >
         EVERY
          [resolve_tac ctxt @{thms nat.induct} 1      take_0_thms:thm,
deflation_take_thmsthm,
_simpset  )
           REPEAT (eresolve_tac 
                    resolve_tacctxt,lhsT =
                     ctxt]
          java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    fun           =Binding "_" dbind
|conjunctsn[) thm =[n )]
      |       take_Suc_thms:thm,
          val thmL  RS{ conjunct1
valthmRthm  take_strict_thms:thm,
        in (n, thmL):: conjuncts ns             :term ,
             (, thy
 ( "")
        (map (apsnd Drule.zero_var_indexes)
          (conjuncts dbinds           (conjuncts dbinds deflation_take_thm

    (* prove strictness of take functions *) define_take_functions
    fun prove_take_strict (deflation_takefun prove_chain_takejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        val take_strict_thm =
            Drulez
    @{ deflation_strict OF[])
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
add_qualified_simp_thm dbindtake_strict_thmthy
      end
    val (take_strict_thms, thy) =
      fold_map prove_take_strict
        (eflation_take_thms~ binds

    *prove/take rules)
fun  ((hain_take ),dbindthy =
      let
        
            Drule.zero_var_indexes
              (deflation_chain_min [,deflation_take)
      in
          = take_const$\^>\<>0:nat>
     
     (thy
      fold_mapjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
        (hain_take_thms~ deflation_take_thms ~~ dbinds java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

    (* prove take_below rules *)thmlist,
fun     : list
      let
            take_strict_thmslist
    finite_consts:term list
              
      in
          java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      end
(, 
chain_take_thmstlist
        (deflation_take_thms ~      let

    (* define finiteness predicates *)
dbind)(,_)=
      let
        val    :        val =   (,body
        val finite_bind = Binding.           thm
val(, ) =
          .declare_const_global(finite_bindfinite_type) java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
val   (x,)
        val n = Free       end
        valfinite_rhs}>. \\>\<)
 x(HOLogicexists_const<Type<>natclose> $
            (lambda n ( (mk_capplytake_const$n,        take_consts  ~dbinds ) thy
        val    (* prove deflation theorems for take functions *)
        val (finite_def_thm,     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            add_qualified_definite_def(,finite_eqn
      in (, finite_def_thm)thy
val(inite_constsfinite_defs))=thy
      |> fold_map define_finite_const (dbinds ~~ take_consts)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
|ListPairunzip

    val
      {
         = ,
take_defs,
  rev Named_Theorems       java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
        take_0_thms = take_0_thms,
   take_Suc_thms =take_Suc_thms,
        deflation_take_thms = deflation_take_thms,
        take_strict_thms =            asm_simp_tac (put_simpset HOL_basaddsimps)1
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
s = finite_defs
      }

  in
    (, thy)
  end

fun
    (spec   letval T = ctsn: =let
  =thmRS@ java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
    (lub_take_thms . (.         (thmL ns end
    (thy : theory) qualified_thm
  let(map( (******************************************)
    val dbinds = map fst spec
    val iso_infos = map snd spec
    val absTs = map #absT iso_infos
    val {take_consts, ...} = take_info
val{chain_take_thms,take_0_thms take_Suc_thms, .}=take_info
    val {finite_consts, finite_defs            ,

    val decisive_lemma =
      let
        i info) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  = iso_locale
   map_of_typ
   fn=@ decisive_abs_repx iso_locale_thms
        val n java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      { }OFchain_take)
v add_deflation_thm hm >theory> e)thy
 in\<Const\<>decisive   get_deflation_thms:theory> list
        fun ftake_const =  ( $n
        val = mk_trp( mk_conj( f ))
          =@thm} ::take_0_thms
val =val(,) =
cisive_abs_rep_thms
            @ abs_constterm,
         tac =EVERY
type take_info
            take_defs  list
             (put_simpset  ctxt :list
      invaltake_below_thm=
    fun conjuncts 1 thm =      :  list
      | conjuncts n thm         "take_below" (ake_defsthm,
          val thmL = thm RS     @        val (finite )=
          val thmR
        in thmL :: conjuncts (n-1) thmR end
    val

      (absT finite_const)
      let
        val goal   (inite_const (x )
         type  bool            (ambda k_eq ( $,)))java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
            EVERY [
rewrite_goals_tacfinite_defs
            fun (, bs) =
            resolve_tac ctxt chain_take_thms 1,
           resolve_tac
            resolve_tac decisive_thms]
in
Goal thy][ goal tac #ontext)
      end
    valfinite_thms=
         prove_finite_thm( ~ )

     prove_take_induct(, lub_take ) =
        .export_without_context
          (thm}OF,lub_take ]
val java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
open 
chain_take_thms~decisive_thms)

    al=thy
        |> fold (snd oo add_qualified_thm "finite")
      }
        |> fold (snd oo   

  in
    ((fun(*****************************
  end

unadd_lub_take_theorems
java.lang.StringIndexOutOfBoundsException: Range [35, 4) out of bounds for length 38
    (ake_info )
    (let
    ( :theoryjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20


    (* retrieve components of spec *)
    val dbinds  fst specvalchain_take_thmstake_0_thms,, .}= take_info
    val  = mapsnd
    java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
val=map 
    val {chain_take_thms thms{iso}  [ ,# info

   (* prove take lemmas *)
             decisive_abs_rep_thms
      let
valtake_lemma
               "" ^\open)
(******************************************************************************)
      in
        add_qualified_thm ""dbindtake_lemmajava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
      end
    val (           = mk_decisive( $n
     fold_mapjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
        (    yield_singleton Global_Theory

    (* prove reach lemmas *)
     prove_reach_lemma(hain_take lub_take) thy
let
        val =
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
              ({hm } OF [, lub_takejava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
      in
fun efine_take_functions
     java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    val (reach_thms, thy) =
      fold_map prove_reach_lemma
        (chain_take_thms ~~    valdbinds map hm=

    (* test for finiteness of domain definitions *)
    local
      val types  [^type_name><open>ssum\<close>, <^>\open\<>]
        d   ifmemberop )absTsTthen  finitedT
      andjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          let val d' = d andalso member |mk_projs(:xs) t (, = @{ conjunct2java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [47, 24) out of bounds for length 47
     newTs : list map fst ctxt
    in
      val  =forall(inite) repTs
    end

     ((, take_induct_thms one_copy_rhsrep_abs _ rhsT 
       is_finite
      then
        let
          val ((finites, take_inducts), thy) =
      in
        in
          ((OME, take_inducts, thy)
        end
      else
let
          fun         approve_finite_thm         (no) ( dbinds
              Drule.
                (@{thm     define_take_const (, take_rhs, lhsT_)thy
           take_inducts
mapprove_take_inductvalabs_isoabs_inverse
valthy  sndadd_qualified_thm"
                         (java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
        in
          =Logic (fun  thytheory(:( *term)T:): 
        end

    val =
      
        take_consts         = #    >Pattern.ewrite_term rules[
        take_defs           = #      >  end
        chain_take_thms     = #chain_take_thms (********************* declaring definitions and theorems ****************)
              
              =take_Suc_thms,
        deflation_take_thms = #deflation_take_thms take_info,
       take_strict_thms take_strict_thmstake_info
        finite_consts       = #finite_consts java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
 take_info
      end
        reach_thms          = reach_thms,
        take_lemma_thms     = take_lemma_thms,
        is_finite
 spec:(inding*so_infolist
      }
  in lhstake_const$\^>\open:nat>
    (result, thy)
  end

end

100%


¤ Dauer der Verarbeitung: 0.15 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge