l_heap_is_wellformed_def: fixes type_wf :: "(_) heap \<Rightarrow> bool"   and known_ptr :: "(_) object_ptr \<Rightarrow> bool"   and heap_is_wellformed :: "(_) heap \<Rightarrow> bool"   and parent_child_rel :: "(_) heap \<Rightarrow> ((_) object_ptr \<times> (_) object_ptr) set"   and get_child_nodes :: "(_) object_ptr \<Rightarrow> ((_) heap, exception, (_) node_ptr list) prog"   and get_disconnected_nodes :: "(_) document_ptr \<Rightarrow> ((_) heap, exception, (_) node_ptr list) prog" shows "l_heap_is_wellformed type_wf known_ptr heap_is_wellformed parent_child_rel get_child_nodes get_disconnected_nodes \<equiv> (((\<forall>h ptr children child. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_child_nodes ptr \<rightarrow>\<^sub>r children \<longrightarrow> child \<in> set children \<longrightarrow> child |\<in>| node_ptr_kinds h) \<and> (\<forall>h document_ptr disc_nodes node. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_disconnected_nodes document_ptr \<rightarrow>\<^sub>r disc_nodes \<longrightarrow> node \<in> set disc_nodes \<longrightarrow> node |\<in>| node_ptr_kinds h) \<and> (\<forall>h ptr children ptr' children'. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_child_nodes ptr \<rightarrow>\<^sub>r children \<longrightarrow> h \<turnstile> get_child_nodes ptr' \<rightarrow>\<^sub>r children' \<longrightarrow> set children \<inter> set children' \<noteq> {} \<longrightarrow> ptr = ptr')) \<and> ((\<forall>h document_ptr disc_nodes document_ptr' disc_nodes'. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_disconnected_nodes document_ptr \<rightarrow>\<^sub>r disc_nodes \<longrightarrow> h \<turnstile> get_disconnected_nodes document_ptr' \<rightarrow>\<^sub>r disc_nodes' \<longrightarrow> set disc_nodes \<inter> set disc_nodes' \<noteq> {} \<longrightarrow> document_ptr = document_ptr') \<and> (\<forall>h ptr children document_ptr disc_nodes. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_child_nodes ptr \<rightarrow>\<^sub>r children \<longrightarrow> h \<turnstile> get_disconnected_nodes document_ptr \<rightarrow>\<^sub>r disc_nodes \<longrightarrow> set children \<inter> set disc_nodes = {})) \<and> (\<forall>h document_ptr disc_nodes. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_disconnected_nodes document_ptr \<rightarrow>\<^sub>r disc_nodes \<longrightarrow> distinct disc_nodes) \<and> (\<forall>h ptr children. heap_is_wellformed h \<longrightarrow> h \<turnstile> get_child_nodes ptr \<rightarrow>\<^sub>r children \<longrightarrow> distinct children)) \<and> ((\<forall>h node_ptr. heap_is_wellformed h \<longrightarrow> node_ptr |\<in>| node_ptr_kinds h \<longrightarrow> \<not> (\<exists>parent\<in>fset (object_ptr_kinds h). node_ptr \<in> set |h \<turnstile> get_child_nodes parent|\<^sub>r) \<longrightarrow> (\<exists>document_ptr\<in>fset (document_ptr_kinds h). node_ptr \<in> set |h \<turnstile> get_disconnected_nodes document_ptr|\<^sub>r)) \<and> (\<forall>h ptr children child. h \<turnstile> get_child_nodes ptr \<rightarrow>\<^sub>r children \<longrightarrow> (child \<in> set children) = ((ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child) \<in> parent_child_rel h)) \<and> (\<forall>h. heap_is_wellformed h \<longrightarrow> finite (parent_child_rel h))) \<and> ((\<forall>h. heap_is_wellformed h \<longrightarrow> acyclic (parent_child_rel h)) \<and> (\<forall>parent child_ptr h. (parent, child_ptr) \<in> parent_child_rel h \<longrightarrow> is_node_ptr_kind child_ptr)) \<and> (\<forall>parent child_ptr h. (parent, child_ptr) \<in> parent_child_rel h \<longrightarrow> parent |\<in>| object_ptr_kinds h) \<and> (\<forall>h parent child_ptr. heap_is_wellformed h \<longrightarrow> type_wf h \<longrightarrow> known_ptr parent \<longrightarrow> (parent, child_ptr) \<in> parent_child_rel h \<longrightarrow> child_ptr |\<in>| object_ptr_kinds h)"