let module C = Cic in
let module U = UriManager in
let curi,metasenv,pbo,pty = proof in
- let metano,context,gty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let metano,context,gty = CicUtil.lookup_meta goal metasenv in
let eq_ind_r,ty,t1,t2 =
match CicTypeChecker.type_of_aux' metasenv context equality with
C.Appl [C.MutInd (uri,0,[]) ; ty ; t1 ; t2]
C.Lambda
(ProofEngineHelpers.mk_fresh_name context C.Anonymous ty, ty, gty'')
in
- let fresh_meta = ProofEngineHelpers.new_meta proof in
- let irl =
- ProofEngineHelpers.identity_relocation_list_for_metavariable context in
+ let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in
+ let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in
let metasenv' = (fresh_meta,context,C.Appl [pred ; t2])::metasenv in
let (proof',goals) =
let module C = Cic in
let module U = UriManager in
let curi,metasenv,pbo,pty = proof in
- let metano,context,gty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let metano,context,gty = CicUtil.lookup_meta goal metasenv in
let eq_ind_r,ty,t1,t2 =
match CicTypeChecker.type_of_aux' metasenv context equality with
C.Appl [C.MutInd (uri,0,[]) ; ty ; t1 ; t2]
C.Lambda
(ProofEngineHelpers.mk_fresh_name context C.Anonymous ty, ty, gty'')
in
- let fresh_meta = ProofEngineHelpers.new_meta proof in
+ let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in
let irl =
- ProofEngineHelpers.identity_relocation_list_for_metavariable context in
+ CicMkImplicit.identity_relocation_list_for_metavariable context in
let metasenv' = (fresh_meta,context,C.Appl [pred ; t2])::metasenv in
let (proof',goals) =
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 wty = CicTypeChecker.type_of_aux' metasenv context what in
try
if (wty = (CicTypeChecker.type_of_aux' metasenv context with_what))
- then T.thens
- ~start:(
- P.cut_tac
- (C.Appl [
- (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"), 0, [])) ; (* quale uguaglianza usare, eq o eqT ? *)
- wty ;
- what ;
- with_what]))
- ~continuations:[
- T.then_
- ~start:(rewrite_simpl_tac ~term:(C.Rel 1))
- ~continuation:(
- ProofEngineStructuralRules.clear
- ~hyp:(List.hd context)) ;
- T.id_tac]
- ~status
+ then
+ let equality =
+ match CicTypeChecker.type_of_aux' metasenv context wty with
+ C.Sort C.Set -> "cic:/Coq/Init/Logic/eq.ind"
+ | C.Sort C.Type
+ | C.Sort C.CProp
+ | C.Sort C.Prop -> "cic:/Coq/Init/Logic_Type/eqT.ind"
+ | _ -> assert false
+ in
+ T.thens
+ ~start:(
+ P.cut_tac
+ (C.Appl [
+ (C.MutInd ((U.uri_of_string equality), 0, [])) ;
+ wty ;
+ what ;
+ with_what]))
+ ~continuations:[
+ T.then_
+ ~start:(rewrite_simpl_tac ~term:(C.Rel 1))
+ ~continuation:(
+ ProofEngineStructuralRules.clear
+ ~hyp:(List.hd context)) ;
+ T.id_tac]
+ ~status
else raise (ProofEngineTypes.Fail "Replace: terms not replaceable")
with (Failure "hd") -> raise (ProofEngineTypes.Fail "Replace: empty context")
;;
let module R = CicReduction in
let module U = UriManager in
let (_,metasenv,_,_) = proof in
- let metano,context,ty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let metano,context,ty = CicUtil.lookup_meta goal metasenv in
match (R.whd context ty) with
(C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) when (U.eq uri (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind")) ->
PrimitiveTactics.apply_tac ~status:(proof,goal)
let module U = UriManager in
let module T = Tacticals in
let (_,metasenv,_,_) = proof in
- let metano,context,ty = List.find (function (m,_,_) -> m=goal) metasenv in
+ let metano,context,ty = CicUtil.lookup_meta goal metasenv in
match (R.whd context ty) with
(C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) when (uri = (U.uri_of_string "cic:/Coq/Init/Logic/eq.ind")) ->
T.thens