lemma path_split: assumes"n -as@a#as'→* n'" shows"n -as→* sourcenode a"and"valid_edge a"and"targetnode a -as'→* n'" using‹n -as@a#as'→* n'› proof(induct as arbitrary:n) case Nil case1 thus ?caseby(fastforce elim:path.cases intro:empty_path) next case Nil case2 thus ?caseby(fastforce elim:path.cases intro:path_edge) next case Nil case3 thus ?caseby(fastforce elim:path.cases) next case (Cons ax asx) note IH1 = ‹∧n. n -asx@a#as'→* n' ==> n -asx→* sourcenode a› note IH2 = ‹∧n. n -asx@a#as'→* n' ==> valid_edge a› note IH3 = ‹∧n. n -asx@a#as'→* n' ==> targetnode a -as'→* n'›
{ case1 hence"sourcenode ax = n"and"targetnode ax -asx@a#as'→* n'"and"valid_edge ax" by(auto elim:path.cases) from IH1[OF ‹ targetnode ax -asx@a#as'→* n'›] have"targetnode ax -asx→* sourcenode a" . with‹sourcenode ax = n›‹valid_edge ax›show ?caseby(fastforce intro:Cons_path) next case2hence"targetnode ax -asx@a#as'→* n'"by(auto elim:path.cases) from IH2[OF this] show ?case . next case3hence"targetnode ax -asx@a#as'→* n'"by(auto elim:path.cases) from IH3[OF this] show ?case .
} qed
lemma path_split_Cons: assumes"n -as→* n'"and"as ≠ []" obtains a' as' where"as = a'#as'"and"n = sourcenode a'" and"valid_edge a'"and"targetnode a' -as'→* n'" proof - from‹as ≠ []›obtain a' as' where"as = a'#as'"by(cases as) auto with‹n -as→* n'›have"n -[]@a'#as'→* n'"by simp hence"n -[]→* sourcenode a'"and"valid_edge a'"and"targetnode a' -as'→* n'" by(rule path_split)+ from‹n -[]→* sourcenode a'›have"n = sourcenode a'"by fast with‹as = a'#as'›‹valid_edge a'›‹targetnode a' -as'→* n'› that show ?thesis by fastforce qed
lemma path_split_snoc: assumes"n -as→* n'"and"as ≠ []" obtains a' as' where"as = as'@[a']"and"n -as'→* sourcenode a'" and"valid_edge a'"and"n' = targetnode a'" proof - from‹as ≠ []›obtain a' as' where"as = as'@[a']"by(cases as rule:rev_cases) auto with‹n -as→* n'›have"n -as'@a'#[]→* n'"by simp hence"n -as'→* sourcenode a'"and"valid_edge a'"and"targetnode a' -[]→* n'" by(rule path_split)+ from‹targetnode a' -[]→* n'›have"n' = targetnode a'"by fast with‹as = as'@[a']›‹valid_edge a'›‹n -as'→* sourcenode a'› that show ?thesis by fastforce qed
lemma path_split_second: assumes"n -as@a#as'→* n'"shows"sourcenode a -a#as'→* n'" proof - from‹n -as@a#as'→* n'›have"valid_edge a"and"targetnode a -as'→* n'" by(auto intro:path_split) thus ?thesis by(fastforce intro:Cons_path) qed
lemma path_Entry_Cons: assumes"(_Entry_) -as→* n'"and"n' ≠ (_Entry_)" obtains n a where"sourcenode a = (_Entry_)"and"targetnode a = n" and"n -tl as→* n'"and"valid_edge a"and"a = hd as" proof - from‹(_Entry_) -as→* n'›‹n' ≠ (_Entry_)›have"as ≠ []" by(cases as,auto elim:path.cases) with‹(_Entry_) -as→* n'›obtain a' as' where"as = a'#as'" and"(_Entry_) = sourcenode a'"and"valid_edge a'"and"targetnode a' -as'→* n'" by(erule path_split_Cons) with that show ?thesis by fastforce qed
lemma path_det: "[n -as→* n'; n -as→* n'']==> n' = n''" proof(induct as arbitrary:n) case Nil thus ?caseby(auto elim:path.cases) next case (Cons a' as') note IH = ‹∧n. [n -as'→* n'; n -as'→* n'']==> n' = n''› from‹n -a'#as'→* n'›have"targetnode a' -as'→* n'" by(fastforce elim:path_split_Cons) from‹n -a'#as'→* n''›have"targetnode a' -as'→* n''" by(fastforce elim:path_split_Cons) from IH[OF ‹targetnode a' -as'→* n'› this] show ?thesis . qed
lemma path_sourcenode: "[n -as→* n'; as ≠ []]==> hd (sourcenodes as) = n" by(fastforce elim:path_split_Cons simp:sourcenodes_def)
lemma path_targetnode: "[n -as→* n'; as ≠ []]==> last (targetnodes as) = n'" by(fastforce elim:path_split_snoc simp:targetnodes_def)
lemma sourcenodes_is_n_Cons_butlast_targetnodes: "[n -as→* n'; as ≠ []]==> sourcenodes as = n#(butlast (targetnodes as))" proof(induct as arbitrary:n) case Nil thus ?caseby simp next case (Cons a' as') note IH = ‹∧n. [n -as'→* n'; as' ≠ []] ==> sourcenodes as' = n#(butlast (targetnodes as'))› from‹n -a'#as'→* n'›have"n = sourcenode a'"and"targetnode a' -as'→* n'" by(auto elim:path_split_Cons) show ?case proof(cases "as' = []") case True with‹targetnode a' -as'→* n'›have"targetnode a' = n'"by fast with True ‹n = sourcenode a'›show ?thesis by(simp add:sourcenodes_def targetnodes_def) next case False from IH[OF ‹targetnode a' -as'→* n'› this] have"sourcenodes as' = targetnode a' # butlast (targetnodes as')" . with‹n = sourcenode a'› False show ?thesis by(simp add:sourcenodes_def targetnodes_def) qed qed
lemma targetnodes_is_tl_sourcenodes_App_n': "[n -as→* n'; as ≠ []]==> targetnodes as = (tl (sourcenodes as))@[n']" proof(induct as arbitrary:n' rule:rev_induct) case Nil thus ?caseby simp next case (snoc a' as') note IH = ‹∧n'. [n -as'→* n'; as' ≠ []] ==> targetnodes as' = tl (sourcenodes as') @ [n']› from‹n -as'@[a']→* n'›have"n -as'→* sourcenode a'"and"n' = targetnode a'" by(auto elim:path_split_snoc) show ?case proof(cases "as' = []") case True with‹n -as'→* sourcenode a'›have"n = sourcenode a'"by fast with True ‹n' = targetnode a'›show ?thesis by(simp add:sourcenodes_def targetnodes_def) next case False from IH[OF ‹n -as'→* sourcenode a'› this] have"targetnodes as' = tl (sourcenodes as')@[sourcenode a']" . with‹n' = targetnode a'› False show ?thesis by(simp add:sourcenodes_def targetnodes_def) qed qed
lemma Entry_sourcenode_hd: assumes"n -as→* n'"and"(_Entry_) ∈ set (sourcenodes as)" shows"n = (_Entry_)"and"(_Entry_) ∉ set (sourcenodes (tl as))" using‹n -as→* n'›‹(_Entry_) ∈ set (sourcenodes as)› proof(induct rule:path.induct) case (empty_path n) case1 thus ?caseby(simp add:sourcenodes_def) next case (empty_path n) case2 thus ?caseby(simp add:sourcenodes_def) next case (Cons_path n'' as n' a n) note IH1 = ‹(_Entry_) ∈ set(sourcenodes as) ==> n'' = (_Entry_)› note IH2 = ‹(_Entry_) ∈ set(sourcenodes as) ==> (_Entry_) ∉ set(sourcenodes(tl as))› have"(_Entry_) ∉ set (sourcenodes(tl(a#as)))" proof assume"(_Entry_) ∈ set (sourcenodes (tl (a#as)))" hence"(_Entry_) ∈ set (sourcenodes as)"by simp from IH1[OF this] have"n'' = (_Entry_)"by simp with‹targetnode a = n''›‹valid_edge a›show False by -(erule Entry_target,simp) qed hence"(_Entry_) ∉ set (sourcenodes(tl(a#as)))"by fastforce
{ case1 with‹(_Entry_) ∉ set (sourcenodes(tl(a#as)))›‹sourcenode a = n› show ?caseby(simp add:sourcenodes_def) next case2 with‹(_Entry_) ∉ set (sourcenodes(tl(a#as)))›‹sourcenode a = n› show ?caseby(simp add:sourcenodes_def)
} qed
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.