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.
Theorem destruct_ex : forall b : bool, orb b true = true.Starts with a single hole whose type is the statement.?Goal1 open goal: ?Goal
intros b.Built(fun b : bool => ?Goal).(fun b : bool => ?Goal)
1 open goal: ?Goal
destruct b.Builtif 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
-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
reflexivity.Builteq_refl.(fun b : bool => if b as b0 return ((b0 || true)%bool = true) then eq_refl else ?Goal)
1 open goal: ?Goal
-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
reflexivity.Builteq_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.
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
- intro / intros Introducing hypotheses
- apply H Applying a hypothesis
- exact t Giving the term directly
- reflexivity Closing an equation
- destruct x Case analysis on a number
- induction x Induction on nat
- induction x Induction on a list
- split Proving a conjunction
- left Choosing the left disjunct
- right Choosing the right disjunct
- assert (H : P) Proving a helper fact
- rewrite H Rewriting with an equation
- rewrite <- H Rewriting right to left
- assumption Finding the hypothesis
- discriminate Impossible equations
- revert x Putting a variable back in the goal
- exists t Providing a witness