theory Deterministic_AI

lemma next_not_child:
  notes split_paired_All[simp del] split_paired_Ex[simp del]
  shows "next_not_child p t' n
    = (if p = src then
        (if next_not_child dest t m = Some src then Some dest
         else next_not_child dest t m)
      else if p = dest then
        (if next_not_child src t m = Some dest then Some src
         else next_not_child src t m)
      else if next_not_child p t m = Some src then Some dest
      else if next_not_child p t m = Some dest then Some src
      else next_not_child p t m)" apply(case_tac "p=src") apply(case_tac "next_not_child dest t m = Some src") apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(elim conjE exE) apply(rule disjI2) apply(simp add: next_sib) apply(intro impI conjI) apply(drule next_sibD')+ apply(simp add: descendants_of_def cdt_parent_defs) apply(case_tac "m q", simp) apply(case_tac "m src", simp) apply(simp) apply(drule tranclD2) apply(simp) apply(drule_tac a=q and b=a and c=q in rtrancl_into_trancl1) apply(simp) apply(insert no_mloop)[1] apply(simp add: no_mloop_def cdt_parent_defs) apply(case_tac "q=src") apply(rule_tac x=dest in exI) apply(simp) apply(simp add: not_sib_self valid_list) apply(rule_tac x=q in exI) apply(simp) apply(intro conjI impI notI allI) apply(simp add: descendants s_d_swap_def split: if_split_asm)+ apply(simp add: finite_depth) apply(simp) apply(case_tac "next_not_child dest t m") apply(simp) apply(drule next_not_child_NoneD, simp add: findepth) apply(rule next_not_child_NoneI) apply(simp add: next_sib descendants s_d_swap_def) apply(simp add: next_sib) apply(simp add: finite_depth) apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(elim conjE exE) apply(rule disjI2) apply(simp add: next_sib split del: if_split) apply(case_tac "q=src") apply(rule_tac x=dest in exI) apply(simp add: descendants s_d_swap_def) apply(insert no_mloop)[1] apply(intro conjI impI notI allI) apply((simp add: no_mloop_def descendants_of_def)+)[7] apply(drule(1) desc_sib_ne, simp add: valid_list, simp, simp) apply(simp) apply(simp) apply(rule_tac x=q in exI) apply(subgoal_tac "q\<noteq>dest") prefer 2 apply(rule notI) apply(insert valid_mdb)[1] apply(drule_tac slot=dest in desc_not_parent, simp) apply(subgoal_tac "a\<noteq>dest") prefer 2 apply(rule notI, simp) apply(drule(1) desc_sib_ne, simp add: valid_list, simp add: no_mloop, simp) apply(simp add: descendants s_d_swap_def split del: if_split) apply(simp) apply(intro conjI impI allI notI, simp+) apply(simp add: finite_depth) apply(case_tac "p=dest") apply(case_tac "next_not_child src t m = Some dest") apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(elim conjE exE) apply(rule disjI2) apply(simp add: next_sib) apply(intro impI conjI) apply(drule next_sibD')+ apply(simp add: descendants_of_def cdt_parent_defs) apply(case_tac "m q", simp) apply(case_tac "m dest", simp) apply(simp) apply(drule tranclD2) apply(simp) apply(drule_tac a=q and b=a and c=q in rtrancl_into_trancl1) apply(simp) apply(insert no_mloop)[1] apply(simp add: no_mloop_def cdt_parent_defs) apply(case_tac "q=dest") apply(rule_tac x=src in exI) apply(simp add: not_sib_self valid_list) apply(rule_tac x=q in exI) apply(simp) apply(intro conjI impI notI allI) apply(simp add: descendants s_d_swap_def split: if_split_asm)+ apply(simp add: finite_depth) apply(simp) apply(case_tac "next_not_child src t m") apply(simp) apply(drule next_not_child_NoneD, simp add: findepth) apply(rule next_not_child_NoneI) apply(simp add: next_sib descendants s_d_swap_def) apply(simp add: next_sib) apply(simp add: finite_depth) apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(elim conjE exE) apply(rule disjI2) apply(simp add: next_sib split del: if_split) apply(case_tac "q=dest") apply(rule_tac x=src in exI) apply(simp add: descendants s_d_swap_def) apply(insert no_mloop)[1] apply(intro conjI impI notI allI) apply((simp add: no_mloop_def descendants_of_def)+)[7] apply(drule(1) desc_sib_ne, simp add: valid_list, simp, simp) apply(simp) apply(simp) apply(rule_tac x=q in exI) apply(subgoal_tac "q\<noteq>src") prefer 2 apply(rule notI) apply(insert valid_mdb)[1] apply(drule_tac slot=src in desc_not_parent, simp) apply(subgoal_tac "a\<noteq>src") prefer 2 apply(rule notI, simp) apply(drule(1) desc_sib_ne, simp add: valid_list, simp add: no_mloop, simp) apply(simp add: descendants s_d_swap_def split del: if_split) apply(simp) apply(intro conjI impI allI notI, simp+) apply(simp add: finite_depth) apply(case_tac "next_not_child p t m = Some src") apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(rule disjI2) apply(elim conjE exE) apply(subst next_sib, simp) apply(case_tac "q=dest") apply(rule_tac x=src in exI) apply(simp add: next_sib descendants s_d_swap_def split del: if_split) apply(intro allI impI) apply(simp) apply(simp split: if_split_asm) apply(rule_tac x=q in exI) apply(subgoal_tac "q\<noteq>src") prefer 2 apply(rule notI) apply(simp add: not_sib_self valid_list) apply(intro conjI allI impI) apply(simp add: next_sib) apply(simp add: descendants s_d_swap_def) apply(simp add: next_sib) apply(subgoal_tac "next_sib dest t m \<noteq> Some src") prefer 2 apply(rule notI) apply(drule_tac a=q and b=dest in next_sib_inj, simp, simp add: valid_list, simp) apply(case_tac "q'=dest") apply(simp add: descendants s_d_swap_def split: if_split_asm) apply(simp add: descendants s_d_swap_def split: if_split_asm) apply(simp add: finite_depth) apply(case_tac "next_not_child p t m = Some dest") apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(rule disjI2) apply(elim conjE exE) apply(subst next_sib, simp) apply(case_tac "q=src") apply(rule_tac x=dest in exI) apply(simp add: next_sib descendants s_d_swap_def split del: if_split) apply(intro allI impI) apply(simp) apply(simp split: if_split_asm) apply(rule_tac x=q in exI) apply(subgoal_tac "q\<noteq>dest") prefer 2 apply(rule notI) apply(simp add: not_sib_self valid_list) apply(intro conjI allI impI) apply(simp add: next_sib) apply(simp add: descendants s_d_swap_def) apply(simp add: next_sib) apply(subgoal_tac "next_sib src t m \<noteq> Some dest") prefer 2 apply(rule notI) apply(drule_tac a=q and b=src in next_sib_inj, simp, simp add: valid_list, simp) apply(case_tac "q'=src") apply(simp add: descendants s_d_swap_def split: if_split_asm) apply(simp add: descendants s_d_swap_def split: if_split_asm) apply(simp add: finite_depth) apply(simp) apply(case_tac "next_not_child p t m") apply(simp) apply(drule next_not_child_NoneD, simp add: findepth) apply(rule next_not_child_NoneI) apply(simp add: descendants s_d_swap_def next_sib split del: if_split) apply(intro allI conjI) apply(simp_all)[3] apply(simp add: next_sib) apply(simp add: finite_depth) apply(simp) apply(drule next_not_childD, simp add: findepth, simp add: no_mloop) apply(rule next_not_childI) apply(erule disjE) apply(simp add: next_sib) apply(rule disjI2) apply(rule conjI) apply(simp add: next_sib) apply(elim conjE exE) apply(case_tac "q=dest") apply(rule_tac x=src in exI) apply(intro conjI impI allI) apply(simp add: next_sib) apply(simp add: descendants s_d_swap_def) apply(simp add: next_sib descendants s_d_swap_def split: if_split_asm) apply(case_tac "q=src") apply(rule_tac x=dest in exI) apply(intro conjI impI allI) apply(simp add: next_sib) apply(simp add: descendants s_d_swap_def) apply(simp add: next_sib descendants s_d_swap_def split: if_split_asm) apply(rule_tac x=q in exI) apply(intro conjI impI allI) apply(simp add: next_sib) apply(simp add: descendants s_d_swap_def) apply(simp add: next_sib descendants s_d_swap_def split: if_split_asm) apply(simp add: finite_depth) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. p = src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m = Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m = Some src\<rbrakk> \<Longrightarrow> next_not_child src t' n = Some dest
 2. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child src t' n = Some dest
 2. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<lbrakk>p = src; next_sib dest t m = Some src\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = src; next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = src; next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> (next_sib src t m = Some dest \<longrightarrow> (\<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (\<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m = Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m src = Some p \<and> after_in_list (t p) q = Some src; \<exists>p. m src = Some p \<and> m dest = Some p \<and> after_in_list (t p) src = Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of dest n) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; (q, dest) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m src = Some p \<and> after_in_list (t p) q = Some src; \<exists>p. m src = Some p \<and> m dest = Some p \<and> after_in_list (t p) src = Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; (q, dest) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m src = Some p \<and> after_in_list (t p) q = Some src; \<exists>p. m src = Some p \<and> m dest = Some p \<and> after_in_list (t p) src = Some dest; m q = Some a\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a aa. \<lbrakk>p = src; next_sib dest t m = None; (q, dest) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m src = Some p \<and> after_in_list (t p) q = Some src; \<exists>p. m src = Some p \<and> m dest = Some p \<and> after_in_list (t p) src = Some dest; m q = Some a; m src = Some aa\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; (q, dest) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a; \<exists>z. (q, z) \<in> {(p, c). m c = Some p}\<^sup>* \<and> (z, dest) \<in> {(p, c). m c = Some p}\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a; (q, a) \<in> {(p, c). m c = Some p}\<^sup>*\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (6 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a\<rbrakk> \<Longrightarrow> (a, q) \<in> {(p, c). m c = Some p}
 2. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 4. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 6. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = src; next_sib dest t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some src; m dest = Some a \<and> after_in_list (t a) src = Some dest; m q = Some a; m src = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+; no_mloop m\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', src) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (dest, src) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q = src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q = src\<rbrakk> \<Longrightarrow> next_sib dest t m \<noteq> Some dest \<and> (next_sib dest t m \<noteq> Some dest \<longrightarrow> (next_sib dest t m = Some src \<longrightarrow> dest \<noteq> dest \<and> (dest \<noteq> dest \<longrightarrow> dest \<noteq> src \<and> (dest \<noteq> src \<longrightarrow> src \<in> descendants_of dest n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of dest n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of dest n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of dest n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of dest n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of dest n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of dest n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib dest t m = Some src)
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib src t m = Some src; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 3. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t m \<noteq> Some dest \<and> (next_sib q t m \<noteq> Some dest \<longrightarrow> (next_sib q t m = Some src \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some src)
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src\<rbrakk> \<Longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> src \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> src \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (q' = dest \<longrightarrow> dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None)))))
 2. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (11 subgoals):
 1. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> src \<in> descendants_of q n
 3. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m = Some dest; q' = dest; dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n\<rbrakk> \<Longrightarrow> next_sib src t m = None
 4. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n; src \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> False
 5. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' = dest; dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n\<rbrakk> \<Longrightarrow> next_sib src t m = None
 6. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n; src \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> False
 7. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' = dest; dest \<in> descendants_of q n \<and> src \<in> descendants_of dest n\<rbrakk> \<Longrightarrow> next_sib src t m = None
 8. \<And>q q'. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some src; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib src t m \<noteq> Some dest; q \<noteq> src; q \<noteq> dest; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t m = None
 9. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 10. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
A total of 11 subgoals... proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_sib dest t m = Some src \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = None\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 2. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; next_not_child dest t m = None\<rbrakk> \<Longrightarrow> next_not_child src t' n = None
 2. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> next_not_child src t' n = None
 2. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> \<forall>q. src \<in> descendants_of q n \<longrightarrow> next_sib q t' n = None
 2. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = None
 3. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = None
 2. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = src; (\<forall>q. dest \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib dest t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = src; next_not_child dest t m \<noteq> Some src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = next_not_child dest t m
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_not_child dest t m = Some a\<rbrakk> \<Longrightarrow> next_not_child src t' n = Some a
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child src t' n = Some a
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<or> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib src t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> (if dest = src then None else if dest = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib dest t m = Some src then Some dest else if next_sib dest t m = Some dest then Some src else next_sib dest t m) = Some a \<and> src \<in> descendants_of dest n \<and> (\<forall>q'. q' \<in> descendants_of dest n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> (src \<in> descendants_of src m \<longrightarrow> a \<noteq> dest \<and> (a \<noteq> dest \<longrightarrow> (\<forall>q'. (dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest))) \<and> (dest \<notin> descendants_of q' m \<longrightarrow> q' \<noteq> dest)))) \<and> (src \<notin> descendants_of src m \<longrightarrow> a \<noteq> dest \<and> (a \<noteq> dest \<longrightarrow> (\<forall>q'. q' \<noteq> dest \<longrightarrow> dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m))))
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m\<rbrakk> \<Longrightarrow> (src \<in> descendants_of src m \<longrightarrow> a \<noteq> dest \<and> (a \<noteq> dest \<longrightarrow> (\<forall>q'. (dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest))) \<and> (dest \<notin> descendants_of q' m \<longrightarrow> q' \<noteq> dest)))) \<and> (src \<notin> descendants_of src m \<longrightarrow> a \<noteq> dest \<and> (a \<noteq> dest \<longrightarrow> (\<forall>q'. q' \<noteq> dest \<longrightarrow> dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of src m))))
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (13 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m = Some dest; q' = dest\<rbrakk> \<Longrightarrow> False
 3. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 4. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' = dest\<rbrakk> \<Longrightarrow> False
 5. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 6. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' = dest\<rbrakk> \<Longrightarrow> False
 7. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<in> descendants_of src m; a \<noteq> dest; dest \<notin> descendants_of q' m; q' = dest\<rbrakk> \<Longrightarrow> False
 8. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a = dest\<rbrakk> \<Longrightarrow> False
 9. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 10. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
A total of 13 subgoals... proof (prove)
goal (6 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 3. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 4. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 5. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 6. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 3. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 4. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q q'. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib src t m = Some a; dest \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; no_mloop m; src \<notin> descendants_of src m; a \<noteq> dest; q' \<noteq> dest; dest \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> src; q' \<in> descendants_of src m\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> q \<noteq> dest
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> q \<noteq> dest
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q = dest; valid_mdb s\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> a \<noteq> dest
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> a \<noteq> dest
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = src; next_sib dest t m = None; next_sib q t m = Some dest; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then None else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> src \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> src \<in> descendants_of q' n \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> \<forall>q'. (q' = src \<or> q' \<in> descendants_of q m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of q m then {dest} else {})) \<and> (src \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> src \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {})) \<longrightarrow> (if q' = src then None else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = None; next_sib q t m = Some a; dest \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; a \<noteq> dest\<rbrakk> \<Longrightarrow> (src \<in> descendants_of q m \<longrightarrow> (\<forall>q'. dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m))) \<and> (src \<notin> descendants_of q m \<longrightarrow> (\<forall>q'. q' \<noteq> dest \<longrightarrow> dest \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m)))
 2. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = src; a \<noteq> src; next_sib dest t m = Some a \<or> next_sib dest t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> dest \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> dest \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (1 subgoal):
 1. p \<noteq> src \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p = dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m = Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; next_not_child src t m = Some dest\<rbrakk> \<Longrightarrow> next_not_child dest t' n = Some src
 2. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child dest t' n = Some src
 2. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<lbrakk>p = dest; next_sib src t m = Some dest\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = dest; next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = dest; next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (\<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest)) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (\<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m = Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m dest = Some p \<and> after_in_list (t p) q = Some dest; \<exists>p. m dest = Some p \<and> m src = Some p \<and> after_in_list (t p) dest = Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of src n) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; (q, src) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m dest = Some p \<and> after_in_list (t p) q = Some dest; \<exists>p. m dest = Some p \<and> m src = Some p \<and> after_in_list (t p) dest = Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; (q, src) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m dest = Some p \<and> after_in_list (t p) q = Some dest; \<exists>p. m dest = Some p \<and> m src = Some p \<and> after_in_list (t p) dest = Some src; m q = Some a\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a aa. \<lbrakk>p = dest; next_sib src t m = None; (q, src) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; \<exists>p. m q = Some p \<and> m dest = Some p \<and> after_in_list (t p) q = Some dest; \<exists>p. m dest = Some p \<and> m src = Some p \<and> after_in_list (t p) dest = Some src; m q = Some a; m dest = Some aa\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; (q, src) \<in> {(p, c). m c = Some p}\<^sup>+; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a; \<exists>z. (q, z) \<in> {(p, c). m c = Some p}\<^sup>* \<and> (z, src) \<in> {(p, c). m c = Some p}\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a; (q, a) \<in> {(p, c). m c = Some p}\<^sup>*\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (6 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a\<rbrakk> \<Longrightarrow> (a, q) \<in> {(p, c). m c = Some p}
 2. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 4. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 6. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q a. \<lbrakk>p = dest; next_sib src t m = None; \<forall>q'. (q, q') \<in> {(p, c). m c = Some p}\<^sup>+ \<and> (q', src) \<in> {(p, c). m c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None; after_in_list (t a) q = Some dest; m src = Some a \<and> after_in_list (t a) dest = Some src; m q = Some a; m dest = Some a; (q, q) \<in> {(p, c). m c = Some p}\<^sup>+; no_mloop m\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> (q, dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (q', dest) \<notin> {(p, c). n c = Some p}\<^sup>+)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> (q, src) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> (src, dest) \<notin> {(p, c). n c = Some p}\<^sup>+) \<and> (q' \<noteq> src \<longrightarrow> (q, q') \<in> {(p, c). n c = Some p}\<^sup>+ \<and> (q', dest) \<in> {(p, c). n c = Some p}\<^sup>+ \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q = dest\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q = dest\<rbrakk> \<Longrightarrow> (next_sib src t m = Some dest \<longrightarrow> src \<noteq> dest \<and> (src \<noteq> dest \<longrightarrow> src \<noteq> src \<and> (src \<noteq> src \<longrightarrow> dest \<in> descendants_of src n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of src n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of src n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of src n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of src n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of src n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of src n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib src t m = Some dest
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 3. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest\<rbrakk> \<Longrightarrow> (next_sib q t m = Some dest \<longrightarrow> q \<noteq> dest \<and> (q \<noteq> dest \<longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None))))))) \<and> next_sib q t m = Some dest
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest\<rbrakk> \<Longrightarrow> q \<noteq> src \<and> (q \<noteq> src \<longrightarrow> dest \<in> descendants_of q n \<and> (\<forall>q'. (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<longrightarrow> dest \<notin> descendants_of q' n)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> src \<in> descendants_of q n \<and> dest \<in> descendants_of src n \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t m = None)))))
 2. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (11 subgoals):
 1. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> dest \<in> descendants_of q n
 3. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m = Some dest; q' \<noteq> dest; q' = src; src \<in> descendants_of q n \<and> dest \<in> descendants_of src n\<rbrakk> \<Longrightarrow> next_sib dest t m = None
 4. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n; dest \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> False
 5. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' = src; src \<in> descendants_of q n \<and> dest \<in> descendants_of src n\<rbrakk> \<Longrightarrow> next_sib dest t m = None
 6. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n; dest \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> False
 7. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' \<noteq> dest; q' = src; src \<in> descendants_of q n \<and> dest \<in> descendants_of src n\<rbrakk> \<Longrightarrow> next_sib dest t m = None
 8. \<And>q q'. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some dest; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; next_sib dest t m \<noteq> Some src; q \<noteq> dest; q \<noteq> src; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t m = None
 9. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 10. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
A total of 11 subgoals... proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; next_sib src t m = Some dest \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = None\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 2. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; next_not_child src t m = None\<rbrakk> \<Longrightarrow> next_not_child dest t' n = None
 2. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> next_not_child dest t' n = None
 2. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> \<forall>q. dest \<in> descendants_of q n \<longrightarrow> next_sib q t' n = None
 2. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = None
 3. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = None
 2. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p = dest; (\<forall>q. src \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib src t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = dest; next_not_child src t m \<noteq> Some dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = next_not_child src t m
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_not_child src t m = Some a\<rbrakk> \<Longrightarrow> next_not_child dest t' n = Some a
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child dest t' n = Some a
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<or> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib dest t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> (if src = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if src = dest then None else if next_sib src t m = Some src then Some dest else if next_sib src t m = Some dest then Some src else next_sib src t m) = Some a \<and> dest \<in> descendants_of src n \<and> (\<forall>q'. q' \<in> descendants_of src n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> (dest \<in> descendants_of dest m \<longrightarrow> a \<noteq> src \<and> (a \<noteq> src \<longrightarrow> (\<forall>q'. (src \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src))) \<and> (src \<notin> descendants_of q' m \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src)))) \<and> (dest \<notin> descendants_of dest m \<longrightarrow> a \<noteq> src \<and> (a \<noteq> src \<longrightarrow> (\<forall>q'. src \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m))))
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m\<rbrakk> \<Longrightarrow> (dest \<in> descendants_of dest m \<longrightarrow> a \<noteq> src \<and> (a \<noteq> src \<longrightarrow> (\<forall>q'. (src \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src))) \<and> (src \<notin> descendants_of q' m \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src)))) \<and> (dest \<notin> descendants_of dest m \<longrightarrow> a \<noteq> src \<and> (a \<noteq> src \<longrightarrow> (\<forall>q'. src \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of dest m))))
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (13 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a = src\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' = src\<rbrakk> \<Longrightarrow> False
 3. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 4. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' = src\<rbrakk> \<Longrightarrow> False
 5. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 6. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m \<noteq> Some src; q' \<noteq> dest; q' = src\<rbrakk> \<Longrightarrow> False
 7. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<in> descendants_of dest m; a \<noteq> src; src \<notin> descendants_of q' m; q' \<noteq> dest; q' = src\<rbrakk> \<Longrightarrow> False
 8. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a = src\<rbrakk> \<Longrightarrow> False
 9. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 10. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
A total of 13 subgoals... proof (prove)
goal (6 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a = src\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 3. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 4. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 5. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 6. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m = Some dest; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 2. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 3. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 4. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q q'. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib dest t m = Some a; src \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; no_mloop m; dest \<notin> descendants_of dest m; a \<noteq> src; src \<in> descendants_of q' m; next_sib q' t m \<noteq> Some dest; next_sib q' t m = Some src; q' \<noteq> dest; q' \<noteq> src; q' \<in> descendants_of dest m\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> q \<noteq> src
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> q \<noteq> src
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src; valid_mdb s\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> a \<noteq> src
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> a \<noteq> src
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; next_sib src t m = None; next_sib q t m = Some src; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a = src\<rbrakk> \<Longrightarrow> False
 2. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 3. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then None else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = Some a \<and> dest \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> dest \<in> descendants_of q' n \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> \<forall>q'. (q' = dest \<or> q' \<in> descendants_of q m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if dest \<in> descendants_of q m then {src} else {})) \<and> (dest \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> dest \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {})) \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then None else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = None; next_sib q t m = Some a; src \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; a \<noteq> src\<rbrakk> \<Longrightarrow> \<forall>q'. src \<in> descendants_of q' m \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<longrightarrow> q' \<notin> descendants_of q m)
 2. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p = dest; a \<noteq> dest; next_sib src t m = Some a \<or> next_sib src t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> src \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> src \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m = Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m = Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some dest
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some dest
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some dest \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src\<rbrakk> \<Longrightarrow> next_sib p t' n = Some dest \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some dest \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some dest \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> next_sib src t' n = Some dest \<and> p \<in> descendants_of src n \<and> (\<forall>q'. q' \<in> descendants_of src n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib dest t m = Some src; p \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> \<forall>q'. (q' \<in> descendants_of dest m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of dest m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of dest m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {})) \<longrightarrow> (if q' = src then Some dest else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib dest t m = Some src; p \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; (q' \<in> descendants_of dest m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of dest m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of dest m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {}))\<rbrakk> \<Longrightarrow> (if q' = src then Some dest else if q' = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib dest t m = Some src; p \<in> descendants_of dest m; \<forall>q'. q' \<in> descendants_of dest m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; (q' \<in> descendants_of dest m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of dest m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of dest m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {}))\<rbrakk> \<Longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> q \<noteq> src
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> q \<noteq> src
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some dest
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 3. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib dest t m \<noteq> Some src
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib dest t m \<noteq> Some src
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m = Some src\<rbrakk> \<Longrightarrow> False
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src; q' = dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src; q' \<noteq> dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some src; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib dest t m \<noteq> Some src; q' \<noteq> dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some src \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some src \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m = Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m = Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some src
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some src
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some src \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest\<rbrakk> \<Longrightarrow> next_sib p t' n = Some src \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some src \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some src \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some src \<and> p \<in> descendants_of dest n \<and> (\<forall>q'. q' \<in> descendants_of dest n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib src t m = Some dest; p \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src\<rbrakk> \<Longrightarrow> \<forall>q'. (q' \<in> descendants_of src m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of src m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of src m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {})) \<longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then Some src else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib src t m = Some dest; p \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; (q' \<in> descendants_of src m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of src m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of src m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {}))\<rbrakk> \<Longrightarrow> (if q' = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q' = dest then Some src else if next_sib q' t m = Some src then Some dest else if next_sib q' t m = Some dest then Some src else next_sib q' t m) = None
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib src t m = Some dest; p \<in> descendants_of src m; \<forall>q'. q' \<in> descendants_of src m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = src; (q' \<in> descendants_of src m \<and> q' \<noteq> src \<and> q' \<noteq> dest \<or> q' \<in> (if src \<in> descendants_of src m then {dest} else {}) \<or> q' \<in> (if dest \<in> descendants_of src m then {src} else {})) \<and> (p \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m \<or> p \<in> (if src \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {dest} else {}) \<or> p \<in> (if dest \<in> descendants_of (if q' = src then dest else if q' = dest then src else q') m then {src} else {}))\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> next_sib q' t m \<noteq> Some dest \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> next_sib q' t m \<noteq> Some src \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> q \<noteq> dest
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src\<rbrakk> \<Longrightarrow> q \<noteq> dest
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q = dest\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (5 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> next_sib q t' n = Some src
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 3. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib src t m \<noteq> Some dest
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib src t m \<noteq> Some dest
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m = Some dest\<rbrakk> \<Longrightarrow> False
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (4 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest; q' = src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest; q' \<noteq> src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (3 subgoals):
 1. \<And>q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = None; next_sib q t m = Some dest; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> src; q \<noteq> dest; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n; next_sib src t m \<noteq> Some dest; q' \<noteq> src\<rbrakk> \<Longrightarrow> (next_sib dest t m = Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> next_sib src t m \<noteq> Some dest \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> q' = dest)) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> q' \<noteq> src \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None)))))) \<and> (next_sib dest t m \<noteq> Some src \<longrightarrow> (next_sib q' t m = Some dest \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some dest \<longrightarrow> (next_sib q' t m = Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src)) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> q' = src))) \<and> (next_sib q' t m \<noteq> Some src \<longrightarrow> (next_sib src t m = Some dest \<longrightarrow> q' \<noteq> dest \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))) \<and> (next_sib src t m \<noteq> Some dest \<longrightarrow> (q' = dest \<longrightarrow> next_sib src t m = None) \<and> (q' \<noteq> dest \<longrightarrow> (q' = src \<longrightarrow> next_sib dest t m = None) \<and> (q' \<noteq> src \<longrightarrow> next_sib q' t m = None))))))
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_sib p t m = Some dest \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some dest \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = (if p = src then if next_not_child dest t m = Some src then Some dest else next_not_child dest t m else if p = dest then if next_not_child src t m = Some dest then Some src else next_not_child src t m else if next_not_child p t m = Some src then Some dest else if next_not_child p t m = Some dest then Some src else next_not_child p t m) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = None\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m = None\<rbrakk> \<Longrightarrow> next_not_child p t' n = None
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> next_not_child p t' n = None
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> \<forall>q. p \<in> descendants_of q n \<longrightarrow> next_sib q t' n = None
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (4 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> \<forall>q. (p \<in> descendants_of (if q = src then dest else if q = dest then src else q) m \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None) \<and> (p \<in> (if src \<in> descendants_of (if q = src then dest else if q = dest then src else q) m then {dest} else {}) \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None) \<and> (p \<in> (if dest \<in> descendants_of (if q = src then dest else if q = dest then src else q) m then {src} else {}) \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None)
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None
 3. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 4. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (6 subgoals):
 1. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> p \<in> descendants_of (if q = src then dest else if q = dest then src else q) m \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None
 2. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> p \<in> (if src \<in> descendants_of (if q = src then dest else if q = dest then src else q) m then {dest} else {}) \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None
 3. \<And>q. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> p \<in> (if dest \<in> descendants_of (if q = src then dest else if q = dest then src else q) m then {src} else {}) \<longrightarrow> (if q = src then if next_sib dest t m = Some src then Some dest else next_sib dest t m else if q = dest then if next_sib src t m = Some dest then Some src else next_sib src t m else if next_sib q t m = Some src then Some dest else if next_sib q t m = Some dest then Some src else next_sib q t m) = None
 4. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None
 5. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 6. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> next_sib p t' n = None
 2. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> src; p \<noteq> dest; (\<forall>q. p \<in> descendants_of q m \<longrightarrow> next_sib q t m = None) \<and> next_sib p t m = None\<rbrakk> \<Longrightarrow> finite_depth n
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; next_not_child p t m \<noteq> Some src; next_not_child p t m \<noteq> Some dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = next_not_child p t m proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_not_child p t m = Some a\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some a proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_not_child p t' n = Some a proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some a \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a\<rbrakk> \<Longrightarrow> next_sib p t' n = Some a \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some a \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = Some a \<or> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = None \<and> (\<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None))
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> next_sib p t' n = None
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a \<and> p \<in> descendants_of src n \<and> (\<forall>q'. q' \<in> descendants_of src n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (5 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> next_sib src t' n = Some a
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> p \<in> descendants_of src n
 3. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; q' \<in> descendants_of src n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 4. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 5. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest\<rbrakk> \<Longrightarrow> p \<in> descendants_of src n
 2. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; q' \<in> descendants_of src n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 3. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 4. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q = dest; q' \<in> descendants_of src n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a \<and> p \<in> descendants_of dest n \<and> (\<forall>q'. q' \<in> descendants_of dest n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (5 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> next_sib dest t' n = Some a
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> p \<in> descendants_of dest n
 3. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src; q' \<in> descendants_of dest n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 4. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 5. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src\<rbrakk> \<Longrightarrow> p \<in> descendants_of dest n
 2. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src; q' \<in> descendants_of dest n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 3. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 4. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q = src; q' \<in> descendants_of dest n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> \<exists>q. next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some a \<and> p \<in> descendants_of q n \<and> (\<forall>q'. q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n \<longrightarrow> next_sib q' t' n = None)
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (4 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> next_sib q t' n = Some a
 2. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 3. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 4. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (3 subgoals):
 1. \<And>a q. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src\<rbrakk> \<Longrightarrow> p \<in> descendants_of q n
 2. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 3. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (2 subgoals):
 1. \<And>a q q'. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = None; next_sib q t m = Some a; p \<in> descendants_of q m; \<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None; q \<noteq> dest; q \<noteq> src; q' \<in> descendants_of q n \<and> p \<in> descendants_of q' n\<rbrakk> \<Longrightarrow> next_sib q' t' n = None
 2. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p \<noteq> src; p \<noteq> dest; a \<noteq> src; a \<noteq> dest; next_sib p t m = Some a \<or> next_sib p t m = None \<and> (\<exists>q. next_sib q t m = Some a \<and> p \<in> descendants_of q m \<and> (\<forall>q'. q' \<in> descendants_of q m \<and> p \<in> descendants_of q' m \<longrightarrow> next_sib q' t m = None))\<rbrakk> \<Longrightarrow> finite_depth n proof (prove)
goal:
No subgoals!