X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Ftactics%2Fcontinuationals.ml;h=183e8cabf8899e146be6d7ad929fe4107ee85a28;hb=f9abd21eb0d26cf9b632af4df819225be4d091e3;hp=eeff9f9bf537783b0e859cfc686cbd0e09aa41b9;hpb=17974f325b94010f784b745d481bbd343ba59bb1;p=helm.git diff --git a/helm/software/components/tactics/continuationals.ml b/helm/software/components/tactics/continuationals.ml index eeff9f9bf..183e8cabf 100644 --- a/helm/software/components/tactics/continuationals.ml +++ b/helm/software/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 @@ -116,6 +117,10 @@ struct let of_metasenv metasenv = let goals = List.map (fun (g, _, _) -> g) metasenv in [ zero_pos goals, [], [], `NoTag ] + + let of_nmetasenv metasenv = + let goals = List.map (fun (g, _) -> g) metasenv in + [ zero_pos goals, [], [], `NoTag ] let head_switches = function @@ -175,13 +180,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 @@ -327,26 +329,21 @@ 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_s, ([ loc ], [], [],`BranchTag) :: (g', t', k', tag) :: s + | Pos i_s, ([ loc ], t, [],`BranchTag) :: (g', t', k', tag) :: s when is_fresh loc -> - let l_js = List.filter (fun (i, _) -> List.mem i i_s) g' in + let l_js = List.filter (fun (i, _) -> List.mem i i_s) ([loc] @+ g') in new_stack - ((l_js, [], [],`BranchTag) - :: ([ loc ] @+ g' @- l_js, t', k', tag) :: s) - | Pos i_s, (g, t, k,`BranchTag) :: (g', t', k', tag) :: s -> - let l_js = List.filter (fun (i, _) -> List.mem i i_s) g' in - new_stack - ((l_js, [], [],`BranchTag) - :: (g' @- l_js, 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, (g, t, k, `BranchTag) :: (g', t', k', tag) :: s - when g = [] || is_fresh (List.hd g) -> - new_stack - ((g', [], [], `BranchTag) - :: ([], t' @+ filter_open g @+ k, k', tag) :: s) + | 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)