coq - Stuck on even lemma with exists -
i'm stuck on lemma "left exercise" this lecture. goes this:
lemma even_double : forall n, n -> exists k, n = 2 * k. proof. intros n h. induction h. ... where even inductive predicate defined this:
inductive : nat -> prop := | even0 : 0 | evens : forall p:nat, p -> (s (s p). help, please? end (s (s p) = 2 or similar.
edit
some lemmas , tactics used (not complete proof):
destruct iheven exists (s x) rewrite mult_succ_l apply eq_s apply plus_n_sm
after induction step, should have 2 goals.
the first 1 (base case even0) should easy prove. existential witness should picked 0, after goal should hold reflexivity.
the second case (for evens) like:
p : nat h : p iheven : exists k : nat, p = 2 * k ============================ exists k : nat, s (s p) = 2 * k iheven says there exists number (let's name k1) such p = 2 * k1.
your goal exhibit number (say, k2) such can prove s (s p) = 2 * k2.
if math, should see (s k1) perfect candidate.
so proceed can use following tactics:
destructdestructihevenseparate witnessk1, proofp = 2 * k1.existsexhibit(s k1)existential witness goal.- then work prove equality holds.
Comments
Post a Comment