12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455(******************************************************************************)(* *)(* SPDX-License-Identifier LGPL-2.1 *)(* Copyright (C) *)(* CEA (Commissariat à l'énergie atomique et aux énergies alternatives) *)(* INRIA (Institut National de Recherche en Informatique et en Automatique) *)(* INSA (Institut National des Sciences Appliquees) *)(* *)(******************************************************************************)openAutomaton_asttypestate=Automaton_ast.statetypetransition=Automaton_ast.typed_transmoduleVertex=structtypet=stateletcomparexy=Stdlib.comparex.numsy.numslethashx=Hashtbl.hashx.numsletequalxy=x.nums=y.numsletdefault={nums=-1;name="";multi_state=None;acceptation=Bool3.False;init=Bool3.False}endmoduleEdge=structtypet=transitionletcomparexy=Stdlib.comparex.numty.numtletdefault={numt=-1;start=Vertex.default;stop=Vertex.default;cross=TTrue;actions=[]}endincludeGraph.Imperative.Digraph.ConcreteBidirectionalLabeled(Vertex)(Edge)letof_automatonauto=letg=create()inList.iter(funt->add_edge_eg(t.start,t,t.stop))auto.trans;gletstatesg=fold_vertex(funvacc->v::acc)g[]letfilter_statesfg=fold_vertex(funvacc->iffvthenv::accelseacc)g[]letinit_statesg=filter_states(funv->v.Automaton_ast.init=Bool3.True)gletedgesg=fold_edges_e(funeacc->e::acc)g[]