diff --git a/Tactics.v b/Tactics.v index 6bb932a..5a4f58f 100644 --- a/Tactics.v +++ b/Tactics.v @@ -74,7 +74,9 @@ Theorem silly_ex : oddb 3 = true -> evenb 4 = true. Proof. - (* FILL IN HERE *) Admitted. + intros A B. + apply B. +Qed. (** [] *) (** To use the [apply] tactic, the (conclusion of the) fact @@ -107,8 +109,11 @@ Theorem rev_exercise1 : forall (l l' : list nat), l = rev l' -> l' = rev l. Proof. - (* FILL IN HERE *) Admitted. -(** [] *) + intros l l' H. + rewrite -> H. + symmetry. + apply rev_involutive. +Qed. (** **** Exercise: 1 star, standard, optional (apply_rewrite) @@ -176,8 +181,10 @@ Example trans_eq_exercise : forall (n m o p : nat), (n + p) = m -> (n + p) = (minustwo o). Proof. - (* FILL IN HERE *) Admitted. -(** [] *) + intros n m o p H J. + apply trans_eq with (m:=m). + apply J. apply H. +Qed. (* ################################################################# *) (** * The [injection] and [discriminate] Tactics *) @@ -273,8 +280,9 @@ Example injection_ex3 : forall (X : Type) (x y z : X) (l j : list X), y :: l = x :: j -> x = y. Proof. - (* FILL IN HERE *) Admitted. -(** [] *) + intros X x y z l j H J. + injection J as J1. symmetry. apply J1. +Qed. (** So much for injectivity of constructors. What about disjointness? @@ -345,8 +353,9 @@ Example discriminate_ex3 : x :: y :: l = [] -> x = z. Proof. - (* FILL IN HERE *) Admitted. -(** [] *) + intros X x y z l H J. + discriminate J. +Qed. (** The injectivity of constructors allows us to reason that [forall (n m : nat), S n = S m -> n = m]. The converse of this