math - Leibniz property in Coq -


i have definition of equality on natural numbers :

fixpoint equal_nat (n m : nat) : bool :=    match n, m     | o, o => true     | o, s _ => false     | s _, o => false     | s n1, s n2 => equal_nat n1 n2   end. 

(which standard definition)

and i'm trying prove following proposition :

proposition equal_nat_correct :   forall b : nat, = b <-> equal_nat b = true. 

i can first half of proof, not other one... can give me hint ? here i've done far :

proof.   intros.   split.    (* => *)   destruct a.   destruct b.   reflexivity.   discriminate.   intros. destruct h. simpl.   induction a. reflexivity.   simpl. assumption.    (* <= *)   (* ? *) qed. 

thanks.

edit :

here complete proof (probably not optimal however) :

proposition equal_nat_correct :   forall b : nat, = b <-> equal_nat b = true. proof.   split.    (* => *)   revert b.   induction [ | hi]; intros [ | b ]; simpl in *; intuition.   discriminate.   discriminate.    (* <= *)   revert b.   induction a.   intros.   induction b.   reflexivity.   discriminate.   intros [ | b]; simpl in *; intuition.   discriminate.   qed. 

the idea both half go induction have careful in context before perform it. in particular case, should not have introduced b right away. here how have done first half:

intros. split. revert b. (* puts b goal, generalized correctly induction *) induction [ | hi ]. (* gives explicit names term newly created induction *)   intro [ | b ]. (* equalivalent intro b. destruct b [ | b ]. *)     intros; simpl; reflexivity.     intros; discriminate.    intro [ | b ].     intros; discriminate.     intros h; injection h; intros h2.     simpl; apply hi; assumption 

the short version be:

intros. split. revert b. induction [ | hi]; intros [ | b ]; simpl in *; intuition. discriminate. discriminate. 

following same pattern (do not forget generalize b in goal), should able second half of proof.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -