(********************************************************************)(* *)(* The Why3 Verification Platform / The Why3 Development Team *)(* Copyright 2010-2013 -- INRIA - CNRS - Paris-Sud University *)(* *)(* This software is distributed under the terms of the GNU Lesser *)(* General Public License version 2.1, with the special exception *)(* on linking described in file LICENSE. *)(* *)(********************************************************************)(* Resizable arrays *)moduleRA=structtype'at={default:'a;mutablesize:int;mutabledata:'aarray}letlengtha=a.sizeletmakend={default=d;size=n;data=Array.makend}letgetai=ifi<0||i>=a.sizetheninvalid_arg"RA.get";a.data.(i)letsetaiv=ifi<0||i>=a.sizetheninvalid_arg"RA.set";a.data.(i)<-vletresizeas=ifs<=a.sizethenbeginArray.filla.datas(a.size-s)a.defaultendelsebeginletn=Array.lengtha.datainifs>nthenbeginletn'=max(2*n)sinleta'=Array.maken'a.defaultinArray.blita.data0a'0a.size;a.data<-a'endend;a.size<-send(* Priority queue *)(* The heap is encoded into a resizable array, where elements are stored from [0] to [length - 1]. From an element stored at [i], the left (resp. right) subtree, if any, is rooted at [2*i+1] (resp. [2*i+2]). *)moduleMake(X:Set.OrderedType)=structtypeelt=X.ttypet=eltRA.t