set - Proofs in coq using MSet -


so still new coq , msets giving me issues. here 2 functions compute whether element in list or set, please let me know if think set_contains definition correct or if there better way it. help.

    require import msets zarith.     module mset := msetavl.make positive_as_ot.     notation pos_set := mset.t.      definition set_contains (x : positive) (s : pos_set) :=       mset.mem x s.      fixpoint list_contains (x : positive) (l : list positive) : bool :=       match l       | nil => false       | y :: l' =>         if pos.eqb x y true         else nodelist_contains x l'      end.     lemma nodelist_nodeset_contains :       forall x  (s : pos_set),         (nodelist_contains x (mset.elements s)) = (nodeset_contains x s).     proof.       induction s.       destruct list_contains.       destruct set_contains.       auto. 

it seems set_contains evaluates true @ base case after destructs , i'm not sure why. set not mset.empty during stage of proof?

i not know how work mset.in, have trouble base case of proof, have same problem. want state:

    lemma nodelist_containsp :       forall x (l : pos_set),         reflect (mset.in x l) (nodeset_contains x l). 

in case interested here how did proof.

       intros.        apply iff_reflect.        unfold nodeset_contains.        symmetry.        apply mset.mem_spec.        qed. 

list_contains , set_contains functions not make sense try destruct them. coq tries infer meant , guesses want case on value of expression starting list_contains , set_contains respectively.

this not want. want observe behaviour of 2 functions on same input. , can inspecting it.

this should send in right direction:

  destruct s [mset mset_isok].   induction mset.   + unfold set_contains, mset.mem.     simpl.     reflexivity.   + unfold list_contains, set_contains, mset.mem.     simpl. 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -