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:

  • destruct destruct iheven separate witness k1 , proof p = 2 * k1.
  • exists exhibit (s k1) existential witness goal.
  • then work prove equality holds.

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -