]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/tactics/proofEngineHelpers.ml
- decompose tactic: decomposable constants are now allowed (they are unfolded)
[helm.git] / helm / software / components / tactics / proofEngineHelpers.ml
index cf7df2d58a197ca9895837e784aa0a94e4b47294..b4e9a4e94dda77e472926710485393c45799811f 100644 (file)
@@ -686,3 +686,19 @@ let lookup_type metasenv context hyp =
       | [] -> raise (ProofEngineTypes.Fail (lazy "lookup_type: not premise in the current goal"))
    in
    aux 1 context
+
+(* FG: **********************************************************************)
+
+let get_name context index =
+   try match List.nth context (pred index) with
+      | Some (Cic.Name name, _)     -> Some name
+      | _                           -> None
+   with Invalid_argument "List.nth" -> None
+
+let get_rel context name =
+   let rec aux i = function
+      | []                                      -> None
+      | Some (Cic.Name s, _) :: _ when s = name -> Some (Cic.Rel i)
+      | _ :: tl                                 -> aux (succ i) tl
+   in
+   aux 1 context