Rocq proof terms formerly Coq

Applying a hypothesisapply H

apply H puts H at the head of an application; its premises become holes.

Tactic script

Theorem apply_ex : forall (P Q R : Prop), (P -> Q) -> (Q -> R) -> P -> R.
Proof.
  intros P Q R f g p.
  apply g.
  apply f.
  exact p.
Qed.

Proof term

MMMMMMMMMM
apply g. built g ?Goal
(fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) =>
   g ?Goal)

Open goals (1) one per hole

  • ?Goalcurrent goal
    P : PropQ : PropR : Propf : P -> Qg : Q -> Rp : P
    ⊢ Q
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

apply H in Rocq (Coq)

apply H puts H at the head of an application; its premises become holes.

General shape: H ?arg1 … ?argN. H goes at the head of an application; premises Coq cannot infer become new holes.

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 apply_ex : forall (P Q R : Prop), (P -> Q) -> (Q -> R) -> P -> R. Starts with a single hole whose type is the statement.
    ?Goal

    1 open goal: ?Goal

  2. intros P Q R f g p. Built (fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => ?Goal).
    (fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => ?Goal)

    1 open goal: ?Goal

  3. apply g. Built g ?Goal.
    (fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => g ?Goal)

    1 open goal: ?Goal

  4. apply f. Built (f ?Goal).
    (fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => g (f ?Goal))

    1 open goal: ?Goal

  5. exact p. Built p.
    (fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => g (f p))

    No holes left: the term is complete.

  6. Qed. The kernel type-checks the finished term against the statement.
    apply_ex
    : forall P Q R : Prop, (P -> Q) -> (Q -> R) -> P -> R

    Print Assumptions: Closed under the global context

Other tactics