syntaxelement(truth, [], [], [], [], pred).
syntaxelement(falsity, [], [], [], [], pred).
syntaxelement(unknown_truth_value(Msg),[], [], [], Msg, pred). % artificial, e.g., created by well_def_analyser
syntaxelement(conjunct(A,B), [A,B],[], [], [], pred).
syntaxelement(negation(A), [A], [], [], [], pred).
syntaxelement(disjunct(A,B), [A,B],[], [], [], pred).
syntaxelement(implication(A,B), [A,B],[], [], [], pred).
syntaxelement(equivalence(A,B), [A,B],[], [], [], pred).
syntaxelement(equal(A,B), [A,B],[], [], [], pred).
syntaxelement(not_equal(A,B), [A,B],[], [], [], pred).
syntaxelement(member(A,B), [A,B],[], [], [], pred).
syntaxelement(not_member(A,B), [A,B],[], [], [], pred).
syntaxelement(subset(A,B), [A,B],[], [], [], pred).
syntaxelement(subset_strict(A,B), [A,B],[], [], [], pred).
syntaxelement(not_subset(A,B), [A,B],[], [], [], pred).
syntaxelement(not_subset_strict(A,B),[A,B],[], [], [], pred).
syntaxelement(less_equal(A,B), [A,B],[], [], [], pred).
syntaxelement(less(A,B), [A,B],[], [], [], pred).
syntaxelement(less_equal_real(A,B), [A,B],[], [], [], pred).
syntaxelement(less_real(A,B), [A,B],[], [], [], pred).
syntaxelement(greater_equal(A,B), [A,B],[], [], [], pred).
syntaxelement(greater(A,B), [A,B],[], [], [], pred).
syntaxelement(forall(Ids,D,P), [D,P|Ids],Ids,[Ids], [], pred).
syntaxelement(exists(Ids,P), [P|Ids], Ids,[Ids], [], pred).
syntaxelement(finite(A), [A], [], [], [], pred/only_typecheck).
syntaxelement(partition(S,Es), [S|Es],[],[Es],[],pred).
syntaxelement(kodkod(PId,Ids), Ids,[],[Ids],PId, pred).
syntaxelement(external_pred_call(F,Args),Args,[],[Args],F,pred).
syntaxelement(value(V), [], [], [], V, expr).
syntaxelement(operation_call_in_expr(Id,As), As, [], [As], Id, expr). % Do not treat Id as a sub-expression for find_identifier_uses, ...
syntaxelement(boolean_true, [], [], [], [], expr).
syntaxelement(boolean_false, [], [], [], [], expr).
syntaxelement(max_int, [], [], [], [], expr).
syntaxelement(min_int, [], [], [], [], expr).
syntaxelement(empty_set, [], [], [], [], expr).
syntaxelement(bool_set, [], [], [], [], expr).
syntaxelement(float_set, [], [], [], [], expr).
syntaxelement(real(I), [], [], [], I, expr).
syntaxelement(real_set, [], [], [], [], expr).
syntaxelement(string_set, [], [], [], [], expr).
syntaxelement(convert_bool(A), [A], [], [], [], expr).
syntaxelement(convert_real(A), [A], [], [], [], expr).
syntaxelement(convert_int_floor(A), [A], [], [], [], expr).
syntaxelement(convert_int_ceiling(A), [A], [], [], [], expr).
syntaxelement(add(A,B), [A,B],[], [], [], expr).
syntaxelement(add_real(A,B), [A,B],[], [], [], expr).
syntaxelement(minus(A,B), [A,B],[], [], [], expr).
syntaxelement(minus_real(A,B), [A,B],[], [], [], expr).
syntaxelement(minus_or_set_subtract(A,B),[A,B],[], [], [], expr/only_typecheck).
syntaxelement(unary_minus(A), [A], [], [], [], expr).
syntaxelement(unary_minus_real(A), [A], [], [], [], expr).
syntaxelement(multiplication(A,B), [A,B],[], [], [], expr).
syntaxelement(multiplication_real(A,B),[A,B],[], [], [], expr).
syntaxelement(mult_or_cart(A,B), [A,B],[], [], [], expr/only_typecheck).
syntaxelement(cartesian_product(A,B), [A,B],[], [], [], expr).
syntaxelement(div(A,B), [A,B],[], [], [], expr).
syntaxelement(div_real(A,B), [A,B],[], [], [], expr).
syntaxelement(floored_div(A,B), [A,B],[], [], [], expr).
syntaxelement(modulo(A,B), [A,B],[], [], [], expr).
syntaxelement(power_of(A,B), [A,B],[], [], [], expr).
syntaxelement(power_of_real(A,B), [A,B],[], [], [], expr).
syntaxelement(successor, [], [], [], [], expr).
syntaxelement(predecessor, [], [], [], [], expr).
syntaxelement(max(A), [A], [], [], [], expr).
syntaxelement(max_real(A), [A], [], [], [], expr).
syntaxelement(min(A), [A], [], [], [], expr).
syntaxelement(min_real(A), [A], [], [], [], expr).
syntaxelement(card(A), [A], [], [], [], expr).
syntaxelement(couple(A,B), [A,B],[], [], [], expr).
syntaxelement(pow_subset(A), [A], [], [], [], expr).
syntaxelement(pow1_subset(A), [A], [], [], [], expr).
syntaxelement(fin_subset(A), [A], [], [], [], expr).
syntaxelement(fin1_subset(A), [A], [], [], [], expr).
syntaxelement(interval(A,B), [A,B],[], [], [], expr).
syntaxelement(union(A,B), [A,B],[], [], [], expr).
syntaxelement(intersection(A,B), [A,B],[], [], [], expr).
syntaxelement(set_subtraction(A,B), [A,B],[], [], [], expr).
syntaxelement(general_union(A), [A], [], [], [], expr).
syntaxelement(general_intersection(A), [A] , [], [], [], expr).
syntaxelement(relations(A,B), [A,B],[], [], [], expr).
syntaxelement(identity(A), [A], [], [], [], expr).
syntaxelement(event_b_identity, [], [], [], [], expr). % for Rodin 1.0, TO DO: Daniel please check
syntaxelement(reverse(A), [A], [], [], [], expr).
syntaxelement(first_projection(A,B), [A,B],[], [], [], expr/only_typecheck).
syntaxelement(first_of_pair(A), [A], [], [], [], expr).
syntaxelement(event_b_first_projection(A),[A], [], [], [], expr/only_typecheck).
syntaxelement(event_b_first_projection_v2,[], [], [], [], expr/only_typecheck). % for Rodin 1.0, TO DO: Daniel please check
syntaxelement(second_projection(A,B), [A,B],[], [], [], expr/only_typecheck).
syntaxelement(event_b_second_projection_v2,[], [], [], [], expr/only_typecheck). % for Rodin 1.0, TO DO: Daniel please check
syntaxelement(second_of_pair(A), [A], [], [], [], expr).
syntaxelement(event_b_second_projection(A),[A], [], [], [], expr/only_typecheck).
syntaxelement(composition(A,B), [A,B],[], [], [], expr).
syntaxelement(ring(A,B), [A,B],[], [], [], expr/only_typecheck).
syntaxelement(direct_product(A,B), [A,B],[], [], [], expr).
syntaxelement(parallel_product(A,B), [A,B],[], [], [], expr).
syntaxelement(trans_function(A), [A], [], [], [], expr).
syntaxelement(trans_relation(A), [A], [], [], [], expr).
syntaxelement(iteration(A,B), [A,B],[], [], [], expr).
syntaxelement(reflexive_closure(A), [A], [], [], [], expr).
syntaxelement(closure(A), [A], [], [], [], expr).
syntaxelement(domain(A), [A], [], [], [], expr).
syntaxelement(range(A), [A], [], [], [], expr).
syntaxelement(image(A,B), [A,B],[], [], [], expr).
syntaxelement(domain_restriction(A,B), [A,B],[], [], [], expr).
syntaxelement(domain_subtraction(A,B), [A,B],[], [], [], expr).
syntaxelement(range_restriction(A,B), [A,B],[], [], [], expr).
syntaxelement(range_subtraction(A,B), [A,B],[], [], [], expr).
syntaxelement(overwrite(A,B), [A,B],[], [], [], expr).
syntaxelement(partial_function(A,B), [A,B],[], [], [], expr).
syntaxelement(total_function(A,B), [A,B],[], [], [], expr).
syntaxelement(partial_injection(A,B), [A,B],[], [], [], expr).
syntaxelement(total_injection(A,B), [A,B],[], [], [], expr).
syntaxelement(partial_surjection(A,B), [A,B],[], [], [], expr).
syntaxelement(total_surjection(A,B), [A,B],[], [], [], expr).
syntaxelement(total_bijection(A,B), [A,B],[], [], [], expr).
syntaxelement(partial_bijection(A,B), [A,B],[], [], [], expr).
syntaxelement(total_relation(A,B), [A,B],[], [], [], expr).
syntaxelement(surjection_relation(A,B),[A,B],[], [], [], expr).
syntaxelement(total_surjection_relation(A,B),[A,B],[], [], [], expr).
syntaxelement(seq(A), [A], [], [], [], expr).
syntaxelement(seq1(A), [A], [], [], [], expr).
syntaxelement(iseq(A), [A], [], [], [], expr).
syntaxelement(iseq1(A), [A], [], [], [], expr).
syntaxelement(perm(A), [A], [], [], [], expr).
syntaxelement(empty_sequence, [], [], [], [], expr).
syntaxelement(size(A), [A], [], [], [], expr).
syntaxelement(first(A), [A], [], [], [], expr).
syntaxelement(last(A), [A], [], [], [], expr).
syntaxelement(front(A), [A], [], [], [], expr).
syntaxelement(tail(A), [A], [], [], [], expr).
syntaxelement(rev(A), [A], [], [], [], expr).
syntaxelement(concat(A,B), [A,B],[], [], [], expr).
syntaxelement(insert_front(A,B), [A,B],[], [], [], expr).
syntaxelement(insert_tail(A,B), [A,B],[], [], [], expr).
syntaxelement(restrict_front(A,B), [A,B],[], [], [], expr).
syntaxelement(restrict_tail(A,B), [A,B],[], [], [], expr).
syntaxelement(general_concat(A), [A], [], [], [], expr).
syntaxelement(function(A,B), [A,B],[], [], [], expr).
syntaxelement(external_function_call(F,Args),Args,[],[Args],F,expr).
syntaxelement(identifier(I), [], [], [], I, expr).
syntaxelement(lazy_lookup_expr(I), [], [], [], I, expr).
syntaxelement(lazy_lookup_pred(I), [], [], [], I, pred).
syntaxelement(integer(I), [], [], [], I, expr).
syntaxelement(integer_set(T), [], [], [], T, expr).
syntaxelement(string(S), [], [], [], S, expr).
syntaxelement(set_extension(L), L, [], [L], [], expr).
syntaxelement(sequence_extension(L), L, [], [L], [], expr).
syntaxelement(comprehension_set(Ids,P),[P|Ids], Ids,[Ids], [], expr).
syntaxelement(event_b_comprehension_set(Ids,E,P),[E,P|Ids], Ids,[Ids], [], expr/only_typecheck).
syntaxelement(lambda(Ids,P,E), [P,E|Ids],Ids,[Ids], [], expr).
syntaxelement(general_sum(Ids,P,E), [P,E|Ids],Ids,[Ids], [], expr).
syntaxelement(general_product(Ids,P,E), [P,E|Ids],Ids,[Ids], [], expr).
syntaxelement(quantified_union(Ids,P,E), [P,E|Ids],Ids,[Ids], [], expr).
syntaxelement(quantified_intersection(Ids,P,E), [P,E|Ids],Ids,[Ids], [], expr).
syntaxelement(struct(Rec), [Rec], [], [], [], expr).
syntaxelement(rec(Fields), FContent, [], [FContent], FNames, expr) :- syntaxfields(Fields,FContent, FNames).
syntaxelement(record_field(R,I), [R], [], [], I, expr).
syntaxelement(assertion_expression(Cond,ErrMsg,Expr), [Cond,Expr], [], [], ErrMsg, expr).
syntaxelement(typeset, [], [], [], [], expr/only_typecheck).
syntaxelement(tree(A), [A], [], [], [], expr).
syntaxelement(btree(A), [A], [], [], [], expr).
syntaxelement(const(A,B), [A,B],[], [], [], expr).
syntaxelement(top(A), [A], [], [], [], expr).
syntaxelement(sons(A), [A], [], [], [], expr).
syntaxelement(prefix(A), [A], [], [], [], expr).
syntaxelement(postfix(A), [A], [], [], [], expr).
syntaxelement(sizet(A), [A], [], [], [], expr).
syntaxelement(mirror(A), [A], [], [], [], expr).
syntaxelement(rank(A,B), [A,B],[], [], [], expr).
syntaxelement(father(A,B), [A,B],[], [], [], expr).
syntaxelement(son(A,B,C), [A,B,C],[], [], [], expr).
syntaxelement(subtree(A,B), [A,B],[], [], [], expr).
syntaxelement(arity(A,B), [A,B],[], [], [], expr).
syntaxelement(bin(A), [A],[], [], [], expr).
syntaxelement(bin(A,B,C), [A,B,C],[], [], [], expr).
syntaxelement(infix(A), [A], [], [], [], expr).
syntaxelement(left(A), [A], [], [], [], expr).
syntaxelement(right(A), [A], [], [], [], expr).
syntaxelement(skip, [], [], [], [], subst).
syntaxelement(precondition(A,B), [A,B],[], [], [], subst).
syntaxelement(assertion(A,B), [A,B],[], [], [], subst).
syntaxelement(witness_then(A,B), [A,B],[], [], [], subst).
syntaxelement(if_elsif(A,B), [A,B],[], [], [], subst/elsif).
syntaxelement(while(A,B,C,D), [A,B,C,D],[], [], [], subst).
syntaxelement(while1(A,B,C,D,E), [A,B,C,D],[], [], E, subst).
syntaxelement(select_when(A,B), [A,B],[], [], [], subst/when).
syntaxelement(block(S),[S],[],[],[], subst/only_typecheck).
syntaxelement(assign(Lhs,Rhs),Exprs,[],[Lhs,Rhs], [], subst) :- append(Lhs,Rhs,Exprs).
syntaxelement(assign_single_id(Id,Rhs),[Id,Rhs],[],[], [], subst).
syntaxelement(any(Ids,P,S),[P,S|Ids],Ids,[Ids], [], subst).
syntaxelement(var(Ids,S), [S|Ids], Ids,[Ids], [], subst).
syntaxelement(if(Ifs), Ifs, [], [Ifs], [], subst).
syntaxelement(parallel(Ss), Ss, [], [Ss], [], subst).
syntaxelement(sequence(Ss), Ss, [], [Ss], [], subst).
syntaxelement(becomes_element_of(Ids,E), [E|Ids], [], [Ids], [], subst).
syntaxelement(becomes_such(Ids,P), [P|Ids], [], [Ids], [], subst). % Ids are new value, Ids$0 is old value
syntaxelement(evb2_becomes_such(Ids,P), [P|Ids], [], [Ids], [], subst/only_typecheck).
syntaxelement(let(Ids,P,S), [P,S|Ids], Ids, [Ids], [], subst).
syntaxelement(operation_call(Id,Rs,As), [Id|Exprs], [], [Rs,As], [], subst) :- append(Rs,As,Exprs).
syntaxelement(case(E,Eithers,Else), [E,Else|Eithers], [], [Eithers], [], subst).
syntaxelement(case_or(Es,S), [S|Es], [], [Es], [], subst/caseor).
syntaxelement(choice(Ss), Ss, [], [Ss], [], subst).
syntaxelement(select(Whens), Whens, [], [Whens], [], subst).
syntaxelement(select(Whens,Else), [Else|Whens], [], [Whens], [], subst).
syntaxelement(operation(I,Rs,As,B), [I,B|Ids], Ids, [Rs,As], [], subst) :- append(Rs,As,Ids).
syntaxelement(external_subst_call(F,Args),Args,[],[Args],F,subst).
syntaxelement(values_entry(I,E),[I,E],[],[],[],values_entry).
syntaxelement(rlevent(I,Sec,St,Ps,G,Ts,As,VWs,PWs,Ums,Rs), Subs, [], [Ps,Ts,As,VWs,PWs,Ums,Rs], [I,Sec], subst) :-
append([[St],Ps,[G],Ts,As,VWs,PWs,Ums,Rs],Subs).
syntaxelement(witness(I,P), [I,P], [], [], [], witness).
syntaxelement(let_predicate(Ids,As,Pred), Exprs, Ids, [Ids,As], [], pred) :- append([Ids,As,[Pred]],Exprs).
syntaxelement(let_expression(Ids,As,Expr), Exprs, Ids, [Ids,As], [], expr) :- append([Ids,As,[Expr]],Exprs).
syntaxelement(let_expression_global(Ids,As,Expr), Exprs, Ids, [Ids,As], [], expr) :- % version used by b_compiler
append([Ids,As,[Expr]],Exprs).
syntaxelement(lazy_let_expr(TID,A,Expr), [TID, A, Expr], [TID], [[TID],[A]], [], expr).
syntaxelement(lazy_let_pred(TID,A,Expr), [TID, A, Expr], [TID], [[TID],[A]], [], pred).
syntaxelement(lazy_let_subst(TID,A,Expr), [TID, A, Expr], [TID], [[TID],[A]], [], subst).
syntaxelement(if_then_else(If,Then,Else),[If,Then,Else], [], [], [], expr).
syntaxelement(compaction(A), [A], [], [], [], expr).
syntaxelement(mu(A), [A], [], [], [], expr).
syntaxelement(bag_items(A), [A], [], [], [], expr).
syntaxelement(freetype_set(Id), [], [], [], Id, expr).
syntaxelement(freetype_case(Type,Case,Expr), [Expr], [], [], [Type,Case], pred).
syntaxelement(freetype_constructor(Type,Case,Expr), [Expr], [], [], [Type,Case], expr).
syntaxelement(freetype_destructor(Type,Case,Expr), [Expr], [], [], [Type,Case], expr).
syntaxelement(ordinary, [], [], [], [], status).
syntaxelement(anticipated(Variant), [Variant], [], [], [], status).
syntaxelement(convergent(Variant), [Variant], [], [], [], status).
syntaxelement(recursive_let(Id,C),[Id,C],[Id],[],[], expr). % Note: Id is not really introduced !