]> matita.cs.unibo.it Git - helm.git/blob - components/tactics/discriminationTactics.ml
- new function for general relocation of local references (rels) in terms
[helm.git] / components / tactics / discriminationTactics.ml
1 (* Copyright (C) 2002, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 (* $Id$ *)
27
28 module C = Cic
29 module U = UriManager
30 module P = PrimitiveTactics
31 module T = Tacticals
32 module CR = CicReduction 
33 module PST = ProofEngineStructuralRules
34 module PET = ProofEngineTypes
35 module CTC = CicTypeChecker
36 module CU = CicUniv
37 module S = CicSubstitution
38
39 let debug = false
40 let debug_print = 
41   if debug then (fun x -> prerr_endline (Lazy.force x)) else (fun _ -> ())
42 ;;
43
44 (* funzione generale di rilocazione dei riferimenti locali *)
45
46 let relocate_term map t =
47    let rec map_xnss k xnss =
48       let imap (uri, t) = uri, map_term k t in
49       List.map imap xnss
50    and map_mss k mss =
51       let imap = function
52          | None   -> None
53          | Some t -> Some (map_term k t)
54       in
55       List.map imap mss
56    and map_fs len k fs = 
57       let imap (name, i, ty, bo) = name, i, map_term k ty, map_term (k + len) bo in
58       List.map imap fs
59    and map_cfs len k cfs = 
60       let imap (name, ty, bo) = name, map_term k ty, map_term (k + len) bo in
61       List.map imap cfs
62    and map_term k = function
63       | C.Rel m -> if m < k then C.Rel m else C.Rel (map (m - k))
64       | C.Sort _ as t -> t
65       | C.Implicit _ as t -> t
66       | C.Var (uri, xnss) -> C.Var (uri, map_xnss k xnss)
67       | C.Const (uri, xnss) -> C.Const (uri, map_xnss k xnss)
68       | C.MutInd (uri, tyno, xnss) -> C.MutInd (uri, tyno, map_xnss k xnss)
69       | C.MutConstruct (uri, tyno, consno, xnss) ->
70          C.MutConstruct (uri, tyno, consno, map_xnss k xnss)
71       | C.Meta (i, mss) -> C.Meta(i, map_mss k mss)
72       | C.Cast (te, ty) -> C.Cast (map_term k te, map_term k ty)
73       | C.Appl ts -> C.Appl (List.map (map_term k) ts)
74       | C.MutCase (sp, i, outty, t, pl) ->
75          C.MutCase (sp, i, map_term k outty, map_term k t, List.map (map_term k) pl)    
76       | C.Prod (n, s, t) -> C.Prod (n, map_term k s, map_term (succ k) t)
77       | C.Lambda (n, s, t) -> C.Lambda (n, map_term k s, map_term (succ k) t)
78       | C.LetIn (n, s, t) -> C.LetIn (n, map_term k s, map_term (succ k) t)
79       | C.Fix (i, fs) -> C.Fix (i, map_fs (List.length fs) k fs)
80       | C.CoFix (i, cfs) -> C.CoFix (i, map_cfs (List.length cfs) k cfs)
81    in
82    map_term 0 t
83
84 (* term ha tipo t1=t2; funziona solo se t1 e t2 hanno in testa costruttori
85 diversi *)
86
87 let discriminate_tac ~term =
88  let true_URI =
89   match LibraryObjects.true_URI () with
90      Some uri -> uri
91    | None -> raise (PET.Fail (lazy "You need to register the default \"true\" definition first. Please use the \"default\" command")) in
92  let false_URI =
93   match LibraryObjects.false_URI () with
94      Some uri -> uri
95    | None -> raise (PET.Fail (lazy "You need to register the default \"false\" definition first. Please use the \"default\" command")) in
96  let fail msg = raise (PET.Fail (lazy ("Discriminate: " ^ msg))) in
97  let find_discriminating_consno t1 t2 =
98    let rec aux t1 t2 =
99      match t1, t2 with
100      | C.MutConstruct _, C.MutConstruct _ when t1 = t2 -> None
101      | C.Appl ((C.MutConstruct _ as constr1) :: args1),
102        C.Appl ((C.MutConstruct _ as constr2) :: args2)
103        when constr1 = constr2 ->
104          let rec aux_list l1 l2 =
105            match l1, l2 with
106            | [], [] -> None
107            | hd1 :: tl1, hd2 :: tl2 ->
108                (match aux hd1 hd2 with
109                | None -> aux_list tl1 tl2
110                | Some _ as res -> res)
111            | _ -> (* same constructor applied to a different number of args *)
112                assert false
113          in
114          aux_list args1 args2
115      | ((C.MutConstruct (_,_,consno1,subst1)),
116        (C.MutConstruct (_,_,consno2,subst2)))
117      | ((C.MutConstruct (_,_,consno1,subst1)),
118        (C.Appl ((C.MutConstruct (_,_,consno2,subst2)) :: _)))
119      | ((C.Appl ((C.MutConstruct (_,_,consno1,subst1)) :: _)),
120        (C.MutConstruct (_,_,consno2,subst2)))
121      | ((C.Appl ((C.MutConstruct (_,_,consno1,subst1)) :: _)),
122        (C.Appl ((C.MutConstruct (_,_,consno2,subst2)) :: _)))
123        when (consno1 <> consno2) || (subst1 <> subst2) ->
124          Some consno2
125      | _ -> fail "not a discriminable equality"
126    in
127    aux t1 t2
128  in
129  let mk_branches_and_outtype turi typeno consno context args =
130     (* a list of "True" except for the element in position consno which
131      * is "False" *)
132     match fst (CicEnvironment.get_obj CicUniv.empty_ugraph turi) with
133     | C.InductiveDefinition (ind_type_list,_,paramsno,_)  ->
134         let _,_,rty,constructor_list = List.nth ind_type_list typeno in 
135         let false_constr_id,_ = List.nth constructor_list (consno - 1) in
136         let branches =
137          List.map 
138            (fun (id,cty) ->
139              (* dubbio: e' corretto ridurre in questo context ??? *)
140              let red_ty = CR.whd context cty in
141              let rec aux t k =
142                match t with
143                | C.Prod (_,_,target) when (k <= paramsno) ->
144                    S.subst (List.nth args (k-1))
145                      (aux target (k+1))
146                | C.Prod (binder,source,target) when (k > paramsno) ->
147                    C.Lambda (binder, source, (aux target (k+1)))
148                | _ -> 
149                    if (id = false_constr_id)
150                    then (C.MutInd(false_URI,0,[]))
151                    else (C.MutInd(true_URI,0,[]))
152              in
153              (S.lift 1 (aux red_ty 1)))
154            constructor_list in
155         let outtype =
156          let seed = ref 0 in
157          let rec mk_lambdas rev_left_args =
158           function
159              0, args, C.Prod (_,so,ta) ->
160               C.Lambda
161                (C.Name (incr seed; "x" ^ string_of_int !seed),
162                so,
163                mk_lambdas rev_left_args (0,args,ta))
164            | 0, args, C.Sort _ ->
165               let rec mk_rels =
166                function
167                   0 -> []
168                 | n -> C.Rel n :: mk_rels (n - 1) in
169               let argsno = List.length args in
170                C.Lambda
171                 (C.Name "x",
172                  (if argsno + List.length rev_left_args > 0 then
173                    C.Appl
174                     (C.MutInd (turi, typeno, []) ::
175                      (List.map
176                       (S.lift (argsno + 1))
177                       (List.rev rev_left_args)) @
178                      mk_rels argsno)
179                   else
180                    C.MutInd (turi,typeno,[])),
181                  C.Sort C.Prop)
182            | 0, _, _ -> assert false (* seriously screwed up *)
183            | n, he::tl, C.Prod (_,_,ta) ->
184               mk_lambdas (he::rev_left_args)(n-1,tl,S.subst he ta)
185            | n,_,_ ->
186               assert false (* we should probably reduce in some context *)
187          in
188           mk_lambdas [] (paramsno, args, rty)
189         in
190          branches, outtype 
191     | _ -> assert false
192  in
193  let discriminate'_tac ~term status = 
194   let (proof, goal) = status in
195   let _,metasenv,_subst,_,_, _ = proof in
196   let _,context,_ = CicUtil.lookup_meta goal metasenv in
197   let termty,_ = 
198     CTC.type_of_aux' metasenv context term CicUniv.empty_ugraph
199   in
200   match termty with
201    | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2]
202      when LibraryObjects.is_eq_URI equri ->
203       let turi,typeno,exp_named_subst,args = 
204         match tty with
205         | (C.MutInd (turi,typeno,exp_named_subst)) ->
206             turi,typeno,exp_named_subst,[]
207         | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::args)) ->
208             turi,typeno,exp_named_subst,args
209         | _ -> fail "not a discriminable equality"
210       in
211       let consno =
212         match find_discriminating_consno t1 t2 with
213         | Some consno -> consno
214         | None -> fail "discriminating terms are structurally equal"
215       in
216       let branches,outtype =
217        mk_branches_and_outtype turi typeno consno context args
218       in
219       PET.apply_tactic
220        (T.then_
221          ~start:(EliminationTactics.elim_type_tac (C.MutInd (false_URI, 0, [])))
222          ~continuation:
223            (T.then_
224              ~start:
225                (ReductionTactics.change_tac 
226                  ~pattern:(PET.conclusion_pattern None)
227                  (fun _ m u ->
228                    C.Appl [
229                      C.Lambda ( C.Name "x", tty,
230                        C.MutCase (turi, typeno, outtype, (C.Rel 1), branches));
231                      t2 ],
232                    m, u))
233              ~continuation:
234                (T.then_
235                  ~start:
236                    (EqualityTactics.rewrite_simpl_tac
237                      ~direction:`RightToLeft
238                      ~pattern:(PET.conclusion_pattern None)
239                      term [])
240                  ~continuation:
241                    (IntroductionTactics.constructor_tac ~n:1)))) status
242     | _ -> fail "not an equality"
243   in
244   PET.mk_tactic (discriminate'_tac ~term)
245
246 let exn_nonproj = 
247   PET.Fail (lazy "Injection: not a projectable equality")
248 let exn_noneq = 
249   PET.Fail (lazy "Injection: not an equality")
250 let exn_nothingtodo = 
251   PET.Fail (lazy "Nothing to do")
252 let exn_discrnonind =
253   PET.Fail (lazy "Discriminate: object is not an Inductive Definition: it's imposible")
254 let exn_injwronggoal = 
255   PET.Fail (lazy "Injection: goal after cut is not correct")
256 let exn_noneqind =
257   PET.Fail (lazy "Injection: not an equality over elements of an inductive type")
258
259 let pp ctx t = 
260   let names = List.map (function Some (n,_) -> Some n | None -> None) ctx in
261   CicPp.pp t names
262
263 let rec injection_tac ~term ~i ~liftno ~continuation =
264  let give_name seed = function
265    | C.Name _ as name -> name
266    | C.Anonymous -> C.Name (incr seed; "y" ^ string_of_int !seed)
267  in
268  let rec mk_rels = function | 0 -> [] | n -> C.Rel n :: (mk_rels (n - 1)) in
269  let injection_tac ~term ~i status =
270   let (proof, goal) = status in
271   (* precondizione: t1 e t2 hanno in testa lo stesso costruttore ma 
272    * differiscono (o potrebbero differire?) nell'i-esimo parametro 
273    * del costruttore *)
274   let term = S.lift liftno term in
275   let _,metasenv,_subst,_,_, _ = proof in
276   let _,context,_ = CicUtil.lookup_meta goal metasenv in
277   let termty,_ = 
278     CTC.type_of_aux' metasenv context term CicUniv.empty_ugraph
279   in
280   debug_print (lazy ("\ninjection1 su : " ^ pp context termty)); 
281   match termty with (* an equality *)
282   | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2]
283     when LibraryObjects.is_eq_URI equri -> 
284       let turi,typeno,ens,params =
285         match tty with (* some inductive type *)
286         | C.MutInd (turi,typeno,ens) -> turi,typeno,ens,[]
287         | C.Appl (C.MutInd (turi,typeno,ens)::params) -> turi,typeno,ens,params
288         | _ -> raise exn_noneqind
289       in
290       let t1',t2',consno = (* sono i due sottotermini che differiscono *)
291         match t1,t2 with
292         | C.Appl ((C.MutConstruct (uri1,typeno1,consno1,ens1))::applist1),
293           C.Appl ((C.MutConstruct (uri2,typeno2,consno2,ens2))::applist2)
294           when (uri1 = uri2) && (typeno1 = typeno2) && 
295                (consno1 = consno2) && (ens1 = ens2) -> 
296                (* controllo ridondante *)
297             List.nth applist1 (i-1),List.nth applist2 (i-1),consno2
298         | _ -> assert false
299       in
300       let tty',_ = CTC.type_of_aux' metasenv context t1' CU.empty_ugraph in
301       let patterns,outtype =
302         match fst (CicEnvironment.get_obj CicUniv.empty_ugraph turi) with
303         | C.InductiveDefinition (ind_type_list,_,paramsno,_)->
304            let left_params, right_params = HExtlib.split_nth paramsno params in
305            let _,_,_,constructor_list = List.nth ind_type_list typeno in
306            let i_constr_id,_ = List.nth constructor_list (consno - 1) in
307            let patterns =
308              let seed = ref 0 in
309              List.map
310                (function (id,cty) ->
311                  let reduced_cty = CR.whd context cty in
312                  let rec aux k = function
313                    | C.Prod (_,_,tgt) when k <= paramsno -> 
314                        let left = List.nth left_params (k-1) in
315                        aux (k+1) (S.subst left tgt)
316                    | C.Prod (binder,source,target) when k > paramsno ->
317                       let binder' = give_name seed binder in
318                       C.Lambda (binder',source,(aux (k+1) target))
319                    | _ ->
320                      let nr_param_constr = k - paramsno - 1 in
321                      if id = i_constr_id then C.Rel (k - i)
322                      else S.lift nr_param_constr t1' 
323                      (* + 1 per liftare anche il lambda aggiunto
324                       * esternamente al case *)
325                  in S.lift 1 (aux 1 reduced_cty))
326                constructor_list 
327            in
328            (* this code should be taken from cases_tac *)
329            let outtype =
330              let seed = ref 0 in
331              let rec to_lambdas te head =
332                match CR.whd context te with
333                | C.Prod (binder,so,ta) ->
334                    let binder' = give_name seed binder in
335                    C.Lambda (binder',so,to_lambdas ta head)
336                | _ -> head 
337              in
338              let rec skip_prods params te =
339                match params, CR.whd context te with
340                | [], _ -> te
341                | left::tl, C.Prod (_,_,ta) -> 
342                    skip_prods tl (S.subst left ta)
343                | _, _ -> assert false
344              in
345              let abstracted_tty =
346                let tty =
347                  List.fold_left (fun x y -> S.subst y x) tty left_params
348                in
349                (* non lift, ma subst coi left! *)
350                match S.lift 1 tty with
351                | C.MutInd _ as tty' -> tty'
352                | C.Appl l ->
353                    let keep,abstract = HExtlib.split_nth (paramsno +1) l in
354                    let keep = List.map (S.lift paramsno) keep in
355                    C.Appl (keep@mk_rels (List.length abstract))
356                | _ -> assert false
357              in
358              match ind_type_list with
359              | [] -> assert false
360              | (_,_,ty,_)::_ ->
361                (* this is in general wrong, do as in cases_tac *)
362                to_lambdas (skip_prods left_params ty)
363                  (C.Lambda 
364                    (C.Name "cased", abstracted_tty,
365                      (* here we should capture right parameters *)
366                      (* 1 for his Lambda, one for the Lambda outside the match
367                       * and then one for each to_lambda *)
368                      S.lift (2+List.length right_params) tty'))
369           in
370             patterns,outtype
371         | _ -> raise exn_discrnonind
372       in
373       let cutted = C.Appl [C.MutInd (equri,0,[]) ; tty' ; t1' ; t2'] in
374       let changed = 
375         C.Appl [ C.Lambda (C.Name "x", tty, 
376                   C.MutCase (turi,typeno,outtype,C.Rel 1,patterns)) ; t1]
377       in
378       (* check if cutted and changed are well typed and if t1' ~ changed *)
379       let go_on =
380         try
381           let _,g = CTC.type_of_aux' metasenv context  cutted
382             CicUniv.empty_ugraph
383           in
384           let _,g = CTC.type_of_aux' metasenv context changed g in
385           fst (CR.are_convertible ~metasenv context  t1' changed g)
386         with
387         | CTC.TypeCheckerFailure _ -> false
388       in
389       if not go_on then
390         PET.apply_tactic T.id_tac status
391       else
392         (debug_print (lazy ("CUT: " ^ pp context cutted)); 
393         PET.apply_tactic   
394           (T.thens ~start: (P.cut_tac cutted)
395              ~continuations:
396                [injection1_tac ~first_time:false ~liftno:0 ~term:(C.Rel 1)
397                   ~continuation:
398                    (fun ~liftno:x -> continuation ~liftno:(liftno+1+x))
399                     (* here I need to lift all the continuations by 1;
400                        since I am setting back liftno to 0, I actually
401                        need to lift all the continuations by liftno + 1 *)
402                ;T.then_ 
403                   ~start:(PET.mk_tactic 
404                     (fun status ->    
405                       debug_print (lazy "riempo il cut"); 
406                       let (proof, goal) = status in
407                       let _,metasenv,_subst,_,_, _ = proof in
408                       let _,context,gty =CicUtil.lookup_meta goal metasenv in
409                       let gty = Unshare.unshare gty in
410                       let new_t1' = 
411                         match gty with 
412                         | (C.Appl (C.MutInd (_,_,_)::_::t::_)) -> t
413                         | _ -> raise exn_injwronggoal
414                       in
415                       debug_print 
416                         (lazy ("metto questo: " ^ pp context changed));
417                       debug_print 
418                         (lazy ("al posto di questo: " ^ pp context new_t1'));
419                       debug_print 
420                         (lazy ("nel goal: " ^ pp context gty));
421                       debug_print 
422                         (lazy ("nel contesto:\n" ^ CicPp.ppcontext context));
423                       debug_print 
424                         (lazy ("e poi rewrite con: "^pp context term));
425                       let rc = 
426                         PET.apply_tactic 
427                           (ReductionTactics.change_tac
428                             ~pattern:(None, [], 
429                               Some (ProofEngineHelpers.pattern_of 
430                               ~term:gty [new_t1']))
431                             (fun _ m u -> changed,m,u))
432                           status
433                         in rc
434                       ))
435                   ~continuation:
436                     (T.then_
437                       ~start:
438                         (EqualityTactics.rewrite_simpl_tac
439                           ~direction:`LeftToRight
440                           ~pattern:(PET.conclusion_pattern None)
441                           term [])
442                       ~continuation:EqualityTactics.reflexivity_tac)
443                ])     
444           status)
445    | _ -> raise exn_noneq
446  in
447   PET.mk_tactic (injection_tac ~term ~i)
448
449 and injection1_tac ~first_time ~term ~liftno ~continuation =
450  let are_convertible hd1 hd2 metasenv context = 
451    fst (CR.are_convertible ~metasenv context hd1 hd2 CicUniv.empty_ugraph)
452  in
453  let injection1_tac ~term status = 
454   let (proof, goal) = status in
455   let _,metasenv,_subst, _,_, _ = proof in
456   let _,context,_ = CicUtil.lookup_meta goal metasenv in
457   let term = S.lift liftno term in
458   let termty,_ = 
459     CTC.type_of_aux' metasenv context term CicUniv.empty_ugraph
460   in
461   debug_print (lazy ("\ninjection su: " ^ pp context termty)); 
462   let tac =
463     match termty with
464     | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2] 
465       when LibraryObjects.is_eq_URI equri -> begin
466         match (CR.whd ~delta:true context tty) with
467         | C.MutInd (turi,typeno,ens)
468         | C.Appl (C.MutInd (turi,typeno,ens)::_) -> begin
469             match t1,t2 with
470             | C.MutConstruct (uri1,typeno1,consno1,ens1),
471               C.MutConstruct (uri2,typeno2,consno2,ens2)
472               when (uri1 = uri2) && (typeno1 = typeno2) && 
473                     (consno1 = consno2) && (ens1 = ens2) ->
474                 if first_time then raise exn_nothingtodo
475                 else continuation ~liftno
476             | C.Appl ((C.MutConstruct (uri1,typeno1,consno1,ens1))::applist1),
477               C.Appl ((C.MutConstruct (uri2,typeno2,consno2,ens2))::applist2)
478               when (uri1 = uri2) && (typeno1 = typeno2) &&
479               (consno1 = consno2) && (ens1 = ens2) ->
480                 let rec traverse_list i l1 l2 =
481                   match l1,l2 with
482                   | [],[] when first_time -> continuation
483                   | [],[] -> begin
484                      match term with
485                      | C.Rel n -> begin
486                         match List.nth context (n-1) with
487                         | Some (C.Name id,_) ->
488                            fun ~liftno ->
489                              T.then_ ~start:(PST.clear ~hyps:[id])
490                                ~continuation:(continuation ~liftno)
491                         | _ -> assert false
492                         end
493                      | _ -> assert false
494                      end
495                   | hd1::tl1,hd2::tl2 -> 
496                      if are_convertible hd1 hd2 metasenv context then
497                        traverse_list (i+1) tl1 tl2
498                      else
499                        injection_tac ~i ~term
500                          ~continuation:(traverse_list (i+1) tl1 tl2)
501                   | _ -> assert false 
502                       (* i 2 termini hanno in testa lo stesso costruttore, 
503                        * ma applicato a un numero diverso di termini *)
504                 in
505                   traverse_list 1 applist1 applist2 ~liftno
506             | C.MutConstruct (uri1,typeno1,consno1,ens1),
507               C.MutConstruct (uri2,typeno2,consno2,ens2)
508             | C.MutConstruct (uri1,typeno1,consno1,ens1),
509               C.Appl ((C.MutConstruct (uri2,typeno2,consno2,ens2))::_)
510             | C.Appl ((C.MutConstruct (uri1,typeno1,consno1,ens1))::_),
511               C.MutConstruct (uri2,typeno2,consno2,ens2)
512             | C.Appl ((C.MutConstruct (uri1,typeno1,consno1,ens1))::_),
513               C.Appl ((C.MutConstruct (uri2,typeno2,consno2,ens2))::_)
514               when (consno1 <> consno2) || (ens1 <> ens2) -> 
515                 discriminate_tac ~term
516             | _ when not first_time -> continuation ~liftno
517             | _ (* when first_time *) -> 
518                 match term with
519                 | Cic.Rel i ->
520                   let name = 
521                     match List.nth context (i-1) with
522                     | Some (Cic.Name s, Cic.Def _) -> s
523                     | Some (Cic.Name s, Cic.Decl _) -> s
524                     | _ -> assert false
525                   in
526                   T.then_
527                     ~start:(ReductionTactics.simpl_tac 
528                       ~pattern:(None,[name,Cic.Implicit (Some `Hole)],None))
529                     ~continuation:(injection1_tac ~first_time:false ~term ~liftno
530                       ~continuation)
531                 | _ -> raise exn_nonproj
532             end
533         | _ when not first_time -> continuation ~liftno
534         | _ (* when first_time *) -> raise exn_nonproj
535         end 
536     | _ -> raise exn_nonproj
537   in  
538     PET.apply_tactic tac status
539  in 
540    PET.mk_tactic (injection1_tac ~term)
541
542 (* destruct performs either injection or discriminate *)
543 (* equivalent to Coq's "analyze equality"             *)
544 let destruct_tac =
545  injection1_tac
546   ~first_time:true ~liftno:0 ~continuation:(fun ~liftno -> T.id_tac)