![](/img/trans.png)
[英]How to upgrade Ocaml to the latest version to support QuickChick in Coq?
[英]How to get the name of a named goal in the coq api
我目前正在開發一個 ocaml 程序,該程序將使用 coq api 來提取有關證明及其目標的信息。 為此,當使用“refine?[name]”或其他命名目標的策略時,我想提取給目標的名稱。 截至目前,我正在獲得當前目標,使用我當前的證明 state 來提取它們,如下所示
(*currstate is the current state of the proof*)
let pstate = match currentstate.proof with
| None ->
begin
failwith ""
end
| Some pst -> pst
in
let goals = (Proof.data pstate).goals in
...
使用這種方法,我可以提取目標的 ID,但不能提取它們的名稱。
有沒有可能提取名稱?
我終於找到了一種從 API 中檢索命名目標名稱的方法。 因為我可能不是唯一需要這個的人,所以我發布了一個答案。
已經存在一個 function 可以讓您在打印機中打印目標的名稱,但遺憾的是它是私有的,不能使用。 它使用Names.Id.print (Termops.evar_suggested_name goal sigma)
來檢索名稱,其中目標是Goal.goal
類型,而 sigma 是Evd.evar_map
類型。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.