let print_buch_synch () =
print_start_block "Function of synchronisation between C code and Buchi automata";
fprintf !out_fmt "/*%c requires \n" '@';
fprintf !out_fmt " %c \\forall int st ; 0<= st < %s && %s[st]!=0 => \n" '@' nbStates curState;
fprintf !out_fmt " %c (\\exists int tr ; 0<=tr<%s && %s(tr)==st && %s(tr,CurOp,Case))\n" '@' nbTrans transStart transCondP;
fprintf !out_fmt " %c assigns %s[..], %s[..], %s, %s\n" '@' curState curTrans curOp curOpStatus;
fprintf !out_fmt " %c ensures \n" '@';
fprintf !out_fmt " %c %s(CurOp,Case) && \n" '@' macro_ligth;
fprintf !out_fmt " %c\n" '@';
fprintf !out_fmt " %c // Each crossable transition is crossed.\n" '@';
fprintf !out_fmt " %c (\\forall int tr ; 0<=tr<%s && \\old(%s[%s(tr)])!=0 && %s(tr)=> \n" '@' nbTrans curState transStart transCond;
fprintf !out_fmt " %c %s[tr]!=0 && %s[%s(tr)]!=0\n" '@' curTrans curState transStop;
fprintf !out_fmt " %c ) &&\n" '@';
fprintf !out_fmt " %c // Non-crossable transition are not crossed over.\n" '@';
fprintf !out_fmt " %c (\\forall int tr ; 0<=tr<%s && (\\old(%s[%s(tr)])==0 || !%s(tr)) =>\n" '@' nbTrans curState transStart transCond;
fprintf !out_fmt " %c %s[tr]==0\n" '@' curTrans;
fprintf !out_fmt " %c ) &&\n" '@';
fprintf !out_fmt " %c // Each transition annotated as crossable is crossable\n" '@' ;
fprintf !out_fmt " %c // -- Interesting for preconditions that follow the operation call --\n" '@';
fprintf !out_fmt " %c (\\forall int tr ; 0<=tr<%s && %s[tr]!=0 => \n" '@' nbTrans curTrans;
fprintf !out_fmt " %c \\old(%s[%s(tr)])!=0 && %s (tr) && %s[%s(tr)]!=0\n" '@' curState transStart transCond curState transStop;
fprintf !out_fmt " %c ) &&\n" '@' ;
fprintf !out_fmt " %c\n" '@' ;
fprintf !out_fmt " %c // If a state is annotated as not reachable, then no crossable transition reaches it is crossable\n" '@';
fprintf !out_fmt " %c (\\forall int st ; \n" '@' ;
fprintf !out_fmt " %c 0<=st<%s &&\n" '@' nbStates;
fprintf !out_fmt " %c (\\forall int tr ; \n" '@' ;
fprintf !out_fmt " %c 0<=tr<%s => \n" '@' nbTrans;
fprintf !out_fmt " %c (%s[tr]==0 || \n" '@' curTrans;
fprintf !out_fmt " %c %s(tr)!=st || \n" '@' transStop;
fprintf !out_fmt " %c !%s(tr) || \n" '@' transCond;
fprintf !out_fmt " %c \\old(%s[%s(tr)])==0)\n" '@' curState transStart;
fprintf !out_fmt " %c )\n" '@' ;
fprintf !out_fmt " %c => %s[st]==0\n" '@' curState;
fprintf !out_fmt " %c ) &&\n" '@' ;
fprintf !out_fmt " %c\n" '@' ;
fprintf !out_fmt " %c // Each non-active state is not reachable\n" '@' ;
fprintf !out_fmt " %c (\\forall int st ; 0<=st<%s && %s[st]==0 => \n" '@' nbStates curState;
fprintf !out_fmt " %c (\\forall int tr ; 0<=tr<%s => \n" '@' nbTrans;
fprintf !out_fmt " %c ( %s[tr]==0 || !%s(tr) \n" '@' curTrans transCond;
fprintf !out_fmt " %c || %s(tr)!=st || \\old(%s[%s(tr)]==0)))) && \n" '@' transStop curState transStart;
fprintf !out_fmt " %c // Each active state is reachable \n" '@' ;
fprintf !out_fmt " %c (\\forall int st ; 0<=st<%s && %s[st]!=0 => \n" '@' nbStates curState;
fprintf !out_fmt " %c (\\exists int tr ; 0<=tr<%s && %s[tr]!=0 && %s(tr) \n" '@' nbTrans curTrans transCond;
fprintf !out_fmt " %c && %s(tr)==st && \\old(%s[%s(tr)]!=0))) \n" '@' transStop curState transStart;
fprintf !out_fmt "*/ \n" ;
fprintf !out_fmt "void %s(int CurOp, int Case); \n" buch_sync;
print_end_block "Function of synchronisation between C code and Buchi automata"