X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Ftactics%2FproofEngineHelpers.ml;h=246751b32785f52b49cad40cff47f7172fffe469;hb=6c2b6d916f0d84b00153c717e1c933895420af69;hp=fa5c77d7170928091cbd50a29917b9fc40ec883c;hpb=3e25c8d9f6e7802a2fc28697795b9128af731494;p=helm.git diff --git a/helm/software/components/tactics/proofEngineHelpers.ml b/helm/software/components/tactics/proofEngineHelpers.ml index fa5c77d71..246751b32 100644 --- a/helm/software/components/tactics/proofEngineHelpers.ml +++ b/helm/software/components/tactics/proofEngineHelpers.ml @@ -363,25 +363,25 @@ let pattern_of ?(equality=(==)) ~term terms = if b1||b2 then true,Cic.Cast (te, ty) else not_found - | Cic.Prod (name, s, t) -> + | Cic.Prod (_, s, t) -> let b1,s = aux s in let b2,t = aux t in if b1||b2 then - true, Cic.Prod (name, s, t) + true, Cic.Prod (Cic.Anonymous, s, t) else not_found - | Cic.Lambda (name, s, t) -> + | Cic.Lambda (_, s, t) -> let b1,s = aux s in let b2,t = aux t in if b1||b2 then - true, Cic.Lambda (name, s, t) + true, Cic.Lambda (Cic.Anonymous, s, t) else not_found - | Cic.LetIn (name, s, t) -> + | Cic.LetIn (_, s, t) -> let b1,s = aux s in let b2,t = aux t in if b1||b2 then - true, Cic.LetIn (name, s, t) + true, Cic.LetIn (Cic.Anonymous, s, t) else not_found | Cic.Appl terms -> @@ -707,3 +707,19 @@ let sort_metasenv (m : Cic.metasenv) = (MS.topological_sort m (relations_of_menv m) : Cic.metasenv) ;; +(** create a ProofEngineTypes.mk_fresh_name_type function which uses given + * names as long as they are available, then it fallbacks to name generation + * using FreshNamesGenerator module *) +let namer_of names = + let len = List.length names in + let count = ref 0 in + fun metasenv context name ~typ -> + if !count < len then begin + let name = match List.nth names !count with + | Some s -> Cic.Name s + | None -> Cic.Anonymous + in + incr count; + name + end else + FreshNamesGenerator.mk_fresh_name ~subst:[] metasenv context name ~typ