-- Test/demonstrate basic synthesis

-- ------------------------------------------
-- Prepare plant model: two simple machines
-- ------------------------------------------

-- read original machine
machine  = faudes.Generator("data/verysimplemachine.gen")

machine:Write()

-- prepare two copies
machine1 = faudes.Generator();
machine2 = faudes.Generator();
faudes.Version(machine,"1",machine1);
faudes.Version(machine,"2",machine2);

machine1:Write()

-- compose overall plant
plant = faudes.Generator();
faudes.Parallel(machine1,machine2,plant);

plant:Write()

-- ------------------------------------------
-- Prepare specification
-- ------------------------------------------

-- load specification
spec = faudes.Generator("data/buffer.gen");

-- selfloop
extra = faudes.EventSet();
faudes.EventSetDifference(plant:Alphabet() ,spec:Alphabet(),extra)
faudes.SelfLoop(spec,extra);

-- ------------------------------------------
-- Do synthesis
-- ------------------------------------------

-- run synthesis
super = faudes.Generator();
faudes.SupConNB(plant,spec,super);

-- ------------------------------------------
-- Report
-- ------------------------------------------

-- report result
plant:Write();
spec:Write();
super:Write();