cases: fixes \<sigma> :: "(String.literal \<times> event_data list) trace"   and j :: "nat"   and a1 :: "String.literal \<Rightarrow> nat option"   and a2 :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option"   and a3 :: "nat"   and a4 :: "event_data list set"   and a5 :: "('msaux, 'muaux) mformula"   and a6 :: "Formula.formula" assumes "wf_mformula \<sigma> j a1 a2 a3 a4 a5 a6" obtains t1 :: "Formula.trm" and t2 :: "Formula.trm" and n :: "nat" and P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and R :: "event_data list set" where "a1 = Pb__" and "a2 = Vb__" and "a3 = nb__" and "a4 = Rb__" and "a5 = MRel (eq_rel nb__ t1 t2)" and "a6 = formula.Eq t1 t2" and "is_simple_eq t1 t2" and "\<forall>x\<in>fv_trm t1. x < nb__" and "\<forall>x\<in>fv_trm t2. x < nb__"   | x :: "nat" and n :: "nat" and P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and R :: "event_data list set" where "a1 = Pc__" and "a2 = Vc__" and "a3 = nc__" and "a4 = Rc__" and "a5 = MRel empty_table" and "a6 = formula.Neg (formula.Eq (trm.Var x__) (trm.Var x__))" and "x__ < nc__"   | e :: "String.literal" and ts :: "Formula.trm list" and n :: "nat" and P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and R :: "event_data list set" where "a1 = Pd__" and "a2 = Vd__" and "a3 = nd__" and "a4 = Rd__" and "a5 = MPred e ts" and "a6 = formula.Pred e ts" and "\<forall>x\<in>fv (formula.Pred e ts). x < nd__" and "\<forall>t\<in>set ts. trm.is_Var t \<or> trm.is_Const t"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and m :: "nat" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and p :: "String.literal" and n :: "nat" and R :: "event_data list set" and \<psi> :: "('msaux, 'muaux) mformula" and \<psi>' :: "Formula.formula" and b :: "nat" where "a1 = Pe__" and "a2 = Ve__" and "a3 = ne__" and "a4 = Re__" and "a5 = MLet p m \<phi>'''__ \<psi>__" and "a6 = formula.Let p \<phi>''''__ \<psi>'__" and "wf_mformula \<sigma> j Pe__ Ve__ m UNIV \<phi>'''__ \<phi>''''__" and "wf_mformula \<sigma> j (Pe__(p \<mapsto> Monitor.progress \<sigma> Pe__ \<phi>''''__ j)) (Ve__(p \<mapsto> \<lambda>i. {v. length v = m \<and> Formula.sat \<sigma> Ve__ v i \<phi>''''__})) ne__ Re__ \<psi>__ \<psi>'__" and "{0..<m} \<subseteq> fv \<phi>''''__" and "b__ \<le> m" and "m = Formula.nfv \<phi>''''__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and \<psi> :: "('msaux, 'muaux) mformula" and \<psi>' :: "Formula.formula" and pos :: "bool" and \<chi> :: "Formula.formula" and buf :: "event_data option list set list \<times> event_data option list set list" where "a1 = Pf__" and "a2 = Vf__" and "a3 = nf__" and "a4 = Rf__" and "a5 = MAnd (fv \<phi>''''''__) \<phi>'''''__ pos (fv \<psi>'''__) \<psi>''__ bufa__" and "a6 = \<chi>" and "wf_mformula \<sigma> j Pf__ Vf__ nf__ Rf__ \<phi>'''''__ \<phi>''''''__" and "wf_mformula \<sigma> j Pf__ Vf__ nf__ Rf__ \<psi>''__ \<psi>'''__" and "if pos then \<chi> = formula.And \<phi>''''''__ \<psi>'''__ else \<chi> = formula.And \<phi>''''''__ (formula.Neg \<psi>'''__) \<and> fv \<psi>'''__ \<subseteq> fv \<phi>''''''__" and "wf_mbuf2' \<sigma> Pf__ Vf__ j nf__ Rf__ \<phi>''''''__ \<psi>'''__ bufa__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and x :: "nat" and t :: "Formula.trm" and conf :: "nat \<times> Formula.trm" and \<psi>' :: "Formula.formula" where "a1 = Pg__" and "a2 = Vg__" and "a3 = ng__" and "a4 = Rg__" and "a5 = MAndAssign \<phi>'''''''__ conf__" and "a6 = formula.And \<phi>''''''''__ \<psi>''''__" and "wf_mformula \<sigma> j Pg__ Vg__ ng__ Rg__ \<phi>'''''''__ \<phi>''''''''__" and "x < ng__" and "x \<notin> fv \<phi>''''''''__" and "fv_trm t \<subseteq> fv \<phi>''''''''__" and "(x, t) = conf__" and "\<psi>''''__ = formula.Eq (trm.Var x) t \<or> \<psi>''''__ = formula.Eq t (trm.Var x)"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and \<psi>' :: "Formula.formula" and conf :: "Formula.trm \<times> bool \<times> mconstraint \<times> Formula.trm" where "a1 = Ph__" and "a2 = Vh__" and "a3 = nh__" and "a4 = Rh__" and "a5 = MAndRel \<phi>'''''''''__ conf" and "a6 = formula.And \<phi>''''''''''__ \<psi>'''''__" and "wf_mformula \<sigma> j Ph__ Vh__ nh__ Rh__ \<phi>'''''''''__ \<phi>''''''''''__" and "\<psi>'''''__ = formula_of_constraint conf" and "let (t1, uu_, uu_, t2) = conf in fv_trm t1 \<union> fv_trm t2 \<subseteq> fv \<phi>''''''''''__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and l :: "('msaux, 'muaux) mformula list" and l_pos :: "Formula.formula list" and l_neg :: "Formula.formula list" and l' :: "Formula.formula list" and buf :: "event_data option list set list list" and A_pos :: "nat set list" and A_neg :: "nat set list" where "a1 = Pi__" and "a2 = Vi__" and "a3 = ni__" and "a4 = Ri__" and "a5 = MAnds A_pos A_neg l bufb__" and "a6 = formula.Ands l'" and "list_all2 (wf_mformula \<sigma> j Pi__ Vi__ ni__ Ri__) l (l_pos @ map remove_neg l_neg)" and "wf_mbufn (Monitor.progress \<sigma> Pi__ (formula.Ands l') j) (map (\<lambda>\<psi>. Monitor.progress \<sigma> Pi__ \<psi> j) (l_pos @ map remove_neg l_neg)) (map (\<lambda>\<psi> i. qtable ni__ (fv \<psi>) (mem_restr Ri__) (\<lambda>v. Formula.sat \<sigma> Vi__ (map the v) i \<psi>)) (l_pos @ map remove_neg l_neg)) bufb__" and "(l_pos, l_neg) = partition safe_formula l'" and "l_pos \<noteq> []" and "list_all safe_formula (map remove_neg l_neg)" and "A_pos = map fv l_pos" and "A_neg = map fv l_neg" and "\<Union> (set A_neg) \<subseteq> \<Union> (set A_pos)"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and \<psi> :: "('msaux, 'muaux) mformula" and \<psi>' :: "Formula.formula" and buf :: "event_data option list set list \<times> event_data option list set list" where "a1 = Pj__" and "a2 = Vj__" and "a3 = nj__" and "a4 = Rj__" and "a5 = MOr \<phi>'''''''''''__ \<psi>''''''__ bufc__" and "a6 = formula.Or \<phi>''''''''''''__ \<psi>'''''''__" and "wf_mformula \<sigma> j Pj__ Vj__ nj__ Rj__ \<phi>'''''''''''__ \<phi>''''''''''''__" and "wf_mformula \<sigma> j Pj__ Vj__ nj__ Rj__ \<psi>''''''__ \<psi>'''''''__" and "fv \<phi>''''''''''''__ = fv \<psi>'''''''__" and "wf_mbuf2' \<sigma> Pj__ Vj__ j nj__ Rj__ \<phi>''''''''''''__ \<psi>'''''''__ bufc__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" where "a1 = Pk__" and "a2 = Vk__" and "a3 = nk__" and "a4 = Rk__" and "a5 = MNeg \<phi>'''''''''''''__" and "a6 = formula.Neg \<phi>''''''''''''''__" and "wf_mformula \<sigma> j Pk__ Vk__ nk__ Rk__ \<phi>'''''''''''''__ \<phi>''''''''''''''__" and "fv \<phi>''''''''''''''__ = {}"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" where "a1 = Pl__" and "a2 = Vl__" and "a3 = nl__" and "a4 = Rl__" and "a5 = MExists \<phi>'''''''''''''''__" and "a6 = formula.Exists \<phi>''''''''''''''''__" and "wf_mformula \<sigma> j Pl__ Vl__ (Suc nl__) (lift_envs Rl__) \<phi>'''''''''''''''__ \<phi>''''''''''''''''__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and b :: "nat" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and y :: "nat" and f :: "Formula.trm" and g0 :: "bool" and \<omega> :: "Formula.agg_type \<times> event_data" where "a1 = Pm__" and "a2 = Vm__" and "a3 = nm__" and "a4 = Rm__" and "a5 = MAgg g0 y \<omega> b f \<phi>'''''''''''''''''__" and "a6 = formula.Agg y \<omega> b f \<phi>''''''''''''''''''__" and "wf_mformula \<sigma> j Pm__ Vm__ (b + nm__) (lift_envs' b Rm__) \<phi>'''''''''''''''''__ \<phi>''''''''''''''''''__" and "y < nm__" and "y + b \<notin> fv \<phi>''''''''''''''''''__" and "{0..<b} \<subseteq> fv \<phi>''''''''''''''''''__" and "fv_trm f \<subseteq> fv \<phi>''''''''''''''''''__" and "g0 = (fv \<phi>''''''''''''''''''__ \<subseteq> {0..<b})"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and first :: "bool" and buf :: "event_data option list set list" and nts :: "nat list" and I :: "\<I>" where "a1 = Pn__" and "a2 = Vn__" and "a3 = nn__" and "a4 = Rn__" and "a5 = MPrev Ia__ \<phi>'''''''''''''''''''__ first__ bufd__ ntsa__" and "a6 = formula.Prev Ia__ \<phi>''''''''''''''''''''__" and "wf_mformula \<sigma> j Pn__ Vn__ nn__ Rn__ \<phi>'''''''''''''''''''__ \<phi>''''''''''''''''''''__" and "first__ = (j = 0)" and "list_all2 (\<lambda>i. qtable nn__ (fv \<phi>''''''''''''''''''''__) (mem_restr Rn__) (\<lambda>v. Formula.sat \<sigma> Vn__ (map the v) i \<phi>''''''''''''''''''''__)) [min (Monitor.progress \<sigma> Pn__ \<phi>''''''''''''''''''''__ j) (j - 1)..<Monitor.progress \<sigma> Pn__ \<phi>''''''''''''''''''''__ j] bufd__" and "list_all2 (\<lambda>i t. t = \<tau> \<sigma> i) [min (Monitor.progress \<sigma> Pn__ \<phi>''''''''''''''''''''__ j) (j - 1)..<j] ntsa__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and first :: "bool" and nts :: "nat list" and I :: "\<I>" where "a1 = Po__" and "a2 = Vo__" and "a3 = no__" and "a4 = Ro__" and "a5 = MNext Ib__ \<phi>'''''''''''''''''''''__ first ntsb__" and "a6 = formula.Next Ib__ \<phi>''''''''''''''''''''''__" and "wf_mformula \<sigma> j Po__ Vo__ no__ Ro__ \<phi>'''''''''''''''''''''__ \<phi>''''''''''''''''''''''__" and "first = (Monitor.progress \<sigma> Po__ \<phi>''''''''''''''''''''''__ j = 0)" and "list_all2 (\<lambda>i t. t = \<tau> \<sigma> i) [Monitor.progress \<sigma> Po__ \<phi>''''''''''''''''''''''__ j - 1..<j] ntsb__"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and \<psi> :: "('msaux, 'muaux) mformula" and \<psi>' :: "Formula.formula" and args :: "Monitor.args" and \<phi>'' :: "Formula.formula" and I :: "\<I>" and buf :: "event_data option list set list \<times> event_data option list set list" and nts :: "nat list" and aux :: "'msaux" where "a1 = Pp__" and "a2 = Vp__" and "a3 = np__" and "a4 = Rp__" and "a5 = MSince args__ \<phi>'''''''''''''''''''''''__ \<psi>''''''''__ bufe__ ntsc__ auxa__" and "a6 = formula.Since \<phi>'''''''''''''''''''''''''__ Ic__ \<psi>'''''''''__" and "wf_mformula \<sigma> j Pp__ Vp__ np__ Rp__ \<phi>'''''''''''''''''''''''__ \<phi>''''''''''''''''''''''''__" and "wf_mformula \<sigma> j Pp__ Vp__ np__ Rp__ \<psi>''''''''__ \<psi>'''''''''__" and "if args_pos args__ then \<phi>'''''''''''''''''''''''''__ = \<phi>''''''''''''''''''''''''__ else \<phi>'''''''''''''''''''''''''__ = formula.Neg \<phi>''''''''''''''''''''''''__" and "safe_formula \<phi>'''''''''''''''''''''''''__ = args_pos args__" and "args_ivl args__ = Ic__" and "args_n args__ = np__" and "args_L args__ = fv \<phi>''''''''''''''''''''''''__" and "args_R args__ = fv \<psi>'''''''''__" and "fv \<phi>''''''''''''''''''''''''__ \<subseteq> fv \<psi>'''''''''__" and "wf_mbuf2' \<sigma> Pp__ Vp__ j np__ Rp__ \<phi>''''''''''''''''''''''''__ \<psi>'''''''''__ bufe__" and "wf_ts \<sigma> Pp__ j \<phi>''''''''''''''''''''''''__ \<psi>'''''''''__ ntsc__" and "wf_since_aux \<sigma> Vp__ Rp__ args__ \<phi>''''''''''''''''''''''''__ \<psi>'''''''''__ auxa__ (Monitor.progress \<sigma> Pp__ (formula.Since \<phi>'''''''''''''''''''''''''__ Ic__ \<psi>'''''''''__) j)"   | P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi> :: "('msaux, 'muaux) mformula" and \<phi>' :: "Formula.formula" and \<psi> :: "('msaux, 'muaux) mformula" and \<psi>' :: "Formula.formula" and args :: "Monitor.args" and \<phi>'' :: "Formula.formula" and I :: "\<I>" and buf :: "event_data option list set list \<times> event_data option list set list" and nts :: "nat list" and aux :: "'muaux" where "a1 = Pq__" and "a2 = Vq__" and "a3 = nq__" and "a4 = Rq__" and "a5 = MUntil args \<phi> \<psi> buff__ ntsd__ auxb__" and "a6 = formula.Until \<phi>'' Id__ \<psi>'" and "wf_mformula \<sigma> j Pq__ Vq__ nq__ Rq__ \<phi> \<phi>'" and "wf_mformula \<sigma> j Pq__ Vq__ nq__ Rq__ \<psi> \<psi>'" and "if args_pos args then \<phi>'' = \<phi>' else \<phi>'' = formula.Neg \<phi>'" and "safe_formula \<phi>'' = args_pos args" and "args_ivl args = Id__" and "args_n args = nq__" and "args_L args = fv \<phi>'" and "args_R args = fv \<psi>'" and "fv \<phi>' \<subseteq> fv \<psi>'" and "wf_mbuf2' \<sigma> Pq__ Vq__ j nq__ Rq__ \<phi>' \<psi>' buff__" and "wf_ts \<sigma> Pq__ j \<phi>' \<psi>' ntsd__" and "wf_until_aux \<sigma> Vq__ Rq__ args \<phi>' \<psi>' auxb__ (Monitor.progress \<sigma> Pq__ (formula.Until \<phi>'' Id__ \<psi>') j)" and "Monitor.progress \<sigma> Pq__ (formula.Until \<phi>'' Id__ \<psi>') j + length_muaux args auxb__ = min (Monitor.progress \<sigma> Pq__ \<phi>' j) (Monitor.progress \<sigma> Pq__ \<psi>' j)"   | r :: "Formula.formula Regex.regex" and P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi>s :: "('msaux, 'muaux) mformula list" and mr :: "mregex" and mrs :: "mregex list" and buf :: "event_data option list set list list" and nts :: "nat list" and I :: "\<I>" and aux :: "(nat \<times> (mregex, event_data option list set) mapping) list" where "a1 = Pr__" and "a2 = Vr__" and "a3 = nr__" and "a4 = Rr__" and "a5 = MMatchP Ie__ mra__ mrsa__ \<phi>sa__ bufg__ ntse__ auxc__" and "a6 = formula.MatchP Ie__ ra__" and "case to_mregex ra__ of (mr', \<phi>s') \<Rightarrow> list_all2 (wf_mformula \<sigma> j Pr__ Vr__ nr__ Rr__) \<phi>sa__ \<phi>s' \<and> mra__ = mr'" and "mrsa__ = sorted_list_of_set (RPDs mra__)" and "safe_regex Past Strict ra__" and "wf_mbufn' \<sigma> Pr__ Vr__ j nr__ Rr__ ra__ bufg__" and "wf_ts_regex \<sigma> Pr__ j ra__ ntse__" and "wf_matchP_aux \<sigma> Vr__ nr__ Rr__ Ie__ ra__ auxc__ (Monitor.progress \<sigma> Pr__ (formula.MatchP Ie__ ra__) j)"   | r :: "Formula.formula Regex.regex" and P :: "String.literal \<Rightarrow> nat option" and V :: "String.literal \<Rightarrow> (nat \<Rightarrow> event_data list set) option" and n :: "nat" and R :: "event_data list set" and \<phi>s :: "('msaux, 'muaux) mformula list" and mr :: "mregex" and mrs :: "mregex list" and buf :: "event_data option list set list list" and nts :: "nat list" and I :: "\<I>" and aux :: "(nat \<times> event_data option list set list \<times> event_data option list set) list" where "a1 = P" and "a2 = V" and "a3 = n" and "a4 = R" and "a5 = MMatchF I mr mrs \<phi>s buf nts aux" and "a6 = formula.MatchF I r" and "case to_mregex r of (mr', \<phi>s') \<Rightarrow> list_all2 (wf_mformula \<sigma> j P V n R) \<phi>s \<phi>s' \<and> mr = mr'" and "mrs = sorted_list_of_set (LPDs mr)" and "safe_regex Futu Strict r" and "wf_mbufn' \<sigma> P V j n R r buf" and "wf_ts_regex \<sigma> P j r nts" and "wf_matchF_aux \<sigma> V n R I r aux (Monitor.progress \<sigma> P (formula.MatchF I r) j) 0" and "Monitor.progress \<sigma> P (formula.MatchF I r) j + length aux = progress_regex \<sigma> P r j"