Rocq proof terms formerly Coq

Rewriting with an equationrewrite H

rewrite uses an equality eliminator (eq_ind / eq_ind_r) driven by H.

Tactic script

Theorem rewrite_ex : forall a b : nat, a = b -> b = a.
Proof.
  intros a b H.
  rewrite H.
  reflexivity.
Qed.

Proof term

MMMMMMMMMM
rewrite H. built eq_ind_r (fun a0 : nat => b = a0) ?Goal H
(fun (a b : nat) (H : a = b) =>
   eq_ind_r  ?Goal H)

Open goals (1) one per hole

  • ?Goalcurrent goal
    a : natb : natH : a = b
    ⊢ b = b
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

rewrite H in Rocq (Coq)

rewrite uses an equality eliminator (eq_ind / eq_ind_r) driven by H.

General shape: eq_ind_r (fun x => …) ?g H. An equality eliminator driven by H (eq_ind_r for rewrite H). The predicate says where the rewritten term occurs.

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.

  1. Theorem rewrite_ex : forall a b : nat, a = b -> b = a. Starts with a single hole whose type is the statement.
    ?Goal

    1 open goal: ?Goal

  2. 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

  3. rewrite H. Built eq_ind_r (fun a0 : nat => b = a0) ?Goal H.
    (fun (a b : nat) (H : a = b) => eq_ind_r (fun a0 : nat => b = a0) ?Goal H)

    1 open goal: ?Goal

  4. reflexivity. Built eq_refl.
    (fun (a b : nat) (H : a = b) => eq_ind_r (fun a0 : nat => b = a0) eq_refl H)

    No holes left: the term is complete.

  5. Qed. The kernel type-checks the finished term against the statement.
    rewrite_ex
    : forall a b : nat, a = b -> b = a

    Print Assumptions: Closed under the global context

Other tactics