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.
Theorem apply_ex : forall (P Q R : Prop), (P -> Q) -> (Q -> R) -> P -> R.Starts with a single hole whose type is the statement.?Goal1 open goal: ?Goal
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
apply g.Builtg ?Goal.(fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => g ?Goal)
1 open goal: ?Goal
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
exact p.Builtp.(fun (P Q R : Prop) (f : P -> Q) (g : Q -> R) (p : P) => g (f p))No holes left: the term is complete.
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
- intro / intros Introducing hypotheses
- exact t Giving the term directly
- reflexivity Closing an equation
- destruct x Case analysis
- 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