Commit c0d31633 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

allow exponentials in foltl expressions

parent 316968b6
...@@ -178,6 +178,10 @@ foltl_expression(E * F) :- ...@@ -178,6 +178,10 @@ foltl_expression(E * F) :-
foltl_expression(E), foltl_expression(E),
foltl_expression(F). foltl_expression(F).
foltl_expression(E ^ F) :-
foltl_expression(E),
foltl_expression(F).
foltl_expression(E / F) :- foltl_expression(E / F) :-
foltl_expression(E), foltl_expression(E),
foltl_expression(F). foltl_expression(F).
...@@ -888,6 +892,14 @@ generate_expression(A) :- ...@@ -888,6 +892,14 @@ generate_expression(A) :-
!, !,
format('(*i)[~d]', [Index]). format('(*i)[~d]', [Index]).
generate_expression(A^B) :-
!,
write('pow('),
generate_expression(A),
write(', '),
generate_expression(B),
write(')').
generate_expression(Expression) :- generate_expression(Expression) :-
binary_operator(Expression, A, Op, B), binary_operator(Expression, A, Op, B),
!, !,
...@@ -953,6 +965,21 @@ check_linearity_expression(Expression) :- ...@@ -953,6 +965,21 @@ check_linearity_expression(Expression) :-
true true
). ).
check_linearity_expression(Expression) :-
Expression = A ^ B,
!,
(
(
has_variable(A)
;
has_variable(B)
)
->
throw(error(not_linear(Expression)))
;
true
).
check_linearity_expression(Expression) :- check_linearity_expression(Expression) :-
Expression = A / B, Expression = A / B,
!, !,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment