1 (* Copyright (C) 2002, HELM Team.
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.
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.
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.
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,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 let debug_print = fun _ -> ()
28 let rec injection_tac ~term =
29 let injection_tac ~term status =
30 let (proof, goal) = status in
32 let module U = UriManager in
33 let module P = PrimitiveTactics in
34 let module T = Tacticals in
35 let _,metasenv,_,_ = proof in
36 let _,context,_ = CicUtil.lookup_meta goal metasenv in
37 let termty,_ = (* TASSI: FIXME *)
38 CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph in
39 ProofEngineTypes.apply_tactic
41 (C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
42 when LibraryObjects.is_eq_URI equri -> (
44 (C.MutInd (turi,typeno,exp_named_subst))
45 | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) -> (
47 ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
48 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
49 when (uri1 = uri2) && (typeno1 = typeno2) &&
50 (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
51 (* raise (ProofEngineTypes.Fail "Injection: nothing to do") ; *) T.id_tac
52 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::applist1)),
53 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::applist2)))
54 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
55 let rec traverse_list i l1 l2 =
58 | hd1::tl1,hd2::tl2 ->
60 ~start:(injection1_tac ~i ~term)
61 ~continuation:(traverse_list (i+1) tl1 tl2)
62 | _ -> raise (ProofEngineTypes.Fail "Discriminate: i 2 termini hanno in testa lo stesso costruttore, ma applicato a un numero diverso di termini. possibile???") ; T.id_tac
63 in traverse_list 1 applist1 applist2
64 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
65 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
66 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
67 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
68 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
69 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
70 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
71 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
72 when (consno1 <> consno2) || (exp_named_subst1 <> exp_named_subst2) ->
73 (* raise (ProofEngineTypes.Fail "Injection: not a projectable equality but a discriminable one") ; *) T.id_tac
74 | _ -> (* raise (ProofEngineTypes.Fail "Injection: not a projectable equality") ; *) T.id_tac
76 | _ -> raise (ProofEngineTypes.Fail "Injection: not a projectable equality")
78 | _ -> raise (ProofEngineTypes.Fail "Injection: not an equation")
81 ProofEngineTypes.mk_tactic (injection_tac ~term)
83 and injection1_tac ~term ~i =
84 let injection1_tac ~term ~i status =
85 let (proof, goal) = status in
86 (* precondizione: t1 e t2 hanno in testa lo stesso costruttore ma differiscono (o potrebbero differire?) nell'i-esimo parametro del costruttore *)
88 let module S = CicSubstitution in
89 let module U = UriManager in
90 let module P = PrimitiveTactics in
91 let module T = Tacticals in
92 let _,metasenv,_,_ = proof in
93 let _,context,_ = CicUtil.lookup_meta goal metasenv in
94 let termty,_ = (* TASSI: FIXME *)
95 CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph in
96 match termty with (* an equality *)
97 (C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
98 when LibraryObjects.is_eq_URI equri -> (
99 match tty with (* some inductive type *)
100 (C.MutInd (turi,typeno,exp_named_subst))
101 | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) ->
102 let t1',t2',consno = (* sono i due sottotermini che differiscono *)
104 ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::applist1)),
105 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::applist2)))
106 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) -> (* controllo ridondante *)
107 (List.nth applist1 (i-1)),(List.nth applist2 (i-1)),consno2
111 CicTypeChecker.type_of_aux' metasenv context t1'
112 CicUniv.empty_ugraph in
114 match fst(CicEnvironment.get_obj
115 CicUniv.empty_ugraph turi ) with
116 C.InductiveDefinition (ind_type_list,_,nr_ind_params_dx,_) ->
117 let _,_,_,constructor_list = (List.nth ind_type_list typeno) in
118 let i_constr_id,_ = List.nth constructor_list (consno - 1) in
120 (function (id,cty) ->
121 let reduced_cty = CicReduction.whd context cty in
124 C.Prod (_,_,target) when (k <= nr_ind_params_dx) ->
126 | C.Prod (binder,source,target) when (k > nr_ind_params_dx) ->
130 | C.Anonymous -> C.Name "y"
132 C.Lambda (binder',source,(aux target (k+1)))
134 let nr_param_constr = k - 1 - nr_ind_params_dx in
135 if (id = i_constr_id)
136 then C.Rel (nr_param_constr - i + 1)
137 else S.lift (nr_param_constr + 1) t1' (* + 1 per liftare anche il lambda agguinto esternamente al case *)
141 | _ -> raise (ProofEngineTypes.Fail "Discriminate: object is not an Inductive Definition: it's imposible")
143 ProofEngineTypes.apply_tactic
145 ~start:(P.cut_tac (C.Appl [(C.MutInd (equri,0,[])) ; tty' ; t1' ; t2']))
148 ~start:(injection_tac ~term:(C.Rel 1))
149 ~continuation:T.id_tac (* !!! qui devo anche fare clear di term tranne al primo passaggio *)
152 ~start:(ProofEngineTypes.mk_tactic
154 let (proof, goal) = status in
155 let _,metasenv,_,_ = proof in
156 let _,context,gty = CicUtil.lookup_meta goal metasenv in
159 (C.Appl (C.MutInd (_,_,_)::arglist)) ->
161 | _ -> raise (ProofEngineTypes.Fail "Injection: goal after cut is not correct")
163 ProofEngineTypes.apply_tactic
164 (ReductionTactics.change_tac
165 ~pattern:(ProofEngineTypes.conclusion_pattern (Some new_t1'))
185 (EqualityTactics.rewrite_simpl_tac
186 ~direction:`LeftToRight
187 ~pattern:(ProofEngineTypes.conclusion_pattern None)
189 ~continuation:EqualityTactics.reflexivity_tac
193 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not a discriminable equality")
195 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not an equality")
197 ProofEngineTypes.mk_tactic (injection1_tac ~term ~i)
202 exception TwoDifferentSubtermsFound of int
204 (* term ha tipo t1=t2; funziona solo se t1 e t2 hanno in testa costruttori
207 let discriminate'_tac ~term =
208 let discriminate'_tac ~term status =
209 let (proof, goal) = status in
210 let module C = Cic in
211 let module U = UriManager in
212 let module P = PrimitiveTactics in
213 let module T = Tacticals in
214 let _,metasenv,_,_ = proof in
215 let _,context,_ = CicUtil.lookup_meta goal metasenv in
217 CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph in
219 (C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
220 when LibraryObjects.is_eq_URI equri -> (
222 (C.MutInd (turi,typeno,exp_named_subst))
223 | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) ->
225 let consno2 = (* bruuutto: uso un eccezione per terminare con successo! buuu!! :-/ *)
227 let rec traverse t1 t2 =
229 ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
230 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
231 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
233 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::applist1)),
234 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::applist2)))
235 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
236 let rec traverse_list l1 l2 =
239 | hd1::tl1,hd2::tl2 -> traverse hd1 hd2; traverse_list tl1 tl2
240 | _ -> raise (ProofEngineTypes.Fail "Discriminate: i 2 termini hanno in testa lo stesso costruttore, ma applicato a un numero diverso di termini. possibile???")
241 in traverse_list applist1 applist2
243 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
244 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
245 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
246 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
247 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
248 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
249 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
250 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
251 when (consno1 <> consno2) || (exp_named_subst1 <> exp_named_subst2) ->
252 raise (TwoDifferentSubtermsFound consno2)
253 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not a discriminable equality")
255 with (TwoDifferentSubtermsFound consno2) -> consno2
258 then raise (ProofEngineTypes.Fail "Discriminate: Discriminating terms are structurally equal")
262 (* a list of "True" except for the element in position consno2 which is "False" *)
263 match fst(CicEnvironment.get_obj
264 CicUniv.empty_ugraph turi) with
265 C.InductiveDefinition (ind_type_list,_,nr_ind_params,_) ->
266 let _,_,_,constructor_list = (List.nth ind_type_list typeno) in
267 let false_constr_id,_ = List.nth constructor_list (consno2 - 1) in
269 (function (id,cty) ->
270 let red_ty = CicReduction.whd context cty in (* dubbio: e' corretto ridurre in questo context ??? *)
273 C.Prod (_,_,target) when (k <= nr_ind_params) ->
275 | C.Prod (binder,source,target) when (k > nr_ind_params) ->
276 C.Lambda (binder,source,(aux target (k+1)))
278 if (id = false_constr_id)
279 then (C.MutInd(LibraryObjects.false_URI (),0,[]))
280 else (C.MutInd(LibraryObjects.true_URI (),0,[]))
284 | _ -> raise (ProofEngineTypes.Fail "Discriminate: object is not an Inductive Definition: it's imposible")
287 let (proof',goals') =
288 ProofEngineTypes.apply_tactic
289 (EliminationTactics.elim_type_tac
290 ~term:(C.MutInd(LibraryObjects.false_URI (),0,[])))
295 let _,metasenv',_,_ = proof' in
296 let _,context',gty' =
297 CicUtil.lookup_meta goal' metasenv'
299 ProofEngineTypes.apply_tactic
302 (ReductionTactics.change_tac
303 ~pattern:(ProofEngineTypes.conclusion_pattern (Some gty'))
309 (C.Lambda ((C.Name "x"),tty,(C.Sort C.Prop))),
320 (EqualityTactics.rewrite_simpl_tac
321 ~direction:`RightToLeft
322 ~pattern:(ProofEngineTypes.conclusion_pattern None)
324 ~continuation:(IntroductionTactics.constructor_tac ~n:1)
327 | _ -> raise (ProofEngineTypes.Fail "Discriminate: ElimType False left more (or less) than one goal")
329 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not a discriminable equality")
331 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not an equality")
333 ProofEngineTypes.mk_tactic (discriminate'_tac ~term)
336 let discriminate_tac ~term =
337 let discriminate_tac ~term status =
338 ProofEngineTypes.apply_tactic
340 ~start:(* (injection_tac ~term) *) Tacticals.id_tac
341 ~continuation:(discriminate'_tac ~term)) (* NOOO!!! non term ma una (qualunque) delle nuove hyp introdotte da inject *)
344 ProofEngineTypes.mk_tactic (discriminate_tac ~term)
349 let decide_equality_tac =
350 (* il goal e' un termine della forma t1=t2\/~t1=t2; la tattica decide se l'uguaglianza
351 e' vera o no e lo risolve *)
357 let compare_tac ~term = Tacticals.id_tac
359 (* term is in the form t1=t2; the tactic leaves two goals: in the first you have to *)
360 (* demonstrate the goal with the additional hyp that t1=t2, in the second the hyp is ~t1=t2 *)
361 let module C = Cic in
362 let module U = UriManager in
363 let module P = PrimitiveTactics in
364 let module T = Tacticals in
365 let _,metasenv,_,_ = proof in
366 let _,context,gty = CicUtil.lookup_meta goal metasenv in
367 let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
369 (C.Appl [(C.MutInd (uri, 0, [])); _; t1; t2]) when (uri = (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind")) ->
371 let term' = (* (t1=t2)\/~(t1=t2) *)
373 (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic/or.ind"), 0, [])) ;
376 (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"), 1, [])) ;
378 C.Appl [C.Const ((U.uri_of_string "cic:/Coq/Init/Logic/not.con"), []) ; t2]
383 ~start:(P.cut_tac ~term:term')
385 T.then_ ~start:(P.intros_tac) ~continuation:(P.elim_intros_simpl_tac ~term:(C.Rel 1)) ;
388 | (C.Appl [(C.MutInd (uri, 0, [])); _; t1; t2]) when (uri = (U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind")) ->
389 let term' = (* (t1=t2) \/ ~(t1=t2) *)
391 (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic/or.ind"), 0, [])) ;
394 (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind"), 1, [])) ;
396 C.Appl [C.Const ((U.uri_of_string "cic:/Coq/Init/Logic/not.con"), []) ; t2]
401 ~start:(P.cut_tac ~term:term')
403 T.then_ ~start:(P.intros_tac) ~continuation:(P.elim_intros_simpl_tac ~term:(C.Rel 1)) ;
406 | _ -> raise (ProofEngineTypes.Fail "Compare: Not an equality")
412 (* DISCRIMINTATE SENZA INJECTION
414 exception TwoDifferentSubtermsFound of (Cic.term * Cic.term * int)
416 let discriminate_tac ~term status =
417 let module C = Cic in
418 let module U = UriManager in
419 let module P = PrimitiveTactics in
420 let module T = Tacticals in
421 let (proof, goal) = status in
422 let _,metasenv,_,_ = proof in
423 let _,context,_ = CicUtil.lookup_meta goal metasenv in
424 let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
426 (C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
427 when (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"))
428 or (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind")) -> (
430 (C.MutInd (turi,typeno,exp_named_subst))
431 | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) ->
433 let (t1',t2',consno2') = (* bruuutto: uso un eccezione per terminare con successo! buuu!! :-/ *)
435 let rec traverse t1 t2 =
436 debug_print ("XXXX t1 " ^ CicPp.ppterm t1) ;
437 debug_print ("XXXX t2 " ^ CicPp.ppterm t2) ;
439 ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
440 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
441 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
443 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::applist1)),
444 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::applist2)))
445 when (uri1 = uri2) && (typeno1 = typeno2) && (consno1 = consno2) && (exp_named_subst1 = exp_named_subst2) ->
446 let rec traverse_list l1 l2 =
449 | hd1::tl1,hd2::tl2 -> traverse hd1 hd2; traverse_list tl1 tl2
450 | _ -> raise (ProofEngineTypes.Fail "Discriminate: i 2 termini hanno in testa lo stesso costruttore, ma applicato a un numero diverso di termini. possibile???")
451 in traverse_list applist1 applist2
453 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
454 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
455 | ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1)),
456 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
457 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
458 (C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2)))
459 | ((C.Appl ((C.MutConstruct (uri1,typeno1,consno1,exp_named_subst1))::_)),
460 (C.Appl ((C.MutConstruct (uri2,typeno2,consno2,exp_named_subst2))::_)))
461 when (consno1 <> consno2) || (exp_named_subst1 <> exp_named_subst2) ->
462 raise (TwoDifferentSubtermsFound (t1,t2,consno2))
463 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not a discriminable equality")
465 with (TwoDifferentSubtermsFound (t1,t2,consno2)) -> (t1,t2,consno2)
467 debug_print ("XXXX consno2' " ^ (string_of_int consno2')) ;
469 then raise (ProofEngineTypes.Fail "Discriminate: Discriminating terms are structurally equal")
473 (* a list of "True" except for the element in position consno2' which is "False" *)
474 match fst(CicEnvironment.get_obj turi
475 CicUniv.empty_ugraph) with
476 C.InductiveDefinition (ind_type_list,_,nr_ind_params) ->
477 debug_print ("XXXX nth " ^ (string_of_int (List.length ind_type_list)) ^ " " ^ (string_of_int typeno)) ;
478 let _,_,_,constructor_list = (List.nth ind_type_list typeno) in
479 debug_print ("XXXX nth " ^ (string_of_int (List.length constructor_list)) ^ " " ^ (string_of_int consno2')) ;
480 let false_constr_id,_ = List.nth constructor_list (consno2' - 1) in
481 debug_print ("XXXX nth funzionano ") ;
483 (function (id,cty) ->
484 let red_ty = CicReduction.whd context cty in (* dubbio: e' corretto ridurre in questo context ??? *)
487 C.Prod (_,_,target) when (k <= nr_ind_params) ->
489 | C.Prod (binder,source,target) when (k > nr_ind_params) ->
490 C.Lambda (binder,source,(aux target (k+1)))
492 if (id = false_constr_id)
493 then (C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/False.ind") 0 [])
494 else (C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/True.ind") 0 [])
498 | _ -> raise (ProofEngineTypes.Fail "Discriminate: object is not an Inductive Definition: it's imposible")
501 let (proof',goals') =
502 EliminationTactics.elim_type_tac
503 ~term:(C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/False.ind") 0 [] )
508 let _,metasenv',_,_ = proof' in
509 let _,context',gty' =
510 CicUtil.lookup_meta goal' metasenv'
522 (C.Lambda ((C.Name "x"),tty,(C.Sort C.Prop))),
531 debug_print ("XXXX rewrite<-: " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' (C.Appl [(C.MutInd (equri,0,[])) ; tty ; t1' ; t2'])));
532 debug_print ("XXXX rewrite<-: " ^ CicPp.ppterm (C.Appl [(C.MutInd (equri,0,[])) ; tty ; t1' ; t2'])) ;
533 debug_print ("XXXX equri: " ^ U.string_of_uri equri) ;
534 debug_print ("XXXX tty : " ^ CicPp.ppterm tty) ;
535 debug_print ("XXXX tt1': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' t1')) ;
536 debug_print ("XXXX tt2': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' t2')) ;
537 if (CicTypeChecker.type_of_aux' metasenv' context' t1') <> tty then debug_print ("XXXX tt1': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' t1')) ;
538 if (CicTypeChecker.type_of_aux' metasenv' context' t2') <> tty then debug_print ("XXXX tt2': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' t2')) ;
539 if (CicTypeChecker.type_of_aux' metasenv' context' t1') <> (CicTypeChecker.type_of_aux' metasenv' context' t2')
540 then debug_print ("XXXX tt1': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux'
541 metasenv' context' t1')) ; debug_print ("XXXX tt2': " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' t2')) ;
543 let termty' = ProofEngineReduction.replace_lifting ~equality:(==) ~what:t1 ~with_what:t1' ~where:termty in
544 let termty'' = ProofEngineReduction.replace_lifting ~equality:(==) ~what:t2 ~with_what:t2' ~where:termty' in
546 debug_print ("XXXX rewrite<- " ^ CicPp.ppterm term ^ " : " ^ CicPp.ppterm (CicTypeChecker.type_of_aux' metasenv' context' term));
548 ~start:(EqualityTactics.rewrite_back_simpl_tac ~term:term)
549 ~continuation:(IntroductionTactics.constructor_tac ~n:1)
552 | _ -> raise (ProofEngineTypes.Fail "Discriminate: ElimType False left more (or less) than one goal")
554 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not a discriminable equality")
556 | _ -> raise (ProofEngineTypes.Fail "Discriminate: not an equality")