File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -800,3 +800,20 @@ let trace_diseq : goal = fun st ->
800800 Format. printf " %a\n %!" Disequality. pp (State. constraints st) ;
801801 success st
802802
803+ IFDEF NON_ABSTRACT_GOAL THEN
804+ let reify_in_state st reifier x =
805+ let env = State. env st in
806+ let subst = State. subst st in
807+ reifier (State. env st) (Subst. reify env subst x |> Obj. magic)
808+
809+ let is_ground v st cb =
810+ let ans = Subst. reify (State. env st) (State. subst st) v in
811+ cb (not (Term. is_var ans))
812+
813+ let is_ground_bool
814+ : bool ilogic -> State.t -> onvar:(unit->unit) -> on_ground:(bool -> unit) -> unit =
815+ fun v st ~onvar ~on_ground ->
816+ let ans = Subst. reify (State. env st) (State. subst st) (Obj. magic v) in
817+ if (Term. is_var ans) then onvar()
818+ else on_ground (Obj. magic ans : bool )
819+ END
Original file line number Diff line number Diff line change 330330val reify_in_empty : ('a , 'b ) Reifier .t -> 'a -> 'b
331331
332332val trace_diseq : goal
333+
334+ IFDEF NON_ABSTRACT_GOAL THEN
335+ val reify_in_state : State .t -> ('a , 'b ) Reifier .t -> 'a -> 'b
336+
337+ val is_ground : 'a ilogic -> State .t -> (bool -> unit ) -> unit
338+
339+ val is_ground_bool : bool ilogic -> State .t -> onvar :(unit ->unit ) -> on_ground :(bool -> unit ) -> unit
340+
341+ END
Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ let is_box t =
123123 t < = Obj. last_non_constant_constructor_tag &&
124124 t > = Obj. first_non_constant_constructor_tag
125125
126+ let is_var x =
127+ let x = Obj. repr x in
128+ let tx = Obj. tag x in
129+ is_box tx && Var. has_var_structure tx (Obj. size x) x
130+ ;;
131+
126132let is_int = (= ) Obj. int_tag
127133let is_str = (= ) Obj. string_tag
128134let is_dbl = (= ) Obj. double_tag
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ val pp : Format.formatter -> t -> unit
8181(* [var x] if [x] is logic variable returns it, otherwise returns [None] *)
8282val var : 'a -> Var .t option
8383
84+ val is_var : 'a -> bool
85+
8486(* [map ~fvar ~fval x] map over OCaml's value extended with logic variables;
8587 * handles primitive types with the help of [fval] and logic variables with the help of [fvar]
8688 *)
You can’t perform that action at this time.
0 commit comments