rewrite <- H in Rocq (Coq)
rewrite <- H is the mirror image of rewrite H.
General shape: eq_ind x (fun y => …) ?g y H. The mirror image of rewrite H: the same equality eliminator, but eq_ind instead of eq_ind_r.
Step by step: the proof term after each sentence
Recorded from Coq with Show Proof. after every sentence. Teal is what the sentence built; ?Goal pills are holes still to fill.
Theorem rewrite_back_ex : forall a b : nat, a = b -> b = a.Starts with a single hole whose type is the statement.?Goal1 open goal: ?Goal
intros a b H.Built(fun (a b : nat) (H : a = b) => ?Goal).(fun (a b : nat) (H : a = b) => ?Goal)
1 open goal: ?Goal
rewrite <- H.Builteq_ind a (fun b0 : nat => b0 = a) ?Goal b H.(fun (a b : nat) (H : a = b) => eq_ind a (fun b0 : nat => b0 = a) ?Goal b H)
1 open goal: ?Goal
reflexivity.Builteq_refl.(fun (a b : nat) (H : a = b) => eq_ind a (fun b0 : nat => b0 = a) eq_refl b H)No holes left: the term is complete.
Qed.The kernel type-checks the finished term against the statement.rewrite_back_ex : forall a b : nat, a = b -> b = a
Print Assumptions: Closed under the global context
Other tactics
- intro / intros Introducing hypotheses
- apply H Applying a hypothesis
- exact t Giving the term directly
- reflexivity Closing an equation
- destruct x Case analysis
- destruct x Case analysis on a number
- induction x Induction on nat
- induction x Induction on a list
- split Proving a conjunction
- left Choosing the left disjunct
- right Choosing the right disjunct
- assert (H : P) Proving a helper fact
- rewrite H Rewriting with an equation
- assumption Finding the hypothesis
- discriminate Impossible equations
- revert x Putting a variable back in the goal
- exists t Providing a witness