[STATEMENT]
lemma r_distinguishable_k_least_next :
  assumes "\<exists> k . r_distinguishable_k M q1 q2 k"
      and "(LEAST k . r_distinguishable_k M q1 q2 k) = Suc k"
      and "x \<in> (inputs M)"
      and "\<forall>t1\<in> transitions M. \<forall>t2\<in> transitions M.
            t_source t1 = q1 \<and>
            t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow>
            r_distinguishable_k M (t_target t1) (t_target t2) k"
    shows "\<exists> t1 \<in> transitions M . \<exists> t2 \<in> transitions M . (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k . r_distinguishable_k M (t_target t1) (t_target t2) k) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
have "r_distinguishable_k M q1 q2 (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (Suc k)
[PROOF STEP]
using assms LeastI
[PROOF STATE]
proof (prove)
using this:
\<exists>k. r_distinguishable_k M q1 q2 k
(LEAST k. r_distinguishable_k M q1 q2 k) = Suc k
x \<in> FSM.inputs M
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k
?P ?k \<Longrightarrow> ?P (LEAST x. ?P x)

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (Suc k)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (Suc k)

goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (Suc k)

goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
have "\<not> r_distinguishable_k M q1 q2 k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> r_distinguishable_k M q1 q2 k
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
(LEAST k. r_distinguishable_k M q1 q2 k) = Suc k

goal (1 subgoal):
 1. \<not> r_distinguishable_k M q1 q2 k
[PROOF STEP]
by (metis lessI not_less_Least)
[PROOF STATE]
proof (state)
this:
\<not> r_distinguishable_k M q1 q2 k

goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
have **: "(\<forall>t1\<in> transitions M.
         \<forall>t2\<in> transitions M.
            t_source t1 = q1 \<and>
            t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow>
            (LEAST k' . r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
[PROOF STEP]
using assms(3,4) Least_le
[PROOF STATE]
proof (prove)
using this:
x \<in> FSM.inputs M
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k
?P ?k \<Longrightarrow> (LEAST x. ?P x) \<le> ?k

goal (1 subgoal):
 1. \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k

goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
assume assm : "\<not> (\<exists>t1\<in>(transitions M).
           \<exists>t2\<in>(transitions M).
              (t_source t1 = q1 \<and>
               t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and>
              (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k)"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k)

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
let ?hs = "{(t1,t2) | t1 t2 . t1 \<in> transitions M \<and> t2 \<in> transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have "finite ?hs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
have "?hs \<subseteq> (transitions M \<times> transitions M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<subseteq> FSM.transitions M \<times> FSM.transitions M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<subseteq> FSM.transitions M \<times> FSM.transitions M

goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<subseteq> FSM.transitions M \<times> FSM.transitions M

goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
have "finite (transitions M \<times> transitions M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (FSM.transitions M \<times> FSM.transitions M)
[PROOF STEP]
using fsm_transitions_finite
[PROOF STATE]
proof (prove)
using this:
finite (FSM.transitions ?M)

goal (1 subgoal):
 1. finite (FSM.transitions M \<times> FSM.transitions M)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (FSM.transitions M \<times> FSM.transitions M)

goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<subseteq> FSM.transitions M \<times> FSM.transitions M
finite (FSM.transitions M \<times> FSM.transitions M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<subseteq> FSM.transitions M \<times> FSM.transitions M
finite (FSM.transitions M \<times> FSM.transitions M)

goal (1 subgoal):
 1. finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
by (simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have fk_def : "\<And> tt . tt \<in> ?hs \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
fix tt
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
assume "tt \<in> ?hs"
[PROOF STATE]
proof (state)
this:
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
have "(fst tt) \<in> transitions M \<and> (snd tt) \<in> transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)"
[PROOF STATE]
proof (prove)
using this:
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)

goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)
[PROOF STEP]
have "\<exists> k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k"
[PROOF STATE]
proof (prove)
using this:
fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)

goal (1 subgoal):
 1. \<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k

goal (1 subgoal):
 1. \<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k

goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k
[PROOF STEP]
show "r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k

goal (1 subgoal):
 1. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
using LeastI2_wellorder
[PROOF STATE]
proof (prove)
using this:
\<exists>k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k
\<lbrakk>?P ?a; \<And>a. \<lbrakk>?P a; \<forall>b. ?P b \<longrightarrow> a \<le> b\<rbrakk> \<Longrightarrow> ?Q a\<rbrakk> \<Longrightarrow> ?Q (Least ?P)

goal (1 subgoal):
 1. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) (LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) (LEAST k. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k)

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
let ?k = "Max (image (\<lambda> tt . (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)) ?hs)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have "\<And> t1 t2 . t1 \<in> transitions M \<Longrightarrow> t2 \<in> transitions M \<Longrightarrow> t_source t1 = q1 \<Longrightarrow> t_source t2 = q2 \<Longrightarrow> t_input t1 = x \<Longrightarrow> t_input t2 = x \<Longrightarrow> t_output t1 = t_output t2 \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) ?k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
fix t1 t2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
assume "t1 \<in> transitions M"
                   and "t2 \<in> transitions M"
                   and "t_source t1 = q1"
                   and "t_source t2 = q2"
                   and "t_input t1 = x"
                   and "t_input t2 = x"
                   and "t_output t1 = t_output t2"
[PROOF STATE]
proof (state)
this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1
t_source t2 = q2
t_input t1 = x
t_input t2 = x
t_output t1 = t_output t2

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1
t_source t2 = q2
t_input t1 = x
t_input t2 = x
t_output t1 = t_output t2
[PROOF STEP]
have "(t1,t2) \<in> ?hs"
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1
t_source t2 = q2
t_input t1 = x
t_input t2 = x
t_output t1 = t_output t2

goal (1 subgoal):
 1. (t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
[PROOF STEP]
have "r_distinguishable_k M (t_target t1) (t_target t2) ((\<lambda> tt . (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)) (t1,t2))"
[PROOF STATE]
proof (prove)
using this:
(t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k)
[PROOF STEP]
using fk_def
[PROOF STATE]
proof (prove)
using this:
(t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) (LEAST k. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k)

goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k)

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
have "(\<lambda> tt . (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)) (t1,t2) \<le> ?k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k) \<le> (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
using \<open>(t1,t2) \<in> ?hs\<close> \<open>finite ?hs\<close>
[PROOF STATE]
proof (prove)
using this:
(t1, t2) \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. (LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k) \<le> (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
by (meson Max.coboundedI finite_imageI image_iff)
[PROOF STATE]
proof (state)
this:
(LEAST k. r_distinguishable_k M (t_target (fst (t1, t2))) (t_target (snd (t1, t2))) k) \<le> (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1; t_source t2 = q2; t_input t1 = x; t_input t2 = x; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
show "r_distinguishable_k M (t_target t1) (t_target t2) ?k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
using r_distinguishable_k_by_larger[OF \<open>r_distinguishable_k M (t_target t1) (t_target t2) ((\<lambda> tt . (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)) (t1,t2))\<close> \<open>(\<lambda> tt . (LEAST k . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)) (t1,t2) \<le> ?k\<close>]
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1; t_source ?t2.0 = q2; t_input ?t1.0 = x; t_input ?t2.0 = x; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1; t_source ?t2.0 = q2; t_input ?t1.0 = x; t_input ?t2.0 = x; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
[PROOF STEP]
have "r_distinguishable_k M q1 q2 (Suc ?k)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1; t_source ?t2.0 = q2; t_input ?t1.0 = x; t_input ?t2.0 = x; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (Suc (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k))
[PROOF STEP]
unfolding r_distinguishable_k.simps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1; t_source ?t2.0 = q2; t_input ?t1.0 = x; t_input ?t2.0 = x; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. Least (r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)))) \<or> (\<exists>xa\<in>FSM.inputs M. \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = xa \<and> t_input t2 = xa \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. Least (r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)))))
[PROOF STEP]
using \<open>x \<in> (inputs M)\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1; t_source ?t2.0 = q2; t_input ?t1.0 = x; t_input ?t2.0 = x; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k)
x \<in> FSM.inputs M

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. Least (r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)))) \<or> (\<exists>xa\<in>FSM.inputs M. \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = xa \<and> t_input t2 = xa \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. Least (r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (Suc (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k))

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have "?hs \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<noteq> {}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {} \<Longrightarrow> False
[PROOF STEP]
assume "?hs = {}"
[PROOF STATE]
proof (state)
this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {}

goal (1 subgoal):
 1. {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {}
[PROOF STEP]
have "r_distinguishable_k M q1 q2 0"
[PROOF STATE]
proof (prove)
using this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {}

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 0
[PROOF STEP]
unfolding r_distinguishable_k.simps
[PROOF STATE]
proof (prove)
using this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {}

goal (1 subgoal):
 1. \<exists>x\<in>FSM.inputs M. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)
[PROOF STEP]
using \<open>x \<in> (inputs M)\<close>
[PROOF STATE]
proof (prove)
using this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {}
x \<in> FSM.inputs M

goal (1 subgoal):
 1. \<exists>x\<in>FSM.inputs M. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 0

goal (1 subgoal):
 1. {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} = {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r_distinguishable_k M q1 q2 0
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 0
(LEAST k. r_distinguishable_k M q1 q2 k) = Suc k

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<noteq> {}

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have "\<And> t1 t2 . t1\<in> transitions M \<Longrightarrow>
         t2\<in> transitions M \<Longrightarrow>
            t_source t1 = q1 \<and>
            t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<Longrightarrow>
            (LEAST k' . r_distinguishable_k M (t_target t1) (t_target t2) k') < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
fix t1 t2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
assume "t1\<in> transitions M" and "t2\<in> transitions M" and t12_def : "t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2"
[PROOF STATE]
proof (state)
this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
have "(LEAST k' . r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
[PROOF STEP]
using \<open>t1\<in> transitions M\<close> \<open>t2\<in> transitions M\<close> t12_def **
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k

goal (1 subgoal):
 1. (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
have "(LEAST k' . r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k
[PROOF STEP]
using \<open>t1\<in> transitions M\<close> \<open>t2\<in> transitions M\<close> t12_def assm
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
\<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k)

goal (1 subgoal):
 1. (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k
[PROOF STEP]
show "(LEAST k' . r_distinguishable_k M (t_target t1) (t_target t2) k') < k"
[PROOF STATE]
proof (prove)
using this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<le> k
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') \<noteq> k

goal (1 subgoal):
 1. (LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST k'. r_distinguishable_k M (t_target t1) (t_target t2) k') < k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1 \<and> t_source ?t2.0 = q2 \<and> t_input ?t1.0 = x \<and> t_input ?t2.0 = x \<and> t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) k') < k

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1 \<and> t_source ?t2.0 = q2 \<and> t_input ?t1.0 = x \<and> t_input ?t2.0 = x \<and> t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) k') < k

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
have "\<And> tt . tt \<in> ?hs \<Longrightarrow> (fst tt) \<in> transitions M \<and> (snd tt) \<in> transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> fst tt \<in> FSM.transitions M \<and> snd tt \<in> FSM.transitions M \<and> t_source (fst tt) = q1 \<and> t_source (snd tt) = q2 \<and> t_input (fst tt) = x \<and> t_input (snd tt) = x \<and> t_output (fst tt) = t_output (snd tt)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> fst ?tt \<in> FSM.transitions M \<and> snd ?tt \<in> FSM.transitions M \<and> t_source (fst ?tt) = q1 \<and> t_source (snd ?tt) = q2 \<and> t_input (fst ?tt) = x \<and> t_input (snd ?tt) = x \<and> t_output (fst ?tt) = t_output (snd ?tt)

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1 \<and> t_source ?t2.0 = q2 \<and> t_input ?t1.0 = x \<and> t_input ?t2.0 = x \<and> t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) k') < k
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> fst ?tt \<in> FSM.transitions M \<and> snd ?tt \<in> FSM.transitions M \<and> t_source (fst ?tt) = q1 \<and> t_source (snd ?tt) = q2 \<and> t_input (fst ?tt) = x \<and> t_input (snd ?tt) = x \<and> t_output (fst ?tt) = t_output (snd ?tt)
[PROOF STEP]
have "\<And> tt . tt \<in> ?hs \<Longrightarrow> (LEAST k' . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k') < k"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M; ?t2.0 \<in> FSM.transitions M; t_source ?t1.0 = q1 \<and> t_source ?t2.0 = q2 \<and> t_input ?t1.0 = x \<and> t_input ?t2.0 = x \<and> t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target ?t1.0) (t_target ?t2.0) k') < k
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> fst ?tt \<in> FSM.transitions M \<and> snd ?tt \<in> FSM.transitions M \<and> t_source (fst ?tt) = q1 \<and> t_source (snd ?tt) = q2 \<and> t_input (fst ?tt) = x \<and> t_input (snd ?tt) = x \<and> t_output (fst ?tt) = t_output (snd ?tt)

goal (1 subgoal):
 1. \<And>tt. tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k') < k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k') < k

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k') < k

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
obtain tt where "tt \<in> ?hs" and "?k = (LEAST k' . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>tt. \<lbrakk>tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}; (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Max_elem[OF \<open>finite ?hs\<close> \<open>?hs \<noteq> {}\<close>, of "\<lambda> tt . (LEAST k' . r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')"]
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k') = (LEAST k'. r_distinguishable_k M (t_target (fst xa)) (t_target (snd xa)) k')

goal (1 subgoal):
 1. (\<And>tt. \<lbrakk>tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}; (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k') < k
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')
[PROOF STEP]
have "?k < k"
[PROOF STATE]
proof (prove)
using this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k') < k
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')

goal (1 subgoal):
 1. (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k
[PROOF STEP]
using \<open>finite ?hs\<close>
[PROOF STATE]
proof (prove)
using this:
?tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2} \<Longrightarrow> (LEAST k'. r_distinguishable_k M (t_target (fst ?tt)) (t_target (snd ?tt)) k') < k
tt \<in> {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) = (LEAST k'. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k')
finite {(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}

goal (1 subgoal):
 1. (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k

goal (1 subgoal):
 1. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2) \<open>r_distinguishable_k M q1 q2 (Suc ?k)\<close>
[PROOF STATE]
proof (prove)
using this:
(MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k) < k
(LEAST k. r_distinguishable_k M q1 q2 k) = Suc k
r_distinguishable_k M q1 q2 (Suc (MAX tt\<in>{(t1, t2) |t1 t2. t1 \<in> FSM.transitions M \<and> t2 \<in> FSM.transitions M \<and> t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2}. LEAST k. r_distinguishable_k M (t_target (fst tt)) (t_target (snd tt)) k))

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis (no_types, lifting) Suc_mono not_less_Least)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma C\<^sub>0_minus: "C\<^sub>0 (- x) = - C\<^sub>0 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C\<^sub>0 (- x) = - C\<^sub>0 x
[PROOF STEP]
by (simp add: C\<^sub>0_def single_uminus)


[STATEMENT]
lemma size_index_conv: "size xs = n \<Longrightarrow> (n = index xs x) = (x \<notin> set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = n \<Longrightarrow> (n = index xs x) = (x \<notin> set xs)
[PROOF STEP]
by (metis index_size_conv)


[STATEMENT]
lemma SA_zero_set_memI:
  assumes "f \<in> carrier (SA n)"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "f x = \<zero>"
  shows  "x \<in> SA_zero_set n f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> SA_zero_set n f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f x = \<zero>

goal (1 subgoal):
 1. x \<in> SA_zero_set n f
[PROOF STEP]
unfolding SA_zero_set_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f x = \<zero>

goal (1 subgoal):
 1. x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>}
[PROOF STEP]
by blast


[STATEMENT]
lemma det_1[simp]: "det (1::'a::comm_ring_1^^'n) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det 1 = (1::'a)
[PROOF STEP]
by (subst det_diagonal) (transfer, simp)+


[STATEMENT]
lemma has_integral_affinity':
  fixes a :: "'a::euclidean_space"
  assumes "(f has_integral i) (cbox a b)" and "m > 0"
  shows "((\<lambda>x. f(m *\<^sub>R x + c)) has_integral (i /\<^sub>R m ^ DIM('a)))
           (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
proof (cases "cbox a b = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cbox a b = {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
 2. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
cbox a b = {}

goal (2 subgoals):
 1. cbox a b = {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
 2. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
hence "(cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) = {}"
[PROOF STATE]
proof (prove)
using this:
cbox a b = {}

goal (1 subgoal):
 1. cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m) = {}
[PROOF STEP]
using \<open>m > 0\<close>
[PROOF STATE]
proof (prove)
using this:
cbox a b = {}
0 < m

goal (1 subgoal):
 1. cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m) = {}
[PROOF STEP]
unfolding box_eq_empty
[PROOF STATE]
proof (prove)
using this:
\<exists>i\<in>Basis. b \<bullet> i < a \<bullet> i
0 < m

goal (1 subgoal):
 1. \<exists>i\<in>Basis. ((b - c) /\<^sub>R m) \<bullet> i < ((a - c) /\<^sub>R m) \<bullet> i
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m) = {}

goal (2 subgoals):
 1. cbox a b = {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
 2. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
with True and assms
[PROOF STATE]
proof (chain)
picking this:
cbox a b = {}
(f has_integral i) (cbox a b)
0 < m
cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cbox a b = {}
(f has_integral i) (cbox a b)
0 < m
cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m) = {}

goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
cbox a b \<noteq> {}

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
have "((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i)
          ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_integral i) (cbox a b)
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)
[PROOF STEP]
by (intro has_integral_affinity) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
have "((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b) =
               ((\<lambda>x.  - ((1 / m) *\<^sub>R c) + x) ` (\<lambda>x. (1 / m) *\<^sub>R x) ` cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b = (+) (- ((1 / m) *\<^sub>R c)) ` (*\<^sub>R) (1 / m) ` cbox a b
[PROOF STEP]
by (simp add: image_image algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b = (+) (- ((1 / m) *\<^sub>R c)) ` (*\<^sub>R) (1 / m) ` cbox a b

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b = (+) (- ((1 / m) *\<^sub>R c)) ` (*\<^sub>R) (1 / m) ` cbox a b

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
have "(\<lambda>x. (1 / m) *\<^sub>R x) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) (1 / m) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)
[PROOF STEP]
using \<open>m > 0\<close> False
[PROOF STATE]
proof (prove)
using this:
0 < m
cbox a b \<noteq> {}

goal (1 subgoal):
 1. (*\<^sub>R) (1 / m) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)
[PROOF STEP]
by (subst image_smult_cbox) simp_all
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) (1 / m) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) (1 / m) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
have "(\<lambda>x. - ((1 / m) *\<^sub>R c) + x) ` \<dots> = cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) (- ((1 / m) *\<^sub>R c)) ` cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b) = cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)
[PROOF STEP]
by (subst cbox_translation [symmetric]) (simp add: field_simps vector_add_divide_simps)
[PROOF STATE]
proof (state)
this:
(+) (- ((1 / m) *\<^sub>R c)) ` cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b) = cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))

goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
using \<open>m > 0\<close>
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral i /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) prod_principal_idealTr1:"  \<lbrakk>a \<in> carrier R; b \<in> carrier R\<rbrakk> \<Longrightarrow>
      \<forall>f \<in> {j. j \<le> (n::nat)} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b).
                                         \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>f\<in>{j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>f\<in>{j. j \<le> 0} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f 0 \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
 2. \<And>n. \<lbrakk>a \<in> carrier R; b \<in> carrier R; \<forall>f\<in>{j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)\<rbrakk> \<Longrightarrow> \<forall>f\<in>{j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f Suc n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (rule ballI,
        frule_tac f = f in funcset_mem[of _ "{j. j \<le> 0}"
         "set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b)"], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. \<lbrakk>a \<in> carrier R; b \<in> carrier R; f \<in> {j. j \<le> 0} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); f 0 \<in> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b)\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f 0 \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
 2. \<And>n. \<lbrakk>a \<in> carrier R; b \<in> carrier R; \<forall>f\<in>{j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)\<rbrakk> \<Longrightarrow> \<forall>f\<in>{j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f Suc n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (simp add:prod_principal_idealTr0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>a \<in> carrier R; b \<in> carrier R; \<forall>f\<in>{j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)\<rbrakk> \<Longrightarrow> \<forall>f\<in>{j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b). \<Sigma>\<^sub>e R f Suc n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (rule ballI,
       frule func_pre,
       frule_tac x = f in bspec, assumption,
       thin_tac "\<forall>f\<in>{j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b).
                                       \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f. \<lbrakk>a \<in> carrier R; b \<in> carrier R; f \<in> {j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); f \<in> {j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (frule ring_tOp_closed[of a b], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f. \<lbrakk>a \<in> carrier R; b \<in> carrier R; f \<in> {j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); f \<in> {j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b); a \<cdot>\<^sub>r b \<in> carrier R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (frule principal_ideal[of "a \<cdot>\<^sub>r b"], simp,
        rule ideal_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f. \<lbrakk>a \<in> carrier R; b \<in> carrier R; f \<in> {j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); f \<in> {j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b); a \<cdot>\<^sub>r b \<in> carrier R; ideal R (R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b))\<rbrakk> \<Longrightarrow> f (Suc n) \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (cut_tac n = "Suc n" in n_in_Nsetn,
        frule_tac f = f and A = "{j. j \<le> Suc n}" and
        B = "set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b)" in funcset_mem, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f. \<lbrakk>a \<in> carrier R; b \<in> carrier R; f \<in> {j. j \<le> Suc n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); f \<in> {j. j \<le> n} \<rightarrow> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b); \<Sigma>\<^sub>e R f n \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b); a \<cdot>\<^sub>r b \<in> carrier R; ideal R (R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)); Suc n \<in> {i. i \<le> Suc n}; f (Suc n) \<in> set_mult R (R \<diamondsuit>\<^sub>p a) (R \<diamondsuit>\<^sub>p b)\<rbrakk> \<Longrightarrow> f (Suc n) \<in> R \<diamondsuit>\<^sub>p (a \<cdot>\<^sub>r b)
[PROOF STEP]
apply (simp add:prod_principal_idealTr0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cm_Euclidean_space_iff_continuous_on:
  "continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
   \<longleftrightarrow> continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and>
       f ` (topspace (subtopology (Euclidean_space m) S)) \<subseteq> topspace (Euclidean_space n)"
  (is "?P \<longleftrightarrow> ?Q \<and> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
have ?Q if ?P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (topspace (subtopology (Euclidean_space m) S)) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on (topspace (subtopology (Euclidean_space m) S)) f
[PROOF STEP]
have "\<And>n. Euclidean_space n = top_of_set {f. \<forall>m\<ge>n. f m = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. Euclidean_space n = top_of_set {f. \<forall>m\<ge>n. f m = 0}
[PROOF STEP]
by (simp add: Euclidean_space_def euclidean_product_topology)
[PROOF STATE]
proof (state)
this:
Euclidean_space ?n = top_of_set {f. \<forall>m\<ge>?n. f m = 0}

goal (1 subgoal):
 1. continuous_on (topspace (subtopology (Euclidean_space m) S)) f
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
Euclidean_space ?n = top_of_set {f. \<forall>m\<ge>?n. f m = 0}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
Euclidean_space ?n = top_of_set {f. \<forall>m\<ge>?n. f m = 0}

goal (1 subgoal):
 1. continuous_on (topspace (subtopology (Euclidean_space m) S)) f
[PROOF STEP]
by (simp add: subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
continuous_on (topspace (subtopology (Euclidean_space m) S)) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> continuous_on (topspace (subtopology (Euclidean_space m) S)) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> continuous_on (topspace (subtopology (Euclidean_space m) S)) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
have ?R if ?P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f

goal (1 subgoal):
 1. f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
by (simp add: image_subset_iff continuous_map_def)
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
have ?P if ?Q ?R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
[PROOF STEP]
have "continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f
[PROOF STEP]
using Euclidean_space_def that
[PROOF STATE]
proof (prove)
using this:
Euclidean_space ?n \<equiv> subtopology (powertop_real UNIV) {x. \<forall>i\<ge>?n. x i = 0}
continuous_on (topspace (subtopology (Euclidean_space m) S)) f
f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)

goal (1 subgoal):
 1. continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_map (top_of_set (topspace (subtopology (subtopology (powertop_real UNIV) {f. \<forall>n\<ge>m. f n = 0}) S))) (top_of_set (topspace (subtopology (powertop_real UNIV) {f. \<forall>na\<ge>n. f na = 0}))) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
[PROOF STEP]
by (simp add: Euclidean_space_def euclidean_product_topology subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>continuous_on (topspace (subtopology (Euclidean_space m) S)) f; f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)\<rbrakk> \<Longrightarrow> continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> continuous_on (topspace (subtopology (Euclidean_space m) S)) f
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)
\<lbrakk>continuous_on (topspace (subtopology (Euclidean_space m) S)) f; f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)\<rbrakk> \<Longrightarrow> continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> continuous_on (topspace (subtopology (Euclidean_space m) S)) f
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f \<Longrightarrow> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)
\<lbrakk>continuous_on (topspace (subtopology (Euclidean_space m) S)) f; f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n)\<rbrakk> \<Longrightarrow> continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f

goal (1 subgoal):
 1. continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (Euclidean_space n) f = (continuous_on (topspace (subtopology (Euclidean_space m) S)) f \<and> f ` topspace (subtopology (Euclidean_space m) S) \<subseteq> topspace (Euclidean_space n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_base: "get_base (square_base b) = get_base b * get_base b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_base (square_base b) = get_base b * get_base b
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
lemma recip_succ_recip: "recip \<circ> succ \<circ> recip = (\<lambda>(x, y). (x, x + y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. recip \<circ> succ \<circ> recip = (\<lambda>(x, y). (x, x + y))
[PROOF STEP]
by (clarsimp simp: fun_eq_iff)


[STATEMENT]
lemma has_real_derivative_pos_inc_left:
  fixes f :: "real \<Rightarrow> real"
  shows "(f has_real_derivative l) (at x within S) \<Longrightarrow> 0 < l \<Longrightarrow>
    \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f (x - h) < f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative l) (at x within S); 0 < l\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f (x - h) < f x
[PROOF STEP]
by (rule has_real_derivative_neg_dec_left [of "\<lambda>x. - f x" "-l" x S, simplified])
      (auto simp add: DERIV_minus)


[STATEMENT]
lemma ereal_of_enat_1: "ereal_of_enat 1 = ereal 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal_of_enat 1 = ereal 1
[PROOF STEP]
by (simp add: one_enat_def)


[STATEMENT]
lemma extended_simps [simp]:
  "(\<turnstile> < x) = (x \<noteq> \<turnstile>)"
  "(\<lbrakk>x'\<rbrakk> < \<lbrakk>y'\<rbrakk>) = (x' < y')"
  "\<lbrakk>x'\<rbrakk> < \<stileturn>"
  "\<not>(\<lbrakk>x'\<rbrakk> < \<turnstile>)"
  "\<not>(\<stileturn> < x)"
  "\<turnstile> \<le> x"
  "(\<lbrakk>x'\<rbrakk> \<le> \<lbrakk>y'\<rbrakk>) = ((x' :: '\<I> :: linorder) \<le> y')"
  "x \<le> \<stileturn>"
  "\<not>(\<lbrakk>x'\<rbrakk> \<le> \<turnstile>)"
  "(\<stileturn> \<le> x) = (x = \<stileturn>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((\<turnstile> < x) = (x \<noteq> \<turnstile>) &&& (\<lbrakk>x'\<rbrakk> < \<lbrakk>y'\<rbrakk>) = (x' < y')) &&& \<lbrakk>x'\<rbrakk> < \<stileturn> &&& \<not> \<lbrakk>x'\<rbrakk> < \<turnstile> &&& \<not> \<stileturn> < x) &&& (\<turnstile> \<le> x &&& (\<lbrakk>x'\<rbrakk> \<le> \<lbrakk>y'\<rbrakk>) = (x' \<le> y')) &&& x \<le> \<stileturn> &&& \<not> \<lbrakk>x'\<rbrakk> \<le> \<turnstile> &&& (\<stileturn> \<le> x) = (x = \<stileturn>)
[PROOF STEP]
by (case_tac [!] x, simp_all add:less_extended_def less_eq_extended_def le_less)


[STATEMENT]
lemma reduce_system_matrix_subsets_helper:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  fixes S:: "nat list"
  assumes nonzero: "p \<noteq> 0"
  assumes inv: "length subsets \<ge> length signs"
  assumes well_def_h: "\<forall>x. List.member S x \<longrightarrow> x < length subsets"
  shows "matrix_A signs (take_indices subsets S) = take_rows_from_matrix (matrix_A signs subsets) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat signs (take_indices subsets S) = take_rows_from_matrix (M_mat signs subsets) S
[PROOF STEP]
using assms reduce_system_matrix_subsets_helper_aux alt_matrix_char
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
length signs \<le> length subsets
\<forall>x. List.member S x \<longrightarrow> x < length subsets
\<lbrakk>length ?signs \<le> length ?subsets; \<forall>x. List.member ?S x \<longrightarrow> x < length ?subsets; ?p \<noteq> 0\<rbrakk> \<Longrightarrow> alt_matrix_A ?signs (take_indices ?subsets ?S) = take_rows_from_matrix (alt_matrix_A ?signs ?subsets) ?S
alt_matrix_A ?signs ?subsets = M_mat ?signs ?subsets

goal (1 subgoal):
 1. M_mat signs (take_indices subsets S) = take_rows_from_matrix (M_mat signs subsets) S
[PROOF STEP]
by auto