Rocq proof terms formerly Coq

Induction on natinduction x

induction n applies the induction principle nat_ind to a predicate, a base hole and a step hole.

Tactic script

Theorem plus_n_O_ex : forall n : nat, n = n + 0.
Proof.
  intros n.
  induction n as [| n' IHn'].
  - reflexivity.
  - simpl.
    rewrite <- IHn'.
    reflexivity.
Qed.

Proof term

MMMMMMMMMM
induction n as [| n' IHn']. built nat_ind (fun n0 : nat => n0 = n0 + 0) ?Goal (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal0) n
(fun (n : nat) =>
   nat_ind
     
     ?Goal
     (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal0)
     n)

Open goals (2) one per hole

  • ?Goalcurrent goal
    ⊢ 0 = 0 + 0
  • ?Goal0goal 2
    n' : natIHn' : n' = n' + 0
    ⊢ S n' = S n' + 0
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

induction x in Rocq (Coq)

induction n applies the induction principle nat_ind to a predicate, a base hole and a step hole.

General shape: nat_ind P ?base ?step x. The induction principle applied to the predicate P, a base case, a step case (with the induction hypothesis as an extra argument) and x.

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 plus_n_O_ex : forall n : nat, n = n + 0. Starts with a single hole whose type is the statement.
    ?Goal

    1 open goal: ?Goal

  2. intros n. Built (fun n : nat => ?Goal).
    (fun n : nat => ?Goal)

    1 open goal: ?Goal

  3. induction n as [| n' IHn']. Built nat_ind (fun n0 : nat => n0 = n0 + 0) ?Goal (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal0) n.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) ?Goal (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal0) n)

    2 open goals: ?Goal, ?Goal0

  4. - Builds no new structure.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) ?Goal (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal0) n)

    2 open goals: ?Goal, ?Goal0

  5. reflexivity. Built eq_refl.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) eq_refl (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal) n)

    1 open goal: ?Goal

  6. - Builds no new structure.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) eq_refl (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal) n)

    1 open goal: ?Goal

  7. simpl. Built ?Goal : S n' = S n' + 0.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) eq_refl (fun (n' : nat) (IHn' : n' = n' + 0) => ?Goal : S n' = S n' + 0) n)

    1 open goal: ?Goal

  8. rewrite <- IHn'. Built eq_ind n' (fun n0 : nat => S n' = S n0) ?Goal (n' + 0) IHn'.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) eq_refl (fun (n' : nat) (IHn' : n' = n' + 0) => eq_ind n' (fun n0 : nat => S n' = S n0) ?Goal (n' + 0) IHn' : S n' = S n' + 0) n)

    1 open goal: ?Goal

  9. reflexivity. Built eq_refl.
    (fun n : nat => nat_ind (fun n0 : nat => n0 = n0 + 0) eq_refl (fun (n' : nat) (IHn' : n' = n' + 0) => eq_ind n' (fun n0 : nat => S n' = S n0) eq_refl (n' + 0) IHn' : S n' = S n' + 0) n)

    No holes left: the term is complete.

  10. Qed. The kernel type-checks the finished term against the statement.
    plus_n_O_ex
    : forall n : nat, n = n + 0

    Print Assumptions: Closed under the global context

Other tactics