[STATEMENT]
lemma paths_from_product_path :
  assumes "path (product A B) (initial (product A B)) p"
  shows   "path A (initial A) (left_path p)"
      and "path B (initial B) (right_path p)"
      and "target (initial A) (left_path p) = fst (target (initial (product A B)) p)"
      and "target (initial B) (right_path p) = snd (target (initial (product A B)) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (path A (FSM.initial A) (left_path p) &&& path B (FSM.initial B) (right_path p)) &&& target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) &&& target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. path A (FSM.initial A) (left_path p)
 2. path B (FSM.initial B) (right_path p)
 3. target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
 4. target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
have "path A (initial A) (left_path p)
            \<and> path B (initial B) (right_path p)
            \<and> target (initial A) (left_path p) = fst (target (initial (product A B)) p)
            \<and> target (initial B) (right_path p) = snd (target (initial (product A B)) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p

goal (1 subgoal):
 1. path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
proof (induction p rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) [] \<Longrightarrow> path A (FSM.initial A) (left_path []) \<and> path B (FSM.initial B) (right_path []) \<and> target (FSM.initial A) (left_path []) = fst (target (FSM.initial (Product_FSM.product A B)) []) \<and> target (FSM.initial B) (right_path []) = snd (target (FSM.initial (Product_FSM.product A B)) [])
 2. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) []

goal (2 subgoals):
 1. path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) [] \<Longrightarrow> path A (FSM.initial A) (left_path []) \<and> path B (FSM.initial B) (right_path []) \<and> target (FSM.initial A) (left_path []) = fst (target (FSM.initial (Product_FSM.product A B)) []) \<and> target (FSM.initial B) (right_path []) = snd (target (FSM.initial (Product_FSM.product A B)) [])
 2. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) []

goal (1 subgoal):
 1. path A (FSM.initial A) (left_path []) \<and> path B (FSM.initial B) (right_path []) \<and> target (FSM.initial A) (left_path []) = fst (target (FSM.initial (Product_FSM.product A B)) []) \<and> target (FSM.initial B) (right_path []) = snd (target (FSM.initial (Product_FSM.product A B)) [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path []) \<and> path B (FSM.initial B) (right_path []) \<and> target (FSM.initial A) (left_path []) = fst (target (FSM.initial (Product_FSM.product A B)) []) \<and> target (FSM.initial B) (right_path []) = snd (target (FSM.initial (Product_FSM.product A B)) [])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
case (snoc t p)
[PROOF STATE]
proof (state)
this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p \<Longrightarrow> path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (p @ [t])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p \<Longrightarrow> path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (p @ [t])
[PROOF STEP]
have "path (product A B) (initial (product A B)) p"
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p \<Longrightarrow> path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (p @ [t])

goal (1 subgoal):
 1. path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p
[PROOF STEP]
have "path A (initial A) (left_path p)"
      and "path B (initial B) (right_path p)"
      and "target (initial A) (left_path p) = fst (target (initial (product A B)) p)"
      and "target (initial B) (right_path p) = snd (target (initial (product A B)) p)"
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p

goal (1 subgoal):
 1. (path A (FSM.initial A) (left_path p) &&& path B (FSM.initial B) (right_path p)) &&& target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) &&& target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
using snoc.IH
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) p \<Longrightarrow> path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal (1 subgoal):
 1. (path A (FSM.initial A) (left_path p) &&& path B (FSM.initial B) (right_path p)) &&& target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) &&& target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
by fastforce+
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path p)
path B (FSM.initial B) (right_path p)
target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path A (FSM.initial A) (left_path p)
path B (FSM.initial B) (right_path p)
target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
have "t_source t = (target (initial A) (left_path p), target (initial B) (right_path p))"
[PROOF STATE]
proof (prove)
using this:
path A (FSM.initial A) (left_path p)
path B (FSM.initial B) (right_path p)
target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal (1 subgoal):
 1. t_source t = (target (FSM.initial A) (left_path p), target (FSM.initial B) (right_path p))
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
path A (FSM.initial A) (left_path p)
path B (FSM.initial B) (right_path p)
target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (p @ [t])

goal (1 subgoal):
 1. t_source t = (target (FSM.initial A) (left_path p), target (FSM.initial B) (right_path p))
[PROOF STEP]
by (metis (no_types, lifting) path_cons_elim path_suffix prod.collapse)
[PROOF STATE]
proof (state)
this:
t_source t = (target (FSM.initial A) (left_path p), target (FSM.initial B) (right_path p))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have ***: "target (initial A) (left_path (p@[t]))= fst (target (initial (product A B)) (p@[t]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have ****: "target (initial B) (right_path (p@[t]))= snd (target (initial (product A B)) (p@[t]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have "t \<in> transitions (product A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> FSM.transitions (Product_FSM.product A B)
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (p @ [t])

goal (1 subgoal):
 1. t \<in> FSM.transitions (Product_FSM.product A B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> FSM.transitions (Product_FSM.product A B)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> FSM.transitions (Product_FSM.product A B)
[PROOF STEP]
have "(fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> transitions A"
[PROOF STATE]
proof (prove)
using this:
t \<in> FSM.transitions (Product_FSM.product A B)

goal (1 subgoal):
 1. (fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A
[PROOF STEP]
unfolding product_transitions_alt_def
[PROOF STATE]
proof (prove)
using this:
t \<in> {((t_source tA, t_source tB), t_input tA, t_output tA, t_target tA, t_target tB) |tA tB. tA \<in> FSM.transitions A \<and> tB \<in> FSM.transitions B \<and> t_input tA = t_input tB \<and> t_output tA = t_output tB}

goal (1 subgoal):
 1. (fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have "target (initial A) (left_path p) = fst (t_source t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. target (FSM.initial A) (left_path p) = fst (t_source t)
[PROOF STEP]
using \<open>t_source t = (target (initial A) (left_path p), target (initial B) (right_path p))\<close>
[PROOF STATE]
proof (prove)
using this:
t_source t = (target (FSM.initial A) (left_path p), target (FSM.initial B) (right_path p))

goal (1 subgoal):
 1. target (FSM.initial A) (left_path p) = fst (t_source t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
target (FSM.initial A) (left_path p) = fst (t_source t)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A
target (FSM.initial A) (left_path p) = fst (t_source t)
[PROOF STEP]
have "path A (initial A) ((left_path p)@[(fst (t_source t), t_input t, t_output t, fst (t_target t))])"
[PROOF STATE]
proof (prove)
using this:
(fst (t_source t), t_input t, t_output t, fst (t_target t)) \<in> FSM.transitions A
target (FSM.initial A) (left_path p) = fst (t_source t)

goal (1 subgoal):
 1. path A (FSM.initial A) (left_path p @ [(fst (t_source t), t_input t, t_output t, fst (t_target t))])
[PROOF STEP]
by (simp add: \<open>path A (initial A) (map (\<lambda>t. (fst (t_source t), t_input t, t_output t, fst (t_target t))) p)\<close> path_append_transition)
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path p @ [(fst (t_source t), t_input t, t_output t, fst (t_target t))])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path A (FSM.initial A) (left_path p @ [(fst (t_source t), t_input t, t_output t, fst (t_target t))])
[PROOF STEP]
have *: "path A (initial A) (left_path (p@[t]))"
[PROOF STATE]
proof (prove)
using this:
path A (FSM.initial A) (left_path p @ [(fst (t_source t), t_input t, t_output t, fst (t_target t))])

goal (1 subgoal):
 1. path A (FSM.initial A) (left_path (p @ [t]))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path (p @ [t]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have "(snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> transitions B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B
[PROOF STEP]
using \<open>t \<in> transitions (product A B)\<close>
[PROOF STATE]
proof (prove)
using this:
t \<in> FSM.transitions (Product_FSM.product A B)

goal (1 subgoal):
 1. (snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B
[PROOF STEP]
unfolding product_transitions_alt_def
[PROOF STATE]
proof (prove)
using this:
t \<in> {((t_source tA, t_source tB), t_input tA, t_output tA, t_target tA, t_target tB) |tA tB. tA \<in> FSM.transitions A \<and> tB \<in> FSM.transitions B \<and> t_input tA = t_input tB \<and> t_output tA = t_output tB}

goal (1 subgoal):
 1. (snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
have "target (initial B) (right_path p) = snd (t_source t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. target (FSM.initial B) (right_path p) = snd (t_source t)
[PROOF STEP]
using \<open>t_source t = (target (initial A) (left_path p), target (initial B) (right_path p))\<close>
[PROOF STATE]
proof (prove)
using this:
t_source t = (target (FSM.initial A) (left_path p), target (FSM.initial B) (right_path p))

goal (1 subgoal):
 1. target (FSM.initial B) (right_path p) = snd (t_source t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
target (FSM.initial B) (right_path p) = snd (t_source t)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B
target (FSM.initial B) (right_path p) = snd (t_source t)
[PROOF STEP]
have "path B (initial B) ((right_path p)@[(snd (t_source t), t_input t, t_output t, snd (t_target t))])"
[PROOF STATE]
proof (prove)
using this:
(snd (t_source t), t_input t, t_output t, snd (t_target t)) \<in> FSM.transitions B
target (FSM.initial B) (right_path p) = snd (t_source t)

goal (1 subgoal):
 1. path B (FSM.initial B) (right_path p @ [(snd (t_source t), t_input t, t_output t, snd (t_target t))])
[PROOF STEP]
by (simp add: \<open>path B (initial B) (map (\<lambda>t. (snd (t_source t), t_input t, t_output t, snd (t_target t))) p)\<close> path_append_transition)
[PROOF STATE]
proof (state)
this:
path B (FSM.initial B) (right_path p @ [(snd (t_source t), t_input t, t_output t, snd (t_target t))])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path B (FSM.initial B) (right_path p @ [(snd (t_source t), t_input t, t_output t, snd (t_target t))])
[PROOF STEP]
have **: "path B (initial B) (right_path (p@[t]))"
[PROOF STATE]
proof (prove)
using this:
path B (FSM.initial B) (right_path p @ [(snd (t_source t), t_input t, t_output t, snd (t_target t))])

goal (1 subgoal):
 1. path B (FSM.initial B) (right_path (p @ [t]))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path B (FSM.initial B) (right_path (p @ [t]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) xs \<Longrightarrow> path A (FSM.initial A) (left_path xs) \<and> path B (FSM.initial B) (right_path xs) \<and> target (FSM.initial A) (left_path xs) = fst (target (FSM.initial (Product_FSM.product A B)) xs) \<and> target (FSM.initial B) (right_path xs) = snd (target (FSM.initial (Product_FSM.product A B)) xs); path (Product_FSM.product A B) (FSM.initial (Product_FSM.product A B)) (xs @ [x])\<rbrakk> \<Longrightarrow> path A (FSM.initial A) (left_path (xs @ [x])) \<and> path B (FSM.initial B) (right_path (xs @ [x])) \<and> target (FSM.initial A) (left_path (xs @ [x])) = fst (target (FSM.initial (Product_FSM.product A B)) (xs @ [x])) \<and> target (FSM.initial B) (right_path (xs @ [x])) = snd (target (FSM.initial (Product_FSM.product A B)) (xs @ [x]))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path A (FSM.initial A) (left_path (p @ [t])) \<and> path B (FSM.initial B) (right_path (p @ [t])) \<and> target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t])) \<and> target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))
[PROOF STEP]
using * ** *** ****
[PROOF STATE]
proof (prove)
using this:
path A (FSM.initial A) (left_path (p @ [t]))
path B (FSM.initial B) (right_path (p @ [t]))
target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))
target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))

goal (1 subgoal):
 1. path A (FSM.initial A) (left_path (p @ [t])) \<and> path B (FSM.initial B) (right_path (p @ [t])) \<and> target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t])) \<and> target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path (p @ [t])) \<and> path B (FSM.initial B) (right_path (p @ [t])) \<and> target (FSM.initial A) (left_path (p @ [t])) = fst (target (FSM.initial (Product_FSM.product A B)) (p @ [t])) \<and> target (FSM.initial B) (right_path (p @ [t])) = snd (target (FSM.initial (Product_FSM.product A B)) (p @ [t]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal (4 subgoals):
 1. path A (FSM.initial A) (left_path p)
 2. path B (FSM.initial B) (right_path p)
 3. target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
 4. target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
show "path A (initial A) (left_path p)"
      and "path B (initial B) (right_path p)"
      and "target (initial A) (left_path p) = fst (target (initial (product A B)) p)"
      and "target (initial B) (right_path p) = snd (target (initial (product A B)) p)"
[PROOF STATE]
proof (prove)
using this:
path A (FSM.initial A) (left_path p) \<and> path B (FSM.initial B) (right_path p) \<and> target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) \<and> target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal (1 subgoal):
 1. (path A (FSM.initial A) (left_path p) &&& path B (FSM.initial B) (right_path p)) &&& target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p) &&& target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
path A (FSM.initial A) (left_path p)
path B (FSM.initial B) (right_path p)
target (FSM.initial A) (left_path p) = fst (target (FSM.initial (Product_FSM.product A B)) p)
target (FSM.initial B) (right_path p) = snd (target (FSM.initial (Product_FSM.product A B)) p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arc_set_balanced_all:
  "arc_set_balanced u (arcs G) v =
      (if u = v then (\<forall>w \<in> verts G. in_degree G w = out_degree G w)
      else (\<forall>w \<in> verts G. (w \<noteq> u \<and> w \<noteq> v) \<longrightarrow> in_degree G w = out_degree G w)
        \<and> in_degree G u + 1 = out_degree G u
        \<and> out_degree G v + 1 = in_degree G v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_set_balanced u (arcs G) v = (if u = v then \<forall>w\<in>verts G. in_degree G w = out_degree G w else (\<forall>w\<in>verts G. w \<noteq> u \<and> w \<noteq> v \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v)
[PROOF STEP]
unfolding arc_set_balanced_def arc_set_balance_def in_degree_def out_degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if u = v then \<forall>w\<in>verts G. int (card (in_arcs G w \<inter> arcs G)) - int (card (out_arcs G w \<inter> arcs G)) = 0 else (\<forall>w\<in>verts G. w \<noteq> u \<and> w \<noteq> v \<longrightarrow> int (card (in_arcs G w \<inter> arcs G)) - int (card (out_arcs G w \<inter> arcs G)) = 0) \<and> int (card (in_arcs G u \<inter> arcs G)) - int (card (out_arcs G u \<inter> arcs G)) = - 1 \<and> int (card (in_arcs G v \<inter> arcs G)) - int (card (out_arcs G v \<inter> arcs G)) = 1) = (if u = v then \<forall>w\<in>verts G. card (in_arcs G w) = card (out_arcs G w) else (\<forall>w\<in>verts G. w \<noteq> u \<and> w \<noteq> v \<longrightarrow> card (in_arcs G w) = card (out_arcs G w)) \<and> card (in_arcs G u) + 1 = card (out_arcs G u) \<and> card (out_arcs G v) + 1 = card (in_arcs G v))
[PROOF STEP]
by auto


[STATEMENT]
lemma filter_le_avg_correct:
    "my_invar s \<Longrightarrow>
    my_invar (filter_le_avg s) \<and>
    my_\<alpha> (filter_le_avg s) = {x\<in>my_\<alpha> s. x\<le>average (my_\<alpha> s)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. my_invar s \<Longrightarrow> my_invar (filter_le_avg s) \<and> my_\<alpha> (filter_le_avg s) = {x \<in> my_\<alpha> s. x \<le> average (my_\<alpha> s)}
[PROOF STEP]
unfolding filter_le_avg_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. my_invar s \<Longrightarrow> my_invar (hs.iterate s (\<lambda>x sa. if x \<le> avg s then my_ins x sa else sa) (my_empty ())) \<and> my_\<alpha> (hs.iterate s (\<lambda>x sa. if x \<le> avg s then my_ins x sa else sa) (my_empty ())) = {x \<in> my_\<alpha> s. x \<le> average (my_\<alpha> s)}
[PROOF STEP]
apply (rule_tac
      I="\<lambda>it r. my_invar r \<and> my_\<alpha> r = {x\<in>my_\<alpha> s - it. x\<le>average (my_\<alpha> s)}"
      in my_iterate_rule_P)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. my_invar s \<Longrightarrow> my_invar s
 2. my_invar s \<Longrightarrow> my_invar (my_empty ()) \<and> my_\<alpha> (my_empty ()) = {x \<in> my_\<alpha> s - my_\<alpha> s. x \<le> average (my_\<alpha> s)}
 3. \<And>x it \<sigma>. \<lbrakk>my_invar s; x \<in> it; it \<subseteq> my_\<alpha> s; my_invar \<sigma> \<and> my_\<alpha> \<sigma> = {x \<in> my_\<alpha> s - it. x \<le> average (my_\<alpha> s)}\<rbrakk> \<Longrightarrow> my_invar (if x \<le> avg s then my_ins x \<sigma> else \<sigma>) \<and> my_\<alpha> (if x \<le> avg s then my_ins x \<sigma> else \<sigma>) = {xa \<in> my_\<alpha> s - (it - {x}). xa \<le> average (my_\<alpha> s)}
 4. \<And>\<sigma>. \<lbrakk>my_invar s; my_invar \<sigma> \<and> my_\<alpha> \<sigma> = {x \<in> my_\<alpha> s - {}. x \<le> average (my_\<alpha> s)}\<rbrakk> \<Longrightarrow> my_invar \<sigma> \<and> my_\<alpha> \<sigma> = {x \<in> my_\<alpha> s. x \<le> average (my_\<alpha> s)}
[PROOF STEP]
apply (auto simp add: my_correct avg_correct)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma word_eq_iff: "x = y \<longleftrightarrow> (\<forall>n<LENGTH('a). bit x n = bit y n)" (is \<open>?P \<longleftrightarrow> ?Q\<close>)
  for x y :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (\<forall>n<LENGTH('a). bit x n = bit y n)
[PROOF STEP]
by transfer (auto simp add: bit_eq_iff bit_take_bit_iff)


[STATEMENT]
lemma smooth_compat_D1:
  "k-smooth_on (c1 ` (domain c1 \<inter> domain c2)) (c2 \<circ> inv_chart c1)"
  if "k-smooth_compat c1 c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
have "open (c1 ` (domain c1 \<inter> domain c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (apply_chart c1 ` (domain c1 \<inter> domain c2))
[PROOF STEP]
by (rule open_chart_image) auto
[PROOF STATE]
proof (state)
this:
open (apply_chart c1 ` (domain c1 \<inter> domain c2))

goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open (apply_chart c1 ` (domain c1 \<inter> domain c2))

goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
have "k-smooth_on (c1 ` (domain c1 \<inter> domain c2)) (c2 \<circ> inv_chart c1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
using that(1)
[PROOF STATE]
proof (prove)
using this:
k-smooth_compat c1 c2

goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
by (auto simp: smooth_compat_def)
[PROOF STATE]
proof (state)
this:
k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)

goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open (apply_chart c1 ` (domain c1 \<inter> domain c2))
k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open (apply_chart c1 ` (domain c1 \<inter> domain c2))
k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)

goal (1 subgoal):
 1. k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k-smooth_on (apply_chart c1 ` (domain c1 \<inter> domain c2)) (apply_chart c2 \<circ> inv_chart c1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quad_part_2_less :
  assumes lLength : "length L > var"
  assumes detGreater0 : "SQ\<ge>0"
  assumes hdeg : "MPoly_Type.degree (p::real mpoly) var = (deg ::nat)"
  assumes hsq : "\<forall>x. insertion (nth_default 0 (list_update L var x)) sq = (SQ::real)"
  shows "aEval (Less p) (list_update L var (sqrt SQ)) = aEval (Less(quadratic_part_2 var sq p)) (list_update L var (sqrt SQ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
define f where "f i = insertion (nth_default 0 (list_update L var (sqrt SQ))) (isolate_variable_sparse p var i)" for i
[PROOF STATE]
proof (state)
this:
f ?i = insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var ?i)

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
have h1a : "(\<Sum>i\<in>{0..<deg+1}. (f i * (SQ^(i div 2)) * real (i mod 2) * sqrt SQ +f i * SQ ^ (i div 2) * (1 - real (i mod 2))))
             =(\<Sum>i\<in>{0..<deg+1}. (f i * ((sqrt SQ)^i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. f i * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + f i * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. f i * sqrt SQ ^ i)
[PROOF STEP]
using sum_over_sqrt detGreater0
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?SQ \<Longrightarrow> (\<Sum>i = 0..<?n + 1. ?f i * ?SQ ^ (i div 2) * real (i mod 2) * sqrt ?SQ + ?f i * ?SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<?n + 1. ?f i * sqrt ?SQ ^ i)
0 \<le> SQ

goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. f i * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + f i * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. f i * sqrt SQ ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<deg + 1. f i * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + f i * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. f i * sqrt SQ ^ i)

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
have "(\<Sum>i\<in>{0..<deg+1}. (insertion (nth_default 0 (list_update L var (sqrt SQ))) (isolate_variable_sparse p var i) * (SQ^(i div 2)) * real (i mod 2) * sqrt SQ + (insertion (nth_default 0 (list_update L var (sqrt SQ))) (isolate_variable_sparse p var i)) * SQ ^ (i div 2) * (1 - real (i mod 2))))
             =(\<Sum>i\<in>{0..<deg+1}. (insertion (nth_default 0 (list_update L var (sqrt SQ))) (isolate_variable_sparse p var i) * ((sqrt SQ)^i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i)
[PROOF STEP]
using h1a f_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<deg + 1. f i * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + f i * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. f i * sqrt SQ ^ i)
f ?i = insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var ?i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i)

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i)

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
have "... = insertion (nth_default 0 (list_update L var (sqrt SQ))) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i) = insertion (nth_default 0 (L[var := sqrt SQ])) p
[PROOF STEP]
using sum_over_degree_insertion hdeg lLength
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?var < length ?L; MPoly_Type.degree ?p ?var = ?d\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<?d + 1. insertion (nth_default 0 (?L[?var := ?x])) (isolate_variable_sparse ?p ?var i) * ?x ^ i) = insertion (nth_default 0 (?L[?var := ?x])) ?p
MPoly_Type.degree p var = deg
var < length L

goal (1 subgoal):
 1. (\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i) = insertion (nth_default 0 (L[var := sqrt SQ])) p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * sqrt SQ ^ i) = insertion (nth_default 0 (L[var := sqrt SQ])) p

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = insertion (nth_default 0 (L[var := sqrt SQ])) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + insertion (nth_default 0 (L[var := sqrt SQ])) (isolate_variable_sparse p var i) * SQ ^ (i div 2) * (1 - real (i mod 2))) = insertion (nth_default 0 (L[var := sqrt SQ])) p

goal (1 subgoal):
 1. aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])
[PROOF STEP]
by(simp add:hdeg hsq insertion_add insertion_sum insertion_mult insertion_pow insertion_var insertion_const lLength)
[PROOF STATE]
proof (state)
this:
aEval (Less p) (L[var := sqrt SQ]) = aEval (Less (quadratic_part_2 var sq p)) (L[var := sqrt SQ])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asprod_pos_mono:"0 < w \<Longrightarrow> ((w *\<^sub>a x) \<le> (w *\<^sub>a y)) =  (x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < w \<Longrightarrow> (w *\<^sub>a x \<le> w *\<^sub>a y) = (x \<le> y)
[PROOF STEP]
by (simp add:asprod_amult, simp add:amult_pos_mono_l)


[STATEMENT]
lemma match_list_append: "match_list \<gamma> (m1@m2) a p \<longleftrightarrow> (\<not> match_list \<gamma> m1 a p \<longrightarrow> match_list \<gamma> m2 a p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. match_list \<gamma> (m1 @ m2) a p = (\<not> match_list \<gamma> m1 a p \<longrightarrow> match_list \<gamma> m2 a p)
[PROOF STEP]
by(induction m1) simp+


[STATEMENT]
lemma powrat_inject_exp [simp]:
  "1 < x  \<Longrightarrow> (x pow\<^sub>\<rat> r = x pow\<^sub>\<rat> s) = (s = r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (x pow\<^sub>\<rat> r = x pow\<^sub>\<rat> s) = (s = r)
[PROOF STEP]
by (metis neq_iff powrat_less_cancel_iff)


[STATEMENT]
lemma prv_eql_subst_trm2:
  assumes "x \<in> var" and "\<phi> \<in> fmla" and "t1 \<in> trm" and "t2 \<in> trm"
  assumes "prv (eql t1 t2)"
  shows "prv (imp (subst \<phi> t1 x) (subst \<phi> t2 x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (subst \<phi> t1 x) (subst \<phi> t2 x))
[PROOF STEP]
by (meson assms eql imp local.subst prv_eql_subst_trm prv_imp_mp)


[STATEMENT]
lemma g_orbit_eq:
  fixes X::"('a::preorder) \<Rightarrow> 'b"
  shows "\<gamma> X G U = {X t |t. t \<in> U \<and> (\<forall>\<tau>\<in>down U t. G (X \<tau>))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> X G U = {X t |t. t \<in> U \<and> (\<forall>\<tau>\<in>down U t. G (X \<tau>))}
[PROOF STEP]
unfolding g_orbit_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {\<P> X (down U t) |t. \<P> X (down U t) \<subseteq> Collect G} = {X t |t. t \<in> U \<and> (\<forall>\<tau>\<in>down U t. G (X \<tau>))}
[PROOF STEP]
using order_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. \<Union> {\<P> X (down U t) |t. \<P> X (down U t) \<subseteq> Collect G} = {X t |t. t \<in> U \<and> (\<forall>\<tau>\<in>down U t. G (X \<tau>))}
[PROOF STEP]
by auto blast