-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmi.pl
More file actions
28 lines (19 loc) · 842 Bytes
/
mi.pl
File metadata and controls
28 lines (19 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mi(Goal) :-
prolog_current_choice(ChoicePoint), % Choice point identified
mi(Goal, ChoicePoint).
mi(true, _) :- !.
mi(!, ChoicePoint) :-
prolog_cut_to(ChoicePoint). % Ancestral (choice point) cut
mi(Goal, _) :-
Goal \= (_, _), Goal \= (_; _), Goal \= (_ -> _),
predicate_property(Goal, built_in), !, call(Goal).
mi(Goal, _) :-
Goal \= (_, _), Goal \= (_; _), Goal \= (_ -> _),
prolog_current_choice(ChoicePoint), % Choice point identified
clause(Goal, Body),
mi(Body, ChoicePoint).
mi((A, B), ChoicePoint) :- mi(A, ChoicePoint), mi(B, ChoicePoint).
mi((A -> B), ChoicePoint) :- mi(A), !, mi(B, ChoicePoint).
mi((A -> B; _), ChoicePoint) :- mi(A), !, mi(B, ChoicePoint).
mi((_ -> _; C), ChoicePoint) :- !, mi(C, ChoicePoint).
mi((A; B), ChoicePoint) :- mi(A, ChoicePoint); mi(B, ChoicePoint).