diff --git a/Makefile.dev b/Makefile.dev
index bac7e8a1c78a288b7727786469718330b4753dca..d67e2bd7c395bdbad6f3d6170724a249e11bdf2a 100644
--- a/Makefile.dev
+++ b/Makefile.dev
@@ -84,3 +84,13 @@ opam : $(WWW)/pool/$(PACKNAME).tgz
 	  cd .. ; opam-admin check  && opam-admin make -g \
      ) || echo "*** I won't make an opam package\n*** until you commit something!"
 
+###############################
+# tags
+
+OTAGS=otags
+# otags don't manage to parse gnuplotRif.ml
+NO_TAGS=gnuplotRif.ml
+tags:
+	$(OTAGS) -v $(shell ocamlc -where)/*.mli  $(shell ls src/*.ml | grep -v $(NO_TAGS))
+tags2:
+	$(OTAGS) -v  $(shell ls src/*.ml | grep -v $(NO_TAGS))
diff --git a/_oasis b/_oasis
index c058ba9071b4102a23a3b960dcf776f6c0442c4c..dc131a6025564a12a78cae555b0183bd1d3d8948 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 Name:        lustre-v6
-Version:     1.650
+Version:     1.651
 Synopsis:    The Lustre V6 Verimag compiler
 Description: This package contains:
    (1) lus2lic: the (current) name of the compiler (and interpreter via -exec).
diff --git a/src/lic.ml b/src/lic.ml
index 8f9a225fcb19685e0b09710bada58e9867f078b2..924307903fa8f081a809009d78124182fe0c9347 100644
--- a/src/lic.ml
+++ b/src/lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/05/2016 (at 16:01) by Erwan Jahier> *)
+(* Time-stamp: <modified the 30/05/2016 (at 17:35) by Erwan Jahier> *)
 
 (** Define the Data Structure representing Compiled programs. By
     compiled we mean that constant are propagated, packages are
@@ -635,7 +635,9 @@ and string_of_clock = function
 and enum_to_string s ll =
   match Lv6MainArgs.global_opt.Lv6MainArgs.expand_enums with
     | Lv6MainArgs.AsInt -> (string_of_int (Lv6util.pos_in_list 0 s ll))
-    | _ -> string_of_ident s
+    | Lv6MainArgs.AsBool 
+    | Lv6MainArgs.AsConst 
+    | Lv6MainArgs.AsEnum -> string_of_ident s
 
 and string_of_const = function
   | Bool_const_eff true -> "true"
diff --git a/src/licDump.ml b/src/licDump.ml
index af22d41e578a6eedeb4ab892eed1f37a6453c5a4..7357c06d73d1931eea464eea67b4c4c27bcee8fd 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/05/2016 (at 16:01) by Erwan Jahier> *)
+(* Time-stamp: <modified the 31/05/2016 (at 15:18) by Erwan Jahier> *)
 
 open Lv6errors
 open Printf
@@ -63,44 +63,44 @@ let string_of_ident x =
 
 let rec string_of_const_eff =
   function
-    | Bool_const_eff true -> "true"
-    | Bool_const_eff false -> "false"
-    | Int_const_eff i -> (sprintf "%s" i)
-    | Real_const_eff r -> r
-    | Extern_const_eff (s,t) -> (dump_long s)
-    | Abstract_const_eff (s,t,v,_) -> 
-      (dump_long s) ^ (* XXX ? *)
-        (string_of_const_eff v)
-    (*     | Abstract_const_eff (s,t,v,false) -> (dump_long s)  *)
-    | Enum_const_eff   (s,Enum_type_eff(_,ll)) -> Lic.enum_to_string s ll
-    | Enum_const_eff   (_) -> assert false
-    | Struct_const_eff (fl, t) -> (
-      let string_of_field = 
-        function (id, veff) -> 
-          (Lv6Id.to_string id)^" = "^ (string_of_const_eff veff) 
-      in
-      let flst = List.map string_of_field fl in
-      (string_of_type_eff t)^"{"^(String.concat "; " flst)^"}"
-    )
-    | Array_const_eff (ctab, t) -> (
-      let vl = List.map string_of_const_eff ctab in
-      "["^(String.concat ", " vl)^"]"
-    )
-    | Tuple_const_eff   cl ->  (
-      string_of_const_eff_list cl
-    )
+  | Bool_const_eff true -> "true"
+  | Bool_const_eff false -> "false"
+  | Int_const_eff i -> (sprintf "%s" i)
+  | Real_const_eff r -> r
+  | Extern_const_eff (s,t) -> (dump_long s)
+  | Abstract_const_eff (s,t,v,_) -> 
+     (dump_long s) ^ (* XXX ? *)
+       (string_of_const_eff v)
+  (*     | Abstract_const_eff (s,t,v,false) -> (dump_long s)  *)
+  | Enum_const_eff   (s,Enum_type_eff(_,ll)) -> Lic.enum_to_string s ll
+  | Enum_const_eff   (_) -> assert false
+  | Struct_const_eff (fl, t) -> (
+    let string_of_field = 
+      function (id, veff) -> 
+               (Lv6Id.to_string id)^" = "^ (string_of_const_eff veff) 
+    in
+    let flst = List.map string_of_field fl in
+    (string_of_type_eff t)^"{"^(String.concat "; " flst)^"}"
+  )
+  | Array_const_eff (ctab, t) -> (
+    let vl = List.map string_of_const_eff ctab in
+    "["^(String.concat ", " vl)^"]"
+  )
+  | Tuple_const_eff   cl ->  (
+    string_of_const_eff_list cl
+  )
 
 and string_of_const_eff_list =
   function
-    | [c] -> string_of_const_eff c
-    | cl -> "(" ^ (String.concat ", " (List.map string_of_const_eff cl)) ^ ")"
+  | [c] -> string_of_const_eff c
+  | cl -> "(" ^ (String.concat ", " (List.map string_of_const_eff cl)) ^ ")"
 
 (* modify numbers notations in such a way that they
    become "valid" identifiers. Policy:
    - minus (-) becomes "m"
    - plus (+) becomes "p"
    - dot (d) becomes "d"
-*)
+ *)
 and correct_num_string s = 
   let (s:Bytes.t)  = Bytes.of_string s in
   let (res:Bytes.t)= Bytes.copy s in
@@ -120,26 +120,26 @@ and string_ident_of_const_eff c =
   (* that version generates a string that is a valid lic ident, in order to use it
      to generate a node name using static parameters *)
   match c with
-    | Int_const_eff _
-    | 
-        Real_const_eff _ ->
-      correct_num_string(string_of_const_eff c)
-    | Bool_const_eff _
-    | Extern_const_eff _
-    | Abstract_const_eff _
-    | Enum_const_eff _  -> string_of_const_eff c
-    | Struct_const_eff (_, t) -> (
-      match t with 
-        | Struct_type_eff (sn,_) -> Lv6Id.no_pack_string_of_long sn
-        | _ -> assert false
-    )
-    | Array_const_eff (ctab, t) -> string_of_type_eff t
-    | Tuple_const_eff cl ->  string_ident_of_const_eff_list cl
+  | Int_const_eff _
+  | 
+    Real_const_eff _ ->
+     correct_num_string(string_of_const_eff c)
+  | Bool_const_eff _
+  | Extern_const_eff _
+  | Abstract_const_eff _
+  | Enum_const_eff _  -> string_of_const_eff c
+  | Struct_const_eff (_, t) -> (
+    match t with 
+    | Struct_type_eff (sn,_) -> Lv6Id.no_pack_string_of_long sn
+    | _ -> assert false
+  )
+  | Array_const_eff (ctab, t) -> string_of_type_eff t
+  | Tuple_const_eff cl ->  string_ident_of_const_eff_list cl
 
 and string_ident_of_const_eff_list cl =
   match cl with
-    | [c] -> string_ident_of_const_eff c
-    | _ -> "" ^ (String.concat "_" (List.map string_ident_of_const_eff cl)) ^ ""
+  | [c] -> string_ident_of_const_eff c
+  | _ -> "" ^ (String.concat "_" (List.map string_ident_of_const_eff cl)) ^ ""
 
 and string_of_const_eff_opt = function
   | None -> ""
@@ -152,25 +152,25 @@ and string_def_of_type_eff = function
   | External_type_eff (i) -> dump_long i
   | Abstract_type_eff (i, t) -> string_def_of_type_eff t
   | Enum_type_eff (i, sl) ->
-    assert (sl <>[]);
-    let f sep acc s  = acc ^ sep ^ (dump_long s) in
-    (List.fold_left (f ", ")  (f "" "enum {" (List.hd sl)) (List.tl sl)) ^ "}"
+     assert (sl <>[]);
+     let f sep acc s  = acc ^ sep ^ (dump_long s) in
+     (List.fold_left (f ", ")  (f "" "enum {" (List.hd sl)) (List.tl sl)) ^ "}"
   | Array_type_eff (ty, sz) -> sprintf "%s^%d" (string_of_type_eff ty) sz
   | Struct_type_eff (name, fl) -> 
-    assert (fl <>[]);
-    let f sep acc (id, (type_eff, const_eff_opt))  = 
-      acc ^ sep ^ (Lv6Id.to_string id) ^ " : " ^
-        (string_of_type_eff type_eff) ^
-        match const_eff_opt with
-            None -> ""
-          | Some ce -> " = " ^ (string_of_const_eff ce)
-    in
-    if global_opt.kcg then
-      (List.fold_left (f ", ")  (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}"
-    else
-      "struct " ^
-        (List.fold_left (f "; ")  (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}"
-        
+     assert (fl <>[]);
+     let f sep acc (id, (type_eff, const_eff_opt))  = 
+       acc ^ sep ^ (Lv6Id.to_string id) ^ " : " ^
+         (string_of_type_eff type_eff) ^
+           match const_eff_opt with
+             None -> ""
+           | Some ce -> " = " ^ (string_of_const_eff ce)
+     in
+     if global_opt.kcg then
+       (List.fold_left (f ", ")  (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}"
+     else
+       "struct " ^
+         (List.fold_left (f "; ")  (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}"
+                                                                              
   | TypeVar Any -> "a"
   | TypeVar AnyNum -> "o"
 
@@ -184,13 +184,23 @@ and string_of_type_eff  = function
   | Real_type_eff -> "real"
   | External_type_eff (name) -> (string_of_ident name)
   | Abstract_type_eff (name, t) -> (string_of_ident name)
-  | Enum_type_eff (name, _) -> 
-    (match global_opt.Lv6MainArgs.expand_enums with
+  | Enum_type_eff (name, el) -> 
+     (match global_opt.Lv6MainArgs.expand_enums with
       | AsEnum | AsConst -> string_of_ident name
-      | AsInt ->if global_opt.kcg then dump_long name else "int"
-    )
+      | AsInt  -> if global_opt.kcg then dump_long name else "int"
+      | AsBool -> if global_opt.kcg then dump_long name else 
+                    let get_n x = (* returns the n s.t., 2^(n-1) < x <= 2^n *)
+                      assert(x>0);
+                      let rec f n acc = 
+                        if x > acc then f (n+1) (2*acc) else n 
+                      in
+                      f 0 1
+                    in
+                    let size = get_n  (List.length el) in
+                    ("bool^"^(string_of_int size))
+     )
   | Array_type_eff (ty, sz) ->
-    Printf.sprintf "%s^%d" (string_of_type_eff ty) sz
+     Printf.sprintf "%s^%d" (string_of_type_eff ty) sz
   | Struct_type_eff (name, _) -> (if global_opt.kcg then dump_long name else string_of_ident name)
   | TypeVar Any -> "any"
   | (TypeVar AnyNum) -> "anynum"
@@ -213,146 +223,146 @@ and string_of_const = function
   | Enum_const_eff   (s,Enum_type_eff(_,ll)) -> (string_of_int (Lv6util.pos_in_list 0 s ll))
   | Enum_const_eff _  -> assert false
   | Struct_const_eff (fl, t) -> 
-    let string_of_field (id, veff) =
-      (Lv6Id.to_string id)^" = "^ (string_of_const veff)
-    in
-    Printf.sprintf "%s{%s}"
-      (string_of_type_eff t)
-      (String.concat "; " (List.map string_of_field fl))
+     let string_of_field (id, veff) =
+       (Lv6Id.to_string id)^" = "^ (string_of_const veff)
+     in
+     Printf.sprintf "%s{%s}"
+                    (string_of_type_eff t)
+                    (String.concat "; " (List.map string_of_field fl))
   | Array_const_eff (ctab, t) ->
-    Printf.sprintf "[%s]"
-      (String.concat ", " (List.map string_of_const ctab))
+     Printf.sprintf "[%s]"
+                    (String.concat ", " (List.map string_of_const ctab))
   | Tuple_const_eff   cl ->
-    Printf.sprintf "(%s)"
-      (String.concat ", " (List.map string_of_const cl))
+     Printf.sprintf "(%s)"
+                    (String.concat ", " (List.map string_of_const cl))
 
 and string_of_var_info x =
   (AstCore.string_of_var_nature x.var_nature_eff) ^ " " ^
     (Lv6Id.to_string x.var_name_eff) ^ ":"^(string_of_type_eff x.var_type_eff)^
-    (string_of_clock (snd x.var_clock_eff)^"("^ (Lv6Id.to_string (fst x.var_clock_eff)) ^","^
-       (string_of_int x.var_number_eff)^")")
+      (string_of_clock (snd x.var_clock_eff)^"("^ (Lv6Id.to_string (fst x.var_clock_eff)) ^","^
+         (string_of_int x.var_number_eff)^")")
 
 and string_of_var_list vl = String.concat " ; " (List.map string_of_var_info vl)
 
 and string_of_node_key = function
   | (ik, []) ->
-    (string_of_ident ik)
+     (string_of_ident ik)
   | (ik, sargs)  -> Printf.sprintf "%s<<%s>>"
-    (string_of_ident ik)
-    (String.concat ", " (List.map string_of_static_arg sargs))
+                                   (string_of_ident ik)
+                                   (String.concat ", " (List.map string_of_static_arg sargs))
 
 and string_of_static_arg = function
   | ConstStaticArgLic(id, ceff) -> Printf.sprintf "const %s = %s" id (string_of_const ceff)
   | TypeStaticArgLic (id, teff) -> Printf.sprintf "type %s = %s" id (string_of_type_eff teff)
   (* | NodeStaticArgLic (id, ((long,sargs), _, _), _) -> *)
   | NodeStaticArgLic (id, nk) ->
-    Printf.sprintf "node %s = %s" id (string_of_node_key nk)
+     Printf.sprintf "node %s = %s" id (string_of_node_key nk)
 
 and string_of_type_var tv = string_of_type_eff (TypeVar tv)
 and string_of_type_matches pm =
   let sotm (tv,t) = Printf.sprintf "%s <- %s"
-    (string_of_type_var tv) (string_of_type_eff t)
+                                   (string_of_type_var tv) (string_of_type_eff t)
   in
   String.concat ", " (List.map sotm pm)
 
 (* for printing recursive node *)
 and string_of_node_key_rec (no_prefix:bool) (nkey: node_key) = 
   match nkey with
-    | (ik, []) -> if global_opt.kcg then Lv6Id.no_pack_string_of_long ik else
-      if no_prefix 
-      then Lv6Id.no_pack_string_of_long ik 
-      else Lv6Id.string_of_long ik
-    | (ik, salst) ->
-      if global_opt.kcg then  ((* recursive nodes have been unfold *)
-	   (*assert (List.mem ik ["map"]);*)
-	   (* not yet working : 
+  | (ik, []) -> if global_opt.kcg then Lv6Id.no_pack_string_of_long ik else
+                  if no_prefix 
+                  then Lv6Id.no_pack_string_of_long ik 
+                  else Lv6Id.string_of_long ik
+  | (ik, salst) ->
+     if global_opt.kcg then  ((* recursive nodes have been unfold *)
+	    (*assert (List.mem ik ["map"]);*)
+	    (* not yet working : 
 	      - cas des noeuds itérés prédéfinis
 	      - il genere des alias des noeuds que scade ne comprend pas
-	   *)
-	   let rec get_node sl = 
-	     match sl with 
-	     | [] -> assert false
-	     | s::sl -> (match s with
-	       | NodeStaticArgLic  (_,nk) -> nk,sl
-	       | ConstStaticArgLic (_, _) 
-	       | TypeStaticArgLic  (_,_) -> 
-		 let n,sl = get_node sl in
-		 n, s::sl
-	     )
-	   in
-	   let nk, salst = get_node salst in
-	   let astrings = List.map static_arg2string_kcg salst in
-	   let name = sprintf "(%s %s <<%s>>)" (Lv6Id.no_pack_string_of_long ik)
-	     (string_of_node_key_rec no_prefix nk) (String.concat "," astrings) 
-	   in
-	   (FreshName.node_key nkey name)
-
-      )	
-      else 
-      let astrings = List.map static_arg2string_bis salst in
-      let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) (String.concat "_" astrings) in
-      (FreshName.node_key nkey name)
+	     *)
+	    let rec get_node sl = 
+	      match sl with 
+	      | [] -> assert false
+	      | s::sl -> (match s with
+	                  | NodeStaticArgLic  (_,nk) -> nk,sl
+	                  | ConstStaticArgLic (_, _) 
+	                  | TypeStaticArgLic  (_,_) -> 
+		                  let n,sl = get_node sl in
+		                  n, s::sl
+	                 )
+	    in
+	    let nk, salst = get_node salst in
+	    let astrings = List.map static_arg2string_kcg salst in
+	    let name = sprintf "(%s %s <<%s>>)" (Lv6Id.no_pack_string_of_long ik)
+	                       (string_of_node_key_rec no_prefix nk) (String.concat "," astrings) 
+	    in
+	    (FreshName.node_key nkey name)
+
+     )	
+     else 
+       let astrings = List.map static_arg2string_bis salst in
+       let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) (String.concat "_" astrings) in
+       (FreshName.node_key nkey name)
 
 (* for printing iterators *)
 and string_of_node_key_iter (nkey: node_key) = 
   match nkey with
-    | (ik, []) -> dump_long ik
-    | (ik, salst) ->
-      let astrings = List.map (static_arg2string) salst in
-      sprintf "%s<<%s>>" (Lv6Id.string_of_long ik) (String.concat ", " astrings)
+  | (ik, []) -> dump_long ik
+  | (ik, salst) ->
+     let astrings = List.map (static_arg2string) salst in
+     sprintf "%s<<%s>>" (Lv6Id.string_of_long ik) (String.concat ", " astrings)
 
 (* pour ecrire UN NIVEAU d'arg statique (cf. LicMetaOp *)
 and string_of_node_key_def (nkey: node_key) = 
   match nkey with
-    | (ik, []) -> dump_long ik
-    | (ik, salst) ->
-      let astrings = List.map (string_of_static_arg) salst in
-      sprintf "%s<<%s>>" (Lv6Id.no_pack_string_of_long ik) (String.concat ", " astrings)
+  | (ik, []) -> dump_long ik
+  | (ik, salst) ->
+     let astrings = List.map (string_of_static_arg) salst in
+     sprintf "%s<<%s>>" (Lv6Id.no_pack_string_of_long ik) (String.concat ", " astrings)
 
 (* for inventing a name to parametrized nodes *)
 and static_arg2string_bis (sa : Lic.static_arg) =
   match sa with
-    | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
-    | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
-    (* | NodeStaticArgLic  (id, ((long, _sargs), _, _), _) -> *)
-    | NodeStaticArgLic  (id, (long,_)) ->
-      sprintf "%s" (Lv6Id.no_pack_string_of_long long)
+  | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
+  | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
+  (* | NodeStaticArgLic  (id, ((long, _sargs), _, _), _) -> *)
+  | NodeStaticArgLic  (id, (long,_)) ->
+     sprintf "%s" (Lv6Id.no_pack_string_of_long long)
 
 and static_arg2string_kcg (sa : Lic.static_arg) =
   match sa with
-    | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
-    | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
-    (* | NodeStaticArgLic  (id, ((long, _sargs), _, _), _) -> *)
-    | NodeStaticArgLic  (id, (long,_)) -> assert false (* should not occur *)
+  | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
+  | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
+  (* | NodeStaticArgLic  (id, ((long, _sargs), _, _), _) -> *)
+  | NodeStaticArgLic  (id, (long,_)) -> assert false (* should not occur *)
 
 
 (* for printing recursive node and iterators *)
 and static_arg2string (sa : Lic.static_arg) =
   match sa with
-    | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
-    | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
-    (* | NodeStaticArgLic  (id, ((long,sargs), _, _), _) -> *)
-    | NodeStaticArgLic  (id, (long,sargs)) ->
-      string_of_node_key_iter (long,sargs)
+  | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
+  | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
+  (* | NodeStaticArgLic  (id, ((long,sargs), _, _), _) -> *)
+  | NodeStaticArgLic  (id, (long,sargs)) ->
+     string_of_node_key_iter (long,sargs)
 (*      sprintf "%s" (dump_long long) *)
 
 and static_arg2string_rec (sa : Lic.static_arg) =
   match sa with
-    | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
-    | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
-    (* | NodeStaticArgLic  (id, ((long,sargs), _, _), _) -> *)
-    | NodeStaticArgLic  (id, (long,sargs)) ->
-      string_of_node_key_rec global_opt.no_prefix (long,sargs)
+  | ConstStaticArgLic (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff)
+  | TypeStaticArgLic  (id, teff) -> sprintf "%s" (string_of_type_eff teff)
+  (* | NodeStaticArgLic  (id, ((long,sargs), _, _), _) -> *)
+  | NodeStaticArgLic  (id, (long,sargs)) ->
+     string_of_node_key_rec global_opt.no_prefix (long,sargs)
 (*      sprintf "%s" (dump_long long) *)
 
 
 and (string_of_var_info_eff: Lic.var_info -> string) =
   fun x -> 
-    (Lv6Id.to_string x.var_name_eff) ^ ":"^(string_of_type_eff x.var_type_eff)
+  (Lv6Id.to_string x.var_name_eff) ^ ":"^(string_of_type_eff x.var_type_eff)
 
 and (type_string_of_var_info_eff: Lic.var_info -> string) =
   fun x -> (string_of_type_eff x.var_type_eff) ^ 
-    (string_of_clock2 (snd x.var_clock_eff))
+             (string_of_clock2 (snd x.var_clock_eff))
 
 and string_of_decl var_info_eff = 
   let vt_str = 
@@ -367,104 +377,104 @@ and string_of_decl var_info_eff =
 
 and (string_of_type_decl_list : Lic.var_info list -> string -> string) =
   fun tel sep -> 
-    let str = String.concat sep (List.map string_of_decl tel) in
-    str
+  let str = String.concat sep (List.map string_of_decl tel) in
+  str
 
 and string_of_slice_info_eff si_eff =
   "[" ^ (string_of_int si_eff.se_first) ^ " .. " ^ (string_of_int si_eff.se_last) ^
     (if si_eff.se_step = 1 then "" else " step " ^ (string_of_int si_eff.se_step)) ^
-    "]"
+      "]"
 
 and (string_of_leff : Lic.left -> string) =
   function
-    | LeftVarLic  (vi_eff,_) -> Lv6Id.to_string vi_eff.var_name_eff  
-    | LeftFieldLic(leff,id,_) -> (string_of_leff leff) ^ "." ^ (Lv6Id.to_string id)
-    | LeftArrayLic(leff,i,_)  -> (string_of_leff leff) ^ "[" ^ (string_of_int i) ^ "]"
-    | LeftSliceLic(leff,si,_) -> (string_of_leff leff) ^ (string_of_slice_info_eff si)
+  | LeftVarLic  (vi_eff,_) -> Lv6Id.to_string vi_eff.var_name_eff  
+  | LeftFieldLic(leff,id,_) -> (string_of_leff leff) ^ "." ^ (Lv6Id.to_string id)
+  | LeftArrayLic(leff,i,_)  -> (string_of_leff leff) ^ "[" ^ (string_of_int i) ^ "]"
+  | LeftSliceLic(leff,si,_) -> (string_of_leff leff) ^ (string_of_slice_info_eff si)
 
 and (string_of_leff_list : Lic.left list -> string) =
   fun l -> if global_opt.kcg then
-      String.concat ", " (List.map string_of_leff l) 
+             String.concat ", " (List.map string_of_leff l) 
 
-      else
-    (if List.length l = 1 then "" else "(") ^ 
-      (String.concat ", " (List.map string_of_leff l)) ^ 
-      (if List.length l = 1 then "" else ")") 
+           else
+             (if List.length l = 1 then "" else "(") ^ 
+               (String.concat ", " (List.map string_of_leff l)) ^ 
+                 (if List.length l = 1 then "" else ")") 
 
 and (array_of_size_one : Lic.val_exp -> bool) =
   function 
-    | {ve_typ= [Array_type_eff(Bool_type_eff, size)] } -> size = 1
-    | {ve_typ= [_] } -> true
-    | _ ->  false
+  | {ve_typ= [Array_type_eff(Bool_type_eff, size)] } -> size = 1
+  | {ve_typ= [_] } -> true
+  | _ ->  false
 and sov ve = string_of_val_exp_eff ve
 and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> string) =
   fun posop vel -> 
-    let tuple vel = (String.concat ", " (List.map string_of_val_exp_eff vel)) in
-    let tuple_par vel = "(" ^ (tuple vel) ^ ")" in
-    let tuple_square vel = 
-      "[" ^ (String.concat ", " (List.map string_of_val_exp_eff vel)) ^ "]"
-    in
-    let str =
-      match posop.it,vel with
-        | CONST c,_ -> string_of_const_eff c 
-        | CALL ({it=("Lustre","not"),[]}), [ve1]
-        | PREDEF_CALL ({it=("Lustre","not"),[]}), [ve1] ->
-          ((op2string AstPredef.NOT_n) ^ " " ^ 
-              (if is_a_tuple ve1 then (tuple_par [ve1]) else sov ve1))
-            
-        | CALL ({it=("Lustre","diese"),[]}), [ve1] 
-        | PREDEF_CALL ({it=("Lustre","diese"),[]}), [ve1] ->
-          if (global_opt.lv4) && array_of_size_one ve1
-          then sov ve1 (* lv4 does no accept to apply # on One var only! *)
-          (*else if global_opt.kcg then
+  let tuple vel = (String.concat ", " (List.map string_of_val_exp_eff vel)) in
+  let tuple_par vel = "(" ^ (tuple vel) ^ ")" in
+  let tuple_square vel = 
+    "[" ^ (String.concat ", " (List.map string_of_val_exp_eff vel)) ^ "]"
+  in
+  let str =
+    match posop.it,vel with
+    | CONST c,_ -> string_of_const_eff c 
+    | CALL ({it=("Lustre","not"),[]}), [ve1]
+    | PREDEF_CALL ({it=("Lustre","not"),[]}), [ve1] ->
+       ((op2string AstPredef.NOT_n) ^ " " ^ 
+          (if is_a_tuple ve1 then (tuple_par [ve1]) else sov ve1))
+         
+    | CALL ({it=("Lustre","diese"),[]}), [ve1] 
+    | PREDEF_CALL ({it=("Lustre","diese"),[]}), [ve1] ->
+       if (global_opt.lv4) && array_of_size_one ve1
+       then sov ve1 (* lv4 does no accept to apply # on One var only! *)
+       (*else if global_opt.kcg then
 	     ("#" ^ (dump_array_no_square ve1)) *)
-	  (* do later *)
-	  else
-            ("#" ^ (tuple_par [ve1]))
-
-        | CALL ({it=("Lustre","nor"),[]}), [ve1] 
-        | PREDEF_CALL ({it=("Lustre","nor"),[]}), [ve1] ->
-          (("nor") ^ (tuple_par [ve1]))
-            
-        | CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] 
-        | PREDEF_CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] ->
-          let ve2str = string_of_val_exp_eff ve2 in 
-          let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in
-          let ve3str = string_of_val_exp_eff ve3 in 
-          let ve3str = if is_a_tuple ve3 then "("^ve3str^")" else ve3str in
-          " if " ^ (string_of_val_exp_eff ve1) ^ 
-            " then " ^ ve2str ^ " else " ^ ve3str
-
-        | CALL(op), vel 
-        | PREDEF_CALL(op), vel -> (
-          if AstPredef.is_a_predef_op (snd(fst op.it)) then
-            let op_str = snd (fst op.it) in
-            let op_short_str = AstPredef.op2string (AstPredef.string_to_op op_str) in
-            if AstPredef.is_infix (AstPredef.string_to_op op_str) then (
-              match vel with 
-                | [ve1; ve2] -> 
-                  (string_of_val_exp_eff ve1) ^ " " ^ op_short_str ^ 
-                    " " ^ (string_of_val_exp_eff ve2)
-                | _ -> assert false
-            ) 
-            else 
-              (op_short_str ^
-                 (match op_str with
-                   | "not" | "true" | "false"  ->  tuple vel
-                   | _ -> tuple_par vel 
-                 )
-              )
-          else
-            let nk = op.it in
-            if global_opt.lv4 then
-              ((string_of_node_key nk) ^ (tuple_par vel))
-            else
-              ((string_of_node_key_rec global_opt.no_prefix nk) ^ (tuple_par vel))
-        )
-        | CONST_REF idl, _ -> dump_long idl
-        | VAR_REF id, _ -> id
-        | PRE, _ -> "pre "  ^ (tuple_par vel)
-        | ARROW, [ve1; ve2] -> (* if global_opt.kcg then (
+	    (* do later *)
+	    else
+         ("#" ^ (tuple_par [ve1]))
+
+    | CALL ({it=("Lustre","nor"),[]}), [ve1] 
+    | PREDEF_CALL ({it=("Lustre","nor"),[]}), [ve1] ->
+       (("nor") ^ (tuple_par [ve1]))
+         
+    | CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] 
+    | PREDEF_CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] ->
+       let ve2str = string_of_val_exp_eff ve2 in 
+       let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in
+       let ve3str = string_of_val_exp_eff ve3 in 
+       let ve3str = if is_a_tuple ve3 then "("^ve3str^")" else ve3str in
+       " if " ^ (string_of_val_exp_eff ve1) ^ 
+         " then " ^ ve2str ^ " else " ^ ve3str
+
+    | CALL(op), vel 
+    | PREDEF_CALL(op), vel -> (
+      if AstPredef.is_a_predef_op (snd(fst op.it)) then
+        let op_str = snd (fst op.it) in
+        let op_short_str = AstPredef.op2string (AstPredef.string_to_op op_str) in
+        if AstPredef.is_infix (AstPredef.string_to_op op_str) then (
+          match vel with 
+          | [ve1; ve2] -> 
+             (string_of_val_exp_eff ve1) ^ " " ^ op_short_str ^ 
+               " " ^ (string_of_val_exp_eff ve2)
+          | _ -> assert false
+        ) 
+        else 
+          (op_short_str ^
+             (match op_str with
+              | "not" | "true" | "false"  ->  tuple vel
+              | _ -> tuple_par vel 
+             )
+          )
+      else
+        let nk = op.it in
+        if global_opt.lv4 then
+          ((string_of_node_key nk) ^ (tuple_par vel))
+        else
+          ((string_of_node_key_rec global_opt.no_prefix nk) ^ (tuple_par vel))
+    )
+    | CONST_REF idl, _ -> dump_long idl
+    | VAR_REF id, _ -> id
+    | PRE, _ -> "pre "  ^ (tuple_par vel)
+    | ARROW, [ve1; ve2] -> (* if global_opt.kcg then (
 	                               "fby(" ^
                                   (if is_a_tuple ve2 then tuple_par [ve2] else string_of_val_exp_eff ve2)
                                   ^ ";1;" ^
@@ -472,134 +482,134 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st
                                   
 	                               ) 
 	                               else( *)
-          (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^
-            " -> " ^ 
-            (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
-	         
-        | FBY, [ve1; ve2] -> 
-	       (* dead code ? *)
-          if global_opt.lv4 then
-            (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1)
-            ^ " -> pre " ^ 
-              (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
-          else
-
-	         if global_opt.kcg then (
-	           "fby(" ^
-                (if is_a_tuple ve2 then tuple_par [ve2] else string_of_val_exp_eff ve2)
-              ^ ";1;" ^
-                (if is_a_tuple ve2 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ ")"
-                
-	         ) 
-	         else( 
-              (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1)
-              ^ " fby " ^ 
-                (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
-	         )
-
-        | WHEN clk, vel -> (tuple vel) ^ (string_of_clock clk)
-
-        | CURRENT Some _,_ -> (* transform to merge in kcg mode *) 
-	  if global_opt.kcg then assert false 
-	  else
-	    "current " ^ tuple_par (if global_opt.ec then List.tl vel else vel)
-        | CURRENT None,_ -> "current " ^ tuple_par vel
-        | TUPLE,_ -> (tuple vel)
-        | CONCAT, [ve1; ve2] ->  
-          (string_of_val_exp_eff ve1) ^ " | " ^ (string_of_val_exp_eff ve2)
-        | HAT (i), [ve] -> (string_of_val_exp_eff ve) ^ "^" ^ (string_of_int i)
-        | HAT (i), _ -> assert false
-        | ARRAY, vel -> tuple_square vel
-        | STRUCT_ACCESS(id), [ve1] ->
-          (string_of_val_exp_eff ve1) ^ "." ^ (Lv6Id.to_string id)
-
-        | ARRAY_ACCES(i), [ve1] ->
-          (string_of_val_exp_eff ve1) ^ "[" ^ (string_of_int i) ^ "]"
-
-        | ARRAY_SLICE(si_eff), [ve1] -> 
-          (string_of_val_exp_eff ve1) ^ (string_of_slice_info_eff si_eff)
-
-        | ARRAY_SLICE(_), _ -> assert false (* todo *)
-
-        (* Cannot happen *)
-        | ARROW, _ -> assert false
-        | FBY, _ -> assert false
-        | CONCAT, _ -> assert false
-        | STRUCT_ACCESS(_), _ -> assert false
-        | ARRAY_ACCES(i), _ -> assert false
-    in
-    let do_not_parenthesize = function 
-      | VAR_REF _,_
-      | CONST_REF _,_
-      | PREDEF_CALL({it=("Lustre","true"),[]}),_
-      | PREDEF_CALL({it=("Lustre","false"),[]}),_
-      | ARRAY_ACCES _,_
-      | STRUCT_ACCESS _,_ -> true   
-      | _,_ ->  false 
-    in 
-    if 
-      (* already parenthesized *)
-      ( Str.string_match (Str.regexp "^(") str 0 && 
-          Str.string_match (Str.regexp ")$") str 0 ) 
-      || 
-        (* ident or predef constants *)
-        (do_not_parenthesize (posop.it,vel)) 
-      ||
-        global_opt.one_op_per_equation
-    then 
-      str 
-    else 
-      ("(" ^ str ^ ")")
+       (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^
+         " -> " ^ 
+           (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
+	          
+    | FBY, [ve1; ve2] -> 
+	    (* dead code ? *)
+       if global_opt.lv4 then
+         (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1)
+         ^ " -> pre " ^ 
+           (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
+       else
+
+	      if global_opt.kcg then (
+	        "fby(" ^
+             (if is_a_tuple ve2 then tuple_par [ve2] else string_of_val_exp_eff ve2)
+             ^ ";1;" ^
+               (if is_a_tuple ve2 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ ")"
+                                                                                           
+	      ) 
+	      else( 
+           (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1)
+           ^ " fby " ^ 
+             (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
+	      )
+
+    | WHEN clk, vel -> (tuple vel) ^ (string_of_clock clk)
+
+    | CURRENT Some _,_ -> (* transform to merge in kcg mode *) 
+	    if global_opt.kcg then assert false 
+	    else
+	      "current " ^ tuple_par (if global_opt.ec then List.tl vel else vel)
+    | CURRENT None,_ -> "current " ^ tuple_par vel
+    | TUPLE,_ -> (tuple vel)
+    | CONCAT, [ve1; ve2] ->  
+       (string_of_val_exp_eff ve1) ^ " | " ^ (string_of_val_exp_eff ve2)
+    | HAT (i), [ve] -> (string_of_val_exp_eff ve) ^ "^" ^ (string_of_int i)
+    | HAT (i), _ -> assert false
+    | ARRAY, vel -> tuple_square vel
+    | STRUCT_ACCESS(id), [ve1] ->
+       (string_of_val_exp_eff ve1) ^ "." ^ (Lv6Id.to_string id)
+
+    | ARRAY_ACCES(i), [ve1] ->
+       (string_of_val_exp_eff ve1) ^ "[" ^ (string_of_int i) ^ "]"
+
+    | ARRAY_SLICE(si_eff), [ve1] -> 
+       (string_of_val_exp_eff ve1) ^ (string_of_slice_info_eff si_eff)
+
+    | ARRAY_SLICE(_), _ -> assert false (* todo *)
+
+    (* Cannot happen *)
+    | ARROW, _ -> assert false
+    | FBY, _ -> assert false
+    | CONCAT, _ -> assert false
+    | STRUCT_ACCESS(_), _ -> assert false
+    | ARRAY_ACCES(i), _ -> assert false
+  in
+  let do_not_parenthesize = function 
+    | VAR_REF _,_
+    | CONST_REF _,_
+    | PREDEF_CALL({it=("Lustre","true"),[]}),_
+    | PREDEF_CALL({it=("Lustre","false"),[]}),_
+    | ARRAY_ACCES _,_
+    | STRUCT_ACCESS _,_ -> true   
+    | _,_ ->  false 
+  in 
+  if 
+    (* already parenthesized *)
+    ( Str.string_match (Str.regexp "^(") str 0 && 
+        Str.string_match (Str.regexp ")$") str 0 ) 
+    || 
+      (* ident or predef constants *)
+      (do_not_parenthesize (posop.it,vel)) 
+    ||
+      global_opt.one_op_per_equation
+  then 
+    str 
+  else 
+    ("(" ^ str ^ ")")
 
 
 and string_of_val_exp_eff ve = string_of_val_exp_eff_core ve.ve_core
 and string_of_val_exp_eff_core ve_core = 
   match ve_core with
-    | CallByPosLic (by_pos_op_eff, vel) ->
-      (* ICI : on pourrait afficher en commentaire l'éventuel type_matches ? *)
-      (string_of_by_pos_op_eff by_pos_op_eff vel) 
-
-    | Merge (ve, [({it=Bool_const_eff true }, ct); ({it=Bool_const_eff false}, cf)]) 
-    | Merge (ve, [({it=Bool_const_eff false}, cf); ({it=Bool_const_eff true}, ct)]) -> 
-      if global_opt.lv4 then (
-        "if " ^ (string_of_val_exp_eff ve) ^ " then current (" ^
-          (string_of_val_exp_eff ct) ^ ") else current (" ^ 
-          (string_of_val_exp_eff cf) ^")" 
-      ) else  (
-	     if global_opt.kcg then (
-          "merge ( " ^ (string_of_val_exp_eff ve) ^ ";" ^
-            (string_of_val_exp_eff ct) ^ "when " ^(string_of_val_exp_eff ve) ^ ";" ^ 
-            (string_of_val_exp_eff cf) ^ "when not " ^ (string_of_val_exp_eff ve) ^ ")" 
-        ) else  (
-          "merge " ^ (string_of_val_exp_eff ve) ^ " (true -> " ^
-            (string_of_val_exp_eff ct) ^ ") (false -> "^  (string_of_val_exp_eff cf) ^")"
-        )
+  | CallByPosLic (by_pos_op_eff, vel) ->
+     (* ICI : on pourrait afficher en commentaire l'éventuel type_matches ? *)
+     (string_of_by_pos_op_eff by_pos_op_eff vel) 
+
+  | Merge (ve, [({it=Bool_const_eff true }, ct); ({it=Bool_const_eff false}, cf)]) 
+  | Merge (ve, [({it=Bool_const_eff false}, cf); ({it=Bool_const_eff true}, ct)]) -> 
+     if global_opt.lv4 then (
+       "if " ^ (string_of_val_exp_eff ve) ^ " then current (" ^
+         (string_of_val_exp_eff ct) ^ ") else current (" ^ 
+           (string_of_val_exp_eff cf) ^")" 
+     ) else  (
+	    if global_opt.kcg then (
+         "merge ( " ^ (string_of_val_exp_eff ve) ^ ";" ^
+           (string_of_val_exp_eff ct) ^ "when " ^(string_of_val_exp_eff ve) ^ ";" ^ 
+             (string_of_val_exp_eff cf) ^ "when not " ^ (string_of_val_exp_eff ve) ^ ")" 
+       ) else  (
+         "merge " ^ (string_of_val_exp_eff ve) ^ " (true -> " ^
+           (string_of_val_exp_eff ct) ^ ") (false -> "^  (string_of_val_exp_eff cf) ^")"
+       )
+     )
+  | Merge (ve, cl) -> (
+    "merge " ^ (string_of_val_exp_eff ve) ^ " " ^
+      (String.concat " " 
+                     (List.map 
+                        (fun (id,ve) -> "( "^(string_of_const_eff id.it) ^ " -> " ^ 
+                                          (string_of_val_exp_eff ve)^" )")
+                        cl
+                     )
       )
-    | Merge (ve, cl) -> (
-      "merge " ^ (string_of_val_exp_eff ve) ^ " " ^
-        (String.concat " " 
-           (List.map 
-              (fun (id,ve) -> "( "^(string_of_const_eff id.it) ^ " -> " ^ 
-                (string_of_val_exp_eff ve)^" )")
-              cl
-           )
-        )
-    )
-    | CallByNameLic(by_name_op_eff, fl) -> 
-      (match by_name_op_eff.it with
-        | STRUCT (long) -> (Lv6Id.string_of_long long)
-        | STRUCT_with (long, _dft) -> (Lv6Id.string_of_long long)
-        | STRUCT_anonymous -> ""          
-      ) ^ (
-        "{" ^ (String.concat ";" 
-                 (List.map 
-                    (fun (id,veff) -> 
-                      let str = string_of_val_exp_eff veff in
-                      (Lv6Id.to_string id.it) ^ "=" ^ 
-                        (if is_a_tuple veff then ("("^ str^")") else str)
-                    )
-                    fl)) ^
-          "}")
+  )
+  | CallByNameLic(by_name_op_eff, fl) -> 
+     (match by_name_op_eff.it with
+      | STRUCT (long) -> (Lv6Id.string_of_long long)
+      | STRUCT_with (long, _dft) -> (Lv6Id.string_of_long long)
+      | STRUCT_anonymous -> ""          
+     ) ^ (
+      "{" ^ (String.concat ";" 
+                           (List.map 
+                              (fun (id,veff) -> 
+                               let str = string_of_val_exp_eff veff in
+                               (Lv6Id.to_string id.it) ^ "=" ^ 
+                                 (if is_a_tuple veff then ("("^ str^")") else str)
+                              )
+                              fl)) ^
+        "}")
 
 
 and wrap_long_line str = 
@@ -608,13 +618,13 @@ and wrap_long_line str =
     let new_str, reste =
       List.fold_left
         (fun (accl, acc_str) str ->
-          let new_acc_str = acc_str ^ " " ^ str in
-          if 
-            String.length new_acc_str > 75
-          then
-            (accl ^ acc_str ^ "\n\t" , str)
-          else
-            (accl, new_acc_str)
+         let new_acc_str = acc_str ^ " " ^ str in
+         if 
+           String.length new_acc_str > 75
+         then
+           (accl ^ acc_str ^ "\n\t" , str)
+         else
+           (accl, new_acc_str)
         )
         ("","")
         str_list
@@ -625,19 +635,19 @@ and wrap_long_line str =
 and string_of_eq_info_eff (leff_list, vee) =
   let str = string_of_val_exp_eff vee in
   wrap_long_line (
-    (string_of_leff_list leff_list) ^ " = " ^ 
-      (if is_a_tuple vee then ("("^ str^")") else str) ^ ";")
+      (string_of_leff_list leff_list) ^ " = " ^ 
+        (if is_a_tuple vee then ("("^ str^")") else str) ^ ";")
 
 and (string_of_assert : Lic.val_exp srcflagged -> string ) =
   fun eq_eff -> 
-    wrap_long_line (
+  wrap_long_line (
       if global_opt.kcg then "assume " ^ FreshName.local_var "A" ^ ": " ^ string_of_val_exp_eff eq_eff.it ^ ";"
       else
-      "assert(" ^ string_of_val_exp_eff eq_eff.it ^ ");")
+        "assert(" ^ string_of_val_exp_eff eq_eff.it ^ ");")
 
 and (string_of_eq : Lic.eq_info srcflagged -> string) =
   fun eq_eff ->
-    string_of_eq_info_eff eq_eff.it
+  string_of_eq_info_eff eq_eff.it
 
 
 
@@ -645,172 +655,176 @@ and wrap_long_profile str =
 
   if String.length str < 75 then str else
     "\n"^(
-      Str.global_replace (Str.regexp "returns") "\nreturns"
-        (Str.global_replace (Str.regexp "(") "(\n\t"
-           (Str.global_replace (Str.regexp "; ") ";\n\t" str)))  
+    Str.global_replace (Str.regexp "returns") "\nreturns"
+                       (Str.global_replace (Str.regexp "(") "(\n\t"
+                                           (Str.global_replace (Str.regexp "; ") ";\n\t" str)))  
 
 and (profile_of_node_exp_eff: Lic.node_exp -> string) =
   fun neff ->
-    
-    ("(" ^ (string_of_type_decl_list  neff.inlist_eff "; ") ^ ") returns (" ^
-	     (string_of_type_decl_list neff.outlist_eff "; ") ^ ")")
+  
+  ("(" ^ (string_of_type_decl_list  neff.inlist_eff "; ") ^ ") returns (" ^
+	  (string_of_type_decl_list neff.outlist_eff "; ") ^ ")")
 
 
 and (string_of_node_def : Lic.node_def -> string list) =
   function
-    | ExternLic
-    | MetaOpLic
-    | AbstractLic _ -> []
-    | BodyLic node_body_eff -> 
-      List.append
-        (List.map string_of_assert node_body_eff.asserts_eff)
-        (List.map string_of_eq node_body_eff.eqs_eff)
+  | ExternLic
+  | MetaOpLic
+  | AbstractLic _ -> []
+  | BodyLic node_body_eff -> 
+     List.append
+       (List.map string_of_assert node_body_eff.asserts_eff)
+       (List.map string_of_eq node_body_eff.eqs_eff)
 
-        
+       
 
 (* exported *)
 and (type_decl: Lv6Id.long -> Lic.type_ -> string) =
-  fun tname teff -> if global_opt.kcg then
-      match teff with
-        | Enum_type_eff (_) -> 
-          "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n"
-        | External_type_eff (_) 
-        | Abstract_type_eff(_,External_type_eff (_)) -> "type imported " ^ (dump_long tname) ^  ";\n"
-        | _ -> "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n"
-      
-     
-      else
+  fun tname teff ->
+  if global_opt.kcg then
+    match teff with
+    | Enum_type_eff (_) -> 
+       "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n"
+    | External_type_eff (_) 
+    | Abstract_type_eff(_,External_type_eff (_)) -> 
+       "type imported " ^ (dump_long tname) ^  ";\n"
+    | _ -> "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n"
+  else
     "type " ^ (dump_long tname) ^ 
       (match teff with
-        | Enum_type_eff (_) -> 
+       | Enum_type_eff (_) -> 
           " = " ^ (string_def_of_type_eff teff) ^ ";\n"
-        | External_type_eff (_) 
-        | Abstract_type_eff(_,External_type_eff (_)) -> ";\n"
-        | _ ->  " = " ^ (string_def_of_type_eff teff) ^ ";\n"
+       | External_type_eff (_) 
+       | Abstract_type_eff(_,External_type_eff (_)) -> ";\n"
+       | _ ->  " = " ^ (string_def_of_type_eff teff) ^ ";\n"
       )
-      
+                          
 (* exported *)
 and (const_decl: Lv6Id.long -> Lic.const -> string) =
   fun tname ceff -> 
-    let begin_str = ("const " ^ (dump_long tname)) in
-    let end_str = (string_of_const_eff ceff) ^ ";\n" in
-    (match ceff with 
-      | Enum_const_eff(id, t)  -> "" 
-      | Extern_const_eff _
-      | Abstract_const_eff _ -> if global_opt.kcg then 
-	  "const imported " ^ (dump_long tname) ^ " : " ^ (string_of_type_eff (Lic.type_of_const ceff)) ^ (";\n")
-	  else
+  let begin_str = ("const " ^ (dump_long tname)) in
+  let end_str = (string_of_const_eff ceff) ^ ";\n" in
+  (match ceff with 
+   | Enum_const_eff(id, t)  -> "" 
+   | Extern_const_eff _
+   | Abstract_const_eff _ ->
+      if global_opt.kcg then 
+	     "const imported " ^ (dump_long tname) ^ " : " ^ 
+          (string_of_type_eff (Lic.type_of_const ceff)) ^ (";\n")
+	   else
         begin_str ^ " : " ^ (string_of_type_eff (Lic.type_of_const ceff)) ^ 
           (*                (if global_opt.ec then ".\n" else  *)
           (";\n")
-      | Struct_const_eff _
-      | Array_const_eff _
-      | Bool_const_eff _
-      | Int_const_eff _
-      | Real_const_eff _ -> if global_opt.kcg then begin_str ^ ":" ^ (string_of_type_eff (Lic.type_of_const ceff)) ^ " = " ^ end_str
-	     else begin_str ^ " = " ^ end_str
-		| Tuple_const_eff _ ->
-		  print_internal_error "LicDump.const_decl" "should not have been called for a tuple";
-		  assert false
-      ) 
-
-        
+   | Struct_const_eff _
+   | Array_const_eff _
+   | Bool_const_eff _
+   | Int_const_eff _
+   | Real_const_eff _ -> 
+      if global_opt.kcg then 
+        begin_str ^ ":" ^ (string_of_type_eff (Lic.type_of_const ceff)) ^ " = " ^ end_str
+	   else begin_str ^ " = " ^ end_str
+	| Tuple_const_eff _ ->
+		print_internal_error "LicDump.const_decl" "should not have been called for a tuple";
+		assert false
+  ) 
+
+    
 (* exported *)
 and node_of_node_exp_eff (neff: Lic.node_exp): string =
-   wrap_long_profile (
+  wrap_long_profile (
       (
-         if neff.is_safe_eff then "" else "unsafe "
+        if neff.is_safe_eff then "" else "unsafe "
       )^(
-         if neff.def_eff = ExternLic && not (global_opt.lv4) && not (global_opt.kcg)
-         (* no extern kwd in v4 and in "scade"... *)
-         then "extern " else ""
-       )^(
-        if global_opt.lv4 || global_opt.kcg then (
-            (* node and function does not have the same meaning in scade and in lv4... *)
-          if neff.def_eff = ExternLic then "function " else "node "
-        ) else (
-          if neff.has_mem_eff  then "node " else "function "
-        )
+        if neff.def_eff = ExternLic && not (global_opt.lv4) && not (global_opt.kcg)
+        (* no extern kwd in v4 and in "scade"... *)
+        then "extern " else ""
+      )^(
+         if global_opt.lv4 || global_opt.kcg then (
+           (* node and function does not have the same meaning in scade and in lv4... *)
+           if neff.def_eff = ExternLic then "function " else "node "
+         ) else (
+           if neff.has_mem_eff  then "node " else "function "
+         )
        )^(if global_opt.kcg then
-	   if neff.def_eff = ExternLic then "imported " else ""
-	 else "")
+	         if neff.def_eff = ExternLic then "imported " else ""
+	       else "")
 	   ^(if global_opt.kcg then 
-               string_of_node_key_rec (not global_opt.no_prefix) neff.node_key_eff
+          string_of_node_key_rec (not global_opt.no_prefix) neff.node_key_eff
 	     else
 	       string_of_node_key_rec  global_opt.no_prefix neff.node_key_eff
        )^(
         profile_of_node_exp_eff neff
 	   )
-       ^
-	(match neff.def_eff with
-        | ExternLic ->  ";\n"
-        | MetaOpLic -> (
+      ^
+	     (match neff.def_eff with
+         | ExternLic ->  ";\n"
+         | MetaOpLic -> (
 
-            (* on écrit juste un alias *)
-          " = " ^(string_of_node_key_def neff.node_key_eff)^ ";\n"
+           (* on écrit juste un alias *)
+           " = " ^(string_of_node_key_def neff.node_key_eff)^ ";\n"
          )
          | AbstractLic _ -> "; \n"
          | BodyLic _ -> (
            (if global_opt.kcg then "\n" else ";\n") ^
              (match neff.loclist_eff with
-               | None -> ""
-               | Some [] -> ""
-               | Some l ->
+              | None -> ""
+              | Some [] -> ""
+              | Some l ->
 	              ("var\n   " ^ (string_of_type_decl_list l ";\n   ") ^ ";\n"
 	              )
              ) 
-	   ^ "let\n   " ^
-	     (String.concat "\n   " (string_of_node_def neff.def_eff)) ^
-	     "\ntel\n-- end of node " ^
-	     (string_of_node_key_rec (not global_opt.no_prefix) neff.node_key_eff) ^ "\n")
-	   )
-   )
-      
+	          ^ "let\n   " ^
+	            (String.concat "\n   " (string_of_node_def neff.def_eff)) ^
+	              "\ntel\n-- end of node " ^
+	                (string_of_node_key_rec (not global_opt.no_prefix) neff.node_key_eff) ^ "\n")
+	     )
+    )
+                    
 and (string_of_clock_exp : AstCore.clock_exp -> string) = 
   function
-    | AstCore.Base -> ""
-    | AstCore.NamedClock clk -> 
-        " when " ^ (string_of_ident_clk clk.it)
+  | AstCore.Base -> ""
+  | AstCore.NamedClock clk -> 
+     " when " ^ (string_of_ident_clk clk.it)
 
 and (string_of_ident_clk : Lv6Id.clk -> string) =
   fun clk -> 
-    let (cc,v) = clk in
-    let clk_exp_str =
-      match cc with
-        | "Lustre","true" -> (Lv6Id.to_string v)
-        | "Lustre","false" ->  "not " ^ (Lv6Id.to_string v)
-        | _ -> 
-(*              if global_opt.lv4 || global_opt.ec then *)
-(*                raise (Lv6errors.Global_error *)
-(*                         ("Cannot generate V4 style Lustre for programs with enumerated "^ *)
-(*                            "clocks (yet), sorry.")) *)
-(*              else *)
-              Lv6Id.string_of_clk clk
-    in
-      clk_exp_str
+  let (cc,v) = clk in
+  let clk_exp_str =
+    match cc with
+    | "Lustre","true" -> (Lv6Id.to_string v)
+    | "Lustre","false" ->  "not " ^ (Lv6Id.to_string v)
+    | _ -> 
+       (*              if global_opt.lv4 || global_opt.ec then *)
+       (*                raise (Lv6errors.Global_error *)
+       (*                         ("Cannot generate V4 style Lustre for programs with enumerated "^ *)
+       (*                            "clocks (yet), sorry.")) *)
+       (*              else *)
+       Lv6Id.string_of_clk clk
+  in
+  clk_exp_str
 
 
 (* exported *)
 and string_of_clock2 (ck : Lic.clock) =
   match ck with
-    | BaseLic -> " on base"
-    | On((cc,cv,_),ceff) ->
-        let clk_exp_str = string_of_ident_clk (cc,cv) in
-          " on " ^ clk_exp_str ^ (string_of_clock2 ceff)
-    | ClockVar i ->  "'a" ^ string_of_int i
-        
-        
+  | BaseLic -> " on base"
+  | On((cc,cv,_),ceff) ->
+     let clk_exp_str = string_of_ident_clk (cc,cv) in
+     " on " ^ clk_exp_str ^ (string_of_clock2 ceff)
+  | ClockVar i ->  "'a" ^ string_of_int i
+                                        
+                                        
 and string_of_clock (ck : Lic.clock) =
   match ck with
-    | BaseLic -> ""
-    | On((cc,cv,_),_) -> 
-        let clk_exp_str = string_of_ident_clk (cc,cv) in
-          " when " ^ clk_exp_str
-    | ClockVar _ ->  
-        "" (* it migth occur that (unused) constant remain with a clock var.
+  | BaseLic -> ""
+  | On((cc,cv,_),_) -> 
+     let clk_exp_str = string_of_ident_clk (cc,cv) in
+     " when " ^ clk_exp_str
+  | ClockVar _ ->  
+     "" (* it migth occur that (unused) constant remain with a clock var.
               But in that case, it is ok to consider then as on the base clock.
-           *)
-          (*     | ClockVar i -> "_clock_var_" ^ (string_of_int i) *)
+         *)
+(*     | ClockVar i -> "_clock_var_" ^ (string_of_int i) *)
 
 and op2string op = 
   (* Une verrue pour être compatible avec les outils qui mangent du ec...  *)
diff --git a/src/licPrg.ml b/src/licPrg.ml
index 5dd14dc54ff366125dcce973c4eb4fcf4061b03e..e7dd3a4fa5afbc433715a6bbf90c0200e229b8d9 100644
--- a/src/licPrg.ml
+++ b/src/licPrg.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 14/01/2016 (at 10:41) by Erwan Jahier> *)
+(* Time-stamp: <modified the 31/05/2016 (at 15:30) by Erwan Jahier> *)
 open Lv6MainArgs
 
 module ItemKeyMap = struct
@@ -115,25 +115,38 @@ let del_node (k:Lic.node_key) (prg:t) : t =
     Printf.printf  "## LicPrg.del_node %s\n" (LicDump.string_of_node_key_rec false k));
    { prg with nodes = NodeKeyMap.remove k prg.nodes }
 
+
+(* to encode int into bools (for --expand-enums-as-bool) *)
+let rec (int_to_bool_array: int -> int -> bool list) =
+  fun i size -> 
+  assert(size >= 0);
+  if size = 0 then [] else
+  let d,r = i / 2, (i mod 2) = 1 in
+  r::(int_to_bool_array d (size-1))
+                                 
+let _ = 
+  assert (int_to_bool_array 1 3  = [true; false; false]);
+  assert (int_to_bool_array 2 3  = [false; true; false]);
+  assert (int_to_bool_array 8 3  = [false; false; false]);;
+
+
+
 exception Print_me of Lic.node_exp
 let to_file (opt: Lv6MainArgs.t) (this:t) (main_node: Lv6Id.idref option) = 
   LicDump.dump_entete opt.Lv6MainArgs.oc;
-  (* On imprime dans l'ordre du iter, donc pas terrible ???
-  *)
-  ItemKeyMap.iter
-    (fun tn te ->
-      if global_opt.kcg then
-	if ((not Lv6MainArgs.global_opt.Lv6MainArgs.lv4 || Lic.is_extern_type te) 
-           (* && (Lv6MainArgs.global_opt.Lv6MainArgs.expand_enums = Lv6MainArgs.AsEnum)*))
-	then 
-        output_string opt.Lv6MainArgs.oc (LicDump.type_decl tn te)
-      else
-	  if ((not Lv6MainArgs.global_opt.Lv6MainArgs.lv4 || Lic.is_extern_type te) 
-        && (Lv6MainArgs.global_opt.Lv6MainArgs.expand_enums = Lv6MainArgs.AsEnum))
-	  then 
-        output_string opt.Lv6MainArgs.oc (LicDump.type_decl tn te)
-    )
-    this.types;
+  if (global_opt.Lv6MainArgs.lv4) then () else (
+    ItemKeyMap.iter
+      (fun tn te ->
+       if (Lic.is_extern_type te) && (
+         global_opt.Lv6MainArgs.kcg || 
+           Lv6MainArgs.global_opt.Lv6MainArgs.expand_enums = AsEnum)
+       then 
+         output_string opt.Lv6MainArgs.oc (LicDump.type_decl tn te)
+       else 
+         ()
+      )
+      this.types
+  );
 
   (* for generating lv4 or ec compatible code, enum types are
      translated into an extern type + an extern const per enums.
@@ -154,95 +167,120 @@ let to_file (opt: Lv6MainArgs.t) (this:t) (main_node: Lv6Id.idref option) =
      const blue:color1;
      const white:color1;
 
-  *)
+   *)
+  let to_const_list types =
+    ItemKeyMap.fold
+      (fun tn te acc -> 
+       match te with
+       | Lic.Enum_type_eff(long, longl) ->  
+          (List.map (fun x -> long,x) longl) :: acc
+       | _ -> acc
+      )
+      this.types
+      []
+  in
   (match Lv6MainArgs.global_opt.Lv6MainArgs.expand_enums with
-    | Lv6MainArgs.AsConst  -> if global_opt.kcg then () else (
-      let const_list = 
-        ItemKeyMap.fold
-          (fun tn te acc -> 
-            match te with
-              | Lic.Enum_type_eff(long, longl) ->  
-                output_string opt.Lv6MainArgs.oc (LicDump.type_decl long (Lic.External_type_eff long));
+   | Lv6MainArgs.AsConst  ->
+      if global_opt.kcg then () else (
+        let const_list = 
+          ItemKeyMap.fold
+            (fun tn te acc -> 
+             match te with
+             | Lic.Enum_type_eff(long, longl) ->  
+                output_string opt.Lv6MainArgs.oc 
+                              (LicDump.type_decl long (Lic.External_type_eff long));
                 List.rev_append (List.map (fun x -> long,x) longl) acc
-              | _ -> acc
-          )
-          this.types
-          []
-      in
-      List.iter
-        (fun (t,elt) -> 
-          let const = Lic.Extern_const_eff (elt, Lic.External_type_eff t) in
-          output_string opt.Lv6MainArgs.oc (LicDump.const_decl elt const))
-        const_list;
-   )
-    | Lv6MainArgs.AsInt -> if global_opt.kcg then () else (
-      let const_list = 
-        ItemKeyMap.fold
-          (fun tn te acc -> 
-            match te with
-              | Lic.Enum_type_eff(long, longl) ->  
-                (List.map (fun x -> long,x) longl) :: acc
-              | _ -> acc
+             | _ -> acc
+            )
+            this.types
+            []
+        in
+        List.iter
+          (fun (t,elt) -> 
+           let const = Lic.Extern_const_eff (elt, Lic.External_type_eff t) in
+           output_string opt.Lv6MainArgs.oc (LicDump.const_decl elt const))
+          const_list;
+      )
+   | Lv6MainArgs.AsInt -> 
+      if global_opt.kcg then () else (
+        let const_list = to_const_list this.types in
+        List.iter
+          (List.iteri
+             (fun i (t,elt) ->
+              let const = Lic.Int_const_eff (string_of_int i) in
+              output_string opt.Lv6MainArgs.oc (LicDump.const_decl elt const))
           )
-          this.types
-          []
-      in
-      List.iter(
-        List.iteri
-          (fun i (t,elt) -> 
-            let const = Lic.Int_const_eff (string_of_int i) in
-            output_string opt.Lv6MainArgs.oc (LicDump.const_decl elt const))
+          const_list;     
       )
-        const_list;     
-    )
-  
-    | Lv6MainArgs.AsEnum -> ()
+   | Lv6MainArgs.AsBool -> (
+     let const_list = to_const_list this.types in
+     List.iter
+       (fun l -> 
+        (List.iteri
+          (fun i (t,elt) -> 
+           let get_n x = (* returns the n s.t., 2^(n-1) < x <= 2^n *)
+             assert(x>0);
+             let rec f n acc = if x > acc then f (n+1) (2*acc) else n in
+             f 0 1
+           in
+           let size = get_n (List.length l) in
+           let bool_list = int_to_bool_array i size  in
+           let const = Lic.Array_const_eff 
+                         (List.map (fun b -> Lic.Bool_const_eff(b)) bool_list,
+                          Lic.Bool_type_eff)
+           in
+           output_string opt.Lv6MainArgs.oc (LicDump.const_decl elt const))
+        )
+          l)
+       const_list;     
+   )
+   | Lv6MainArgs.AsEnum -> ()
   );
   ItemKeyMap.iter
     (fun cn ce -> 
-      if (not Lv6MainArgs.global_opt.Lv6MainArgs.ec || Lic.is_extern_const ce) then
-        output_string opt.Lv6MainArgs.oc (LicDump.const_decl cn ce)
+     if (not Lv6MainArgs.global_opt.Lv6MainArgs.ec || Lic.is_extern_const ce) then
+       output_string opt.Lv6MainArgs.oc (LicDump.const_decl cn ce)
     )
     this.consts  ;
   if Lv6MainArgs.global_opt.Lv6MainArgs.ec then (
     (* in ec, we first need to declare the profile of extern nodes *)
     NodeKeyMap.iter 
       (fun (key,_) nexp -> (
-        if nexp.Lic.def_eff = Lic.ExternLic && Lv6Id.pack_of_long key <> "Lustre" then (
-          let str = (if nexp.Lic.has_mem_eff then "extern node " else "function ") ^
-              (Lv6Id.of_long key)^(LicDump.profile_of_node_exp_eff nexp)^".\n" 
-          in
-          output_string opt.Lv6MainArgs.oc (str);
-          flush opt.Lv6MainArgs.oc;
-        )))
+         if nexp.Lic.def_eff = Lic.ExternLic && Lv6Id.pack_of_long key <> "Lustre" then (
+           let str = (if nexp.Lic.has_mem_eff then "extern node " else "function ") ^
+                       (Lv6Id.of_long key)^(LicDump.profile_of_node_exp_eff nexp)^".\n" 
+           in
+           output_string opt.Lv6MainArgs.oc (str);
+           flush opt.Lv6MainArgs.oc;
+      )))
       this.nodes ;
-      
+    
     (* If no node is set a top-level, the compiler will compile every node. But the
        ec format only accepts one node (and no type nor const) 
        Hence we print the first one (if no main node is set).
-    *)
-      try 
-        NodeKeyMap.iter 
-          (fun (key,_) nexp -> (
-            match main_node with
-              | Some { Lv6Id.id_pack = None ; Lv6Id.id_id= name } -> 
-                if Lv6Id.of_long key = name && Lv6Id.pack_of_long key <> "Lustre" 
-                then raise (Print_me nexp)
-              | Some idref -> 
-                if Lv6Id.long_of_idref idref = key then raise (Print_me nexp)
-              | None -> (
-                match nexp.Lic.node_key_eff, nexp.Lic.def_eff with
-                (* only user or extern nodes with a body makes valid ec node *)
-                  | _, Lic.BodyLic _ -> raise (Print_me nexp)
-                  | _, Lic.ExternLic -> ()
-                  | _  -> ()
-              )
+     *)
+    try 
+      NodeKeyMap.iter 
+        (fun (key,_) nexp -> (
+           match main_node with
+           | Some { Lv6Id.id_pack = None ; Lv6Id.id_id= name } -> 
+              if Lv6Id.of_long key = name && Lv6Id.pack_of_long key <> "Lustre" 
+              then raise (Print_me nexp)
+           | Some idref -> 
+              if Lv6Id.long_of_idref idref = key then raise (Print_me nexp)
+           | None -> (
+             match nexp.Lic.node_key_eff, nexp.Lic.def_eff with
+             (* only user or extern nodes with a body makes valid ec node *)
+             | _, Lic.BodyLic _ -> raise (Print_me nexp)
+             | _, Lic.ExternLic -> ()
+             | _  -> ()
            )
-          )
-          this.nodes        
-      with Print_me nexp -> 
-        output_string opt.Lv6MainArgs.oc (LicDump.node_of_node_exp_eff nexp);
-        flush opt.Lv6MainArgs.oc;
+         )
+        )
+        this.nodes        
+    with Print_me nexp -> 
+      output_string opt.Lv6MainArgs.oc (LicDump.node_of_node_exp_eff nexp);
+      flush opt.Lv6MainArgs.oc;
   ) else (
     (* Pour les noeuds, pas sur que ça marche tant qu'on n'a
        pas séparés les transformations  source_to_source du LicTab:
@@ -252,16 +290,16 @@ let to_file (opt: Lv6MainArgs.t) (this:t) (main_node: Lv6Id.idref option) =
        modify (instanciate) the node profiles.
 
        On n'affiche PAS les extern Lustre::...
-    *)
+     *)
 
     NodeKeyMap.iter (
-      fun _ nexp ->
+        fun _ nexp ->
         match nexp.Lic.node_key_eff with
-          (* inutile d'écrire les noeuds predefs *)
-          | (("Lustre",_),[]) -> ()
-          | _ -> output_string opt.Lv6MainArgs.oc (LicDump.node_of_node_exp_eff nexp)
-    )
-      this.nodes
+        (* inutile d'écrire les noeuds predefs *)
+        | (("Lustre",_),[]) -> ()
+        | _ -> output_string opt.Lv6MainArgs.oc (LicDump.node_of_node_exp_eff nexp)
+      )
+                    this.nodes
   )
 
 (********************************************************************************)
diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml
index 8754fe70972accc6a11e015b3d2115282915ba94..da706928c9e257c794f6b814eb9db132a2cd9f09 100644
--- a/src/lv6MainArgs.ml
+++ b/src/lv6MainArgs.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/05/2016 (at 17:16) by Erwan Jahier> *)
+(* Time-stamp: <modified the 31/05/2016 (at 16:25) by Erwan Jahier> *)
 (*
 Le manager d'argument adapté de celui de lutin, plus joli
 N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global,
@@ -11,7 +11,7 @@ open Arg
 let tool_name = Lv6version.tool
 let usage_msg =  "usage: "^tool_name^" [options] <file> | "^tool_name^" -help"
 
-type enum_mode = AsInt | AsConst | AsEnum
+type enum_mode = AsInt | AsBool | AsConst | AsEnum 
 type io_transmit_mode = Stack | Heap | HeapStack
 type schedul_mode = Simple | Sort | Reorder
 
@@ -228,7 +228,9 @@ let (mkopt : t -> string list -> ?doc_level:doc_level -> ?arg:string -> Arg.spec
 (* utils *)
 let set_v4_options opt =
   global_opt.lv4 <- true;
-  global_opt.expand_enums <- AsConst; (* only override the default *)
+  (match global_opt.expand_enums with
+  | AsEnum -> global_opt.expand_enums <- AsConst; (* only override the default *)
+  | AsInt | AsConst | AsBool -> ());
   opt.inline_iterator <- true;
   opt.expand_arrays <- true
 
@@ -307,6 +309,11 @@ let mkoptab (opt:t) : unit = (
       (Arg.Unit (fun _ -> global_opt.expand_enums <- AsInt))
       [" Translate enums using integers (to be kind with data plotters)"]
     ;
+    mkopt opt ~doc_level:Advanced
+      ["-eeb"; "--expand-enums-as-bool"]
+      (Arg.Unit (fun _ -> global_opt.expand_enums <- AsBool))
+      [" Translate enums using boolean arrays (to be kind with model-checkers)"]
+    ;
     mkopt opt ~doc_level:Advanced
       ["-esa"; "--expand-structs-and-arrays"]
       (Arg.Unit (fun _ ->
diff --git a/src/lv6MainArgs.mli b/src/lv6MainArgs.mli
index f2f3b9de33c9d9059eec318bba4a67bceb5c9dad..46644ec52db699c51b7d79901c1e2639d95ee6a3 100644
--- a/src/lv6MainArgs.mli
+++ b/src/lv6MainArgs.mli
@@ -1,6 +1,7 @@
 
 type enum_mode = 
     AsInt  (* translate enums into int (for rif-friendlyness *)
+  | AsBool (* translate enums into bool arrays (for lesar-friendlyness *)
   | AsConst  (* translate enums into abstract const *)
   | AsEnum (* do nothing *)
 
diff --git a/src/lv6version.ml b/src/lv6version.ml
index b96cff686306c564a49ea62d3a58390eab956dbe..1fe6aa0ecb17a3bd7d351f008bb39cf37b1c5c53 100644
--- a/src/lv6version.ml
+++ b/src/lv6version.ml
@@ -1,7 +1,7 @@
 (** Automatically generated from Makefile *) 
 let tool = "lus2lic"
 let branch = "master"
-let commit = "650"
-let sha_1 = "61be1e6730e95ae2c3e8b5c83252cfd999ec10a1"
+let commit = "651"
+let sha_1 = "24ccb0f4ff3e7f6636441748533c1e5d41a5c06f"
 let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
 let maintainer = "jahier@imag.fr"
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index fff14e0f05090d3ca4439287c5a8c7dfc2e10f28..2737422f3692496cb788ffbd44574fb71c91decc 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,5 +1,5 @@
 ==> lus2lic0.sum <==
-Test Run By jahier on Mon May 30 17:25:11 
+Test Run By jahier on Tue May 31 16:27:05 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic0 tests ===
@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
 XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
 
 ==> lus2lic1.sum <==
-Test Run By jahier on Mon May 30 17:25:11 
+Test Run By jahier on Tue May 31 16:27:07 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic1 tests ===
@@ -396,7 +396,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus  {}
 
 ==> lus2lic2.sum <==
-Test Run By jahier on Mon May 30 17:25:27 
+Test Run By jahier on Tue May 31 16:27:23 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic2 tests ===
@@ -741,7 +741,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus  {}
 
 ==> lus2lic3.sum <==
-Test Run By jahier on Mon May 30 17:26:03 
+Test Run By jahier on Tue May 31 16:28:00 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic3 tests ===
@@ -1243,7 +1243,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec}
 PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
 
 ==> lus2lic4.sum <==
-Test Run By jahier on Mon May 30 17:26:15 
+Test Run By jahier on Tue May 31 16:28:13 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic4 tests ===
@@ -1764,14 +1764,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
 # of unexpected failures	4
 ===============================
 # Total number of failures: 23
-lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds
-lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 15 seconds
-lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 36 seconds
-lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 12 seconds
-lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 38 seconds
+lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
+lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 16 seconds
+lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 37 seconds
+lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 13 seconds
+lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 40 seconds
 * Ref time: 
-0.04user 0.02system 1:42.99elapsed 0%CPU (0avgtext+0avgdata 5180maxresident)k
-32inputs+0outputs (0major+5581minor)pagefaults 0swaps
+0.04user 0.05system 1:48.37elapsed 0%CPU (0avgtext+0avgdata 5168maxresident)k
+0inputs+0outputs (0major+5569minor)pagefaults 0swaps
 * Quick time (-j 4):
-0.03user 0.02system 0:47.98elapsed 0%CPU (0avgtext+0avgdata 5184maxresident)k
-32inputs+0outputs (0major+5638minor)pagefaults 0swaps
+0.04user 0.01system 0:49.25elapsed 0%CPU (0avgtext+0avgdata 5172maxresident)k
+64inputs+0outputs (0major+5573minor)pagefaults 0swaps