* http://cs.unibo.it/helm/.
*)
+open HelmLibraryObjects
let rec injection_tac ~term ~status:((proof, goal) as status) =
let module C = Cic in
let module P = PrimitiveTactics in
let module T = Tacticals in
let _,metasenv,_,_ = proof in
- let _,context,_ = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,_ = CicUtil.lookup_meta goal metasenv in
let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
(match termty with
(C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
- when (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"))
- or (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind")) -> (
+ when (U.eq equri Logic.eq_URI)
+ or (U.eq equri Logic_Type.eqt_URI) -> (
match tty with
(C.MutInd (turi,typeno,exp_named_subst))
| (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) -> (
let module P = PrimitiveTactics in
let module T = Tacticals in
let _,metasenv,_,_ = proof in
- let _,context,_ = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,_ = CicUtil.lookup_meta goal metasenv in
let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
match termty with (* an equality *)
(C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
- when (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"))
- or (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind")) -> (
+ when (U.eq equri Logic.eq_URI) or
+ (U.eq equri Logic_Type.eqt_URI) -> (
match tty with (* some inductive type *)
(C.MutInd (turi,typeno,exp_named_subst))
| (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) ->
~start:
(fun ~status:((proof,goal) as status) ->
let _,metasenv,_,_ = proof in
- let _,context,gty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,gty = CicUtil.lookup_meta goal metasenv in
prerr_endline ("XXXX goal " ^ string_of_int goal) ;
prerr_endline ("XXXX gty " ^ CicPp.ppterm gty) ;
prerr_endline ("XXXX old t1' " ^ CicPp.ppterm t1') ;
let module P = PrimitiveTactics in
let module T = Tacticals in
let _,metasenv,_,_ = proof in
- let _,context,_ = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,_ = CicUtil.lookup_meta goal metasenv in
let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
match termty with
(C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
- when (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"))
- or (U.eq equri (U.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind")) -> (
+ when (U.eq equri Logic.eq_URI) or (U.eq equri Logic_Type.eqt_URI) -> (
match tty with
(C.MutInd (turi,typeno,exp_named_subst))
| (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::_)) ->
C.Lambda (binder,source,(aux target (k+1)))
| _ ->
if (id = false_constr_id)
- then (C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/False.ind") 0 [])
- else (C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/True.ind") 0 [])
+ then (C.MutInd(Logic.false_URI,0,[]))
+ else (C.MutInd(Logic.true_URI,0,[]))
in aux red_ty 1
)
constructor_list
let (proof',goals') =
EliminationTactics.elim_type_tac
- ~term:(C.MutInd (U.uri_of_string "cic:/Coq/Init/Logic/False.ind") 0 [] )
+ ~term:(C.MutInd(Logic.false_URI,0,[]))
~status
in
(match goals' with
[goal'] ->
let _,metasenv',_,_ = proof' in
- let _,context',gty' = List.find (function (m,_,_) -> m=goal') metasenv' in
-prerr_endline ("XXXX gty " ^ CicPp.ppterm gty') ;
-prerr_endline ("XXXX tty " ^ CicPp.ppterm tty) ;
-prerr_endline ("XXXX t1 " ^ CicPp.ppterm t1) ;
-prerr_endline ("XXXX t2 " ^ CicPp.ppterm t2) ;
-ignore (List.map (fun t -> prerr_endline ("XXXX t " ^ CicPp.ppterm t)) pattern) ;
-prerr_endline ("XXXX case " ^ CicPp.ppterm (C.Appl [
- C.Lambda (
- C.Name "x", tty,
- C.MutCase (
- turi, typeno,
- (C.Lambda ((C.Name "x"),tty,(C.Sort C.Prop))),
- (C.Rel 1), pattern
- )
- ); t2])) ;
+ let _,context',gty' =
+ CicUtil.lookup_meta goal' metasenv'
+ in
T.then_
~start:
(P.change_tac
let module P = PrimitiveTactics in
let module T = Tacticals in
let _,metasenv,_,_ = proof in
- let _,context,gty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,gty = CicUtil.lookup_meta goal metasenv in
let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
match termty with
(C.Appl [(C.MutInd (uri, 0, [])); _; t1; t2]) when (uri = (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind")) ->
let module P = PrimitiveTactics in
let module T = Tacticals in
let _,metasenv,_,_ = proof in
- let _,context,_ = List.find (function (m,_,_) -> m=goal) metasenv in
+ let _,context,_ = CicUtil.lookup_meta goal metasenv in
let termty = (CicTypeChecker.type_of_aux' metasenv context term) in
match termty with
(C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2])
(match goals' with
[goal'] ->
let _,metasenv',_,_ = proof' in
- let _,context',gty' = List.find (function (m,_,_) -> m=goal') metasenv' in
-prerr_endline ("XXXX gty " ^ CicPp.ppterm gty') ;
-prerr_endline ("XXXX tty " ^ CicPp.ppterm tty) ;
-prerr_endline ("XXXX t1' " ^ CicPp.ppterm t1') ;
-prerr_endline ("XXXX t2' " ^ CicPp.ppterm t2') ;
-ignore (List.map (fun t -> prerr_endline ("XXXX t " ^ CicPp.ppterm t)) pattern) ;
-prerr_endline ("XXXX case " ^ CicPp.ppterm (C.Appl [
- C.Lambda (
- C.Name "x", tty,
- C.MutCase (
- turi, typeno,
- (C.Lambda ((C.Name "x"),tty,(C.Sort C.Prop))),
- (C.Rel 1), pattern
- )
- ); t2'])) ;
+ let _,context',gty' =
+ CicUtil.lookup_meta goal' metasenv'
+ in
T.then_
~start:
(P.change_tac