Rocq proof terms formerly Coq

Induction on a listinduction x

The same shape for another inductive type: list_ind.

Tactic script

Open Scope list_scope.

Theorem app_nil_ex : forall l : list nat, l ++ nil = l.
Proof.
  intros l.
  induction l as [| h t IHt].
  - reflexivity.
  - simpl.
    rewrite IHt.
    reflexivity.
Qed.

Proof term

MMMMMMMMMM
induction l as [| h t IHt]. built list_ind (fun l0 : list nat => l0 ++ nil = l0) ?Goal (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal0) l
(fun (l : list nat) =>
   list_ind
     
     ?Goal
     (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) =>
        ?Goal0)
     l)

Open goals (2) one per hole

  • ?Goalcurrent goal
    ⊢ nil ++ nil = nil
  • ?Goal0goal 2
    h : natt : list natIHt : t ++ nil = t
    ⊢ (h :: t) ++ nil = h :: t
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

induction x in Rocq (Coq)

The same shape for another inductive type: list_ind.

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 app_nil_ex : forall l : list nat, l ++ nil = l. Starts with a single hole whose type is the statement.
    ?Goal

    1 open goal: ?Goal

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

    1 open goal: ?Goal

  3. induction l as [| h t IHt]. Built list_ind (fun l0 : list nat => l0 ++ nil = l0) ?Goal (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal0) l.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) ?Goal (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal0) l)

    2 open goals: ?Goal, ?Goal0

  4. - Builds no new structure.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) ?Goal (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal0) l)

    2 open goals: ?Goal, ?Goal0

  5. reflexivity. Built eq_refl.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) eq_refl (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal) l)

    1 open goal: ?Goal

  6. - Builds no new structure.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) eq_refl (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal) l)

    1 open goal: ?Goal

  7. simpl. Built ?Goal : (h :: t) ++ nil = h :: t.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) eq_refl (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => ?Goal : (h :: t) ++ nil = h :: t) l)

    1 open goal: ?Goal

  8. rewrite IHt. Built eq_ind_r (fun l0 : list nat => h :: l0 = h :: t) ?Goal IHt.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) eq_refl (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => eq_ind_r (fun l0 : list nat => h :: l0 = h :: t) ?Goal IHt : (h :: t) ++ nil = h :: t) l)

    1 open goal: ?Goal

  9. reflexivity. Built eq_refl.
    (fun l : list nat => list_ind (fun l0 : list nat => l0 ++ nil = l0) eq_refl (fun (h : nat) (t : list nat) (IHt : t ++ nil = t) => eq_ind_r (fun l0 : list nat => h :: l0 = h :: t) eq_refl IHt : (h :: t) ++ nil = h :: t) l)

    No holes left: the term is complete.

  10. Qed. The kernel type-checks the finished term against the statement.
    app_nil_ex
    : forall l : list nat, l ++ nil = l

    Print Assumptions: Closed under the global context

Other tactics