4
當試圖創建一個循環可變長度參數列表的Ltac定義時,我在Coq 8.4pl2上遇到以下意外行爲。任何人都可以解釋給我嗎?Coq:可變參數列表中的Ltac定義?
Ltac ltac_loop X :=
match X with
| 0 => idtac "done"
| _ => (fun Y => idtac "hello"; ltac_loop Y)
end.
Goal True.
ltac_loop 0. (* prints "done" as expected *)
ltac_loop 1 0. (* prints "hello" then "done" as expected *)
ltac_loop 1 1 0. (* unexpectedly yields "Error: Illegal tactic application." *)
在'ltac_loop_aux',你可以取代'(樂趣Y => ltac_loop_aux LTAC:(idtac 「你好」; K)Y)'和'ltac_loop_aux ltac:(idtac「hello」; k)'。 –