Rocq proof terms formerly Coq

Case analysisdestruct x

destruct x builds a match with one branch (hole) per constructor.

Tactic script

Theorem destruct_ex : forall b : bool, orb b true = true.
Proof.
  intros b.
  destruct b.
  - reflexivity.
  - reflexivity.
Qed.

Proof term

MMMMMMMMMM
destruct b. built if b as b0 return ((b0 || true)%bool = true) then ?Goal else ?Goal0
(fun (b : bool) =>
   if b  then ?Goal else ?Goal0)

Open goals (2) one per hole

  • ?Goalcurrent goal
    ⊢ (true || true)%bool = true
  • ?Goal0goal 2
    ⊢ (false || true)%bool = true
built by the current tactichole: a goal still to fillearlier tactics greyed · later ones dashed

destruct x in Rocq (Coq)

destruct x builds a match with one branch (hole) per constructor.

General shape: match x with | C₁ … => ?g₁ | C₂ … => ?g₂ end. One branch (hole) per constructor. For bool, Coq prints the match as if … then … else.

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 destruct_ex : forall b : bool, orb b true = true. Starts with a single hole whose type is the statement.
    ?Goal

    1 open goal: ?Goal

  2. intros b. Built (fun b : bool => ?Goal).
    (fun b : bool => ?Goal)

    1 open goal: ?Goal

  3. destruct b. Built if b as b0 return ((b0 || true)%bool = true) then ?Goal else ?Goal0.
    (fun b : bool => if b as b0 return ((b0 || true)%bool = true) then ?Goal else ?Goal0)

    2 open goals: ?Goal, ?Goal0

  4. - Builds no new structure.
    (fun b : bool => if b as b0 return ((b0 || true)%bool = true) then ?Goal else ?Goal0)

    2 open goals: ?Goal, ?Goal0

  5. reflexivity. Built eq_refl.
    (fun b : bool => if b as b0 return ((b0 || true)%bool = true) then eq_refl else ?Goal)

    1 open goal: ?Goal

  6. - Builds no new structure.
    (fun b : bool => if b as b0 return ((b0 || true)%bool = true) then eq_refl else ?Goal)

    1 open goal: ?Goal

  7. reflexivity. Built eq_refl.
    (fun b : bool => if b as b0 return ((b0 || true)%bool = true) then eq_refl else eq_refl)

    No holes left: the term is complete.

  8. Qed. The kernel type-checks the finished term against the statement.
    destruct_ex
    : forall b : bool, (b || true)%bool = true

    Print Assumptions: Closed under the global context

Other tactics