Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Folschette Maxime
Hoare-fol
Commits
780500f6
Commit
780500f6
authored
Oct 25, 2012
by
Maxime Folschette
Browse files
Remove more commented code
parent
cf826654
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.ml
View file @
780500f6
...
...
@@ -532,13 +532,6 @@ struct
replace_formula
f
v
e
;;
(** Conversion d'une expression en chaîne de caractères pour ASP *)
(* let rec asp_of_expr s =
let paramlist = List.fold_right (fun v l -> (powerset_sort (BRNinfo.getpredec v) BRN.multcompare) :: l) BRN.varlist [] in
function
| ExprBin(op, e1, e2) -> ("(" ^ (asp_of_expr e1) ^ (asp_of_exprop2 op) ^ (asp_of_expr e2) ^ ")")
| ExprVar(v) -> BRN.asp_of_var v (* TODO: Énumération préalable des variables ? *)
| ExprParam(v, l) -> ("K_" ^ BRN.asp_of_var v ^ "_" ^ (string_of_int (index (List.nth paramlist (index BRN.varlist v)) (List.sort BRN.multcompare l))))
| ExprConst(i) -> string_of_int i ;; *)
let
rec
asp_of_state_expr
s
=
let
paramlist
=
List
.
fold_right
(
fun
v
l
->
(
powerset_sort
(
BRNinfo
.
getpredec
v
)
BRN
.
multcompare
)
::
l
)
BRN
.
varlist
[]
in
function
...
...
@@ -642,7 +635,7 @@ struct
let
phi
v
omega
=
let
rec
phi_eval
v
l
omega
=
match
l
with
|
[]
->
PropConst
True
(*raise (Invalid_argument "phi_eval: Empty l list for phi_eval")*)
|
[]
->
PropConst
True
|
h
::
[]
->
if
(
mem
h
omega
)
then
formula_of_multformula
(
BRNinfo
.
getformula
h
)
else
PropUn
(
Neg
,
formula_of_multformula
(
BRNinfo
.
getformula
h
))
...
...
@@ -700,9 +693,6 @@ struct
let
asp_of_state_param
p
=
let
(
v
,
n
)
=
p
in
"K_"
^
(
asp_of_var
v
)
^
"_"
^
(
string_of_int
n
)
in
let
param_enum_var
v
=
List
.
fold_right
(
fun
n
l
->
(
v
,
n
)
::
l
)
(
from_up_to
0
((
power
2
(
List
.
length
(
BRNinfo
.
getpredec
v
)))
-
1
))
[]
in
let
param_enum
=
List
.
fold_right
(
fun
v
l
->
(
param_enum_var
v
)
@
l
)
BRN
.
varlist
[]
in
(* let vars_enum s = ((string_of_list (asp_of_state_var s) "," BRN.varlist) ^ "," ^ (string_of_list (asp_of_state_param s) "," param_enum)) in *)
(* let hard_state_enum s = ((if s = 0 then "main_" else "") ^ "state(" ^ (vars_enum s) ^ ")") in
let soft_state_enum s = if s = 0 then "" else ("state(" ^ (string_of_list (asp_of_state_var s) "," BRN.varlist) ^ ")") ^ ", " in *)
let
state_enum
s
=
((
if
s
=
0
then
"main_"
else
""
)
^
"state("
^
(
string_of_list
(
asp_of_state_var
s
)
","
BRN
.
varlist
)
^
")"
)
in
let
soft_state_enum
s
=
if
s
=
0
then
""
else
((
state_enum
s
)
^
", "
)
in
let
params_enum
=
(
"params("
^
(
string_of_list
asp_of_state_param
","
param_enum
)
^
")"
)
in
...
...
@@ -769,24 +759,7 @@ struct
output_string
out
(
string_of_list
(
fun
c
->
let
(
v
,
n
)
=
c
in
"param_"
^
(
asp_of_var
v
)
^
"_"
^
(
string_of_int
n
)
^
"(K_"
^
(
asp_of_var
v
)
^
"_"
^
(
string_of_int
n
)
^
")"
)
", "
param_enum
)
;
output_string
out
".
\n\n
"
;
(* output_string out ((hard_state_enum 0) ^ " :- ") ;
List.iter (fun v -> output_string out ("var_" ^ (asp_of_var v) ^ "(" ^ (asp_of_var v) ^ "), ")) BRN.varlist ;
output_string out (string_of_list
(fun c -> let (v, n) = c in "param_" ^ (asp_of_var v) ^ "_" ^ (string_of_int n) ^ "(K_" ^ (asp_of_var v) ^ "_" ^ (string_of_int n) ^ ")")
", " param_enum) ;
output_string out ".\n\n" ; *)
(* output_string out ("state(" ^ (string_of_list (asp_of_state_var 0) "," BRN.varlist) ^ ") :- ") ;
output_string out (string_of_list (fun v -> "varbound_" ^ (asp_of_var v) ^ "(" ^ (asp_of_var v) ^ ")") ", " BRN.varlist) ;
(* List.iter (fun v -> output_string out ("varbound_" ^ (asp_of_var v) ^ "(" ^ (asp_of_var v) ^ "), ")) BRN.varlist ; *)
(* output_string out (string_of_list
(fun c -> let (v, n) = c in "param_" ^ (asp_of_var v) ^ "_" ^ (string_of_int n) ^ "(K_" ^ (asp_of_var v) ^ "_" ^ (string_of_int n) ^ ")")
", " param_enum) ; *)
output_string out ".\n\n" ; in *)
in
output_string
out
".
\n\n
"
in
let
write_footer
out
=
output_string
out
(
"
\n
#hide.
\n
#show main_state/"
^
(
string_of_int
(
List
.
length
BRN
.
varlist
))
^
".
\n
#show params/"
^
(
string_of_int
(
List
.
length
param_enum
))
^
".
\n\n
"
)
in
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment