Finite map example

前端 未结 1 598
伪装坚强ぢ
伪装坚强ぢ 2021-02-08 20:39

For my application, I need to use and reason about finite maps in Coq. Googling around I\'ve found about FMapAVL which seems to be a perfect fit for my needs. The problem is tha

1条回答
  •  温柔的废话
    2021-02-08 21:24

    Assuming you know how to create a module OrderedNat : OrderedType module, ask in the comments if you need help for that.

    Module M := FMapAVL.Make(OrderedNat).
    
    Definition map_nat_nat := M.t nat.
    
    Definition find k (m : nap_nat_nat) := M.find k m. (* you can just use M.find otherwise... *)
    
    Notation "x |-> y" := (M.add x y M.empty) (at level 60, no associativity).
    
    Notation "[ ]" := nil.
    
    Notation "[ k1 |-> d1 , .. , kn |-> dn ]" := (M.add k1 d1 .. (M.add kn dn M.empty) .. ).
    

    I can't test that right now but it should be pretty similar to this.

    0 讨论(0)
提交回复
热议问题