12345678910111213141516171819202122232425262728293031323334353637383940414243openCoreopen!ImportmoduleNode=Types.NodeincludeTypes.Scopelettop=Topletis_top=function|Top->true|Bind_->false;;letinvariant=function|Top->()|Bindbind->Bind.invariantignoreignorebind;;(* Unlike for nodes, there is no invariant [is_necessary t <=> height > -1] (doesn't work
because of [Top]). This is fine since the height of a scope is only used to constrain
other heights, not to schedule it. *)letheight=function|Top->-1|Bindbind->bind.lhs_change.height;;letis_valid=function|Top->true|Bindbind->Bind.is_validbind;;letis_necessary=function|Top->true|Bindbind->Node.is_necessarybind.main;;letadd_nodet(node:_Node.t)=assert(phys_equalnode.created_int);matchtwith|Top->()|Bindbind->node.next_node_in_same_scope<-bind.all_nodes_created_on_rhs;bind.all_nodes_created_on_rhs<-Uopt.some(Types.Node.Packed.Tnode);;