tmiyaããã®ç·´ç¿åé¡ãã©ã ãå¼ã§è§£ãã¦ã¿ã
2010-09-26 ãè¦ã¦åãå½é¡ã Agda2 ã§è¨¼æãã¦ã¿ãã
Functional Programming Memo: [Coq] Coq-99 : Part 1
agda-mode ã証æããã®ãæä¼ã£ã¦ãããã®ã§ãæ°æ¥½ã§ãã
module Practice1 where data True : Prop where tt : True data False : Prop where data _â§_ (P Q : Prop) : Prop where â§-intro : P â Q â P ⧠Q â§-eliml : â {P Q} â P ⧠Q â P â§-eliml (â§-intro y y') = y â§-elimr : â {P Q} -> P ⧠Q -> Q â§-elimr (â§-intro y y') = y' data _â¨_ (P Q : Prop) : Prop where â¨-introl : P -> P ⨠Q â¨-intror : Q -> P ⨠Q â¨-elim : â {P Q R : Prop} -> (P ⨠Q) -> (P -> R) -> (Q -> R) -> R â¨-elim (â¨-introl y) a b = a y â¨-elim (â¨-intror y) a b = b y ~_ : Prop -> Prop ~ p = p -> False infixl 10 _â§_ infixl 9 _â¨_ lemma01 : â (A B C : Prop) â (A â B â C) â (A â B) â A â C lemma01 a b c d e f = d f (e f) lemma02 : â A B C â A ⧠(B ⧠C) â (A ⧠B) ⧠C lemma02 a b c d = â§-intro (â§-intro (â§-eliml d) (â§-eliml (â§-elimr d))) (â§-elimr (â§-elimr d)) lemma03 : â A B C D â (A â C) ⧠(B â D) ⧠A ⧠B â C ⧠D lemma03 a b c d e = â§-intro (â§-eliml (â§-eliml (â§-eliml e)) (â§-elimr (â§-eliml e))) (â§-elimr (â§-eliml (â§-eliml e)) (â§-elimr e)) lemma04 : â A â ~(A ⧠(~ A)) lemma04 a b = â§-elimr b (â§-eliml b) lemma05 : â A B C â A ⧠(B ⨠C) â (A ⨠B) ⨠C lemma05 a b c d = â¨-introl (â¨-introl (â§-eliml d)) lemma06 : â A â ~(~(~ A)) â ~ A lemma06 a b c = b (λ x â x c) lemma07 : â A B â (A â B) â ~ B â ~ A lemma07 a b c d e = d (c e) lemma08 : â (A B : Prop) â ((((A â B) â A) â A) â B) â B lemma08 a b c = c (λ x â x (λ x' â c (λ _ -> x'))) lemma09 : â A â ~(~(A ⨠(~ A))) lemma09 a b = b (â¨-intror (λ x â b (â¨-introl x)))