archive-nl.com » NL » R » ROBBERTKREBBERS.NL

Total: 145

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Module countable
    option A encode o match o with None 1 Some x Pos succ encode x end decode p if decide p 1 then Some None else Some decode Pos pred p Next Obligation intros x simpl repeat case decide auto with lia by rewrite Pos pred succ decode encode Qed Program Instance sum countable Countable A Countable B Countable A B type encode xy match xy with inl x encode x 0 inr y encode y 1 end decode p match p with 1 None p 0 inl decode p p 1 inr decode p end Next Obligation by intros x y simpl rewrite decode encode Qed Fixpoint prod encode fst p positive positive match p with 1 1 p 0 prod encode fst p 0 0 p 1 prod encode fst p 0 1 end Fixpoint prod encode snd p positive positive match p with 1 1 0 p 0 prod encode snd p 0 0 p 1 prod encode snd p 1 0 end Fixpoint prod encode p q positive positive match p q with 1 1 1 1 p 0 1 prod encode fst p 1 0 p 1 1 prod encode fst p 1 1 1 q 0 prod encode snd q 0 1 1 q 1 prod encode snd q 1 1 p 0 q 0 prod encode p q 0 0 p 0 q 1 prod encode p q 1 0 p 1 q 0 prod encode p q 0 1 p 1 q 1 prod encode p q 1 1 end Fixpoint prod decode fst p positive option positive match p with p 0 0 0 prod decode fst p p 0 1 Some match prod decode fst p with Some q q 1 1 end p 1 0 0 prod decode fst p p 1 1 Some match prod decode fst p with Some q q 1 1 end 1 0 None 1 1 Some 1 1 Some 1 end Fixpoint prod decode snd p positive option positive match p with p 0 0 0 prod decode snd p p 0 1 0 prod decode snd p p 1 0 Some match prod decode snd p with Some q q 1 1 end p 1 1 Some match prod decode snd p with Some q q 1 1 end 1 0 Some 1 1 1 Some 1 1 None end Lemma prod decode encode fst p q prod decode fst prod encode p q Some p Proof assert p prod decode fst prod encode fst p Some p intros p by induction p simplify option equality assert p prod decode fst prod encode snd p None intros p by induction p simplify option equality revert q by induction p intros simplify option equality Qed Lemma prod decode encode snd p q prod decode snd prod encode p q Some q Proof assert p prod decode snd prod encode snd p Some p intros p by induction p simplify option equality assert p

    Original URL path: http://robbertkrebbers.nl/research/ch2o/countable.html (2015-08-10)
    Open archived version from archive