33
44namespace howto {
55
6- pred main-trm i:term, i:string, i:int.
6+ pred main-trm i:term, i:string, i:option int.
77main-trm T STgt Depth :- coq.term->gref T GR, main-gref GR STgt Depth.
88
9- pred main-str i:string, i:string, i:int.
9+ pred main-str i:string, i:string, i:option int.
1010main-str S STgt Depth :- coq.locate S GR, main-gref GR STgt Depth.
1111
12- pred main-gref i:gref, i:string, i:int.
12+ pred main-gref i:gref, i:string, i:option int.
1313main-gref GR STgt Depth :- class-def (class _ GR _), !,
1414 private.mixins-in-structures [GR] MLSrc,
1515 main-from MLSrc STgt Depth.
@@ -18,15 +18,23 @@ main-gref GR STgt Depth :-
1818 private.mixins-in-structures SL MLSrc,
1919 main-from MLSrc STgt Depth.
2020
21- pred main-from i:list mixinname, i:string, i:int.
21+ pred main-from i:list mixinname, i:string, i:option int.
2222main-from MLSrc STgt Depth :-
2323 private.mixins-in-structures [{coq.locate STgt}] MLTgt,
2424 private.list-diff MLTgt MLSrc ML,
25- if (ML = []) (coq.say "HB: nothing to do.")
26- (private.paths-from-for-step MLSrc ML Depth R,
27- if (R = [])
28- (coq.error "HB: no solution found, try to increase search depth.")
29- (private.pp-solutions R)).
25+ if (ML = []) (coq.say "HB: nothing to do.") (main-from.aux MLSrc ML Depth).
26+ main-from.aux MLSrc ML (some Depth) :- main-increase-depth MLSrc ML Depth false.
27+ main-from.aux MLSrc ML none :- main-increase-depth MLSrc ML 3 true.
28+
29+ pred main-increase-depth i:list mixinname, i:list mixinname, i:int, i:prop.
30+ main-increase-depth MLSrc ML Depth AutoIncrease :-
31+ private.paths-from-for-step MLSrc ML Depth R,
32+ if (not (R = [])) (private.pp-solutions R)
33+ (if AutoIncrease
34+ (Depth' is Depth + 1,
35+ coq.say "HB: no solution found at depth" Depth "looking at depth" Depth',
36+ main-increase-depth MLSrc ML Depth' true)
37+ (coq.error "HB: no solution found, try to increase search depth.")).
3038
3139
3240/* ------------------------------------------------------------------------- */
0 commit comments