X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Ftactics%2Fcontinuationals.ml;h=044fa45c841cb61e39ecfbe335a14e20937160ec;hb=ae1e6d714da0f555dfa9d7f1b0e9321278db12e5;hp=3ed167a71c3f7ab471d95c6c13027fac3f519ce1;hpb=7f2444c2670cadafddd8785b687ef312158376b0;p=helm.git diff --git a/components/tactics/continuationals.ml b/components/tactics/continuationals.ml index 3ed167a71..044fa45c8 100644 --- a/components/tactics/continuationals.ml +++ b/components/tactics/continuationals.ml @@ -72,7 +72,8 @@ struct let is_open = function _, Open _ -> true | _ -> false let close = function n, Open g -> n, Closed g | l -> l let filter_open = List.filter is_open - let is_fresh = function n, Open _ when n > 0 -> true | _ -> false + let is_fresh = + function n, Open _ when n > 0 -> true | _,Closed _ -> true | _ -> false let goal_of_loc = function _, Open g | _, Closed g -> g let goal_of_switch = function Open g | Closed g -> g let switch_of_loc = snd @@ -175,13 +176,10 @@ sig type output_status type tactic - - val id_tactic : tactic val mk_tactic : (input_status -> output_status) -> tactic val apply_tactic : tactic -> input_status -> output_status val goals : output_status -> goal list * goal list (** opened, closed goals *) - val set_goals: goal list * goal list -> output_status -> output_status val get_stack : input_status -> Stack.t val set_stack : Stack.t -> output_status -> output_status @@ -205,7 +203,8 @@ sig | Branch | Shift - | Pos of int + | Pos of int list + | Wildcard | Merge | Focus of goal list @@ -233,7 +232,8 @@ struct | Semicolon | Branch | Shift - | Pos of int + | Pos of int list + | Wildcard | Merge | Focus of goal list | Unfocus @@ -245,7 +245,8 @@ struct | Semicolon -> "Semicolon" | Branch -> "Branch" | Shift -> "Shift" - | Pos i -> "Pos " ^ string_of_int i + | Pos i -> "Pos " ^ (String.concat "," (List.map string_of_int i)) + | Wildcard -> "Wildcard" | Merge -> "Merge" | Focus gs -> sprintf "Focus [%s]" (String.concat "; " (List.map string_of_int gs)) @@ -270,7 +271,13 @@ struct match cmd, stack with | _, [] -> assert false | Tactical tac, (g, t, k, tag) :: s -> - if g = [] then fail (lazy "can't apply a tactic to zero goals"); +(* COMMENTED OUT TO ALLOW PARAMODULATION TO DO A + * auto paramodulation.try assumption. + * EVEN IF NO GOALS ARE LEFT OPEN BY AUTO. + + if g = [] then fail (lazy "can't apply a tactic to zero goals"); + +*) debug_print (lazy ("context length " ^string_of_int (List.length g))); let rec aux s go gc = function @@ -293,7 +300,7 @@ struct debug_print (lazy ("closed: " ^ String.concat " " (List.map string_of_int gcn))); let stack = - (zero_pos gon, t @~- gcn, k @~- gon, tag) :: deep_close gcn s + (zero_pos gon, t @~- gcn, k @~- gcn, tag) :: deep_close gcn s in sn, stack | Dot, ([], _, [], _) :: _ -> @@ -318,21 +325,22 @@ struct | [] -> fail (lazy "no more goals to shift") | loc :: loc_tl -> new_stack - (([ loc ], t @+ filter_open g, [],`BranchTag) + (([ loc ], t @+ filter_open g @+ k, [],`BranchTag) :: (loc_tl, t', k', tag) :: s)) | Shift, _ -> fail (lazy "can't shift goals here") - | Pos i, ([ loc ], [], [],`BranchTag) :: (g', t', k', tag) :: s + | Pos i_s, ([ loc ], t, [],`BranchTag) :: (g', t', k', tag) :: s when is_fresh loc -> - let loc_i, g' = extract_pos i g' in - new_stack - (([ loc_i ], [], [],`BranchTag) - :: ([ loc ] @+ g', t', k', tag) :: s) - | Pos i, (g, t, k,`BranchTag) :: (g', t', k', tag) :: s -> - let loc_i, g' = extract_pos i g' in + let l_js = List.filter (fun (i, _) -> List.mem i i_s) ([loc] @+ g') in new_stack - (([ loc_i ], [], [],`BranchTag) - :: (g', t' @+ filter_open g, k', tag) :: s) + ((l_js, t , [],`BranchTag) + :: (([ loc ] @+ g') @- l_js, t', k', tag) :: s) | Pos _, _ -> fail (lazy "can't use relative positioning here") + | Wildcard, ([ loc ] , t, [], `BranchTag) :: (g', t', k', tag) :: s + when is_fresh loc -> + new_stack + (([loc] @+ g', t, [], `BranchTag) + :: ([], t', k', tag) :: s) + | Wildcard, _ -> fail (lazy "can't use wildcard here") | Merge, (g, t, k,`BranchTag) :: (g', t', k', tag) :: s -> new_stack ((t @+ filter_open g @+ g' @+ k, t', k', tag) :: s) | Merge, _ -> fail (lazy "can't merge goals here")