Proof: Difference between revisions

83 bytes added ,  12 years ago
m
no edit summary
(update the task and agda example)
mNo edit summary
Line 39:
 
=={{header|ACL2}}==
 
3.1. using built-in natural numbers:
 
<lang Lisp>(thm (implies (and (evenp x) (evenp y))
(evenp (+ x y))))</lang>
Line 201 ⟶ 204:
 
=={{header|Coq}}==
 
1.1., 1.2, 2.1. and 3.1:
 
<lang coq>Inductive nat : Set :=
| O : nat
Line 241 ⟶ 247:
=={{header|Haskell}}==
 
Using [http://www.haskell.org/haskellwiki/GADT GADTs] and [http://www.haskell.org/haskellwiki/GHC/Type_families type families] it is possible to write ana partial adaptation of the Agda version:
 
<lang haskell>{-# LANGUAGE TypeOperators, TypeFamilies, GADTs #-}
Line 247 ⟶ 253:
module Arith where
 
-- 1.1. Natural numbers.
 
data Z = Z
data S n = S n
 
-- 2.1. Addition.
 
infixl 6 :+
Line 259 ⟶ 265:
type instance (S m) :+ n = S (m :+ n)
 
-- 31.2. Even natural numbers.
 
data En :: * -> * where
Line 265 ⟶ 271:
Es :: En n -> En (S (S n))
 
-- 43.1. Sum of any two even numbers is even.
 
sum_of_even_is_even :: En m -> En n -> En (m :+ n)
Line 280 ⟶ 286:
cong Refl = Refl
 
-- 53.2. Associativity of addition (via propositional equality).
 
class AssocAdd m where
Anonymous user