I wrote the following ML code:
(我编写了以下ML代码:)
lemma fstI: "x = (y, z) ? y = fst x"
by simp
ML ?
val ctxt0 = @{context};
val ctxt = ctxt0;
val (_,ctxt) = Variable.add_fixes ["z1'","x1'","y1'","x1", "y1", "x2", "y2"] ctxt;
val (assms,ctxt) = Assumption.add_assumes
[@{cprop "z1' = (x1',y1')"},@{cprop "z1' = ext_add (x1,y1) (x2,y2)"}] ctxt;
val th1 = @{thm fstI} OF [(nth assms 0)]
val th2 = Thm.instantiate' [SOME @{ctyp "'a"}] [SOME @{cterm "fst::'a×'a ? 'a"}] (@{thm arg_cong} OF [(nth assms 1)])
val x1'_expr = Goal.prove ctxt [] []
@{prop "x1' = fst (ext_add (x1,y1) (x2,y2))"}
(fn _ => EqSubst.eqsubst_tac ctxt [1] [th1] 1
THEN EqSubst.eqsubst_tac ctxt [1] [th2] 1
THEN simp_tac ctxt 1)
?
corresponding to the following Isar proof:
(对应于以下Isar证明:)
lemma taylored_assoc:
assumes "z1' = (x1',y1')"
"z1' = ext_add (x1,y1) (x2,y2)" "z3' = add (x2,y2) (x3,y3)"
shows "x1' = fst (ext_add (x1,y1) (x2,y2))"
by(tactic ?EqSubst.eqsubst_tac @{context} [1] [@{thm fstI[OF assms(1)]}] 1
THEN EqSubst.eqsubst_tac @{context} [1] [@{thm arg_cong[OF assms(2), of fst]}] 1
THEN simp_tac @{context} 1?)
The ML version of it is not working for some reason?
(由于某些原因,它的ML版本无法正常工作吗?)
How could I debug this? (我该如何调试呢?)
There is the print_tac tactic, but it only acccepts strings, while I would like to print the actual subgoal after each tactic is applied. (有print_tac策略,但它只接受字符串,而我想在应用每种策略后打印实际的子目标。)
ask by Rodrigo translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…