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

Benutzer

Quelle  W.thy

  Sprache: Isabelle
 

(* Title:     MiniML/W.thy
   Author:    Dieter Nazareth, Wolfgang Naraschewski and Tobias Nipkow
   Copyright1996TU Muenchen
    result_W = "(subst* yp*nat) optionjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
*)


sectionSome$2 \circ S1 t2, m2) )"

theory W
  imports MiniML
begin

type_synonym result_W = "(subst * typ * nat) option"

\<comment>
fun W :: " ,ctxt, nat> result_" where
 "W (Var i) A n =
 (if i < length hashastype:
 bound_typ_inst (λ) (A!i),
 n + (min_new_bound_tv (A!i)) )
 else None)"

  "W (Abs e) A n = ( (S,t,m) := W e ((FVar n)#A) (SVar n :: t"
 Some( S, (S n) -> t, m) )"

  "W (App e1 e2) A n = ( (S1,t1,m1) := W e1 A n;
 (S2,t22 = W e2$SS )m1;
 : g $2t)(2-> (TVar m2));
 Some( $U >Abs e :: t"

  "W (LET e1 e2) A n = ( (S1,t1,m1) := W e1 A n;
 (S2,t2,m2) := W e2 ((gen ($S1 A) t1)#($S1 A)) m1;
 Some( $S2


  Suc_le_lessD [simp]

  has_ty App e1 e2 ::t"
 "A
 "A "A \A
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
 "A


 
  W_var_ge:
 "W e A n = e A n = Some (,,)\Longrightarrow e
  (induction e arbitra: A n S t m)
 case Var thus ?case by (auto split: if_splits)
 
 case Abs thus ?case by (fastforce split: splits
 
 case App thus ?case by (fastforce split: split_option_bind_asm)
 
 case LET thus ?case by (fastforce split: split_option_bind_asm)
  lessI new_tv_Cons new_tv_FVar new_tv_Suc new_tv_compatible_ )

declare W_var_ge [simp] (* FIXME*)

lemma thus
  "Some (S,t,m) = W e A n \<apply(S x
  by (metis W_var_ge)


lemma new_tv_compatible_W:
  "new_tv n A ==> Some (S,t,m) = W e A n ==> auto
  metis new_tv_le)

lemma new_tv_bound_typ_inst_scht, <>          
  " (v v v<n ==>free_tv A"
proof (induction sch)
  case FVar thus ?case by simp
next
  case BVar thusTrue
next
  case SFun ( W.simps free_tv_nth_A_impl_free_tv_A not_None_eq
qed

ent
lemma  [rule_format
  "thesis
               new_tv m S fsimp: o_def free_tv_nth_A_impl_free_tv_A dest: free_tv_ound_t
proof (induction e)
  case Var thus ?case
    by (auto simp add: new_tv_bound_typqed
next
  case Abs thus ?case
    apply (simp add:t m vv)
    by (methen obtain S1 t1 n1where " e FVar Some
next
  case App (lifting Wsimpsnot_None_eq
    apply (simp split: split_option_bind)
    by (smtverit) W_var_geD funfunmap_comp lessI mgu_new new_tv_Sucnew_tv_le new_tv_subst new_tv_subst_scheme_list)
next
  T thus case
    apply (simp simp codD cod_app_subst
     (metis W_var_ge new_tv_Cons new_tv_compatible_gen new_tv_le new_tv_subst_scheme_list
qed

lemma free_tv_bound_typ_inst1:
  "v
  by (induction sch) auto

lemma free_tv_W:
  " e A n =Some,t,)\Longrightarrow           
          v\in> S free_tv t) ==>>v "
proof (induction e arbitrary: n A S t m v)
  case (Var i)
  show ?case
  proof (cases " \in>ree_tv
    case True
    with Var show ?thesis
      by and e1 e1t'n1
  next
    case False
    with mgu"(S12  ome
      by (force simp" " e2yo
          split: if_split_asm "v <in> frefree_tv A"
  qed
next
   n A  t m v)
  then     proof
    by (assume"v $ S1 S')"
  then have "v \in> ffree_tv S2 x. $ S1 (S' x))"
    using.IH "FVar # A" n" S1 t1 n1v] Abs.prem
    by (forcesubsetD)
next
  case (App e1 e2 n A S t m v)
  then show ?moreove
  proof (clarsimp split: split_option_bind_asm prod.split_asm)
    fix S' t' n1 S1 t1 n2 S2
    assume v: " $ S1  v 
        using mgumgu_free byfastforce
      show\in_
      and App n v1 <>v e1e2 free_tv_app_subst_scheme_list
      and mgu: "by (sm (verit, ccfv_threshold) Un_iff free_t free_tv_o_subst
    have n: " \le n1" "n1  n2"
      using e1 e2 by auto
    show "    
      using v2"v
    proof
      assume v1: "\using App n by linarith
      then have "v uni> free_tv (λx. $ S1 (S' x))"
        by (metis (no_types, lifting) ext comp_apply free_tv_o_subst fun.map_comp
            subsetD)
      moreover
      have "free_tv S2 insert n2 (free_tv ($ S1 t') free_tv t1)"
        using mgu mgu_free by fastforce
      ultimately
      show "v free_tv A"
        using App.IH n v1  e2 codD free_tv_app_sub
 by (smt (verit, ccfv_threshold) Un_iff free_tv_app_subst_te free_tv_o_subst
 fun.ap_comp insert_iff linorder_not_less order.stricsubsetD)
 next
 assume v2: "v free_tv A"
 then have "v < n1 n v2 <<open e1 e2 codD free_tv_app_subst_
 using App.prems n by linarith
 then have "free_tv S2 (sm (verit, ccfv_threshold) UnE cod_app_sbst empty_iff
  mgu mgu_free by blast
 then show "v
 sing App..IH n v2 v<n1\
 by (smt (verit, ccfv_threshold) UnE cod_app_subst empty_iff case (LETe1e2 n A S
 free_tv_app_subst_te free_tv_typ.simps insert_iff linorder_not_less subsetD)
 qed
 qed
 
 case (LET e1 e2 n A S t2 n3 v)
 then show ?case
 proof (clarsimp split: split_option_bind_asm prod.split_asm)
 fix S1 t1 n2 S2
 assume "v (clarimp sp split: split_option_bind_a prod.split_a)
 and "v < n
 and "W e1 A n = Some (S1, t1, n2)"
 and "W e2 (gen ($ S1 A) t1 # $ S1 A) n2 = Some (S2, t2, n3)"
 with LET.IH
 show "v " nS1) \<or 
 by (smt (verit) Un_iff W_var_geD codD free_tv_app_subst_scheme_list
 free_tv_gen_cons free_tv_o_subst order.strict_trans2 subsetD)
 qed
 

  weaken_A_Int_B_eq_empty: "(x. x A x B) ==> A B = {}"
 by blast

  weaken_not_elem_A_minus_B: "x We1 A A = Some (, t1, n2)"
 by blast

  correctness of W with respect to @{text has_type}
  W_correct_lemma: "[new_tv n A; Some (S,t,m) = W e A n] ==> $S A e :: t"
  (induction "e" arbitrary: A S t m n)
 case Var thus ?case
 using is_bound_typ_instance by (auto split: if_splits)
 
 case (Abs e) thus ?case
 apply (simp split: split_option_bind_asm prod.splits)
 by (metis AbsI app_subst_Cons app_subst_type_scheme.simps(1) lessI new_tv_Cons
 new_tv_FVar new_tv_Suc)
 
 case (App e1 e2)
 then show ?case
 proof (simp split: split_option_bind_asm prod.splits)
 fix S1 t1 n1 S2 t2 n2 S3
 assume e1: "W e1 A n = Some (S1, t1, n1)"
 and e2: "W e2 ($ S1 A) n1 = Some (S2, t2, n2)"
 and mgu: "mgu ($ S2 t1) (t2 -> TVar n2) = Some S3"
 show "$ (λa. $ S3 ($ S2 (S1 a))) A App e1 e2 :: S3 n2"
 proof (rule has_type.AppI)
 have "$ S3 (t2 -> TVar n2) = $ S3 ($ S2 t1)"
 using mgu mgu_eq by presburger
 with App show "$ (λa. $ S3 ($ S2 (S1 a))) A e1 :: $ S3 t2 -> S3 n2"
 by (metis (no_types) Type.app_subst_Fun Type.app_subst_TVar e1 has_type_cl_sub subst_comp_scheme_list)
 show "$ (λa. $ S3 ($ S2 (S1 a))) A e2 :: $ S3 t2"
 using e1 e2 mgu App
 by (metis has_type_cl_sub new_tv_W new_tv_compatible_W new_tv_subst_scheme_list
 subst_comp_scheme_list)
 qed
 qed
 
 case (LET e1 e2) thus ?case
 proof (simp split: split_option_bind_asm prod.splits)
 fix S1 t1 m1 S2
 assume "new_tv n A"
 and e1: "W e1W e1 A n = Some S1, t1, m1)"
 and e2: "W e2 (gen ($ S1 A) t1 # $ S1 A) m1 = Some (S2, t, m)"
 show "$ (λby (smt (v) Un_iff W_var_
 proof (rule has_type.LETI)
 show "$ (λa. $ S2 (S1 a)) A e1 :: $ S2 t1"
 using LET e1 by (metis (no_types, lifting) has_type_cl_sub sust_comp_scheme_list)
 have "free_tv S2 (free_tv t1 - free_tv ($ S1 A)) = {}" 
 using e1 e2 LEsing e1 e2 LET
 by (smt (verit) DiffD2 Diff_subset free_tv_W free_tv_gen_cons
 free_tv_le_new_tv new_tv_W subsetD weaken_A_Int_B_eq_empty)
 then
 show "gen ($ (λa. $ S2 (S1 a)) A) ($ S2 t1) # $ (λa. $ S2 (S1 a)) A e2 :: t"
 using e1 e2 LET
 by (metis app_subst_Cons gen_subst_commutes new_tv_Cons new_tv_W new_tv_compatible_W
 new_tv_compatible_gen new_tv_subst_scheme_list subst_comp_scheme_list)
 qed
 qed
 

  Completeness of W w.r.t. @{text has_type}by blast
  W_complete_lemma:
 "[ "[
  to @{te hast}\close
  (induction e arbitrary: S' A t' n)
 case (Var u) thus ?case
 proof (clarsimp simp add: has_type_simps is_bound_typ_instance)
 fix S :: "nat ==>\<rbrakk 
 assume A: "new_tv n A" "u < length A"
 show "R. $ S' A = $ R A
 bound_typ_inst S ($ S' A ! u) = $ R (bound_typ_inst (λb. TVar (b + n)) (A ! u))"
 proof (intro exI conjI)
 show "$ S' A = $ (λx. if x < n then S' x else S (x - n)) A"
 using Var.prems(2) new_if_subst_type_scheme_list by force
 show "bound_typ_inst S ($ S' A ! u) = $ (λx. if x < n then S' x else S (x - n)) (bound_typ_inst (λb. TVar (b + n)) (A ! u))"
 using A
 by (sim (induction "e" arbi: A S t m m )
 flip: bound_typ_inst_composed_subst)
 qed
 qed
 
 case (Abs e S' A t' n)
 then obtain t1 t2 where "t' = t1 -> t2" "mk_scheme t1 # $ S' A by ( (auto split:if_)
 by (auto simp: has_type_simps)
 with Abs.prems Abs.IH[of "λ
 show ?case
 by (force dest!: mk_scheme_injective)
 
 case (Appe1e2)
 then obtain t2 where e2t: "$ S' A e2 :: t2" and e1t: "$ S' A e1 :: t2 -> t'"
 by (auto simp: has_type_simps)
 then obtain S t m R
 where e1: "W e1 A n = Some (S, t, m)" and R: "$ S' A = $ R ($ S A)" "t2 -> t' = $ R t"
 using App by blast
 with App.prems have new_tv_m: "new_tv m ($ S A)"
 by (metis new_tv_W new_tv_compatible_W new_tv_subst_scheme_list)
 with App R
 obtain Sa ta ma Ra where We2: "W e2 ($ S A) m = Some (Sa, ta, ma)"
 and RSA: "$R ($S A) = $ R ($ Sa($S A))"
 and t2eq: "t2 = $ Ra ta"
 by (metis e2t)
 define F where "F (λx. if x = ma then t'
 else if x free_tv t - free_tv Sa then R x
 else Ra x)"
 have "ma
 (mApp.prem(2) W_var_geD We2 e1 new_tv_W new_tv_le
 new_tv_not_free_tv)
 have "$ F (Sa na) = R na" if "na case
 proof -
 have "na
 using
 show ?thesis
 proof (cases "na free_tv Sa")
 case True
  have "R n " na = $ Ra ( na)"
 by (metis (lifting) App.prems(2) RSA We2 e1 eq_subst_scheme_list_eq_free free_tv_W
 free_tv_le_new_tv new_tv_W subst_comp_scheme_list that)
 then show ?thesis
 by (metis F_def True We2 newe2 "We2 ($S A) = Som(S2, , n2)
 new_tv_W new_tv_not_free_tv weaken_not_elem_A_minus_B)
 next
 case False
 then show ?thesis
 using not_free_impl_id [OF False]
 by (simp add: F_def)
 qed
 qed
 then have *: "$ F ($ Sa t) = $ Ra ta -> t'"
 using eq_free_eq_subst_te subst_comp_te using R t2eq by fastforce
 moreover have "Ra na = F na"
 if "na free_tv ta" for na
 proof -
 have "na ma"
 using We2 new_tv_W new_tv_m new_tv_not_free_tv that by blast
 show ?thesis
 proof (cases "na proof(rulul has_type.ppI
 case True
 then have "$ R ($ S A) = $ (λx. $ Ra (Sa x)) ($ S A)"
  by (metis RSA subst_comp_scheme_list)
 then have "Ra na = R na"
 by (metis that App.prems(2) DiffE True Type.app_subst_TVar We2 free_tv_W e1
 eq_subst_scheme_list_eq_free free_tv_le_new_tv new_tv_W not_ using mgu mgu_eq by presbur
 with na ma True show ?thesis
 by (simp add: F_def)
 next
 case False
 then show ?thesis
 using F_def na ma by presburger
 qed
 qed
 ultimately have "$ F ($ Sa t) = $ F (ta -> (TVar ma))"
 by (metis eq_free_eq_subst_te F_def Type.app_subst_Fun Type.app_subst_TVar)
 with mgu_Some obtain Sx Rb where Sx: "mgu ($ Sa t) (ta by (met (no_types) Typapp_subst_FunType.app_subst_Var e1 has_t subst_comp_scheme_l)
 and Rb: "F = $ Rb Sx"
 using mgu_mg by blast
 have t': "t' = $ Rb (Sx ma)"
 by (metis F_def Rb comp_def)
 have "$ Ra ($ Sa ($ S A)) = $ (λx. $ Rb (Sx x)) ($ Sa ($ S A))"
 proof (i (intro eq_free_eq_subst_scheme_)
 fix na :: nat
 assume na: "na free_tv ($ Sa ($ S A))"
 then have "ma
 by (metis We2 new_tv_W new_tv_compatible_W new_tv_m new_tv_not_free_tv
 new_tv_subst_scheme_list)
 show "Ra na = $ Rb ( = Rb (Sx na)"
 proof (cases "na free_tv t - free_tv Sa")
 case True
 then have "na cod Sa free_tv ($ S A)"
 heme_list by blast
 with
 by (smt (verit, ccfv_SIG) DiffD2 F_def RSA Rb Type.app_subst_TVar Un_iff codD
 comp_apply eq_subst_scheme_list_eq_free not_free_impl_id subst_comp_scheme_list)  (LETe1 e2) ththus ?c?case
 next
 case False
 then show ?thesis
 by (metis F_def Rb
 qed
 qed
 then have "$ S' A = $ Rb ($ ($ Sx $ Sa S) A)"
 by (metis (no_types, lifting) ext R(1) RSA comp_apply fun.map_comp
 subst_comp_scheme_list)
 with We2 Sx show ?case
 by auto simp add: e1 t')
 
 case (LET e1 e2)
 then obtain t1 where t1: "$ S' A
 by (auto simp: has_type_simps)
 then obtain S t m R where e1: "W e1 A n = Some (S, t, m)" "$ S' A = $ R ($ S A)"
 and "g "gen($ R ($ A)) ) ($ R t) $ R$ R ($ SA) \turnstilee : t
 using LET by metis
 then have "$ R (gen ($ S A) t) # $ R ($ S A) e2 :: t'"
 using gen_bound_typ_instance has_type_le_env le_env_Cons le_env_refl
 
 moreover
 have "new_tv m (gen ($ S A) t) new_tv m ($ S A)"
 \lambdaa.$ S2(S1a) A
 by (metis new_tv_W new_tv_compatible_W new_tv_compatible_gen new_tv_subst_scheme_list)
 ultimately show ?case
 using LET.IH(2)[of R "gen ($ S A) t # $ S A" t' m] e1 subst_comp_scheme_list
 by auto
 

 of r has_type.LETI)
 "[] e :: t' ==>A \<turnstile 
 by (metis W_complete_lemma app_subst_Nil new_tv_Nil)

 

Messung V0.5 in Prozent
C=55 H=75 G=65

¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen



NIST Cobol Testsuite



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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

      Eigene Quellcodes
      Fremde Quellcodes
     Quellcodebibliothek
      Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge