I am new to Coq and am asking a quick question about destruction tactics. Suppose I have a count function that counts the number of occurrences of a given natural number in a list of natural numbers:
Fixpoint count (v : nat) (xs : natlist) : nat := match xs with | nil => 0 | h :: t => match beq_nat hv with | true => 1 + count v xs | false => count v xs end end.
I would like to prove the following theorem:
Theorem count_cons : forall (ny : nat) (xs : natlist), count n (y :: xs) = count n xs + count n [y].
If I proved a similar theorem for n = 0, I could simply destroy y to 0 or S y '. In the general case, what I would like to do is destruct (beq_nat ny) is true or false, but I cannot make it work - I do not see any part of the Coq syntax.
Any ideas?
source share