diff --git a/src/interpretation.ml b/src/interpretation.ml index 8aa6b79eacd39a418306c5dbebdfa2e3007ef296..2c47cbf9ac998caa21bba3e9dd6e9be85074e794 100644 --- a/src/interpretation.ml +++ b/src/interpretation.ml @@ -114,8 +114,8 @@ let const_real_of_float value = in Constant.ConstReal (Number.real_literal ~radix:10 ~neg ~int ~frac ~exp:None) -let term t = CRE.Value (Term t) -let int i = CRE.Value (Int i) +let value_term t = CRE.Value (Term t) +let value_int i = CRE.Value (Int i) let builtin_caisar : caisar_env CRE.built_in_theories list = let error_message ls = @@ -147,13 +147,13 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = ( term_of_caisar_op engine (Data (D_csv features)) ty_features, Term.t_int_const (BigInt.of_int (Int.of_string label)) ) in - term (Term.t_tuple [ t_features; t_label ]) + value_term (Term.t_tuple [ t_features; t_label ]) | Vector v -> let n = Option.value_exn (Language.lookup_vector v) in assert (List.length tl1 = n && i <= n); - term (List.nth_exn tl1 i) + value_term (List.nth_exn tl1 i) | Data _ | NeuralNetwork _ -> assert false) - | [ Term t1; Term t2 ] -> term (Term.t_app_infer ls [ t1; t2 ]) + | [ Term t1; Term t2 ] -> value_term (Term.t_app_infer ls [ t1; t2 ]) | _ -> invalid_arg (error_message ls) in let length : _ CRE.builtin = @@ -161,19 +161,19 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = match vl with | [ Term { t_node = Tapp (ls, []); _ } ] -> ( match caisar_op_of_ls engine ls with - | Dataset (DS_csv csv) -> int (BigInt.of_int (Csv.lines csv)) + | Dataset (DS_csv csv) -> value_int (BigInt.of_int (Csv.lines csv)) | Vector v -> - int (BigInt.of_int (Option.value_exn (Language.lookup_vector v))) - | Data (D_csv data) -> int (BigInt.of_int (List.length data)) + value_int (BigInt.of_int (Option.value_exn (Language.lookup_vector v))) + | Data (D_csv data) -> value_int (BigInt.of_int (List.length data)) | NeuralNetwork _ -> assert false) | [ Term { t_node = Tapp (ls, tl); _ } ] -> ( match caisar_op_of_ls engine ls with | Vector v -> let n = Option.value_exn (Language.lookup_vector v) in assert (List.length tl = n); - int (BigInt.of_int n) + value_int (BigInt.of_int n) | Dataset _ | Data _ | NeuralNetwork _ -> assert false) - | [ Term t ] -> term (Term.t_app_infer ls [ t ]) + | [ Term t ] -> value_term (Term.t_app_infer ls [ t ]) | _ -> invalid_arg (error_message ls) in let vminus : _ CRE.builtin = @@ -208,9 +208,9 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = (Term.t_app_infer minus [ tl; c ], ty_cst)) in let caisar_op = Vector (Language.create_vector env n) in - term (term_of_caisar_op ~args engine caisar_op ty) + value_term (term_of_caisar_op ~args engine caisar_op ty) | _ -> assert false) - | [ Term t1; Term t2 ] -> term (Term.t_app_infer ls [ t1; t2 ]) + | [ Term t1; Term t2 ] -> value_term (Term.t_app_infer ls [ t1; t2 ]) | _ -> invalid_arg (error_message ls) in let mapi : _ CRE.builtin = @@ -235,9 +235,9 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = Vector (Language.create_vector env n) in Eval (term_of_caisar_op ~args engine caisar_op ty) - | Dataset (DS_csv csv) -> int (BigInt.of_int (Csv.lines csv)) + | Dataset (DS_csv csv) -> value_int (BigInt.of_int (Csv.lines csv)) | Data _ | NeuralNetwork _ -> assert false) - | [ Term t1; Term t2 ] -> term (Term.t_app_infer ls [ t1; t2 ]) + | [ Term t1; Term t2 ] -> value_term (Term.t_app_infer ls [ t1; t2 ]) | _ -> invalid_arg (error_message ls) in @@ -261,13 +261,13 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = in NeuralNetwork nn in - term (term_of_caisar_op engine caisar_op ty) + value_term (term_of_caisar_op engine caisar_op ty) | _ -> invalid_arg (error_message ls) in let apply_neural_network : _ CRE.builtin = fun _engine ls vl _ty -> match vl with - | [ Term t1; Term t2 ] -> term (Term.t_app_infer ls [ t1; t2 ]) + | [ Term t1; Term t2 ] -> value_term (Term.t_app_infer ls [ t1; t2 ]) | _ -> invalid_arg (error_message ls) in @@ -285,7 +285,7 @@ let builtin_caisar : caisar_env CRE.built_in_theories list = let dataset = DS_csv (Csv.load filename) in Dataset dataset in - term (term_of_caisar_op engine caisar_op ty) + value_term (term_of_caisar_op engine caisar_op ty) | _ -> invalid_arg (error_message ls) in