discriminate in Rocq (Coq)
discriminate derives False from a constructor clash.
General shape: False_ind … (eq_ind … I … H). Uses the equation between different constructors to derive False, then False_ind.
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 discriminate_ex : forall n : nat, S n = 0 -> False.Starts with a single hole whose type is the statement.?Goal1 open goal: ?Goal
intros n H.Built(fun (n : nat) (H : S n = 0) => ?Goal).(fun (n : nat) (H : S n = 0) => ?Goal)
1 open goal: ?Goal
discriminate H.Builtlet H0 : False := eq_ind (S n) (fun e : nat => match e with | 0 => False | S _ => True end) I 0 H in False_ind False H0.(fun (n : nat) (H : S n = 0) => let H0 : False := eq_ind (S n) (fun e : nat => match e with | 0 => False | S _ => True end) I 0 H in False_ind False H0)
No holes left: the term is complete.
Qed.The kernel type-checks the finished term against the statement.discriminate_ex : forall n : nat, S n = 0 -> False
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
- 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
- revert x Putting a variable back in the goal
- exists t Providing a witness