Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

# Homework 4.2

This task corresponds to only homework 4.2. Deadline: November 13, 2018, 10 am.

## Resources

### Definitions File

theory Defs
imports Main
begin

inductive is_path :: "('v \<Rightarrow> 'v \<Rightarrow> bool) \<Rightarrow> 'v \<Rightarrow> 'v list \<Rightarrow> 'v \<Rightarrow> bool"
for E where
NilI: "is_path E u [] u"
| ConsI: "\<lbrakk> E u v; is_path E v l w \<rbrakk> \<Longrightarrow> is_path E u (u#l) w"

fun path :: "('v \<Rightarrow> 'v \<Rightarrow> bool) \<Rightarrow> 'v \<Rightarrow> 'v list \<Rightarrow> 'v \<Rightarrow> bool" where
"path E u [] v \<longleftrightarrow> v = u" |
"path E u [v] w \<longleftrightarrow> u = v \<and> E v w" |
"path E u (x # y # xs) v \<longleftrightarrow> (u = x \<and> E x y \<and> path E y (y # xs) v)"

lemma path_Nil: "is_path E u [] v \<longleftrightarrow> u=v"
by (auto intro: is_path.intros elim: is_path.cases)

lemma path_Cons: "is_path E u (v#p) w \<longleftrightarrow>
(\<exists>vh. u=v \<and> E v vh \<and> is_path E vh p w)"
by (auto intro: is_path.intros elim: is_path.cases)

end

### Template File

theory Submission
imports Defs
begin

theorem path_distinct:
assumes "is_path E u p v"
shows "\<exists>p'. distinct p' \<and> is_path E u p' v"
using assms
proof (induction p rule: length_induct)
case step: (1 p)
note IH = step.IH
note prems = step.prems
show ?case proof (cases "distinct p")
case True
then show ?thesis sorry
next
case False
then show ?thesis sorry
qed
qed

end

### Check File

theory Check
imports Submission
begin

theorem path_distinct:
assumes "is_path E u p v"
shows "\<exists>p'. distinct p' \<and> is_path E u p' v"
using assms by (rule Submission.path_distinct)

end

Terms and Conditions