thys2/SizeBound6CT.thy
changeset 434 0cce1aee0fb2
parent 433 210df4cd512b
child 435 65e786a58365
child 436 222333d2bdc2
equal deleted inserted replaced
433:210df4cd512b 434:0cce1aee0fb2
    78   |   "zip_concat [] [] = []"
    78   |   "zip_concat [] [] = []"
    79   | "zip_concat [] (s2#ss2) = s2 # (zip_concat [] ss2)"
    79   | "zip_concat [] (s2#ss2) = s2 # (zip_concat [] ss2)"
    80   | "zip_concat (s1#ss1) [] = s1 # (zip_concat ss1 [])"
    80   | "zip_concat (s1#ss1) [] = s1 # (zip_concat ss1 [])"
    81 
    81 
    82 
    82 
    83 
    83 (*
    84 lemma compliment_pref_suf:
    84 lemma compliment_pref_suf:
    85   shows "zip_concat (orderedPref s) (orderedSuf s) = replicate (length s) s "
    85   shows "zip_concat (orderedPref s) (orderedSuf s) = replicate (length s) s "
    86   apply(induct s)
    86   apply(induct s)
    87    apply auto[1]
    87    apply auto[1]
    88   sorry
    88   sorry
    89 
    89 
    90 
    90 
    91 
    91 *)
    92 
    92 
    93 datatype rrexp = 
    93 datatype rrexp = 
    94   RZERO
    94   RZERO
    95 | RONE 
    95 | RONE 
    96 | RCHAR char
    96 | RCHAR char
   212    apply(erule exE)+
   212    apply(erule exE)+
   213    apply simp
   213    apply simp
   214   apply simp
   214   apply simp
   215   by(meson neq_Nil_conv)
   215   by(meson neq_Nil_conv)
   216   
   216   
   217 
       
   218 lemma finite_list_of_ders:
       
   219   shows"\<exists>dersset. ( (finite dersset) \<and> (\<forall>s. (rders_simp r s) \<in> dersset) )"
       
   220   sorry
       
   221 
       
   222 
   217 
   223 
   218 
   224 
   219 
   225 
   220 
   226 
   221 
   473 
   468 
   474 lemma rsimp_idem:
   469 lemma rsimp_idem:
   475   shows "rsimp (rsimp r) = rsimp r"
   470   shows "rsimp (rsimp r) = rsimp r"
   476   sorry
   471   sorry
   477 
   472 
       
   473 corollary rsimp_inner_idem1:
       
   474   shows "rsimp r = RSEQ r1 r2 \<Longrightarrow> rsimp r1 = r1 \<and> rsimp r2 = r2"
       
   475   
       
   476   sorry
       
   477 
       
   478 corollary rsimp_inner_idem2:
       
   479   shows "rsimp r = RALTS rs \<Longrightarrow> \<forall>r' \<in> (set rs). rsimp r' = r'"
       
   480   sorry
       
   481 
       
   482 corollary rsimp_inner_idem3:
       
   483   shows "rsimp r = RALTS rs \<Longrightarrow> map rsimp rs = rs"
       
   484   by (meson map_idI rsimp_inner_idem2)
       
   485 
       
   486 corollary rsimp_inner_idem4:
       
   487   shows "rsimp r = RALTS rs \<Longrightarrow> flts rs = rs"
       
   488   sorry
       
   489 
       
   490 
   478 lemma head_one_more_simp:
   491 lemma head_one_more_simp:
   479   shows "map rsimp (r # rs) = map rsimp (( rsimp r) # rs)"
   492   shows "map rsimp (r # rs) = map rsimp (( rsimp r) # rs)"
   480   by (simp add: rsimp_idem)
   493   by (simp add: rsimp_idem)
   481 
   494 
   482 lemma head_one_more_dersimp:
   495 lemma head_one_more_dersimp:
   556 
   569 
   557 lemma nullable_seq_with_list1:
   570 lemma nullable_seq_with_list1:
   558   shows " rnullable (rders_simp r1 s) \<Longrightarrow>
   571   shows " rnullable (rders_simp r1 s) \<Longrightarrow>
   559     rsimp (rder c (RALTS ( (RSEQ (rders_simp r1 s) r2) #  (cond_list r1 r2 s)) )) =
   572     rsimp (rder c (RALTS ( (RSEQ (rders_simp r1 s) r2) #  (cond_list r1 r2 s)) )) =
   560     rsimp (RALTS ( (RSEQ (rders_simp r1 (s @ [c])) r2) # (cond_list r1 r2 (s @ [c])) ) )"
   573     rsimp (RALTS ( (RSEQ (rders_simp r1 (s @ [c])) r2) # (cond_list r1 r2 (s @ [c])) ) )"
   561   by (metis LHS1_def_der_seq append.left_neutral append_Cons first_elem_seqder_nullable simp_flatten)
   574   using RHS1 LHS1_def_der_seq cond_list_head_last simp_flatten
       
   575   by (metis append.left_neutral append_Cons)
       
   576 
       
   577 
       
   578 (*^^^^^^^^^nullable_seq_with_list1 related ^^^^^^^^^^^^^^^^*)
       
   579 
       
   580 
       
   581 
       
   582 
       
   583 
       
   584 
   562 
   585 
   563 
   586 
   564 
   587 
   565 
   588 
   566 lemma nullable_seq_with_list:
   589 lemma nullable_seq_with_list:
   681   where 
   704   where 
   682 "rexp_enum 0 = {}"
   705 "rexp_enum 0 = {}"
   683 |"rexp_enum (Suc 0) =  {RALTS []} \<union> {RZERO} \<union> {RONE} \<union> { (RCHAR c) |c. c \<in> set (all_chars 255)}"
   706 |"rexp_enum (Suc 0) =  {RALTS []} \<union> {RZERO} \<union> {RONE} \<union> { (RCHAR c) |c. c \<in> set (all_chars 255)}"
   684 |"rexp_enum (Suc n) = {(RSEQ r1 r2)|r1 r2 i j. r1 \<in>  (rexp_enum i) \<and> r2 \<in>  (rexp_enum j) \<and> i + j = n}"
   707 |"rexp_enum (Suc n) = {(RSEQ r1 r2)|r1 r2 i j. r1 \<in>  (rexp_enum i) \<and> r2 \<in>  (rexp_enum j) \<and> i + j = n}"
   685 
   708 
   686 
   709  
   687 lemma finite_sized_rexp_forms_finite_set:
   710 lemma finite_sized_rexp_forms_finite_set:
   688   shows " \<exists>SN. ( \<forall>r.( rsize r < N \<longrightarrow> r \<in> SN)) \<and> (finite SN)"
   711   shows " \<exists>SN. ( \<forall>r.( rsize r < N \<longrightarrow> r \<in> SN)) \<and> (finite SN)"
   689   apply(induct N)
   712   apply(induct N)
   690    apply simp
   713    apply simp
   691    apply auto
   714    apply auto
   780   apply(subgoal_tac "\<exists>Nr'. \<forall>s. rsize (RSEQ  (rders_simp r1 s) r2) \<le> Nr'")
   803   apply(subgoal_tac "\<exists>Nr'. \<forall>s. rsize (RSEQ  (rders_simp r1 s) r2) \<le> Nr'")
   781    prefer 2
   804    prefer 2
   782   apply (meson order_le_less)
   805   apply (meson order_le_less)
   783   apply(erule exE)
   806   apply(erule exE)
   784   apply(erule exE)
   807   apply(erule exE)
   785   apply(erule exE)
       
   786   apply(rule_tac x = "N3a + Nr'" in exI)
       
   787   sorry
   808   sorry
   788 
   809 
   789 lemma alts_simp_bounded_by_sloppy1_version:
   810 lemma alts_simp_bounded_by_sloppy1_version:
   790   shows "\<forall>s. rsize (rsimp (RALTS  ((RSEQ (rders_simp r1 s) r2) #
   811   shows "\<forall>s. rsize (rsimp (RALTS  ((RSEQ (rders_simp r1 s) r2) #
   791            (rders_cond_list r2 (nullable_bools r1 (orderedPref s))  (orderedSuf s))) )) \<le> 
   812            (rders_cond_list r2 (nullable_bools r1 (orderedPref s))  (orderedSuf s))) )) \<le> 
   931   apply(erule exE)
   952   apply(erule exE)
   932   apply(rule_tac x = "max (N3+2) (Suc (Suc (rsize r1) + (rsize r2)))" in exI)
   953   apply(rule_tac x = "max (N3+2) (Suc (Suc (rsize r1) + (rsize r2)))" in exI)
   933   apply(rule allI)
   954   apply(rule allI)
   934   apply(case_tac "s = []")
   955   apply(case_tac "s = []")
   935    prefer 2
   956    prefer 2
   936    apply (metis add_2_eq_Suc' le_imp_less_Suc less_SucI max.strict_coboundedI1 shape_derssimp_seq(2))
   957    apply (metis add_2_eq_Suc' le_imp_less_Suc less_SucI max.strict_coboundedI1 shape_derssimp_seq)
   937   by (metis add.assoc less_Suc_eq max.strict_coboundedI2 plus_1_eq_Suc rders_simp.simps(1) rsize.simps(5))
   958   by (metis add.assoc less_Suc_eq less_max_iff_disj plus_1_eq_Suc rders_simp.simps(1) rsize.simps(5))
       
   959 
   938  (*  apply (simp add: less_SucI shape_derssimp_seq(2))
   960  (*  apply (simp add: less_SucI shape_derssimp_seq(2))
   939    apply (meson less_SucI less_max_iff_disj)
   961    apply (meson less_SucI less_max_iff_disj)
   940   apply simp
   962   apply simp
   941   done*)
   963   done*)
   942 
   964 
   949   apply simp
   971   apply simp
   950   done*)
   972   done*)
   951 (*For star related  bound*)
   973 (*For star related  bound*)
   952 
   974 
   953 lemma star_is_a_singleton_list_derc:
   975 lemma star_is_a_singleton_list_derc:
   954   shows " \<exists>Ss.  rders_simp (RSTAR r) [c] = rsimp_ALTs (map (\<lambda>s1.  rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)"
   976   shows " \<exists>Ss.  rders_simp (RSTAR r) [c] = rsimp (RALTS ( (map (\<lambda>s1.  rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)))"
   955   apply simp
   977   apply simp
   956   apply(rule_tac x = "[[c]]" in exI)
   978   apply(rule_tac x = "[[c]]" in exI)
   957   apply auto
   979   apply auto
   958   done
   980   apply(case_tac "rsimp (rder c r)")
       
   981        apply simp
       
   982       apply auto
       
   983    apply(subgoal_tac "rsimp (RSEQ x41 x42) = RSEQ x41 x42")
       
   984   prefer 2
       
   985     apply (metis rsimp_idem)
       
   986    apply(subgoal_tac "rsimp x41 = x41")
       
   987   prefer 2
       
   988   using rsimp_inner_idem1 apply blast
       
   989    apply(subgoal_tac "rsimp x42 = x42")
       
   990   prefer 2
       
   991   using rsimp_inner_idem1 apply blast
       
   992    apply simp
       
   993   apply(subgoal_tac "map rsimp x5 = x5")
       
   994   prefer 2
       
   995   using rsimp_inner_idem3 apply blast
       
   996   apply simp
       
   997   apply(subgoal_tac "rflts x5 = x5")
       
   998    prefer 2
       
   999   using rsimp_inner_idem4 apply blast
       
  1000   apply simp
       
  1001   using rsimp_inner_idem4 by auto
       
  1002   
       
  1003 
   959 
  1004 
   960 lemma rder_rsimp_ALTs_commute:
  1005 lemma rder_rsimp_ALTs_commute:
   961   shows "  (rder x (rsimp_ALTs rs)) = rsimp_ALTs (map (rder x) rs)"
  1006   shows "  (rder x (rsimp_ALTs rs)) = rsimp_ALTs (map (rder x) rs)"
   962   apply(induct rs)
  1007   apply(induct rs)
   963    apply simp
  1008    apply simp
   964   apply(case_tac rs)
  1009   apply(case_tac rs)
   965    apply simp
  1010    apply simp
   966   apply auto
  1011   apply auto
   967   done
  1012   done
   968 
  1013 
   969 lemma double_nested_ALTs_under_rsimp:
  1014 
   970   shows "rsimp (rsimp_ALTs ((RALTS rs1) # rs)) = rsimp (RALTS (rs1 @ rs))"
       
   971   apply(case_tac rs1)
       
   972   apply simp
       
   973   
       
   974    apply (metis list.simps(8) list.simps(9) neq_Nil_conv rdistinct.simps(1) rflts.simps(1) rflts.simps(2) rsimp.simps(2) rsimp_ALTs.simps(1) rsimp_ALTs.simps(2) rsimp_ALTs.simps(3))
       
   975   apply(case_tac rs)
       
   976    apply simp
       
   977   apply auto
       
   978   sorry
       
   979 
  1015 
   980 fun star_update :: "char \<Rightarrow> rrexp \<Rightarrow> char list list => char list list" where
  1016 fun star_update :: "char \<Rightarrow> rrexp \<Rightarrow> char list list => char list list" where
   981 "star_update c r [] = []"
  1017 "star_update c r [] = []"
   982 |"star_update c r (s # Ss) = (if (rnullable (rders_simp r s)) 
  1018 |"star_update c r (s # Ss) = (if (rnullable (rders_simp r s)) 
   983                                 then (s@[c]) # [c] # (star_update c r Ss) 
  1019                                 then (s@[c]) # [c] # (star_update c r Ss) 
   984                                else   s # (star_update c r Ss) )"
  1020                                else   s # (star_update c r Ss) )"
   985 
  1021 
       
  1022 lemma star_update_case1:
       
  1023   shows "rnullable (rders_simp r s) \<Longrightarrow> star_update c r (s # Ss) = (s @ [c]) # [c] # (star_update c r Ss)"
       
  1024   
       
  1025   by force
       
  1026 
       
  1027 lemma star_update_case2:
       
  1028   shows "\<not>rnullable (rders_simp r s) \<Longrightarrow> star_update c r (s # Ss) = s # (star_update c r Ss)"
       
  1029   by simp
       
  1030 
       
  1031 lemma rsimp_alts_idem:
       
  1032   shows "rsimp (rsimp_ALTs (a # as)) = rsimp (rsimp_ALTs (a # [(rsimp (rsimp_ALTs as))] ))"
       
  1033   sorry
       
  1034 
       
  1035 lemma rsimp_alts_idem2:
       
  1036   shows "rsimp (rsimp_ALTs (a # as)) = rsimp (rsimp_ALTs ((rsimp a) # [(rsimp (rsimp_ALTs as))] ))"
       
  1037   sorry
       
  1038 
       
  1039 lemma evolution_step1:
       
  1040   shows "rsimp
       
  1041         (rsimp_ALTs
       
  1042           (rder x (rsimp_SEQ (rders_simp r a) (RSTAR r)) # map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss)) =
       
  1043          rsimp 
       
  1044         (rsimp_ALTs
       
  1045           (rder x (rsimp_SEQ (rders_simp r a) (RSTAR r)) # [(rsimp (rsimp_ALTs (map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss)))]))   "
       
  1046   using rsimp_alts_idem by auto
       
  1047 
       
  1048 lemma evolution_step2:
       
  1049   assumes " rsimp (rsimp_ALTs (map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss)) =
       
  1050        rsimp (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) (star_update x r Ss)))"
       
  1051   shows "rsimp 
       
  1052         (rsimp_ALTs 
       
  1053           (rder x (rsimp_SEQ (rders_simp r a) (RSTAR r)) # map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss)) = 
       
  1054                  rsimp 
       
  1055         (rsimp_ALTs
       
  1056           (rder x (rsimp_SEQ (rders_simp r a) (RSTAR r)) # [ rsimp (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) (star_update x r Ss)))]))  "
       
  1057   by (simp add: assms rsimp_alts_idem)
       
  1058 
       
  1059 
       
  1060 (*
       
  1061 proof (prove)
       
  1062 goal (1 subgoal):
       
  1063  1. map f (a # s) = f a # map f s 
       
  1064 Auto solve_direct: the current goal can be solved directly with
       
  1065   HOL.nitpick_simp(115): map ?f (?x21.0 # ?x22.0) = ?f ?x21.0 # map ?f ?x22.0
       
  1066   List.list.map(2): map ?f (?x21.0 # ?x22.0) = ?f ?x21.0 # map ?f ?x22.0
       
  1067   List.list.simps(9): map ?f (?x21.0 # ?x22.0) = ?f ?x21.0 # map ?f ?x22.0
       
  1068 *)
   986 lemma starseq_list_evolution:
  1069 lemma starseq_list_evolution:
   987   fixes  r :: rrexp and Ss :: "char list list" and x :: char 
  1070   fixes  r :: rrexp and Ss :: "char list list" and x :: char 
   988   shows "rsimp (rsimp_ALTs (map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss) ) =
  1071   shows "rsimp (rsimp_ALTs (map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss) ) =
   989          rsimp (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) (star_update x r Ss))  )"   
  1072          rsimp (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) (star_update x r Ss))  )"   
   990   apply(induct Ss)
  1073   apply(induct Ss)
   991   apply simp
  1074    apply simp
       
  1075   apply(subst List.list.map(2))
       
  1076   apply(subst evolution_step2)
       
  1077    apply simp
       
  1078   apply(case_tac "rnullable (rders_simp r a)")
       
  1079    apply(subst star_update_case1)
       
  1080     apply simp
       
  1081    apply(subst List.list.map)+
       
  1082   sledgehammer
   992   sorry
  1083   sorry
   993 
  1084 
   994 
  1085 
   995 lemma star_seqs_produce_star_seqs:
  1086 lemma star_seqs_produce_star_seqs:
   996   shows "rsimp (rsimp_ALTs (map (rder x \<circ> (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss))
  1087   shows "rsimp (rsimp_ALTs (map (rder x \<circ> (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss))
   997        = rsimp (rsimp_ALTs (map ( (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r)))) Ss))"
  1088        = rsimp (rsimp_ALTs (map ( (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r)))) Ss))"
   998   by (meson comp_apply)
  1089   by (meson comp_apply)
   999 
  1090 
  1000 lemma der_seqstar_res:
  1091 lemma map_der_lambda_composition:
  1001   shows "rder x (RSEQ r1 r2) = RSEQ r3 r4"
  1092   shows "map (rder x) (map (\<lambda>s. f s) Ss) = map (\<lambda>s. (rder x (f s))) Ss"
  1002   oops
  1093   by force
       
  1094 
       
  1095 lemma ralts_vs_rsimpalts:
       
  1096   shows "rsimp (RALTS rs) = rsimp (rsimp_ALTs rs)"
       
  1097   sorry
  1003 
  1098 
  1004 lemma linearity_of_list_of_star_or_starseqs: 
  1099 lemma linearity_of_list_of_star_or_starseqs: 
  1005   fixes r::rrexp and Ss::"char list list" and x::char
  1100   fixes r::rrexp and Ss::"char list list" and x::char
  1006   shows "\<exists>Ssa. rsimp (rder x (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))) =
  1101   shows "\<exists>Ssa. rsimp (rder x (rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))) =
  1007                  rsimp_ALTs (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ssa)"
  1102                  rsimp (RALTS ( (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ssa)))"
  1008   apply(simp add: rder_rsimp_ALTs_commute)
  1103   apply(subst rder_rsimp_ALTs_commute)
  1009   apply(induct Ss)
  1104   apply(subst map_der_lambda_composition)
  1010    apply simp
  1105   using starseq_list_evolution
  1011    apply (metis list.simps(8) rsimp_ALTs.simps(1))
  1106   apply(rule_tac x = "star_update x r Ss" in exI)
  1012 
  1107   apply(subst ralts_vs_rsimpalts)
  1013 
  1108   by simp
  1014   sorry
  1109 
       
  1110 
       
  1111 
       
  1112 (*certified correctness---does not depend on any previous sorry*)
       
  1113 lemma star_list_push_der: shows  " \<lbrakk>xs \<noteq> [] \<Longrightarrow> \<exists>Ss. rders_simp (RSTAR r) xs = rsimp (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss));
       
  1114         xs @ [x] \<noteq> []; xs \<noteq> []\<rbrakk> \<Longrightarrow>
       
  1115      \<exists>Ss. rders_simp (RSTAR r ) (xs @ [x]) = 
       
  1116         rsimp (RALTS (map (\<lambda>s1. (rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) ) Ss) )"
       
  1117   apply(subgoal_tac  "\<exists>Ss. rders_simp (RSTAR r) xs = rsimp (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))")
       
  1118   prefer 2
       
  1119   apply blast
       
  1120   apply(erule exE)
       
  1121   apply(subgoal_tac "rders_simp (RSTAR r) (xs @ [x]) = rsimp (rder x (rsimp (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))))")
       
  1122   prefer 2
       
  1123   using rders_simp_append
       
  1124   using rders_simp_one_char apply presburger
       
  1125   apply(rule_tac x= "Ss" in exI)
       
  1126   apply(subgoal_tac " rsimp (rder x (rsimp (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)))) = 
       
  1127                        rsimp (rsimp (rder x (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))))")
       
  1128   prefer 2
       
  1129   using inside_simp_removal rsimp_idem apply presburger
       
  1130   apply(subgoal_tac "rsimp (rsimp (rder x (RALTS (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)))) =
       
  1131                      rsimp (rsimp (RALTS (map (rder x) (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss))))")
       
  1132   prefer 2
       
  1133   using rder.simps(4) apply presburger
       
  1134   apply(subgoal_tac "rsimp (rsimp (RALTS (map (rder x) (map (\<lambda>s1. rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)))) =
       
  1135                      rsimp (rsimp (RALTS (map (\<lambda>s1. (rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r)))) Ss)))")
       
  1136    apply (metis rsimp_idem)
       
  1137   by (metis map_der_lambda_composition)
       
  1138 
       
  1139 lemma simp_in_lambdas : 
       
  1140   shows "
       
  1141 rsimp (RALTS (map (\<lambda>s1. (rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) ) Ss) ) = 
       
  1142 rsimp (RALTS (map (\<lambda>s1. (rsimp (rder x  (rsimp_SEQ (rders_simp r s1) (RSTAR r))))) Ss))"
       
  1143   by (metis (no_types, lifting) comp_apply list.map_comp map_eq_conv rsimp.simps(2) rsimp_idem)
       
  1144 
  1015 
  1145 
  1016 lemma starder_is_a_list_of_stars_or_starseqs:
  1146 lemma starder_is_a_list_of_stars_or_starseqs:
  1017   shows "s \<noteq> [] \<Longrightarrow> \<exists>Ss.  rders_simp (RSTAR r) s = rsimp_ALTs (map (\<lambda>s1.  rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)"
  1147   shows "s \<noteq> [] \<Longrightarrow> \<exists>Ss.  rders_simp (RSTAR r) s = rsimp (RALTS( (map (\<lambda>s1.  rsimp_SEQ (rders_simp r s1) (RSTAR r)) Ss)))"
  1018   apply(induct s rule: rev_induct)
  1148   apply(induct s rule: rev_induct)
  1019   apply simp
  1149   apply simp
  1020   apply(case_tac "xs = []")
  1150   apply(case_tac "xs = []")
  1021   using star_is_a_singleton_list_derc
  1151   using star_is_a_singleton_list_derc
  1022   apply(simp)
  1152    apply(simp)
  1023   apply auto
  1153   apply(subgoal_tac "\<exists>Ss. rders_simp (RSTAR r) (xs @ [x]) = 
  1024   apply(simp add: rders_simp_append)
  1154           rsimp (RALTS (map (\<lambda>s1. rder x (rsimp_SEQ (rders_simp r s1) (RSTAR r))) Ss))")
  1025   using linearity_of_list_of_star_or_starseqs by blast
  1155   prefer 2
       
  1156   using star_list_push_der apply presburger
       
  1157 
       
  1158 
       
  1159   sorry
  1026 
  1160 
  1027 
  1161 
  1028 lemma finite_star:
  1162 lemma finite_star:
  1029   shows "(\<forall>s. rsize (rders_simp r0 s) < N0 )
  1163   shows "(\<forall>s. rsize (rders_simp r0 s) < N0 )
  1030            \<Longrightarrow> \<exists>N3. \<forall>s.(rsize (rders_simp (RSTAR r0) s)) < N3"
  1164            \<Longrightarrow> \<exists>N3. \<forall>s.(rsize (rders_simp (RSTAR r0) s)) < N3"
  1065    prefer 2
  1199    prefer 2
  1066 
  1200 
  1067    apply (simp add: finite_star)
  1201    apply (simp add: finite_star)
  1068   sorry
  1202   sorry
  1069 
  1203 
       
  1204 lemma finite_list_of_ders:
       
  1205   fixes r
       
  1206   shows"\<exists>dersset. ( (finite dersset) \<and> (\<forall>s. (rders_simp r s) \<in> dersset) )"
       
  1207   sorry
       
  1208 
       
  1209 
  1070 
  1210 
  1071 unused_thms
  1211 unused_thms
  1072 lemma seq_ders_shape:
  1212 lemma seq_ders_shape:
  1073   shows "E"
  1213   shows "E"
  1074 
  1214