[STATEMENT]
lemma reduce_system_matrix_match:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  assumes nonzero: "p \<noteq> 0"
  assumes welldefined_signs1: "well_def_signs (length qs) signs"
  assumes distinct_signs: "distinct signs"
  assumes all_info: "set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set(signs)"
  assumes match: "satisfy_equation p qs subsets signs"
  assumes inv: "invertible_mat (matrix_A signs subsets)"
  shows "matrix_A (get_signs (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))
  (get_subsets (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs))))) =
  (get_matrix (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
let ?A = "(matrix_A signs subsets)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
let ?lhs_vec = "(solve_for_lhs p qs subsets (matrix_A signs subsets))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
let ?red_mtx = "(take_rows_from_matrix (reduce_mat_cols (matrix_A signs subsets) ?lhs_vec) (rows_to_keep (reduce_mat_cols (matrix_A signs subsets) ?lhs_vec)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h1: "matrix_A (get_signs (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))
  (get_subsets (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))
   = matrix_A (reduction_signs p qs signs subsets (matrix_A signs subsets)) (reduction_subsets p qs signs subsets (matrix_A signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (reduction_signs p qs signs subsets (M_mat signs subsets)) (reduction_subsets p qs signs subsets (M_mat signs subsets))
[PROOF STEP]
using reduction_signs_is_get_signs reduction_subsets_is_get_subsets
[PROOF STATE]
proof (prove)
using this:
reduction_signs ?p ?qs ?signs ?subsets ?m = get_signs (reduce_system ?p (?qs, ?m, ?subsets, ?signs))
reduction_subsets ?p ?qs ?signs ?subsets ?m = get_subsets (reduce_system ?p (?qs, ?m, ?subsets, ?signs))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (reduction_signs p qs signs subsets (M_mat signs subsets)) (reduction_subsets p qs signs subsets (M_mat signs subsets))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (reduction_signs p qs signs subsets (M_mat signs subsets)) (reduction_subsets p qs signs subsets (M_mat signs subsets))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h1_var: "matrix_A (get_signs (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))
  (get_subsets (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs)))))
   = matrix_A (take_indices signs (find_nonzeros_from_input_vec ?lhs_vec)) (take_indices subsets (rows_to_keep (reduce_mat_cols ?A ?lhs_vec)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))))
[PROOF STEP]
using h1 reduction_signs_def reduction_subsets_def
[PROOF STATE]
proof (prove)
using this:
M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (reduction_signs p qs signs subsets (M_mat signs subsets)) (reduction_subsets p qs signs subsets (M_mat signs subsets))
reduction_signs ?p ?qs ?signs ?subsets ?matr = take_indices ?signs (find_nonzeros_from_input_vec (solve_for_lhs ?p ?qs ?subsets ?matr))
reduction_subsets ?p ?qs ?signs ?subsets ?matr = take_indices ?subsets (rows_to_keep (reduce_mat_cols ?matr (solve_for_lhs ?p ?qs ?subsets ?matr)))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h2: "?red_mtx = (take_rows_from_matrix (take_cols_from_matrix ?A (find_nonzeros_from_input_vec ?lhs_vec)) (rows_to_keep (take_cols_from_matrix ?A (find_nonzeros_from_input_vec ?lhs_vec))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_rows_from_matrix (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take_rows_from_matrix (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h30: "(construct_lhs_vector p qs signs) = ?lhs_vec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
using assms construct_lhs_matches_solve_for_lhs
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
invertible_mat (M_mat signs subsets)
\<lbrakk>satisfy_equation ?p ?qs ?subsets ?signs; invertible_mat (M_mat ?signs ?subsets)\<rbrakk> \<Longrightarrow> w_vec ?p ?qs ?signs = solve_for_lhs ?p ?qs ?subsets (M_mat ?signs ?subsets)

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h3a: "\<forall>x. List.member (find_nonzeros_from_input_vec ?lhs_vec) x \<longrightarrow>x < length (signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length signs
[PROOF STEP]
using h30 size_of_lhs
[PROOF STATE]
proof (prove)
using this:
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs

goal (1 subgoal):
 1. \<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length signs
[PROOF STEP]
unfolding find_nonzeros_from_input_vec_def
[PROOF STATE]
proof (prove)
using this:
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs

goal (1 subgoal):
 1. \<forall>x. List.member (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) x \<longrightarrow> x < length signs
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets); \<And>p qs signs. dim_vec (w_vec p qs signs) = length signs; List.member (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) x\<rbrakk> \<Longrightarrow> x < length signs
[PROOF STEP]
by (metis atLeastLessThan_iff filter_is_subset member_def set_upt subset_eq)
[PROOF STATE]
proof (state)
this:
\<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length signs

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h3b_a: "\<forall>x. List.member (find_nonzeros_from_input_vec ?lhs_vec) x \<longrightarrow>x < length (subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length subsets
[PROOF STEP]
using assms h30 size_of_lhs same_size
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
invertible_mat (M_mat signs subsets)
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs
invertible_mat (M_mat ?signs ?subsets) \<Longrightarrow> length ?subsets = length ?signs

goal (1 subgoal):
 1. \<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length subsets
[PROOF STEP]
unfolding find_nonzeros_from_input_vec_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
invertible_mat (M_mat signs subsets)
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs
invertible_mat (M_mat ?signs ?subsets) \<Longrightarrow> length ?subsets = length ?signs

goal (1 subgoal):
 1. \<forall>x. List.member (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) x \<longrightarrow> x < length subsets
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets); w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets); \<And>p qs signs. dim_vec (w_vec p qs signs) = length signs; \<And>signs subsets. invertible_mat (M_mat signs subsets) \<Longrightarrow> length subsets = length signs; List.member (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) x\<rbrakk> \<Longrightarrow> x < length signs
[PROOF STEP]
by (simp add: find_nonzeros_from_input_vec_def h3a)
[PROOF STATE]
proof (state)
this:
\<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length subsets

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h3ba: "length
     (filter (\<lambda>i. solve_for_lhs p qs subsets (matrix_A signs subsets) $ i \<noteq> 0)
       [0..<length subsets])
    \<le> length subsets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<length subsets]) \<le> length subsets
[PROOF STEP]
using length_filter_le[where P = "(\<lambda>i. solve_for_lhs p qs subsets (matrix_A signs subsets) $ i \<noteq> 0)",
    where xs = "[0..<length subsets]"] length_upto
[PROOF STATE]
proof (prove)
using this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<length subsets]) \<le> length [0..<length subsets]
length [?i..?j] = nat (?j - ?i + 1)

goal (1 subgoal):
 1. length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<length subsets]) \<le> length subsets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<length subsets]) \<le> length subsets

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have " length subsets = dim_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))
[PROOF STEP]
using h30 inv size_of_lhs same_size[of signs subsets]
[PROOF STATE]
proof (prove)
using this:
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
invertible_mat (M_mat signs subsets)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs
invertible_mat (M_mat signs subsets) \<Longrightarrow> length subsets = length signs

goal (1 subgoal):
 1. length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets); invertible_mat (M_mat signs subsets); \<And>p qs signs. dim_vec (w_vec p qs signs) = length signs; length subsets = length signs\<rbrakk> \<Longrightarrow> length signs = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))
[PROOF STEP]
have "length
     (filter (\<lambda>i. solve_for_lhs p qs subsets (matrix_A signs subsets) $ i \<noteq> 0)
       [0..<dim_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))])
    \<le> length subsets"
[PROOF STATE]
proof (prove)
using this:
length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))

goal (1 subgoal):
 1. length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets
[PROOF STEP]
using h3ba
[PROOF STATE]
proof (prove)
using this:
length subsets = dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<length subsets]) \<le> length subsets

goal (1 subgoal):
 1. length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets
[PROOF STEP]
have h3b: "length subsets \<ge> length (take_indices signs (find_nonzeros_from_input_vec ?lhs_vec))"
[PROOF STATE]
proof (prove)
using this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets

goal (1 subgoal):
 1. length (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<le> length subsets
[PROOF STEP]
unfolding take_indices_def find_nonzeros_from_input_vec_def
[PROOF STATE]
proof (prove)
using this:
length (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))]) \<le> length subsets

goal (1 subgoal):
 1. length (map ((!) signs) (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))])) \<le> length subsets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<le> length subsets

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h3c: "\<forall>x. List.member (rows_to_keep (reduce_mat_cols ?A ?lhs_vec)) x \<longrightarrow> x < length (subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. List.member (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) x \<longrightarrow> x < length subsets
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
assume x_mem: "List.member (rows_to_keep
            (take_cols_from_matrix (matrix_A signs subsets)
              (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))) x"
[PROOF STATE]
proof (state)
this:
List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x

goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
obtain nn :: "rat list list \<Rightarrow> nat list \<Rightarrow> nat" where
      "\<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>nn. \<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
\<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2)

goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2)
[PROOF STEP]
have f4: "nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))) < length signs \<or> matrix_A (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets)))) subsets = take_cols_from_matrix (matrix_A signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2)

goal (1 subgoal):
 1. nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
using h3a nonzero reduce_system_matrix_signs_helper
[PROOF STATE]
proof (prove)
using this:
\<forall>x2 x3. (\<exists>v4. v4 \<in> set x3 \<and> \<not> v4 < length x2) = (nn x2 x3 \<in> set x3 \<and> \<not> nn x2 x3 < length x2)
\<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length signs
p \<noteq> 0
\<lbrakk>\<forall>x. List.member ?S x \<longrightarrow> x < length ?signs; ?p \<noteq> 0\<rbrakk> \<Longrightarrow> M_mat (take_indices ?signs ?S) ?subsets = take_cols_from_matrix (M_mat ?signs ?subsets) ?S

goal (1 subgoal):
 1. nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have "matrix_A (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets)))) subsets = take_cols_from_matrix (matrix_A signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (matrix_A signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))\<^sup>T)))"
[PROOF STATE]
proof (prove)
using this:
nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))
[PROOF STEP]
using f4
[PROOF STATE]
proof (prove)
using this:
nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> \<not> nn signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) < length signs \<or> M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))
[PROOF STEP]
by (metis h3a in_set_member rows_to_keep_def x_mem)
[PROOF STATE]
proof (state)
this:
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))

goal (1 subgoal):
 1. \<And>x. List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x \<Longrightarrow> x < length subsets
[PROOF STEP]
thus "x < length (subsets)"
[PROOF STATE]
proof (prove)
using this:
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))

goal (1 subgoal):
 1. x < length subsets
[PROOF STEP]
using x_mem
[PROOF STATE]
proof (prove)
using this:
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))
List.member (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) x

goal (1 subgoal):
 1. x < length subsets
[PROOF STEP]
unfolding rows_to_keep_def
[PROOF STATE]
proof (prove)
using this:
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) subsets = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<and> x \<in> set (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T)))
List.member (map snd (pivot_positions (gauss_jordan_single (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<^sup>T))) x

goal (1 subgoal):
 1. x < length subsets
[PROOF STEP]
by (metis (no_types) dim_row_matrix_A rows_to_keep_def rows_to_keep_lem)
[PROOF STATE]
proof (state)
this:
x < length subsets

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. List.member (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) x \<longrightarrow> x < length subsets

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
have h3: "matrix_A (take_indices signs (find_nonzeros_from_input_vec ?lhs_vec)) (take_indices subsets (rows_to_keep (reduce_mat_cols ?A ?lhs_vec))) =
    (take_rows_from_matrix (take_cols_from_matrix ?A (find_nonzeros_from_input_vec ?lhs_vec)) (rows_to_keep (take_cols_from_matrix ?A (find_nonzeros_from_input_vec ?lhs_vec))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))
[PROOF STEP]
using inv h3a h3b h3c reduce_system_matrix_subsets_helper reduce_system_matrix_signs_helper
      assms
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat signs subsets)
\<forall>x. List.member (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) x \<longrightarrow> x < length signs
length (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<le> length subsets
\<forall>x. List.member (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) x \<longrightarrow> x < length subsets
\<lbrakk>?p \<noteq> 0; length ?signs \<le> length ?subsets; \<forall>x. List.member ?S x \<longrightarrow> x < length ?subsets\<rbrakk> \<Longrightarrow> M_mat ?signs (take_indices ?subsets ?S) = take_rows_from_matrix (M_mat ?signs ?subsets) ?S
\<lbrakk>\<forall>x. List.member ?S x \<longrightarrow> x < length ?signs; ?p \<noteq> 0\<rbrakk> \<Longrightarrow> M_mat (take_indices ?signs ?S) ?subsets = take_cols_from_matrix (M_mat ?signs ?subsets) ?S
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
invertible_mat (M_mat signs subsets)

goal (1 subgoal):
 1. M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
using h1 h2 h3
[PROOF STATE]
proof (prove)
using this:
M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = M_mat (reduction_signs p qs signs subsets (M_mat signs subsets)) (reduction_subsets p qs signs subsets (M_mat signs subsets))
take_rows_from_matrix (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets)))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))
M_mat (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (take_indices subsets (rows_to_keep (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))))) = take_rows_from_matrix (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) (rows_to_keep (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))

goal (1 subgoal):
 1. M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
[PROOF STEP]
by (metis fst_conv get_matrix_def h1_var reduce_system.simps reduction_step.simps)
[PROOF STATE]
proof (state)
this:
M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma holomorphic_on_mult [holomorphic_intros]:
  "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z * g z) holomorphic_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z * g z) holomorphic_on s
[PROOF STEP]
unfolding holomorphic_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. f field_differentiable at x within s; \<forall>x\<in>s. g field_differentiable at x within s\<rbrakk> \<Longrightarrow> \<forall>x\<in>s. (\<lambda>z. f z * g z) field_differentiable at x within s
[PROOF STEP]
by (metis field_differentiable_mult)


[STATEMENT]
lemma fresh_variable_type_schemes:
  "\<exists>n. new_tv n (sch::type_scheme)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. new_tv n sch
[PROOF STEP]
apply (unfold new_tv_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. \<forall>m. m \<in> free_tv sch \<longrightarrow> m < n
[PROOF STEP]
apply (induct_tac sch)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<exists>n. \<forall>m. m \<in> free_tv (FVar x) \<longrightarrow> m < n
 2. \<And>x. \<exists>n. \<forall>m. m \<in> free_tv (BVar x) \<longrightarrow> m < n
 3. \<And>x1a x2a. \<lbrakk>\<exists>n. \<forall>m. m \<in> free_tv x1a \<longrightarrow> m < n; \<exists>n. \<forall>m. m \<in> free_tv x2a \<longrightarrow> m < n\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>m. m \<in> free_tv (x1a =-> x2a) \<longrightarrow> m < n
[PROOF STEP]
apply (auto)[1]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<exists>n. \<forall>m. m \<in> free_tv (BVar x) \<longrightarrow> m < n
 2. \<And>x1a x2a. \<lbrakk>\<exists>n. \<forall>m. m \<in> free_tv x1a \<longrightarrow> m < n; \<exists>n. \<forall>m. m \<in> free_tv x2a \<longrightarrow> m < n\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>m. m \<in> free_tv (x1a =-> x2a) \<longrightarrow> m < n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1a x2a. \<lbrakk>\<exists>n. \<forall>m. m \<in> free_tv x1a \<longrightarrow> m < n; \<exists>n. \<forall>m. m \<in> free_tv x2a \<longrightarrow> m < n\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>m. m \<in> free_tv (x1a =-> x2a) \<longrightarrow> m < n
[PROOF STEP]
by (metis less_trans linorder_cases new_tv_Fun2 new_tv_def)


[STATEMENT]
lemma generalized_sfw_append:
    "generalized_sfw (a @ b) p = (case generalized_sfw a p of Some x \<Rightarrow> Some x
                                                           |  None \<Rightarrow> generalized_sfw b p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generalized_sfw (a @ b) p = (case generalized_sfw a p of None \<Rightarrow> generalized_sfw b p | Some x \<Rightarrow> Some x)
[PROOF STEP]
by(induction a) (simp_all add: generalized_sfw_simps)


[STATEMENT]
lemma sup_SUP:
  "Y \<noteq> {} \<Longrightarrow> sup x (SUP y\<in>Y . f y) = (SUP y\<in>Y. sup x (f y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y \<noteq> {} \<Longrightarrow> x \<squnion> Sup (f ` Y) = (SUP y\<in>Y. x \<squnion> f y)
[PROOF STEP]
apply (subst sup_Sup)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Y \<noteq> {} \<Longrightarrow> f ` Y \<noteq> {}
 2. Y \<noteq> {} \<Longrightarrow> Sup ((\<squnion>) x ` f ` Y) = (SUP y\<in>Y. x \<squnion> f y)
[PROOF STEP]
by (simp_all add: image_image)


[STATEMENT]
lemma hom_component_monom_mult:
  "punit.monom_mult c t (hom_component p n) = hom_component (punit.monom_mult c t p) (deg_pm t + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. punit.monom_mult c t (hom_component p n) = hom_component (punit.monom_mult c t p) (deg_pm t + n)
[PROOF STEP]
by (auto simp: hom_component_def lookup_except punit.lookup_monom_mult deg_pm_minus deg_pm_mono intro!: poly_mapping_eqI)


[STATEMENT]
lemma poly_add_nonzero:
  fixes p q :: "'a :: ufd poly"
  assumes p0: "p \<noteq> 0" and q0: "q \<noteq> 0" and x: "poly p x = 0" and y: "poly q y = 0"
      and pr: "primitive p"
  shows "poly_add p q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add p q \<noteq> 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_add p q = 0 \<Longrightarrow> False
[PROOF STEP]
have degp: "degree p > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < degree p
[PROOF STEP]
using le_0_eq order_degree order_root p0 x
[PROOF STATE]
proof (prove)
using this:
(?n \<le> 0) = (?n = 0)
?p \<noteq> 0 \<Longrightarrow> Polynomial.order ?a ?p \<le> degree ?p
(poly ?p ?a = (0::?'a)) = (?p = 0 \<or> Polynomial.order ?a ?p \<noteq> 0)
p \<noteq> 0
poly p x = (0::'a)

goal (1 subgoal):
 1. 0 < degree p
[PROOF STEP]
by (metis gr0I)
[PROOF STATE]
proof (state)
this:
0 < degree p

goal (1 subgoal):
 1. poly_add p q = 0 \<Longrightarrow> False
[PROOF STEP]
have degq: "degree q > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < degree q
[PROOF STEP]
using le_0_eq order_degree order_root q0 y
[PROOF STATE]
proof (prove)
using this:
(?n \<le> 0) = (?n = 0)
?p \<noteq> 0 \<Longrightarrow> Polynomial.order ?a ?p \<le> degree ?p
(poly ?p ?a = (0::?'a)) = (?p = 0 \<or> Polynomial.order ?a ?p \<noteq> 0)
q \<noteq> 0
poly q y = (0::'a)

goal (1 subgoal):
 1. 0 < degree q
[PROOF STEP]
by (metis gr0I)
[PROOF STATE]
proof (state)
this:
0 < degree q

goal (1 subgoal):
 1. poly_add p q = 0 \<Longrightarrow> False
[PROOF STEP]
assume 0: "poly_add p q = 0"
[PROOF STATE]
proof (state)
this:
poly_add p q = 0

goal (1 subgoal):
 1. poly_add p q = 0 \<Longrightarrow> False
[PROOF STEP]
from resultant_zero_imp_common_factor[OF _ this[unfolded poly_add_def]] degp
   and coprime_poly_x_minus_y_poly_lift[OF degp degq pr]
[PROOF STATE]
proof (chain)
picking this:
0 < degree (poly_x_minus_y p) \<or> 0 < degree (poly_lift q) \<Longrightarrow> \<not> comm_monoid_mult_class.coprime (poly_x_minus_y p) (poly_lift q)
0 < degree p
comm_monoid_mult_class.coprime (poly_x_minus_y p) (poly_lift q)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
0 < degree (poly_x_minus_y p) \<or> 0 < degree (poly_lift q) \<Longrightarrow> \<not> comm_monoid_mult_class.coprime (poly_x_minus_y p) (poly_lift q)
0 < degree p
comm_monoid_mult_class.coprime (poly_x_minus_y p) (poly_lift q)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma per_prefE: assumes "x \<le>p r \<cdot> x" and "r \<noteq> \<epsilon>"
  obtains k where  "x \<le>p r\<^sup>@k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. x \<le>p r \<^sup>@ k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms per_pref per_rootI
[PROOF STATE]
proof (prove)
using this:
x \<le>p r \<cdot> x
r \<noteq> \<epsilon>
?x \<le>p ?r\<^sup>\<omega> = ((\<exists>k. ?x \<le>p ?r \<^sup>@ k) \<and> ?r \<noteq> \<epsilon>)
\<lbrakk>?u \<le>p ?r \<cdot> ?u; ?r \<noteq> \<epsilon>\<rbrakk> \<Longrightarrow> ?u \<le>p ?r\<^sup>\<omega>

goal (1 subgoal):
 1. (\<And>k. x \<le>p r \<^sup>@ k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis


[STATEMENT]
lemma collinear_4_3:
  assumes "a \<noteq> b"
    shows "collinear {a,b,c,d} \<longleftrightarrow> collinear{a,b,c} \<and> collinear{a,b,d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear {a, b, c, d} = (collinear {a, b, c} \<and> collinear {a, b, d})
[PROOF STEP]
using collinear_triples [OF assms, of "{c,d}"]
[PROOF STATE]
proof (prove)
using this:
collinear {a, b, c, d} = (\<forall>x\<in>{c, d}. collinear {a, b, x})

goal (1 subgoal):
 1. collinear {a, b, c, d} = (collinear {a, b, c} \<and> collinear {a, b, d})
[PROOF STEP]
by (force simp:)


[STATEMENT]
lemma sym_symcl:
  fixes Rel :: "('a \<times> 'a) set"
  shows "sym (symcl Rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sym (symcl Rel)
[PROOF STEP]
by (simp add: symcl_def sym_Un_converse)


[STATEMENT]
lemma rk_\<alpha>\<beta>\<gamma>_special_case_3 :
  assumes "desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma>" and "rk {C', P} = 1"
  shows "rk {\<alpha>, \<beta>, \<gamma>} \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
have "desargues_config_2D  C B A C' B' A' P \<gamma> \<beta> \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>
[PROOF STEP]
using assms(1) desargues_config_2D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>]
      desargues_config_2D_def[of C B A C' B' A' P \<gamma> \<beta> \<alpha>]
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, B, C, A', B', C'} = 3 \<and> rk {A, B, P} = 3 \<and> rk {A, C, P} = 3 \<and> rk {B, C, P} = 3 \<and> rk {A, A'} = 2 \<and> rk {B, B'} = 2 \<and> rk {C, C'} = 2
desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha> \<equiv> rk {C, B, A} = 3 \<and> rk {C', B', A'} = 3 \<and> rk {C, C', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {A, A', P} = 2 \<and> rk {C, B, \<alpha>} = 2 \<and> rk {C', B', \<alpha>} = 2 \<and> rk {C, A, \<beta>} = 2 \<and> rk {C', A', \<beta>} = 2 \<and> rk {B, A, \<gamma>} = 2 \<and> rk {B', A', \<gamma>} = 2 \<and> rk {C, B, A, C', B', A'} = 3 \<and> rk {C, B, P} = 3 \<and> rk {C, A, P} = 3 \<and> rk {B, A, P} = 3 \<and> rk {C, C'} = 2 \<and> rk {B, B'} = 2 \<and> rk {A, A'} = 2

goal (1 subgoal):
 1. desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>
[PROOF STEP]
by (metis insert_commute)
[PROOF STATE]
proof (state)
this:
desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
thus "rk {\<alpha>, \<beta>, \<gamma>} \<le> 2"
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
using rk_\<alpha>\<beta>\<gamma>_special_case_1[of C B A C' B' A' P \<gamma> \<beta> \<alpha>] assms(2)
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>
\<lbrakk>desargues_config_2D C B A C' B' A' P \<gamma> \<beta> \<alpha>; rk {C', P} = 1\<rbrakk> \<Longrightarrow> rk {\<gamma>, \<beta>, \<alpha>} \<le> 2
rk {C', P} = 1

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
by (simp add: insert_commute)
[PROOF STATE]
proof (state)
this:
rk {\<alpha>, \<beta>, \<gamma>} \<le> 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conservative_mptI:
  assumes "mpt M T"
    "\<And>A. A \<in> sets M \<Longrightarrow> emeasure M A > 0 \<Longrightarrow> \<exists>n>0. (T^^n)-`A \<inter> A \<noteq> {}"
  shows "conservative_mpt M T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conservative_mpt M T
[PROOF STEP]
unfolding conservative_mpt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpt M T \<and> conservative M T
[PROOF STEP]
apply (auto simp add: assms(1), rule conservativeI2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. qmpt M T
 2. \<And>A. \<lbrakk>A \<in> sets M; 0 < emeasure M A\<rbrakk> \<Longrightarrow> \<exists>n>0. (T ^^ n) -` A \<inter> A \<noteq> {}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
mpt M T

goal (2 subgoals):
 1. qmpt M T
 2. \<And>A. \<lbrakk>A \<in> sets M; 0 < emeasure M A\<rbrakk> \<Longrightarrow> \<exists>n>0. (T ^^ n) -` A \<inter> A \<noteq> {}
[PROOF STEP]
by (auto simp add: mpt_def assms(2))


[STATEMENT]
lemma injective_iff:"\<lbrakk> inj_on f A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow>
                        (x = y) = (f x = f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> (x = y) = (f x = f y)
[PROOF STEP]
apply (rule iffI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; x \<in> A; y \<in> A; f x = f y; x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (frule injective[of "f" "A" "x" "y"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; x \<in> A; y \<in> A; f x = f y; x \<noteq> y; f x \<noteq> f y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma CONJ_eq_False_iff[simp]: "finite Qeq \<Longrightarrow> irrefl Qeq \<Longrightarrow> CONJ (Q, Qeq) = Bool False \<longleftrightarrow> Q = Bool False \<and> Qeq = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite Qeq; irrefl Qeq\<rbrakk> \<Longrightarrow> (CONJ (Q, Qeq) = Bool False) = (Q = Bool False \<and> Qeq = {})
[PROOF STEP]
by (auto simp: CONJ_def)


[STATEMENT]
lemma indiscrete_topology: "topology (indiscrete_top X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topology (indiscrete_top X)
[PROOF STEP]
by (rule topologyI) (auto simp: is_open_def indiscrete_top_def)


[STATEMENT]
lemma perp_up_non_degenerate_in_S_at_end:
  assumes "a \<in> hyp2" and "b \<in> hyp2" and "proj2_incident b l"
  and "\<not> proj2_incident a l"
  shows "perp_up a l \<in> S"
  and "B\<^sub>\<real> (cart2_pt (perp_foot a l)) (cart2_pt a) (cart2_pt (perp_up a l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perp_up a l \<in> S &&& B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. perp_up a l \<in> S
 2. B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)
[PROOF STEP]
from \<open>\<not> proj2_incident a l\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> proj2_incident a l
[PROOF STEP]
have "perp_up a l = endpoint_in_S (perp_foot a l) a"
[PROOF STATE]
proof (prove)
using this:
\<not> proj2_incident a l

goal (1 subgoal):
 1. perp_up a l = endpoint_in_S (perp_foot a l) a
[PROOF STEP]
by (unfold perp_up_def) simp
[PROOF STATE]
proof (state)
this:
perp_up a l = endpoint_in_S (perp_foot a l) a

goal (2 subgoals):
 1. perp_up a l \<in> S
 2. B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)
[PROOF STEP]
from \<open>b \<in> hyp2\<close> and \<open>proj2_incident b l\<close> and \<open>a \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> hyp2
proj2_incident b l
a \<in> hyp2
[PROOF STEP]
have "perp_foot a l \<in> hyp2"
[PROOF STATE]
proof (prove)
using this:
b \<in> hyp2
proj2_incident b l
a \<in> hyp2

goal (1 subgoal):
 1. perp_foot a l \<in> hyp2
[PROOF STEP]
by (rule perp_foot_hyp2)
[PROOF STATE]
proof (state)
this:
perp_foot a l \<in> hyp2

goal (2 subgoals):
 1. perp_up a l \<in> S
 2. B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)
[PROOF STEP]
with \<open>a \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
perp_foot a l \<in> hyp2
[PROOF STEP]
show "perp_up a l \<in> S"
    and "B\<^sub>\<real> (cart2_pt (perp_foot a l)) (cart2_pt a) (cart2_pt (perp_up a l))"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
perp_foot a l \<in> hyp2

goal (1 subgoal):
 1. perp_up a l \<in> S &&& B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)
[PROOF STEP]
unfolding \<open>perp_up a l = endpoint_in_S (perp_foot a l) a\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
perp_foot a l \<in> hyp2

goal (1 subgoal):
 1. endpoint_in_S (perp_foot a l) a \<in> S &&& B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (endpoint_in_S (perp_foot a l) a)
[PROOF STEP]
by (simp_all add: endpoint_in_S)
[PROOF STATE]
proof (state)
this:
perp_up a l \<in> S
B\<^sub>\<real> cart2_pt (perp_foot a l) cart2_pt a cart2_pt (perp_up a l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma indep_vars_PiM_components':
  assumes "\<And>i. i \<in> A \<Longrightarrow> prob_space (M i)"
  assumes "\<And>i. i \<in> A \<Longrightarrow> g i \<in> M i \<rightarrow>\<^sub>M N i"
  shows   "prob_space.indep_vars (PiM A M) N (\<lambda>i f. g i (f i)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space.indep_vars (Pi\<^sub>M A M) N (\<lambda>i f. g i (f i)) A
[PROOF STEP]
by (rule prob_space.indep_vars_compose2[OF prob_space_PiM indep_vars_PiM_components])
     (use assms in simp_all)


[STATEMENT]
lemma finite_incident_loops: "finite (incident_loops v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (incident_loops v)
[PROOF STEP]
using incident_loops_simp
[PROOF STATE]
proof (prove)
using this:
has_loop ?v \<Longrightarrow> incident_loops ?v = {{?v}}
\<not> has_loop ?v \<Longrightarrow> incident_loops ?v = {}

goal (1 subgoal):
 1. finite (incident_loops v)
[PROOF STEP]
by (cases "has_loop v") auto


[STATEMENT]
lemma Graph12: "\<lbrakk>a\<subseteq>Blacks M;j<length M\<rbrakk> \<Longrightarrow> a\<subseteq>Blacks (M[j := Black])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<subseteq> Blacks M; j < length M\<rbrakk> \<Longrightarrow> a \<subseteq> Blacks (M[j := Black])
[PROOF STEP]
apply (unfold Blacks_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<subseteq> {i. i < length M \<and> M ! i = Black}; j < length M\<rbrakk> \<Longrightarrow> a \<subseteq> {i. i < length (M[j := Black]) \<and> M[j := Black] ! i = Black}
[PROOF STEP]
apply(force simp add: nth_list_update)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tensors_from_net_Conv_id:
assumes "valid_net' m"
and "i<nr"
shows "tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i
 = (if i<output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))"
  (is "?a $ i = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i = (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
[PROOF STEP]
proof (rule tensor_lookup_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
 2. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "Tensor.dims (?a $ i) = input_sizes m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m
[PROOF STEP]
by (metis assms(1) assms(2) dims_tensors_from_net
    id_matrix_dim(1) id_matrix_dim(2) input_sizes.simps(2) output_size.simps(2)
    output_size_correct_tensors remove_weights.simps(2) valid_net.intros(2) vec_setI)
[PROOF STATE]
proof (state)
this:
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m

goal (2 subgoals):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
 2. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m

goal (2 subgoals):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
 2. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "Tensor.dims (?b) = input_sizes m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) = input_sizes m
[PROOF STEP]
using dims_tensors_from_net
    output_size_correct_tensors[OF assms(1)] dims_tensor0
[PROOF STATE]
proof (prove)
using this:
?T \<in> set\<^sub>v (tensors_from_net ?m) \<Longrightarrow> dims ?T = input_sizes ?m
output_size' m = dim_vec (tensors_from_net m)
dims (tensor0 ?d) = ?d

goal (1 subgoal):
 1. dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) = input_sizes m
[PROOF STEP]
by (simp add: vec_setI)
[PROOF STATE]
proof (state)
this:
dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) = input_sizes m

goal (2 subgoals):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
 2. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m
dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) = input_sizes m
[PROOF STEP]
show "Tensor.dims (?a $ i) = Tensor.dims (?b)"
[PROOF STATE]
proof (prove)
using this:
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m
dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) = input_sizes m

goal (1 subgoal):
 1. dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = dims (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m))

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
define Convm where "Convm = Conv (id_matrix nr (output_size' m)) m"
[PROOF STATE]
proof (state)
this:
Convm = Conv (id_matrix nr (output_size' m)) m

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
fix "is"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
assume "is \<lhd> Tensor.dims (?a$i)"
[PROOF STATE]
proof (state)
this:
is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i)
[PROOF STEP]
have "is \<lhd> input_sizes m"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i)

goal (1 subgoal):
 1. is \<lhd> input_sizes m
[PROOF STEP]
using \<open>Tensor.dims (?a$i) = input_sizes m\<close>
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i)
dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) = input_sizes m

goal (1 subgoal):
 1. is \<lhd> input_sizes m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is \<lhd> input_sizes m

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "valid_net' Convm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_net' Convm
[PROOF STEP]
by (simp add: assms id_matrix_dim valid_net.intros(2) Convm_def)
[PROOF STATE]
proof (state)
this:
valid_net' Convm

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "base_input m is = base_input Convm is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. base_input m is = base_input Convm is
[PROOF STEP]
by (simp add: Convm_def base_input_def)
[PROOF STATE]
proof (state)
this:
base_input m is = base_input Convm is

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "i < output_size' Convm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < output_size' Convm
[PROOF STEP]
unfolding Convm_def remove_weights.simps output_size.simps
    id_matrix_dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < nr
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_net' m
i < nr

goal (1 subgoal):
 1. i < nr
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
i < output_size' Convm

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)
[PROOF STEP]
by (metis \<open>is \<lhd> input_sizes m\<close> input_sizes.simps(2))
[PROOF STATE]
proof (state)
this:
is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)
[PROOF STEP]
have f1: "lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = evaluate_net (Conv (id_matrix nr (output_size' m)) m) (base_input (Conv (id_matrix nr (output_size' m)) m) is) $ i"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)

goal (1 subgoal):
 1. lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = evaluate_net (Conv (id_matrix nr (output_size' m)) m) (base_input (Conv (id_matrix nr (output_size' m)) m) is) $ i
[PROOF STEP]
using Convm_def \<open>i < output_size' Convm\<close> \<open>valid_net' Convm\<close> lookup_tensors_from_net
[PROOF STATE]
proof (prove)
using this:
is \<lhd> input_sizes (Conv (id_matrix nr (output_size' m)) m)
Convm = Conv (id_matrix nr (output_size' m)) m
i < output_size' Convm
valid_net' Convm
\<lbrakk>valid_net' ?m; ?is \<lhd> input_sizes ?m; ?j < output_size' ?m\<rbrakk> \<Longrightarrow> lookup (tensors_from_net ?m $ ?j) ?is = evaluate_net ?m (base_input ?m ?is) $ ?j

goal (1 subgoal):
 1. lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = evaluate_net (Conv (id_matrix nr (output_size' m)) m) (base_input (Conv (id_matrix nr (output_size' m)) m) is) $ i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = evaluate_net (Conv (id_matrix nr (output_size' m)) m) (base_input (Conv (id_matrix nr (output_size' m)) m) is) $ i

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
have "lookup (tensor0 (input_sizes m)) is = (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (tensor0 (input_sizes m)) is = 0
[PROOF STEP]
by (meson \<open>is \<lhd> input_sizes m\<close> lookup_tensor0)
[PROOF STATE]
proof (state)
this:
lookup (tensor0 (input_sizes m)) is = 0

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) \<Longrightarrow> lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lookup (tensor0 (input_sizes m)) is = 0
[PROOF STEP]
show "Tensor.lookup (?a $ i) is = Tensor.lookup ?b is"
[PROOF STATE]
proof (prove)
using this:
lookup (tensor0 (input_sizes m)) is = 0

goal (1 subgoal):
 1. lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
using Convm_def \<open>base_input m is = base_input Convm is\<close> \<open>is \<lhd> input_sizes m\<close> assms(1) assms(2)
   base_input_length evaluate_net_Conv_id f1 lookup_tensors_from_net
[PROOF STATE]
proof (prove)
using this:
lookup (tensor0 (input_sizes m)) is = 0
Convm = Conv (id_matrix nr (output_size' m)) m
base_input m is = base_input Convm is
is \<lhd> input_sizes m
valid_net' m
i < nr
?is \<lhd> input_sizes ?m \<Longrightarrow> input_sizes ?m = map dim_vec (base_input ?m ?is)
\<lbrakk>valid_net' ?m; input_sizes ?m = map dim_vec ?input; ?j < ?nr\<rbrakk> \<Longrightarrow> evaluate_net (Conv (id_matrix ?nr (output_size' ?m)) ?m) ?input $ ?j = (if ?j < output_size' ?m then evaluate_net ?m ?input $ ?j else 0)
lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = evaluate_net (Conv (id_matrix nr (output_size' m)) m) (base_input (Conv (id_matrix nr (output_size' m)) m) is) $ i
\<lbrakk>valid_net' ?m; ?is \<lhd> input_sizes ?m; ?j < output_size' ?m\<rbrakk> \<Longrightarrow> lookup (tensors_from_net ?m $ ?j) ?is = evaluate_net ?m (base_input ?m ?is) $ ?j

goal (1 subgoal):
 1. lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lookup (tensors_from_net (Conv (id_matrix nr (output_size' m)) m) $ i) is = lookup (if i < output_size' m then tensors_from_net m $ i else tensor0 (input_sizes m)) is

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PosOrd_RightI:
  assumes "v1 :\<sqsubset>val v2" "flat v1 = flat v2"
  shows  "Right v1 :\<sqsubset>val Right v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val.Right v1 :\<sqsubset>val val.Right v2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubset>val v2
flat v1 = flat v2

goal (1 subgoal):
 1. val.Right v1 :\<sqsubset>val val.Right v2
[PROOF STEP]
unfolding PosOrd_ex_def PosOrd_def2
[PROOF STATE]
proof (prove)
using this:
\<exists>p. pflat_len v2 p < pflat_len v1 p \<and> (\<forall>q\<in>Pos v1. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q) \<and> (\<forall>q\<in>Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q)
flat v1 = flat v2

goal (1 subgoal):
 1. \<exists>p. pflat_len (val.Right v2) p < pflat_len (val.Right v1) p \<and> (\<forall>q\<in>Pos (val.Right v1). q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Right v1) q = pflat_len (val.Right v2) q) \<and> (\<forall>q\<in>Pos (val.Right v2). q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Right v1) q = pflat_len (val.Right v2) q)
[PROOF STEP]
apply(auto simp add: pflat_len_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>flat v1 = flat v2; pflat_len v2 p < pflat_len v1 p; \<forall>q\<in>Pos v1. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q; \<forall>q\<in>Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q\<rbrakk> \<Longrightarrow> \<exists>p. pflat_len (val.Right v2) p < pflat_len (val.Right v1) p \<and> (\<forall>q. (\<exists>ps. q = Suc 0 # ps \<and> ps \<in> Pos v1) \<longrightarrow> q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Right v1) q = pflat_len (val.Right v2) q) \<and> (\<forall>q. (\<exists>ps. q = Suc 0 # ps \<and> ps \<in> Pos v2) \<longrightarrow> q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Right v1) q = pflat_len (val.Right v2) q)
[PROOF STEP]
by (metis lex_simps(3) nat_neq_iff pflat_len_simps(5))


[STATEMENT]
lemma OTNoTN[rule_format]: " OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow>  onlyTwoNets x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow> onlyTwoNets x
[PROOF STEP]
apply (induct p, simp_all, rename_tac a p)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow> onlyTwoNets x \<Longrightarrow> OnlyTwoNets (a # p) \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> (x = a \<longrightarrow> onlyTwoNets a) \<and> (x \<in> set p \<longrightarrow> onlyTwoNets x)
[PROOF STEP]
apply (intro impI  conjI,  simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a p. \<lbrakk>OnlyTwoNets p \<longrightarrow> a \<in> set p \<longrightarrow> onlyTwoNets a; OnlyTwoNets (a # p); a \<noteq> DenyAll; x = a\<rbrakk> \<Longrightarrow> onlyTwoNets a
 2. \<And>a p. \<lbrakk>OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow> onlyTwoNets x; OnlyTwoNets (a # p); x \<noteq> DenyAll; x \<in> set p\<rbrakk> \<Longrightarrow> onlyTwoNets x
[PROOF STEP]
subgoal for a p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>OnlyTwoNets p \<longrightarrow> a \<in> set p \<longrightarrow> onlyTwoNets a; OnlyTwoNets (a # p); a \<noteq> DenyAll; x = a\<rbrakk> \<Longrightarrow> onlyTwoNets a
[PROOF STEP]
apply(case_tac a, simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow> onlyTwoNets x; OnlyTwoNets (a # p); x \<noteq> DenyAll; x \<in> set p\<rbrakk> \<Longrightarrow> onlyTwoNets x
[PROOF STEP]
subgoal for a p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>OnlyTwoNets p \<longrightarrow> x \<noteq> DenyAll \<longrightarrow> x \<in> set p \<longrightarrow> onlyTwoNets x; OnlyTwoNets (a # p); x \<noteq> DenyAll; x \<in> set p\<rbrakk> \<Longrightarrow> onlyTwoNets x
[PROOF STEP]
apply(case_tac a, simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma USUP_insert [simp]: "(\<Squnion> i\<in>insert x xs \<bullet> P(i)) = (P(x) \<squnion> (\<Squnion> i\<in>xs \<bullet> P(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> i \<in> insert x xs \<bullet> P i) = P x \<squnion> (\<Squnion> i \<in> xs \<bullet> P i)
[PROOF STEP]
apply (pred_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<Squnion>{uu_. \<exists>xa. uu_ = \<lbrakk>P xa\<rbrakk>\<^sub>e b \<and> (xa = x \<or> xa \<in> xs)} = \<lbrakk>P x\<rbrakk>\<^sub>e b \<squnion> \<Squnion>{uu_. \<exists>x. uu_ = \<lbrakk>P x\<rbrakk>\<^sub>e b \<and> x \<in> xs}
[PROOF STEP]
apply (subst Inf_insert[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<Squnion>{uu_. \<exists>xa. uu_ = \<lbrakk>P xa\<rbrakk>\<^sub>e b \<and> (xa = x \<or> xa \<in> xs)} = \<Squnion>insert (\<lbrakk>P x\<rbrakk>\<^sub>e b) {uu_. \<exists>x. uu_ = \<lbrakk>P x\<rbrakk>\<^sub>e b \<and> x \<in> xs}
[PROOF STEP]
apply (rule_tac cong[of Inf Inf])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. Inf = Inf
 2. \<And>b. {uu_. \<exists>xa. uu_ = \<lbrakk>P xa\<rbrakk>\<^sub>e b \<and> (xa = x \<or> xa \<in> xs)} = insert (\<lbrakk>P x\<rbrakk>\<^sub>e b) {uu_. \<exists>x. uu_ = \<lbrakk>P x\<rbrakk>\<^sub>e b \<and> x \<in> xs}
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filtrationE2:
  assumes "filtration M F"
  shows "s\<le> t \<Longrightarrow> subalgebra (F t) (F s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<le> t \<Longrightarrow> subalgebra (F t) (F s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Filtration.filtration M F

goal (1 subgoal):
 1. s \<le> t \<Longrightarrow> subalgebra (F t) (F s)
[PROOF STEP]
unfolding filtration_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>t. subalgebra M (F t)) \<and> (\<forall>s t. s \<le> t \<longrightarrow> subalgebra (F t) (F s))

goal (1 subgoal):
 1. s \<le> t \<Longrightarrow> subalgebra (F t) (F s)
[PROOF STEP]
by simp


[STATEMENT]
lemma mem_restr_Un_iff: "mem_restr (A \<union> B) x \<longleftrightarrow> mem_restr A x \<or> mem_restr B x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mem_restr (A \<union> B) x = (mem_restr A x \<or> mem_restr B x)
[PROOF STEP]
unfolding mem_restr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bex (A \<union> B) (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) x) = (Bex A (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) x) \<or> Bex B (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) x))
[PROOF STEP]
by blast


[STATEMENT]
lemma basis_to_substdbasis_subspace_isomorphism:
  fixes B :: "'a::euclidean_space set"
  assumes "independent B"
  shows "\<exists>f d::'a set. card d = card B \<and> linear f \<and> f ` B = d \<and>
    f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
have B: "card B = dim B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card B = dim B
[PROOF STEP]
using dim_unique[of B B "card B"] assms span_superset[of B]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B \<subseteq> B; B \<subseteq> span B; independent B; card B = card B\<rbrakk> \<Longrightarrow> dim B = card B
independent B
B \<subseteq> span B

goal (1 subgoal):
 1. card B = dim B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card B = dim B

goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
have "dim B \<le> card (Basis :: 'a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim B \<le> DIM('a)
[PROOF STEP]
using dim_subset_UNIV[of B]
[PROOF STATE]
proof (prove)
using this:
dim B \<le> DIM('a)

goal (1 subgoal):
 1. dim B \<le> DIM('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim B \<le> DIM('a)

goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
from ex_card[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>S\<subseteq>Basis. card S = dim B
[PROOF STEP]
obtain d :: "'a set" where d: "d \<subseteq> Basis" and t: "card d = dim B"
[PROOF STATE]
proof (prove)
using this:
\<exists>S\<subseteq>Basis. card S = dim B

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>d \<subseteq> Basis; card d = dim B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<subseteq> Basis
card d = dim B

goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
let ?t = "{x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
have "\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = ?t \<and> inj_on f (span B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B)
[PROOF STEP]
proof (intro basis_to_basis_subspace_isomorphism subspace_span subspace_substandard span_superset)
[PROOF STATE]
proof (state)
goal (8 subgoals):
 1. dim (span B) = dim {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
 2. independent B
 3. span B \<subseteq> span B
 4. card B = dim (span B)
 5. d \<subseteq> {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
 6. independent d
 7. {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<subseteq> span d
 8. card d = dim {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
[PROOF STEP]
show "d \<subseteq> {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<subseteq> {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
[PROOF STEP]
using d inner_not_same_Basis
[PROOF STATE]
proof (prove)
using this:
d \<subseteq> Basis
\<lbrakk>?u \<in> Basis; ?v \<in> Basis; ?u \<noteq> ?v\<rbrakk> \<Longrightarrow> ?u \<bullet> ?v = 0

goal (1 subgoal):
 1. d \<subseteq> {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d \<subseteq> {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}

goal (7 subgoals):
 1. dim (span B) = dim {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
 2. independent B
 3. span B \<subseteq> span B
 4. card B = dim (span B)
 5. independent d
 6. {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<subseteq> span d
 7. card d = dim {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}
[PROOF STEP]
qed (auto simp: span_substd_basis independent_substdbasis dim_substandard d t B assms)
[PROOF STATE]
proof (state)
this:
\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B)

goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
with t \<open>card B = dim B\<close> d
[PROOF STATE]
proof (chain)
picking this:
card d = dim B
card B = dim B
d \<subseteq> Basis
\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card d = dim B
card B = dim B
d \<subseteq> Basis
\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B)

goal (1 subgoal):
 1. \<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>f d. card d = card B \<and> linear f \<and> f ` B = d \<and> f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_imp_Max_le_iMin: "
  \<lbrakk> finite A; A \<noteq> {}; B \<noteq> {}; \<forall>a\<in>A. \<forall>b\<in>B. a \<le> b \<rbrakk> \<Longrightarrow> Max A \<le> iMin B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}; B \<noteq> {}; \<forall>a\<in>A. \<forall>b\<in>B. a \<le> b\<rbrakk> \<Longrightarrow> Max A \<le> iMin B
[PROOF STEP]
by (blast intro: Max_in iMinI_ex2)


[STATEMENT]
lemma set_integral_mult_right [simp]:
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
  shows "LINT t:A|M. a * f t = a * (LINT t:A|M. f t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT t:A|M. a * f t = a * set_lebesgue_integral M A f
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. indicat_real A x *\<^sub>R (a * f x) = a * (LINT x|M. indicat_real A x *\<^sub>R f x)
[PROOF STEP]
by (subst integral_mult_right_zero[symmetric]) auto


[STATEMENT]
lemma (in kleene_algebra) tt_while: "w \<le> 1 \<Longrightarrow> \<lparr>p \<cdot> v\<rparr> x \<lparr>p\<rparr> \<Longrightarrow> \<lparr>p\<rparr> (v \<cdot> x)\<^sup>\<star> \<cdot> w \<lparr>p\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<le> (1::'a); \<lparr>p \<cdot> v\<rparr>x\<lparr>p\<rparr>\<rbrakk> \<Longrightarrow> \<lparr>p\<rparr>(v \<cdot> x)\<^sup>\<star> \<cdot> w\<lparr>p\<rparr>
[PROOF STEP]
by (metis local.star_inductr_var_equiv local.star_subid local.tt_seq local.tt_skip mult_assoc)


[STATEMENT]
lemma bl_word_not: "to_bl (NOT w) = map Not (to_bl w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_bl (NOT w) = map Not (to_bl w)
[PROOF STEP]
by transfer (simp add: bl_not_bin)


[STATEMENT]
lemma osp_transitivity:
  assumes "A B C OSP P Q" and
    "A B C OSP Q R"
  shows "A B C OSP P R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C OSP P R
[PROOF STEP]
using OSP_def assms(1) assms(2) l9_41_2
[PROOF STATE]
proof (prove)
using this:
?A ?B ?C OSP ?P ?Q \<equiv> \<exists>R. ?A ?B ?CTSP ?P R \<and> ?A ?B ?CTSP ?Q R
A B C OSP P Q
A B C OSP Q R
\<lbrakk>?A ?B ?CTSP ?P ?R; ?A ?B ?C OSP ?P ?Q\<rbrakk> \<Longrightarrow> ?A ?B ?CTSP ?Q ?R

goal (1 subgoal):
 1. A B C OSP P R
[PROOF STEP]
by blast


[STATEMENT]
lemma restrictI[intro!]: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> B x) \<Longrightarrow> (\<lambda>x\<in>A. f x) \<in> Pi A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> B x) \<Longrightarrow> restrict f A \<in> Pi A B
[PROOF STEP]
by (simp add: Pi_def restrict_def)