Rocq proof terms formerly Coq

Proving a helper factassert (H : P)

assert introduces a local lemma: a function applied to its own proof.

Tactic script

Theorem assert_ex : forall P Q : Prop, P -> (P -> Q) -> Q.
Proof.
  intros P Q p f.
  assert (H : Q).
  - apply f.
    exact p.
  - exact H.
Qed.

Proof term

MMMMMMMMMM
assert (H : Q). built let H : Q := ?Goal in ?Goal0
(fun (P Q : Prop) (p : P) (f : P -> Q) =>
   let H : Q := ?Goal in
   ?Goal0)

Open goals (2) one per hole

  • ?Goalcurrent goal
    P : PropQ : Propp : Pf : P -> Q
    ⊢ Q
  • ?Goal0goal 2
    P : PropQ : Propp : Pf : P -> QH : Q
    ⊢ Q
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

assert (H : P) in Rocq (Coq)

assert introduces a local lemma: a function applied to its own proof.

General shape: let H : P := ?proof in ?rest. Two holes: a proof of P, and the rest of the proof in which H is available.

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

    1 open goal: ?Goal

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

    1 open goal: ?Goal

  3. assert (H : Q). Built let H : Q := ?Goal in ?Goal0.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := ?Goal in ?Goal0)

    2 open goals: ?Goal, ?Goal0

  4. - Builds no new structure.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := ?Goal in ?Goal0)

    2 open goals: ?Goal, ?Goal0

  5. apply f. Built f ?Goal0.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := f ?Goal0 in ?Goal)

    2 open goals: ?Goal0, ?Goal

  6. exact p. Built p.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := f p in ?Goal)

    1 open goal: ?Goal

  7. - Builds no new structure.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := f p in ?Goal)

    1 open goal: ?Goal

  8. exact H. Built H.
    (fun (P Q : Prop) (p : P) (f : P -> Q) => let H : Q := f p in H)

    No holes left: the term is complete.

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

    Print Assumptions: Closed under the global context

Other tactics