coq - Software Foundations: apply ... with ... tactic -
i'm try run simple examples on apply ... ...
tactic pierce's "software foundations".
it seems examples book doesn't work me:
theorem trans_eq: forall (x: type) (n m o: type), n = m -> m = o -> n = o. proof. intros x n m o eq1 eq2. rewrite -> eq1. rewrite -> eq2. reflexivity. qed. example trans_eq_example' : forall (a b c d e f : nat), [a;b] = [c;d] -> [c;d] = [e;f] -> [a;b] = [e;f]. proof. intros b c d e f eq1 eq2. (* if tell coq apply trans_eq @ point, can tell (by matching goal against conclusion of lemma) should instantiate x [nat], n [a,b], , o [e,f]. however, matching process doesn't determine instantiation m: have supply 1 explicitly adding (m:=[c,d]) invocation of apply. *) apply trans_eq (m:=[c;d]). apply eq1. apply eq2. qed.
trans_eq_example'
failed error:
trans_eq_example' < apply trans_eq (m:=[c;d]). toplevel input, characters 6-30: > apply trans_eq (m:=[c;d]). > ^^^^^^^^^^^^^^^^^^^^^^^^ error: impossible unify "?1707 = ?1709" "[a; b] = [e; f]".
additional information coq version:
coqtop -v coq proof assistant, version 8.4pl4 (july 2014) compiled on jul 27 2014 23:12:44 ocaml 4.01.0
how can fix error?
the issue not apply
typo in previous code. definition of trans_eq
should be:
theorem trans_eq: forall (x:type) (n m o: x), n = m -> m = o -> n = o.
note type of n m o
should x
, not type
.
Comments
Post a Comment