definition trans :: "i set ==> o"(*transitivity predicate*) where"trans(r) == (ALL x y z. <x,y>:r ⟶ <y,z>:r ⟶ <x,z>:r)"
definition id :: "i set"(*the identity relation*) where"id == {p. EX x. p = <x,x>}"
definition relcomp :: "[i set,i set] ==> i set" (infixr‹O›60) (*composition of relations*) where"r O s == {xz. EX x y z. xz = <x,z> ∧ <x,y>:s ∧ <y,z>:r}"
definition rtrancl :: "i set ==> i set" (‹(‹notation=‹postfix ^*››_^*)› [100] 100) where"r^* == lfp(λs. id Un (r O s))"
definition trancl :: "i set ==> i set" (‹(‹notation=‹postfix ^+››_^+)› [100] 100) where"r^+ == r O rtrancl(r)"
subsection‹Natural deduction for ‹trans(r)››
lemma transI: "(∧x y z. [<x,y>:r; <y,z>:r]==> <x,z>:r) ==> trans(r)" unfolding trans_def by blast
lemma transD: "[trans(r); <a,b>:r; <b,c>:r]==> <a,c>:r" unfolding trans_def by blast
lemma compI: "[<a,b>:s; <b,c>:r]==> <a,c> : r O s" unfolding relcomp_def by blast
(*proof requires higher-level assumptions or a delaying of hyp_subst_tac*) lemma compE: "[xz : r O s; ∧x y z. [xz = <x,z>; <x,y>:s; <y,z>:r]==> P]==> P" unfolding relcomp_def by blast
lemma compEpair: "[<a,c> : r O s; ∧y. [<a,y>:s; <y,c>:r]==> P]==> P" apply (erule compE) apply (simp add: pair_inject) done
lemmas [intro] = compI idI and [elim] = compE idE
lemma comp_mono: "[r'<=r; s'<=s]==> (r' O s') <= (r O s)" by blast
subsection‹The relation rtrancl›
lemma rtrancl_fun_mono: "mono(λs. id Un (r O s))" apply (rule monoI) apply (rule monoI subset_refl comp_mono Un_mono)+ apply assumption done
lemma rtrancl_unfold: "r^* = id Un (r O r^*)" by (rule rtrancl_fun_mono [THEN rtrancl_def [THEN def_lfp_Tarski]])
(*nice induction rule*) lemma rtrancl_induct: "[<a,b> : r^*; P(a); ∧y z. [<a,y> : r^*; <y,z> : r; P(y)]==> P(z) ] ==> P(b)" (*by induction on this formula*) apply (subgoal_tac "ALL y. <a,b> = <a,y> ⟶ P(y)") (*now solve first subgoal: this formula is sufficient*) apply blast (*now do the induction*) apply (erule rtrancl_full_induct) apply blast apply blast done
(*transitivity of transitive closure!! -- by induction.*) lemma trans_rtrancl: "trans(r^*)" apply (rule transI) apply (rule_tac b = z in rtrancl_induct) apply (fast elim: rtrancl_into_rtrancl)+ done
(*elimination of rtrancl -- by induction on a special formula*) lemma rtranclE: "[<a,b> : r^*; a = b ==> P; ∧y. [<a,y> : r^*; <y,b> : r]==> P]==> P" apply (subgoal_tac "a = b | (EX y. <a,y> : r^* ∧ <y,b> : r)") prefer2 apply (erule rtrancl_induct) apply blast apply blast apply blast done
subsection‹The relation trancl›
subsubsection‹Conversions between trancl and rtrancl›
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.