Why does use of Coq's setoid_replace "by" clause need an extra idtac? -


i encountered strange situation using setoid_replace proof step of form:

setoid_replace (a - c + d) b my_tactic 

fails error: no matching clauses match goal, after appending idtac tactic:

setoid_replace (a - c + d) b (my_tactic; idtac) 

the proof succeeds. understanding of idtac was no-op. why presence of idtac make difference here?

here's full code. i'm using coq 8.4pl6 through proof general.

require import qarith. open scope q.  lemma rearrange_eq_r b c d :   == b  ->  b + d == + c  ->  c == d. proof.   intro a_eq_b; rewrite a_eq_b; symmetry; apply qplus_inj_l (z := b). qed.  ltac rearrange :=   match goal   | [ h : _ == _ |- _ == _ ] => apply rearrange_eq_r (1 := h); ring   end.  lemma test_rearrange b c d e (h0 : e < b) (h1 : b + c == + d) :  e < - c + d. proof.   (* why 'idtac' required in line below? *)   setoid_replace (a - c + d) b (rearrange; idtac).   assumption. qed. 

note: matt observes, idtac doesn't seem special here: seems tactic (including fail!) can used in place of idtac make proof succeed.

thanks jason gross on coq bug tracker explaining this. has order of evaluation in ltac tactic language. in failing case, match in rearrange being applied inequality in immediate goal rather equality generated setoid_replace. here's jason's response on bug report:

this because [match] evaluated before [setoid_replace] run. 1 of unfortunate trip-ups of ltac things [match] , [let ... in ...] evaluated eagerly until statement semicolons, or other non-match non-let-in statement reached. if add [idtac; ] before [match] in [rearrange], problem go away.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -