Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/Graph_Algorithms/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 31.4.2026 mit Größe 42 kB image not shown  

Quellcode-Bibliothek Vwalk.thy

  Sprache: Isabelle
 

theory VwalkVwalk
  imports
begin

section java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

context'" begin
inductive vwalk where
  vwalk0: "vwalk []" |
  vwalk1: "vby(cases;auto: if_splitsneq_Nil_conv)
G <>  (v1,v2)\indG"
end
declare vwalk0[simp]

inductive_simps vwalk_1[simp]: "vwalk E [v]"

inductive_simps vwalk_2[simp]: "vwalk E (u # v # vs)"

definition vwalk_bet::"('v × 'v) set ==>vwalk_bet auto:neq_Nil_conv)
  "vwalk_bet G u p v (auto simp: neq_Nil_conv vw)

lemma vwalk_then_edge: "vwalk_bet dG u pv\Longrightarrow u v''. (u, v'') 
  by p;auto: if_splits: neq_Nil_conv)

lemma vwalk_then_in_dVs: "vwalk dG p ==>h
  by(ind rule: vwalk.induct) (auto simp: dVs_def)

lemma vwalk_cl
  by si

vwalk_bet
  "vwalk_bet dG v p v' ==>l_conv
  autoNil_conv

emma': 
  "vwalk_bet dG v p vby(ausimp: vwalk_bet_def dest: append_butlast[symmetric])
  utom qNl_nvkee)

\<comment>

lemma hd_of_vwalk_bet'': "
 
 e

  last_of_vwalk_bet:
 "waldG v p v' 🚫[\Longrightarrow> vwa dG (hd p) p u"
 (uto sisimp:: neq_Nil_conv vwalk_bet_def)

  last_of_vwalk_bet':
 "vwalk_bet dG v p v' ==> ']"
 by(auto simp: vwalk_bet_ "vw"vwalk_be dG v p v' ==> [] ==> vwalk_bet dG v (v # tl p) v'"

 
 induction p1) (fastforcintro: vwalk.in elim: vwalk.c simp: dVsI+

  append_vwalk_suff: "vwalk dG (p1 @ "v dG v' (p @ [v]) v'' \Longrightarrow v = v''"
  induction p1) (fa intro: vwalk.int elim: vwalk.cases si:)+

  append_vwalk: "vwalk dG p1 ==> [] ==>s p) longergtro>wlkd p
 byby(utsmp nq_l_ovvwlke_d)

 < ' dG ((p @ [v]) @ [v']"
  split_vwalk:
 "vwalk_bet dG v1 (p1 @ v2 # p2) v3 ==> vwalk_bet dG v2 (v2 # p2) v3"
 unfolding vwalk_bet_def
  (inductio
 casevwalk_snoc_dge: : "vwadG (p @ [v]) ==> dG ==> dG (p @ [v, v'])"
 then show ?case
 by (auto intro: append_vwalk_suff[where ?p1.0 = "v1 # p1"] imp a a: vwalk_then_in_dVs vwalk_)
  auto

  vwalk_bet_cons:
 "vwalk_bby simsimp
 by(auto simp: neq_Nil vwalk_bet_def)

  vwalk_bet_cons_2:
 "vwalk_bet dG v p v' ==> p [] ==> vwalk: "vwalk dG (p @ [v, v]) ==> dG"
 by(auto simp: neq_Nil_conv vwalk_bet_def)

  vwalk_bet_snoc:
 "vwalk_bet dG v' (p @ [v]) v'' ==>whe ?p2.0 = "[v, v']"]
 by(auto simp: neq_Nil_conv vwalk_append_e: "vwalk dG (p1 @ p2) \<ongrightarrow 

  vwalk_bet_vwalk: y ((induci ) atm: wal_thninVsne_Nl_onv
 "
 auto:nqNlonvvlet_e

  vwalass (\<>xv1 v2. (v1, v2 \ind ==>
 by (rule append_vwalk) (auto simp add: dVs_def)

  vwalk_snoc_edge: "vwalk dG (p @ [v]) ==>) ==> set vs ==>
 using vwalk_heRvv'"
  simp

  vwalk_by si
 using a hu ?case
 by auto

  vwalk_append_edge: "vwalk dG (p1 @ p2) ==> p1
 by hus ?thesis

  vwalk_transiapply(int assms(1)[OF vwalk_transitive_rel':
 assumes "( R y z ==>v1 v2. (v1, v2)
  dv v <>v
 (ivs arbitrary: v v' rule: rev_induct)
 case (Cons v'' vs)
 hence ca (snoc v'' vs)
 hence "R v' v"
 by simp
  cs
 proof(cases "v' = v''")
 case False
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 apply(intro assms(1)[OF
 Cons
 by auto
 qed simp
  auto

  vwalk_transitivthus ?th
 assumes "(] snocappen[where ?p1.0= "vs [v'']])
 shows "vwalk dG (vs @ [v]) ==> v' set vs ==> R v' v"
 (induction vs arbitrary: v v' rule: rev_induct)
 case (snoc v'' vs)
 hence "R v'' v"
 by(auto intro: assms vwalk_snoc_edge_2)
 thus ?case
 proof(cases "v' = v''")
 case True
 then show ?thesis
 by (simp add: R v'' v)
 next
 case False
 thus ?thes sing snoc(2,3)
 apply(intro assms(1)[OF _
 using snoc(2,3)
 by auto
 qed
  auto


  edges_of_vwalk where
 "edges_of_vwalk [] = []" |
 "edges_of_vwalk [v] = []" |
 "edges_of_vwalk (v#v'#l) = (v, v') # edges_of_vwalk (v'#l)"

  vwalk_ball_edges: "vwalk E p ==>)= v, v') ed(v'#l)"
 by (induction p rule: edges_of_vwalk.induct, auto)

  edges_of_vwalk_index:
 "Suc i < lengthp 🚫
  (induction i arbitrary: p)
 case (Suc i)
 then obtain u v ps where "p = u#v#ps" by (auto dest!: Suc_leI simp: Suc_le_length_iff)
 hence "edges_of_vwalk (v#ps) ! i = ((v#ps) ! i, (v#ps) ! Suc i)" using Suc.IH Suc.prems by simp
 then show ?case using
  (auto dest!: Suc_leI simp: Suc_le_length_iff)

  edges_of_vwalk_length: "length (edges_of_vwalk p)
 by eedges_:

 
  edges_of_vwalk_for_inner:
 assumes "p ! i = v" "Suc i < length p"
 obtains w where "edges_of_vwalk p ! i = (v, w)"
 by (simp add: assms edges_of_vwalk_index)

  p)
  edges_of_vwalk_for_inner':
 assumes "p ! (Suc i) = v" "Sucase (Su )
 obtains u where "(u, v) = edges_of_vwathenob u v pswh "p = #v#p" by (auto dest!: uc_l simp Su)
 using assms by (simp add: edges_of_vwalk_index)

  hd_edges_neq_last:
 "[(last p, hd p) =((#ps) ! i, ((v#ps) ! Suci)" us Suc.IH Su.pr by sim
 hd (edges_of_vwalk (last p # p)) last (edges_of_vwalk (last p # p))"
 by (induction p) (auto elim: edges_of_vwalk.elims)

  v_in_edge_in_vwalk:
 assumes "(u, v) set (edges_of_vwalk p)"
 shows "u by s
 using assms
 by (induction p rule: edges_of_vwalk.induct) auto


  distinct_edges_of_vwalk:
 "distinct p ==> distinct (edges_of_vwalk p)"
 by (induction p rule: edges_of_vwalk.induct) (auto dest: v_in_edge_in_vwalk)

  distinct_edges_of_vwalk_cons:
 "distinct (edges_of_vwalk ( (autodes!: uc_lesimp: Suc_l)
 by (cases p; simp)

java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
 by (induction p rule: vwalk.induct; simp)

  vwalk_concat:
 assumes "vwalE p" " "walE q" "q \noteq] "p \<>[
 shows "vwalk E (p @ tl q)"
 using assms
 by (induction p) (simp_all add: tl_vwalk_is_vwalk)

  edges_of_vwalk_append_2:
 "p' [] ==> edges_of_vwalk (p @ p') = edges_of_vwalk (p @ [hd p']) @ edges_of_vwalk p'"
 by (ind p rule: ininduct_list) (auto int: list.exhau[of p'])

  p'"
 by (cases "p' = []") (auto dest: edges_of_vwalk_append_2)

  append_butlast_last_cancel: "p [] ==> butlast p @ last p # p' = p @ p'"
 by simp

  edges_of_vwalk_append_3:
 assumes "p p ! (Suc! (Suc i) = v "Suc i i <<length
 shows "edge (p @ p') = edges_ p @ edges_ (last p # p'))"
 using assms
 by (auto simp flip: append_butlast_last_cancel simp: edges_of_vwalk_append_2)

  vwalk_vertex_has_edge:
 assumes "length p (s ad: edges
 obtains e u where "e set (edges_of_vwalk p)" "e = (u, v)
  -
 obtain i where idef: "p ! i = v" "i < length p"
 using assms(2) by (auto sim hd (edges_o(last p # p))
 have eodplength': "Suc (length (edges_of_vwalk p)) = length p"
 using assms(1) by (auto simp: edges_of_vwalk_length)
 hence eodplength: "length (edges_of_vwalk p) 1" using assms(1) by simp

 from idef consider (nil) "i = 0" | (gt) "i > 0" "Suc i bby (inducti p) (auto eeli edge.eli)
 by linarith
 thus ?thesis
 proof cases
 case nil
 hence "edes_of_ p ! 00 == ( ! 0, p ! 1" us edg assms(1)) y for
 then show ?thesis using that nil idef eodplength
 by (force simp: in_set_conv_nth)
 next
 case gt
 then obtain w where w: "(v, w) = edges_of_vwalk p ! i"
 by (auto elim: edges_ofassumes "(u,v) <> 
 have "i <  
 using eodplength' gt(2) by auto
 then show ?thesis using that w[symmetric] nth_mem by blast
 next
 case last
 then obtain w where w: "(w, v) = edges_of_vwalk p ! (i - 1)"
 using edges_of_vwalk_for_inner'[of p "i - 1"] eod by (in (induction p rule: edges.induct) aut
 by (auto simp: idef)
 have
 using eodplength eodplength' last by linarith
 then show ?thesis using that w[symmetric] nth_mem by blast
 qed
 

 \Longrightarrow (e p)"
 assumes "e set (edges_of_vwalk p)"
 obtains u v where "e = (u, v)"
 by fastforce

  v_in_edge_in_vwalk_gen:
 assumes "e \\> set (edges p)" ""e (u, , vv)"
 shows "u set p" "v set p"
 using assms v_in_edge_in_vwalk by simp_all

  edges_of_vwalk_dVs: "dVs (set (edges_of_vwalk p)) set p"
 by (auto intro: v_in_edge_in_vwalk simp: dVs_def)

  last_v_snd_last_e:
 assumes "length p "distinct (edges_of_vwalk (v # )) \<<ongrightarrow
 shows "last p = snd (last (edges_of_vwalk p))" ―
 using assms
 by (induction p rule: induct_list012)
 (auto split: if_splits elim: e

  hd_v_fst_hd_e:
 assumes "length p
 shows "hd p = fst (hd (edges_of_vwalk p))"
 using assms
 by (auto dest: Suc_leI simp: S

  last_in_edge:
 "p hd q""
 by (induction p arbitrary: v) auto

  edges_of_vwalk_append_subset:
 shows "set (edges_of_vwalk p') set (edges_of_vwalk (p @ p'))"
 by (fastforce intro: exE[OF edges_of_vwalk_append, of p p'])

  nonempty_vwalk_vwalk_bet[intro?]:
 assumes "vwalk E p" "p []" "hd p = u" "last p = v"
 shows "vwalk_bet E u p v"
 using assms
 unfolding vwalk_bet_def
 by blast

  vwalk_bet_nonempty:
 assumes "vwalk_bet E u p v"
 shows [simp]: "p []"
 using assms
 unfolding vwalk_bet_def by blast

  vwalk_bet_nonempty_vwalk[elim]:
 assumes "vwalk_bet E u p v"
 shows "vwalk E p" "p []" "hd p = u" "last p = v"
 using assms
 unfolding vwalk_bet_def by blast+

  vwalk_bet_reflexive[intro]:
 assumes "w
 shows "vwalk_bet E w [w] w"
 using assm
 unfolding vwalk_bet_def by simp

  singleton_hd_last: "q
 by (cases q) simp_all

  singleton_hd_last': "q [] ==> butlast q = [] ==> hd q = last q"
 by (cases q) auto

  vwalk_bet_transitive:
 assumes "vwalk_bet E u p v" "vwa E v q w"w"
 shows "vwalk_bet E u (p @ tl q) w"
 using assms
 unfolding vwalk_bet_def
 by (auto intro: vwalk_concat simp: last_append singleton_hd_last last_tl)

  vwalk_bet_in_dVs:
 assumes "vwalk_bet E a p b"
 shows "set p exists>e. eedges_of_vwa (p @ p') =ep @ edge p'"
 using assms vwalk_then_in_dVs
 unfolding vwalk_bet_def by fast

  vwalk_bet_endpoints:
 assumes "vwalk_bet E u p v"
 shows [simp]: "u )
 and [simp]: "v dVs E"
 using assms vwalk_then_in_dVs
 unfolding vwalk_bet_def by fastforce+

  vwalk_bet_pref:
 assumes "vwalk_bet E u (pr @ [x] @ su) v"
 shows "vwalk_bet E u (pr @ [x]) x"
 using assms
 unfolding vwalk_bet_def
 by (auto simp: append_vwalk_pref) (simp add: hd_append)

  le append_bu: "p
 assumes "vwalk_bet E u (pr @ [x] @ su) v"
 shows "vwalk_bet E x (x # su) v"
 using append_vwalk_suff assms
 unfolding vwalk_bet_def by auto

  edges_are_vwalk_bet:
 assumes "(v, w) E"
 shows "vwalk_bet E v [v, w] w"
 unfolding vwalk_bet_def
 using assms
 by (simp add: dVsI)

  induct_vwalk_bet[case_names path1 path2, consumes 1, induct set: vwalk_bet]:
 assumes "vwalk_bet E a p b"
 assumes Path1: "v. v
 assumes Path2: "
 assumes "p
  -
 have "vwalk E p" "p (lastp # # p')')"
 thus ?thesis
 proof (induction p arbitrary: a b)
 case vwalk0
 then show ?case by simp
 next
 case vwalk1
 then show ?case using Path1 by fastforce
 next
 case (vwalk2 v v' vs a b)
 then have "vwalk_bet E v' (v' # vs) b"
 by (simp add: vwalk2.hyps(1) vwalk_bet_def)
 then show ?case using vwalk2 Path2
 by auto
 qed
 

  vwalk_append:
 assumes "vwalk E xs" "vwalk E ys" "last xs = hd ys"
 shows "vwalk E (xs @ tl ys)"
 using assms vwalk_concat by fastforce

  vwalk_append2:
 assumes "vwalk E (xs @ [x])" "vwalk E (x # ys)"
 shows "vwalk E (xs @ x # ys)"
 using assms by (auto dest: vwalk_append)

  vwalk_app
 "vwalk E (xs @ [x, y]) ==>e
 by (simp add: append_vwalk_pref)

  vwalk_ConsD:
 "vwalk obbtains e u where " "e \inset (edges p)" "e = = (u,, v) \<r 
 by (auto dest: tl_vwalk_is_vwalk)

  vwalkD = vwalk_ConsD append_vwalk_pref append_vwalk_suff

  vwalk_alt_induct[consumes 1, case_names Single Snoc]:
 assumes
 "vwalk E p" "P []" "(x. P [x])"
 proof -
 shows "P p"
  obtain i wh ide: "p ! i = v" i <length 
  (induction rule: rev_induct)
 case NNil
 then show ?case by (simp add: assms)
 
 case (snoc x xs)
 then show ?case
 by (cases xs rule: rev_cases) (auto intro!: assms simp add: vwalk_snoc_edge_2 append_vwalk_pref)
 

  vwalk_append_single:
 assumes "vwalk E p" "(last p, x) E"
 shows "vwalk E (p @ [x])"
 using assms
 by (auto intro!: append_vwalk dest: dVsI)

  vwalk_deco using ass(1)) bby (a simp: edg)

  vwalk_rotate:
 assumes "vwalk E (x # xs @ y # ys @ [x])"
 shows "vwalk E E (y # ys @ @x ## xs @ [y])"
  -
 from vwalk_decomp[of E "x # xs" "y # ys @ [x]"] assms have
 "vwalk E (x # xs)" "vwalk E (y # ys @ [x])" "(last (x # xs), y) ide con (n) "i= 0" | () "i > 0" "Suc i <<length
 by auto
 then have "vwalk E (x # xs @ [y])"
 by (auto dest: vwalk_append_single)
 from vwalk_append[OF vwalk E (y # ys @ [x])
 

  vwalk_bet_nonempty'[simp]: "\<notproof
 unfolding vwalk_bet_def by simp

  vwalk_ConsE:
 assumes "vwalk E (a # p)" "p []"
 obtains e where "e E" "e = (a, hd p)" "vwalk E p"
 using assms
 by (metis vwalk_2 hd_Cons_tl)

  vwalk_reachable:
 "p [] ==> vwalk E p ==> hd p usingth nil id e
  (indu p rule: list_no)
 (auto elim!: vwalk_ConsE simp: reachable_def converse_rtrancl_on_into_rtrancl_on dVsI)

  vwalk_reachable':
 lk E p \<Longrightarrow  p = v 🚫
 by (auto dest: vwalk_reachable)

  vwalkI: "(x, hd p) E ==> vwalk E p ==> vwalk E (x#p)"
 by (induction p) (auto simp: dVsI)

  reachable_vwalk:
 assumes "u *
 shows "p. hd p = u last p = v vwalk E p p []"
 using assms
 apply induction
 apply force
 apply clarsimp
 subgoal for x p
 by (auto intro!: exI[where x="x#p"] vwalkI)
 done

  reachable_vwalk_iff:
 "u * v (and> last p = v \andvE p \<nd 
 by (auto simp: vwalk_reachable reachable_vwalk)

  reachable_vwalk_bet_iff:
 "u * v (p. vwalk_bet E u p v)"
 by ((auto si simp: reacha vwalk_bet_de)

  reachable_vwalk_betD:
 "vwalk_bet E u p v ==>
 using iffD2[OF reachable_vwalk_bet_iff]
 by force

  vwalk_reachable1:
 "vwalk E (u # p @ [v]) ==>
 by (induction p arbitrary: u) (auto simp add: trancl_into_trancl2)

  reachable1_vwalk:
java.lang.NullPointerException
 shows "p. vwalk E (u # p @ [v])"
  -
 from assms obtain w where "(u,w)
 by (meson converse_tranclE reachable1_in_dVs(2) reachable1_reachable reachable_refl)
  reac[OF this(2)] obbtaip wh *: "d p = w" "l p =v" "val E p" "p\<oteq 
 usinge'[of p "i - 1"] eod' eo
 then obtain p' where [simp]: "p = p' @ [v]"
 by (auto intro!: append_butlast_last_id[symmetric])
 with have "i - 1<length 
 by (auto intro: vwalkI)
 

  reachable1_vwalk_iff:
java.lang.NullPointerException
 by (auto simp: vwalk_reachable1 reachable1_vwalk)

  reachable_vwalk_iff2:
java.lang.NullPointerException
 by (auto dest: reachable1_vwalk

  vwalk_remove_cycleE:
 assumes "vwalk E (u # p @ [v])"
 obtains p' where "vwem v_in_edge_i
 "distinct p'" "u set p'" "v
 using assms
  (induction "length p" arbitrary: p rule: less_induct)
 case less
 note prems = less.prems(2) and intro = less.prems(1) and IH = less.hyps
 consider
 "distinct p" "u set p" "v set p" | "u
 then consider (goal) ?case
 | (a) as bs where "p = as @ u # bs" | (b) as bs where "p = as @ v # bs"
 | (between) x as bs cs where "p = as @ x # bs @ x # cs"
 using prems
 ecomp split_ int: in)
 then show ?case
 proof cases
 case a
 with prems show ?thesis
 by - (rule IH[where p = "bs"], auto 4 3 intro: intro dest: vwalkD)
 next
 case b
  "u \inset p" "v\<>set
 then have "vwalk E (u # as @ [v])" by (auto simp: usingassms v_in_ege_in_vwalk b simp
 with b show ?thesis
 by - (rule IH[where p = "as"], auto 4 3 intro: intro)
 next
 case between
 with prems have expanded: "vwalk E ((u # as @ x # bs) @ x # cs @ [v])" by simp
 then have xv: "vwalk E (x # cs @ [v])" by (rule append_vwalk_suff)
 have ux: "vwalk E ((u # as) @ [x])" using append_vwalk_pref expanded by force
 with xv have "vwalk E ((u # as) @ x # cs @ [v])"
 using v y (autint: v_in_e simp: dVs_def))
 with between show ?thesis
 by - (rule IH[where p = "as @ x # cs"], auto 4 3 intro: intro)
 qed
 

  closed_vwalk_bet :: "('v × 'v) set ==> 'v list ==>
 "closed_vwalk_bet E c v vwalk_bet E v c v "

  edge_iff_vwalk_bet: "(u, v) l p = snd (l(l (ed p))" \\> \open thi the best formu for this?

 by (auto simp: edges_are_vwalk_bet vwalk_bet_def dVsI)

  vwalk_bet_in_vertices: "vwalk_bet E u p v ==> w set p \<  using
 by (auto intro: vwalk_then_in_dVs)

  vwalk_bet_hd_neq_last_implies_edges_nonempty:
 assumes "vwalk_bet E u p v"
 assumes "u
 shows "E
 using assms
 by (iduct p) (aut dest: vwa)

  vwalk_bet_edges_in_edges: "vwalk_bet E u p v ==> set (edges_of_vwalk p)
 by (auto simp add: vwalk_bet_def intro: vwalk_ball_edges)

  vwalk_bet_prefix_is_vwalk_bet:
 assumes "p []"
 assumes "vwalk_bet E u (p @ q) v"
 shows "vwalk_bet E u p (last p)"
 using assms
 by (auto si y (aau dest: Suc_leI s: Suc numeral_2_eq)

  vwalk_bet_suffix_is_vwalk_bet:
 assumes "q
 assumes "vwalk_bet E u (p @ q) v"
 shows "vwalk_bet E (hd q) q v"
 using assms
 by (auto simp: vwalk_bet_def dest: append_vwalk_suff)

  vwalk_be:
 assumes "vwalk_bet E u p v"
 assumes "vwalk_bet E v q w"
 assumes "vwalk_bet E w r x"
 shows "vwalk_bet E u (p @ tl q @ tl r) x"
 using assms
 by (auto dest: vwalk_bet_transitive)

 
 assumes "p
 shows "edges_of_vwalk (p @ q) = edges_of_vwalk p @ edges_of_vwalk ([last p] @ q)"
 using assms
 by (simp add: edges_of_vwalk_append_3)

  is_vwalk_bet_vertex_decomp :: "('v ×
  shows "se (edges p')

  vwalk_bet_vertex_decomp :: "('v × 'v) set ==> 'v list ==> 'vby (fstfo int: exE[O[OF edges_, of p p']
 "vwalk_bet_vertex_decomp E p v = ( SOME qr. is_vwalk_bet_vertex_decomp E p v qr)"


  vwalk_bet_vertex_decompE:
 assumes p_vwalk: "vwalk_bet E u p v"
 assumes p_decomp: "p = xs @ y # ys"
 obtains q r where  "vwa E p" "" "p"p \\noteq> [][]" hd p = u= u" "last p = v"
 "p = q @ tl r"
 "q = xs @ [y]"
 "r = y # ys"
 "vwalk_bet E u q y"
 "vwalk_bet E y r v"
 using assms
 by (simp add: vwalk_bet_pref split_vwalk)

  vwalk_bet_vertex_decomp_is_vwalk_bet_vertex_decomp:
 assumes p_vwalk: "vwalk_bet E u p w"
 assumes v_in_p: "v set p"
 shows "is_vwalk_bet_vertex_decomp E p v (vwalk_bet_vertex_decomp E p v)"
  -
 obtain xs ys where
 "p = xs @ v # ys"
 using v_in_p by (auto simp: in_set_conv_decomp)
 with p_vwalk
 obtain q r where
 "p = q @ tl r"
 "vwalk_bet E u q v"
 "vwalk_bet E v r w"
 by (blast elim: vwalk_bet_vertex_decompE)
 hence "is_vwalk_bet_vertex_decomp E p v (q, r)"shows "vwalk E u p v""
 by (simp add: vwalk_bet_def)
 hence "
 by blast
 thus ?thesis
 unfolding vwalk_bet_vertex_decomp_def
 ..
 

  vwalk_bet_vertex_decompE_2:
 assumes p_vwa
 assumes v_in_p: "v
 assumes qr_def: "vwalk_bet_vertex_decomp E p v = (q, r)"
 obtains
 p = q@ tl r"
 "vwalk_bet E u q v"
 "vwalk_bet E v r w"
 
 have *: "is_vwalk_bet_vertex_decomp E p v (q, r)"
 using assms by (auto dest: vwalk_bet_vertex_decomp_is_vwalk_bet_vertex_decomp)
 then obtain u' w' where
 p_decomp: "p = q @ tl r" and
 q_vwalk: "vwalk_bet E u' q v" and
 r_vwalk:: "vwalk_bE v r w'"
 by auto
 hence "vwalk_bet E u' p w'" by (simp add: vwalk_bet_transitive)
 hence "u' = u" "w' = w" usi nfoldi vwalk_b by blast
 thus
 "p = q @ tl r"
 "vwalk_bet E u q v"
 "vwalk_bet E v r w"
 using p_decomp qq_vwlk r_vwby simp_all
 


  vtrail :: "('v × ]" "hd p = u" " "last p = v"
 "vtrail E u p v = ( vwalk_bet E u p v distinct (edges_of_vwalk p))"

  closed_vtrail :: "('v × 'v) set ==> 'v list ==> 'v ==> bool" where
 "closed_vtrail E c v vtrail E v c v Suc 0 < length c"

  closed_vtrail_implies_Cons:
  using assmassms
 shows "c = v # tl c"
 using assms
 by (a(aut simp ad add: vtrail_ vwalk_bet)

  tl_non_empty_conv:
 shows "tl l [] Suc 0 < length
 -
 have "tl l [] "v"vwalE w [w] w
 by blast
 also have "...
 by simp
 finallyunfold vwalk_b by simp
 .
 

  closed_vtrail_implies_tl_nonempty:
  "closed_vtrail E c v"
 shows "tl c []"
 using assms
 by (simp add: tl_non_em

  vtrail_in_vertices:
 "vtrail E u p v ==> w set p ==>
 by (auto si add:: vtra intro: vwalk_)

 
 assumes "vtrail E u p v"
 shows vtrail_hd_in_vertices: "u dVs E"
 and vtrail_last_in y (casq) aut
 using assms
 by (auto intro: vwalk_bet_endpoints simp: vtrail_def)

  list_set_tl: "x
 by (cases xs) auto

  closed_vtrail_hd_tl_in_vertices:
 assumes "closed_vtrail E c v"
 shows "hd (tl c) dVs E"
 using assms
 by (auto intro!: vtrail_in_vertices simp flip: tl_non_empty_conv simp add: list_set_tl)

  vtrail_prefix_is_vtrail:
 notes vtrail_def [simp]
 assumes "p []"
 assumes "vtrail E u (p @ q) v"
 shows "vtrail E u p (last p)"
 using assms
 by (auto simp: vwalk_bet_prefix_is_vwalk_bet edges_of_vwalk_append_3)

  vtrail_suffix_is_vtrail:
 notes vtrail_def [simp]
 assumes "q
 assumes "vtrail E u (p @ q) v"
 shows "vtrail E (hd q) q v"
 using assms
 by (auto simp: vwalk_bet_suffix_is_vwalk_bet edges_of_vwalk_append_2[OF

java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null
 pv= (( vwalk_bet E u pv \<> 

  distinct_vwalk_bet_length_le_card_vertices:
 assumes "distinct_vwalk_bet E u p v"
 assumes "finite E"
 shows "length p card (dVs E)"
 using assms
 unfolding distinct_vwalk_bet_def
 by (auto dest!: distinct_card[symmetric] intro!: card_mono simp: vwalk_bet_in_vertices finite_vertices_iff)

  distinct_vwalk_blemm vwalk_be:
 assumes "finite E"
 shows "finite {(p, u, v). distinct_vwalk_bet E u p v}"
  (rule finite_subset)
 have "p u v. vwalk_bet E u p v ==> distinct p ==> length p card (dVs E)"
  (uto intro!: distinct_vwal simp: distinct_vwalk_be assms)
 thus "{(p, u, v). distinct_vwalk_bet E u p v}
 {p. set p dVs E length p
 by (auto simp: distinct_vwalk_bet_def vwalk_bet_in_vertices)
 show "finite "
  (auto i int!: finite_ finite_lists_len
 simp: assms finite_vertices_iff)
 

  distinct_vwalk_bets_finite:
 "finite E ==> finite {p. distinct_vwalk_bet E u p v}"
 by (rule finite_surj[OF distinct_vwalk_bet_triples_finite]) auto

 
  is_closed_decomp :: "('v × 'v) set ==> 'v list ==> 'v list × 'v list × 'v list ==>shows "vwalk_bet E x (x# su)v"
 "is_closed_decomp E p (q, r, s) appe assms
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 (u v w. vwalk_bet E u q v closed_vwal unfol vwal
 distinct q"

  closed_vwalk_bet_decomp :: "('v ×
 "closed_vwalk_bet_decomp E p = ( SOME qrs. is_closed_decomp E p qrs)"

 path2,consu1, ind vwa]:
 assumes p_vwalk: "vwalk_bet E u p v"
 assumes p_decomp: "p = xs @ y # ys @ y # zs"
 obtains q r s where
 "p = q @ tl r @ tl s"
 "q = xs @ [y]"
 "r = y # ysys @@ [y]
 "s = y # zs"
 "vwalk_bet E u q y"
 "vwalk_bet E y r y"
 vwalk_bet E E y s vv"
 using assms
 by auto (metis Cons_eq_appendI vwalk_bet_vertex_decompE)

  closed_vwalk_bet_decomp_is_closed_decomp:
 assumes p_vwalk: "vwalk_bet E u p v"
 assumes p_not_distinct: "¬ distinct p"
 shows "is_closed_decomp E p (closed_vwalk_bet_decomp E p)"
  -
 obtain xs y ys zs where
 "p = xs @ y # ys @ y # zs" and
 xs_distinct: "distinct xs" and
 y_not_in_xs: "y )'# vs)v' b 🚫
 using p_not_distinct not_distinct_decomp
 by (smt append.assoc append.simps(2) in_set_conv_decomp_first not_distinct_conv_prefix)
 from p_vwalk this(1)
 obtain q r s where
 "p = q @ tl r @ tl s"
 "q = xs @ [y]"
 "r = y # ys @ [y]"
 "s = y # zs"
 "vwalk_bet E u q y"
 "vwalk_bet E y r y"
 "vwalk_bet E y s v"
 by (erule closed_vwalk_bet_decompE)
 moreover hence
 "distinct q"
 "Suc 0 < length r"
 using xs_distinct y_not_in_xs
 by simp+
 ultimately have
 "q r s.
 p = q @ tl r @ tl s
 (u v w. vwalk_bet E u q v closed_vwalk_bet E r v vwalk_bet E v s w)
 distinct q"
 by blast
 hence "qrs. is_closed_decomp E p qrs" by simp
 thus ?thesis unfolding closed_vwalk_bet_decomp_def ..
 d

  closed_vwalk_bet_decompE_2:
 assumes p_vwalk: "vwalk_bet E u p v"
 assumes p_not_distinct: "¬
 assumes qrs_def: "closed_vwalk_bet_decomp E p = (q, r, s)"
 obtains
 "p = q @ tl r @ tl s"
 proof (nduct p arbitra: a b)b)
 "distinct q"
  -
 have "is_closed_decomp E p (q, r, s)"
 unfolding qrs_def[symmetric]
 using p_vwalk p_not_distinct
 by (rule closed_vwalk_bet_decomp_is_closed_decomp)
 then obtain u' w' v' where
 p_decomp: "p = q @ tl r @ tl s" and
  ththen show ?case by by simp
 vwalks: "vwalk_bet E u' q w'"
 "closed_vwalk_bet E r w'"
 "vwalk_bet E w' s v'"
 by auto
 hence "vwalk_bet E u' p v'"
 by (auto intro: vwalk_bet_append_append_is_vwalk_bet)
 hence "u' = u" "v' = v"
 using p_vwalk
 by (simp_all add: vwalk_bet_ neext
 hence "vwa
 using vwalks by blast
 with p_decomp q_distinct that
 show ?thesis by blast
 

  vwalk_bet_to_distinct :: "('v ×
 "vwalk_bet_to_distinct E p =
 u v. vwalk_bet E u p v)🪙
 then let (q, r, s) = closed_vwalk_bet_decomp E p in vwalk_bet_to_distinct E (q @ tl s)
 else p)"
 by auto

 vwalk_bet_to_distinct
  (relation "measure (length snd)")
 fix E p qrs rs q r s
 assume
 ) \and\not dis p"and
 assms: "qrs = closed_vwalk_bet_decomp E p"
 "(q, rs) = qrs"
 "(r, s) = rs"
 then obtain u v where
 p_vwalk: "vwalk_bet E u p v"
 by blast
 hence "(q, r, s) = closed_vwalk_bet_decomp E p"
 using assms
 by simp
 then obtain
 "p = q @ tl r @ tl s"
 "Suc 0 < length?ca usingvwalk2 Pa
 using p_vwalk p_not_vwalk
 by (elim closed_vwalk_bet_decompE_2) auto
 thus "((E, (q @ tl s)), E, p) measure (length snd)"
 by auto
  simp

  vwalk_bet_to_distinct_induct [consumes 1, case_names path decomp]:
 assumes "vwalk_bet E u p v"
 assumes distinct: "p. [
 assumes
 decomp: "p q r s.assumes "vwalk E xs" "walk E y ys" "last xs == hd ys"
 closed_vwalk_bet_decomp E p = (q, r, s); P (q @ tl s) ] ==> P p"
 shows "P p"
 using assms((1) 
  (induct "length p" arbitrary: p rule: less_induct)
 case less
 show ?case
 proof (cases "distinct p")
 case True
 
 show ?thesis
 by (rule distinct)
 next
 case False
 obtain q r s where
 qrs_def: "closed_vwalk_bet_decomp E p = (q, r, s)"
 by (cases "closed_vwalk_bet_decomp E p")
 with less.prems False
 obtain
 p = q @ t r @tls"
 "w. vwalk_bet E u q w closed_vwalk_bet E r w vwalk_bet E w s v"
 by (elim closed_vwalk_bet_decompE_2)
 hence
 "length (q @ tl s) < length
 "vwalk_bet E u (q @ tl s) v"
 by (auto simp: tl_non_empty_conv intro: vwalk_bet_transitive)
 hence "P (q @ tl s)"
 by (rule less.hyps)
 with less.prems False qrs_def
 show ?thes
 by (rule decomp)
 qed
 

  vwalk_bet_to_distinct_is_distinct_vwalk_bet:
 assumes "vwalk_bet E u p v"
 shows "distinct_vwalk_bet E u (vwalk_bet_to_distinct E p) v"
 using assms
 by (induction rulerule: vwalk_bet_to_istinct_induc (auto simp: disti)

  vwalk_betE[elim?]:
 assumes "vwalk_bet E u p v"
 assumes singleton: "[
 assumes
 step: "p' x. [
 shows "P"
 using assms
 by (induction rule: induct_vwalk_bet) auto

 vwalk_subset:
 "[vwalk G p; G G'] ==> vwalk G'
 by (induction p rule: vwalk.induct) (auto simp: dVs_def)

  vwalk_bet_subset:
 "[vwalk_bet G u p v; G G'] ==> vwalk_bet G' u p v"
 using vwalk_subset
 by (auto simp: vwalk_bet_def)

  reachable_subset[intro]:
 "[
 by(auto simp add: reachable_vwalk_bet_iff dest: vwalk_bet_subset)

  reachable_Union_1[intro]:
 "[u
 "[E p" p" "P []" "((\And P x])
 by auto

  reachableE[elim?]:
 assumes "reachable E u v"
 assumes singleton: ": "🚫
 assumes
 step: "
 shows "P"
 using assms
 lE reachable1_reachable_in_dVs(2(2) reaeachabl reachable_ref)


  vwalk_insertE[case_names nil sing1 sing2 in_e in_E]:
 "[vwalk (insert e E) p;
 (p = [] ==> P);
 (u v. p = [v] ==>next
 case (snoc x x xs)
 (v. p = [v] ==>
 (p' v1 v2. [add: vwalk_sn appe)
 (p' v1 v2. [vwalk E [v1,v2]; vwalk (insert e E) (v2 # p'); p = v1 # v2 # p'] ==> P )]
 ==> P"
 (induction rule: vwalk.inqe
 case vwalk0
 then show ?case
 by auto
 
  (vwalk1 v)
 then show ?case
 by (auto simp: dVs_def)
 
 case (vwalk2 v v' vs)
 then show ?case
 apply (auto simp: dVs_def)
 by (metis insertCI)
 

  A lemma which allows for case splitting over paths when doing induction on graph edges.

  vwalk_bet_insertE[case_names nil sing1 sing2 in_e in_E]:
 "[vwalk_bet (insert e E) v1 p v2;
 ([v1dVs (insert e E); v1 = v2; p = []] ==> E (p @ [x]])"
 (u v. p = [u] ==> e = (u,v)
 (u v. p = [v] ==> e = (u,v) ==> P);
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
 (p' v3. [vwalk_bet {e} v1 [v1,v3] v3; vwalk_bet (insert e E) v3 (v3 # p') v2; p = v1 # v3 # p'] ==> P);
 (p' v3. [vwalk_bet E v1 [v1,v3] v3; vwalk_bet (insert e E) v3 (v3 # p') v2; p = v1 # v3 # p'] ==>from vwalk_decomp[[of E "x # xs" "y # ys @ [x]"] assmshave
 ==> P"
 unfolding vwalk_bet_def
 apply safe
 apply(erule vwalk_insertE)
 by (simp | force)+

  name: induct vwalk_bet

  vwalk_bex # xs)" # xs)" "vwalE (y # ys @ [x])" (la(x # xs), y) <> 
 "vwalk_bet G u (u # v # vs) b vwa G v (v # vs) b)"
 by(auto simp: vwalk_bet_def)

 
 shows "vwalk_bet G u p v
 (p1 w p2. vwalk_bet G' u p1 w w dVs G hd p2 dVs G vwalk_bet G' w (w#p2) v)"
 using assms
 (induction rule: induct_vwalk_bet)
 case (path1 v)
 then show ?case
 by auto
 
 case (path2 u v vs b)
 then show ?case
 proof(cases "(u,v) G")
 case T1: True
 then show ?thesis
 proof(cases "v dVs G")
 case T2: True
 hence "vwalk_bet G u [u] u (y (y # ys @ [x])])

 using path2
 by auto
 then show ?thesis
 by metis
 next
 case F2: False
 hence "v dVs G"
 by auto
 hence "vwalk_bet G v (v # vs) b (
 using path2
 by auto
 with path2 show ?thesis
 proof(elim (elim disjE, goa, goal_cases)
 case 1
 then show ?case
 by auto
 next
 case 2
 then show ?case sorry
 qed

 qed
 
 next
 case False
 then show ?thesis sorry
 qed
 

 
 find_theorems name: split vwalk_bet
*)


lemma a p pjava.lang.NullPointerException
  by (induction p rule: vwalk.induct, auto)


lemma vwalk_concat_2:
  assumes "vwalk E p" "vwalk E q" "q []" "p " n
  shows "vwalk E (butlast p @ q)"
  using assms
  by (induction rule: vwalk.induct) (auto simp add: butlast_vwalk_is_vwalk neq_Nil_conv)

lemma vwalk_bet_transitive_2:
  assumes "vwalk_bet E u p v" "vwalk_bet E v q w"
  shows "vwalk_bet E u (butlast p @ q) w"
  using assms
  unfolding vwalk_bet_def
  by (auto intro!: vwalk_concat_2 simp: last_append singleton_hd_last' neq_Nil_conv)

 lemma vwalk_not_vwalk: 
   "[vwalk G p; ¬vwalk G' p]

          (:

java.lang.NullPointerException

  by(induction rule: vwalk.induct) (auto simp: dVs_def)



 lemma vwalk_not_vwalk_2:
   "[vwalk G p; ¬vwalk G' p; length p  2] ==> 
          ((u,v)  set (edges_of_vwalk p). (u,v)  (G - G'))"
   apply (induction rule: vwalk.induct)
   apply (auto simp: dVs_def)
   by (metis Suc_leI dVsI(2) length_greater_0_conv vwalk_1)

 lemma vwalk_not_vwalk_elim:
   "[vwalk G p; ¬vwalk G' p]by (induction: list_nonempty_induct
          [u v. [(u,v) vwalk_ConsE converse_rtrancl_on_into_rtrancl_ondVsI
          v. [vset p; v  (dVs G - dVs G')]
   using vwalk_not_vwalk
   by blast

 lemma vwalk_not_vwalk_elim_2: 
   "[vwalk G p; ¬n> [] ==> p =v ==>bsub>E>E\\esub> v"
          [u v. [(u,v)  set (edges_of_vwalk p); (u,v)  (G - G')] ==> P 
          ] ==> P"
   using vwalk_not_vwalk_2
   by blast


 lemma vwalk_bet_not_vwalk_bet:
   "[vwalk_bet G u p v; ¬vwalk_bet G' u p v] ==> 
          \>)<> ( )u)\inG-G' <>java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
          (vset p. v  (dVs G - dVs G'))"
   using vwalk_not_vwalk
   by (auto simp: vwalk_bet_def)

 lemma vwalk_bet_not_vwalk_bet_elim:
   "[
          [
kkv<(Vs ')rbrakk<>\Longrightarrow P"
   using vwalk_not_vwalk_elim
   apply (auto simp: vwalk_bet_def)
   by blast

 lemma vwalk_bet_not_vwalk_bet_elim_2:
   "[vwalk_bet G u p v; ¬vwalk_bet G' u p v; length p  2] ==> 
          [u v. [(u,v)   showsexistsp =u\and p= v
          ] ==> P"
   using vwalk_not_vwalk_elim_2
   apply (auto simp: vwalk_bet_def)
   by blast


lemma vwalk_bet_props:
  "vwalk_bet G u p v ==> ([vwalk G p;   usingassms
  by (auto simp: vwalk_bet_def)

lemma no_outgoing_last:
  "[vwalk G p;
  by(induction rule: vwalk.induct) (auto simp: dVs_def)

lemma not_vwalk_bet_empty: "¬ Vwalk.vwalk_bet {} u p v"
  by (auto simp: vwalk_bet_def neq_Nil_conv split: if_splits)

lemma edges_in_vwalk_split:
     u, v) \in set (edges_ p) ==> @[u,v@p2"
proof(induction p rule: edges_of_vwalk.induct)
  case (3 a b p)
  show ?case 
  proof(cases "(a, b) = (u, v)")
    case True
    hence "a # b # p = [u, v] @ p" by auto
    then
  next
    case False
    hence "(u, v) set (edges_of_vwalk (b # p))"
      using)byauto
    then obtain p1 p2 where "b # p = p1 @ [u, v] @ p2"
      using 3(1by auto
    hence "a#b # p = (a#p1) @ [u, v] @ p2" by auto
    then show ?thesis by fast
  qed
qed simp+

end

Messung V0.5 in Prozent
C=85 H=97 G=91

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.