{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
{-# LANGUAGE GADTs, StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE UndecidableInstances #-}
module OAlg.Entity.Natural
(
N'(..), toN', type (+), type (*)
, Attestable(..), Ats(..), nValue, W(..), cmpW, (++), (**), W'(..), toW'
, SomeNatural(..), succSomeNatural, someNatural, naturals
, induction
, Any, Some
, refl, lemma1, sbstAdd
, prpAdd0, prpAdd1, prpAdd2
, prpEqlAny, prpEqlAny'
, prpSuccInjective
, prpAddNtrlL, prpAddNtrlR
, prpAddAssoc
, lemmaAdd1, prpAddComm
, prpMltNtrlL, prpMltNtrlR
, prpDstrL
, prpMltAssoc
, lemmaMlt1, lemmaAdd2, prpDstrR
, prpMltComm
, codeW, itfW
, type N0, type N1, type N2, type N3, type N4, type N5
, type N6, type N7, type N8, type N9, type N10
, xSomeNatural
)
where
import Control.Monad (join,return, (>>=))
import Control.Exception
import Data.Typeable
import Data.Type.Equality
import qualified Data.List as L
import OAlg.Prelude
import OAlg.Structure.Oriented
import OAlg.Structure.Multiplicative
import OAlg.Structure.Fibred
import OAlg.Structure.Additive hiding (prpAdd1,prpAdd2)
import OAlg.Structure.Distributive
data N' = N0 | S N' deriving (N' -> N' -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: N' -> N' -> Bool
$c/= :: N' -> N' -> Bool
== :: N' -> N' -> Bool
$c== :: N' -> N' -> Bool
Eq,Eq N'
N' -> N' -> Bool
N' -> N' -> Ordering
N' -> N' -> N'
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: N' -> N' -> N'
$cmin :: N' -> N' -> N'
max :: N' -> N' -> N'
$cmax :: N' -> N' -> N'
>= :: N' -> N' -> Bool
$c>= :: N' -> N' -> Bool
> :: N' -> N' -> Bool
$c> :: N' -> N' -> Bool
<= :: N' -> N' -> Bool
$c<= :: N' -> N' -> Bool
< :: N' -> N' -> Bool
$c< :: N' -> N' -> Bool
compare :: N' -> N' -> Ordering
$ccompare :: N' -> N' -> Ordering
Ord,Int -> N' -> ShowS
[N'] -> ShowS
N' -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [N'] -> ShowS
$cshowList :: [N'] -> ShowS
show :: N' -> String
$cshow :: N' -> String
showsPrec :: Int -> N' -> ShowS
$cshowsPrec :: Int -> N' -> ShowS
Show)
instance LengthN N' where
lengthN :: N' -> N
lengthN N'
N0 = N
0
lengthN (S N'
i) = N
1 forall a. Additive a => a -> a -> a
+ forall x. LengthN x => x -> N
lengthN N'
i
toN' :: N -> N'
toN' :: N -> N'
toN' N
0 = N'
N0
toN' N
i = N' -> N'
S (N -> N'
toN' (N
iN -> N -> N
>-N
1))
infixr 6 +
type family (+) (n :: N') (m :: k) :: N'
type instance N0 + n = n
type instance S n + (m :: N') = S (n+m)
type instance n + 0 = n
type instance n + 1 = S n
type instance n + 2 = S (S n)
type instance n + 3 = S (S (S n))
infixr 7 *
type family (*) (n :: k) (m :: N') :: N'
type instance N0 * m = N0
type instance S n * m = m + (n * m)
type instance 0 * m = N0
type instance 1 * m = m
type instance 2 * m = m + m
type family CmpN' (n :: N') (m :: N') :: Ordering
type instance CmpN' N0 N0 = EQ
type instance CmpN' (S _) N0 = GT
type instance CmpN' N0 (S _) = LT
type instance CmpN' (S n) (S m) = CmpN' n m
instance Enum N' where
succ :: N' -> N'
succ = N' -> N'
S
pred :: N' -> N'
pred N'
N0 = forall a e. Exception e => e -> a
throw AlgebraicException
NoPredecor
pred (S N'
i) = N'
i
toEnum :: Int -> N'
toEnum Int
0 = N'
N0
toEnum Int
i = forall a. Enum a => a -> a
succ forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall a. Enum a => Int -> a
toEnum (Int
iforall a. Abelian a => a -> a -> a
-Int
1)
fromEnum :: N' -> Int
fromEnum N'
N0 = Int
0
fromEnum (S N'
i) = Int
1forall a. Additive a => a -> a -> a
+forall a. Enum a => a -> Int
fromEnum N'
i
instance Validable N' where
valid :: N' -> Statement
valid N'
N0 = Statement
SValid
valid (S N'
n) = forall a. Validable a => a -> Statement
valid N'
n
instance Entity N'
instance Oriented N' where
type Point N' = ()
orientation :: N' -> Orientation (Point N')
orientation = forall b a. b -> a -> b
const (()forall p. p -> p -> Orientation p
:>())
instance Multiplicative N' where
one :: Point N' -> N'
one () = N' -> N'
S N'
N0
N'
N0 * :: N' -> N' -> N'
* N'
_ = N'
N0
S N'
n * N'
m = N'
m forall a. Additive a => a -> a -> a
+ N'
n forall c. Multiplicative c => c -> c -> c
* N'
m
instance Fibred N' where
type Root N' = Orientation ()
instance FibredOriented N'
instance Additive N' where
zero :: Root N' -> N'
zero Root N'
_ = N'
N0
N'
N0 + :: N' -> N' -> N'
+ N'
m = N'
m
S N'
n + N'
m = N' -> N'
S (N'
n forall a. Additive a => a -> a -> a
+ N'
m)
instance Distributive N'
instance Commutative N'
instance Total N'
data W n where
W0 :: W N0
SW :: W n -> W (n+1)
deriving instance Eq (W n)
cmpW :: W n -> W m -> Ordering
cmpW :: forall (n :: N') (m :: N'). W n -> W m -> Ordering
cmpW W n
W0 W m
W0 = Ordering
EQ
cmpW (SW W n
_) W m
W0 = Ordering
GT
cmpW W n
W0 (SW W n
_) = Ordering
LT
cmpW (SW W n
n) (SW W n
m) = forall (n :: N') (m :: N'). W n -> W m -> Ordering
cmpW W n
n W n
m
instance Show (W n) where
show :: W n -> String
show W n
w = forall a. Show a => a -> String
show (forall x. LengthN x => x -> N
lengthN W n
w)
instance Validable (W n) where
valid :: W n -> Statement
valid W n
W0 = Statement
SValid
valid (SW W n
w) = forall a. Validable a => a -> Statement
valid W n
w
instance LengthN (W n) where
lengthN :: W n -> N
lengthN W n
W0 = N
0
lengthN (SW W n
i) = N
1 forall a. Additive a => a -> a -> a
+ forall x. LengthN x => x -> N
lengthN W n
i
infixr 6 ++
(++) :: W n -> W m -> W (n+m)
W n
W0 ++ :: forall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++ W m
m = W m
m
(SW W n
n) ++ W m
m = forall (n :: N'). W n -> W (n + 1)
SW (W n
nforall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++W m
m)
infixr 7 **
(**) :: W n -> W m -> W (n*m)
W n
W0 ** :: forall (n :: N') (m :: N'). W n -> W m -> W (n * m)
** W m
_ = W N0
W0
(SW W n
n) ** W m
m = W m
m forall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++ W n
nforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**W m
m
type Any = W
induction :: Any n -> f N0 -> (forall i . f i -> f (i+1)) -> f n
induction :: forall (n :: N') (f :: N' -> Type).
Any n -> f N0 -> (forall (i :: N'). f i -> f (i + 1)) -> f n
induction W n
W0 f N0
f0 forall (i :: N'). f i -> f (i + 1)
_ = f N0
f0
induction (SW W n
i) f N0
f0 forall (i :: N'). f i -> f (i + 1)
h = forall (i :: N'). f i -> f (i + 1)
h (forall (n :: N') (f :: N' -> Type).
Any n -> f N0 -> (forall (i :: N'). f i -> f (i + 1)) -> f n
induction W n
i f N0
f0 forall (i :: N'). f i -> f (i + 1)
h)
class Typeable n => Attestable n where
attest :: W n
instance Attestable N0 where
attest :: W N0
attest = W N0
W0
instance Attestable n => Attestable (S n) where
attest :: W ('S n)
attest = forall (n :: N'). W n -> W (n + 1)
SW forall (n :: N'). Attestable n => W n
attest
data Ats n where Ats :: Attestable n => Ats n
nValue :: Attestable n => p n -> N
nValue :: forall (n :: N') (p :: N' -> Type). Attestable n => p n -> N
nValue p n
p = forall (p :: N' -> Type) (n :: N'). p n -> Any n -> N
nValue' p n
p forall (n :: N'). Attestable n => W n
attest where
nValue' :: p n -> Any n -> N
nValue' :: forall (p :: N' -> Type) (n :: N'). p n -> Any n -> N
nValue' p n
_ = forall x. LengthN x => x -> N
lengthN
data SomeNatural where
SomeNatural :: Attestable n => W n -> SomeNatural
instance Show SomeNatural where
show :: SomeNatural -> String
show (SomeNatural W n
n) = forall a. Show a => a -> String
show W n
n
eqlW :: W n -> W m -> Bool
eqlW :: forall (n :: N') (m :: N'). W n -> W m -> Bool
eqlW W n
W0 W m
W0 = Bool
True
eqlW W n
W0 (SW W n
_) = Bool
False
eqlW (SW W n
_) W m
W0 = Bool
False
eqlW (SW W n
n) (SW W n
m) = forall (n :: N') (m :: N'). W n -> W m -> Bool
eqlW W n
n W n
m
instance Eq SomeNatural where
SomeNatural W n
n == :: SomeNatural -> SomeNatural -> Bool
== SomeNatural W n
m = forall (n :: N') (m :: N'). W n -> W m -> Bool
eqlW W n
n W n
m
instance Validable SomeNatural where
valid :: SomeNatural -> Statement
valid (SomeNatural W n
n) = forall a. Validable a => a -> Statement
valid W n
n
succSomeNatural :: SomeNatural -> SomeNatural
succSomeNatural :: SomeNatural -> SomeNatural
succSomeNatural (SomeNatural W n
n) = forall (n :: N'). Attestable n => W n -> SomeNatural
SomeNatural (forall (n :: N'). W n -> W (n + 1)
SW W n
n)
someNatural :: N -> SomeNatural
someNatural :: N -> SomeNatural
someNatural N
0 = forall (n :: N'). Attestable n => W n -> SomeNatural
SomeNatural W N0
W0
someNatural N
i = SomeNatural -> SomeNatural
succSomeNatural (N -> SomeNatural
someNatural (forall a. Enum a => a -> a
pred N
i))
xSomeNatural :: X N -> X SomeNatural
xSomeNatural :: X N -> X SomeNatural
xSomeNatural X N
xn = X N
xn forall (m :: Type -> Type) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (m :: Type -> Type) a. Monad m => a -> m a
return forall (c :: Type -> Type -> Type) y z x.
Category c =>
c y z -> c x y -> c x z
. N -> SomeNatural
someNatural
naturals :: [SomeNatural]
naturals :: [SomeNatural]
naturals = SomeNatural -> [SomeNatural]
nats (N -> SomeNatural
someNatural N
0) where nats :: SomeNatural -> [SomeNatural]
nats SomeNatural
n = SomeNatural
n forall a. a -> [a] -> [a]
: SomeNatural -> [SomeNatural]
nats (SomeNatural -> SomeNatural
succSomeNatural SomeNatural
n)
data W' = forall n . W' (W n)
deriving instance Show W'
instance Eq W' where
W' W n
n == :: W' -> W' -> Bool
== W' W n
m = case forall (n :: N') (m :: N'). W n -> W m -> Ordering
cmpW W n
n W n
m of
Ordering
EQ -> Bool
True
Ordering
_ -> Bool
False
instance Ord W' where
compare :: W' -> W' -> Ordering
compare (W' W n
n) (W' W n
m) = forall (n :: N') (m :: N'). W n -> W m -> Ordering
cmpW W n
n W n
m
instance LengthN W' where
lengthN :: W' -> N
lengthN (W' W n
w) = forall x. LengthN x => x -> N
lengthN W n
w
toW' :: N -> W'
toW' :: N -> W'
toW' N
0 = forall (n :: N'). W n -> W'
W' W N0
W0
toW' N
n = forall a. Enum a => a -> a
succ forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ N -> W'
toW' (N
nN -> N -> N
>-N
1)
instance Enum W' where
succ :: W' -> W'
succ (W' W n
w) = forall (n :: N'). W n -> W'
W' (forall (n :: N'). W n -> W (n + 1)
SW W n
w)
pred :: W' -> W'
pred (W' W n
W0) = forall a e. Exception e => e -> a
throw AlgebraicException
NoPredecor
pred (W' (SW W n
w)) = forall (n :: N'). W n -> W'
W' W n
w
toEnum :: Int -> W'
toEnum = N -> W'
toW' forall (c :: Type -> Type -> Type) y z x.
Category c =>
c y z -> c x y -> c x z
. forall a. Enum a => Int -> a
toEnum
fromEnum :: W' -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall (c :: Type -> Type -> Type) y z x.
Category c =>
c y z -> c x y -> c x z
. forall x. LengthN x => x -> N
lengthN
instance Validable W' where
valid :: W' -> Statement
valid (W' W n
w) = forall a. Validable a => a -> Statement
valid W n
w
instance Entity W'
instance Oriented W' where
type Point W' = ()
orientation :: W' -> Orientation (Point W')
orientation = forall b a. b -> a -> b
const (()forall p. p -> p -> Orientation p
:>())
instance Multiplicative W' where
one :: Point W' -> W'
one () = forall a. Enum a => a -> a
succ (forall a. Additive a => Root a -> a
zero (()forall p. p -> p -> Orientation p
:>()))
W' W n
W0 * :: W' -> W' -> W'
* W'
_ = forall (n :: N'). W n -> W'
W' W N0
W0
W' (SW W n
n) * W'
m = W'
m forall a. Additive a => a -> a -> a
+ forall (n :: N'). W n -> W'
W' W n
n forall c. Multiplicative c => c -> c -> c
* W'
m
instance Fibred W' where
type Root W' = Orientation ()
instance FibredOriented W'
instance Additive W' where
zero :: Root W' -> W'
zero (():>()) = forall (n :: N'). W n -> W'
W' W N0
W0
W' W n
W0 + :: W' -> W' -> W'
+ W'
m = W'
m
W' (SW W n
n) + W'
m = forall a. Enum a => a -> a
succ (forall (n :: N'). W n -> W'
W' W n
n forall a. Additive a => a -> a -> a
+ W'
m)
instance Distributive W'
instance Commutative W'
instance Total W'
type Some = W'
infixl 0 >>
(>>) :: forall {k} {a :: k} {b :: k} {c :: k} . (a :~: b) -> (b :~: c) -> a :~: c
>> :: forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
(>>) = forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
trans
refl :: Any x -> x :~: x
refl :: forall (x :: N'). Any x -> x :~: x
refl Any x
_ = forall {k} (a :: k). a :~: a
Refl
lemma1 :: x :~: y -> f x :~: f y
lemma1 :: forall {k} {k} (x :: k) (y :: k) (f :: k -> k).
(x :~: y) -> f x :~: f y
lemma1 x :~: y
Refl = forall {k} (a :: k). a :~: a
Refl
sbstAdd :: a :~: a' -> b :~: b' -> a + b :~: a' + b'
sbstAdd :: forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd a :~: a'
Refl b :~: b'
Refl = forall {k} (a :: k). a :~: a
Refl
prpAdd0 :: a + 0 :~: a
prpAdd0 :: forall (a :: N'). (a + 0) :~: a
prpAdd0 = forall {k} (a :: k). a :~: a
Refl
prpAdd1 :: a + 1 :~: S a
prpAdd1 :: forall (a :: N'). (a + 1) :~: 'S a
prpAdd1 = forall {k} (a :: k). a :~: a
Refl
prpAdd2 :: a + 2 :~: S (S a)
prpAdd2 :: forall (a :: N'). (a + 2) :~: 'S ('S a)
prpAdd2 = forall {k} (a :: k). a :~: a
Refl
prpMlt0 :: 0*a :~: N0
prpMlt0 :: forall (a :: N'). (0 * a) :~: N0
prpMlt0 = forall {k} (a :: k). a :~: a
Refl
prpMlt1 :: 1*a :~: a
prpMlt1 :: forall (a :: N'). (1 * a) :~: a
prpMlt1 = forall {k} (a :: k). a :~: a
Refl
prpMlt2 :: p a -> 2*a :~: a + a
prpMlt2 :: forall (p :: N' -> Type) (a :: N'). p a -> (2 * a) :~: (a + a)
prpMlt2 p a
_ = forall {k} (a :: k). a :~: a
Refl
prpEqlAny :: Any n :~: Any m -> n :~: m
prpEqlAny :: forall (n :: N') (m :: N'). (Any n :~: Any m) -> n :~: m
prpEqlAny Any n :~: Any m
Refl = forall {k} (a :: k). a :~: a
Refl
prpEqlAny' :: n :~: m -> Any n :~: Any m
prpEqlAny' :: forall (n :: N') (m :: N'). (n :~: m) -> Any n :~: Any m
prpEqlAny' n :~: m
Refl = forall {k} (a :: k). a :~: a
Refl
prpSuccInjective :: S n :~: S m -> n :~: m
prpSuccInjective :: forall (n :: N') (m :: N'). ('S n :~: 'S m) -> n :~: m
prpSuccInjective 'S n :~: 'S m
Refl = forall {k} (a :: k). a :~: a
Refl
prpAddNtrlL :: p a -> N0 + a :~: a
prpAddNtrlL :: forall (p :: N' -> Type) (a :: N'). p a -> (N0 + a) :~: a
prpAddNtrlL p a
_ = forall {k} (a :: k). a :~: a
Refl
prpAddNtrlR :: Any a -> a + N0 :~: a
prpAddNtrlR :: forall (a :: N'). Any a -> (a + N0) :~: a
prpAddNtrlR W a
W0 = forall {k} (a :: k). a :~: a
Refl
prpAddNtrlR (SW W n
a) = forall (a :: N'). Any a -> ((a + 1) + N0) :~: (a + 1)
qed W n
a where
qed :: Any a -> (a+1) + N0 :~: a+1
qed :: forall (a :: N'). Any a -> ((a + 1) + N0) :~: (a + 1)
qed Any a
a = forall (p :: N' -> Type) (a :: N').
p a -> ((a + 1) + N0) :~: ('S a + N0)
r1 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (p :: N' -> Type) (a :: N').
p a -> ('S a + N0) :~: 'S (a + N0)
r2 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> 'S (a + N0) :~: 'S a
hyp Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (p :: N' -> Type) (a :: N'). p a -> 'S a :~: (a + 1)
r3 Any a
a
r1 :: p a -> (a+1) + N0 :~: S a + N0
r2 :: p a -> S a + N0 :~: S (a + N0)
hyp :: Any a -> S (a + N0) :~: S a
r3 :: p a -> S a :~: a+1
r1 :: forall (p :: N' -> Type) (a :: N').
p a -> ((a + 1) + N0) :~: ('S a + N0)
r1 p a
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (p :: N' -> Type) (a :: N').
p a -> ('S a + N0) :~: 'S (a + N0)
r2 p a
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N'). Any a -> 'S (a + N0) :~: 'S a
hyp Any a
a = forall {k} {k} (x :: k) (y :: k) (f :: k -> k).
(x :~: y) -> f x :~: f y
lemma1 forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N'). Any a -> (a + N0) :~: a
prpAddNtrlR Any a
a
r3 :: forall (p :: N' -> Type) (a :: N'). p a -> 'S a :~: (a + 1)
r3 p a
_ = forall {k} (a :: k). a :~: a
Refl
prpAddAssoc :: Any a -> Any b -> Any c -> (a + b) + c :~: a + (b + c)
prpAddAssoc :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc W a
W0 Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpAddAssoc (SW W n
a) Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> (((a + 1) + b) + c) :~: ((a + 1) + (b + c))
qed W n
a Any b
b Any c
c where
qed :: Any a -> Any b -> Any c -> ((a+1) + b) + c :~: (a+1) + (b + c)
qed :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> (((a + 1) + b) + c) :~: ((a + 1) + (b + c))
qed Any a
a Any b
b Any c
c = forall {k} {k} (a :: N') (p :: k -> Type) (b :: k) (q :: k -> Type)
(c :: k).
Any a -> p b -> q c -> (((a + 1) + b) + c) :~: (('S a + b) + c)
r1 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a + b) + c) :~: ('S (a + b) + c)
r2 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S (a + b) + c) :~: 'S ((a + b) + c)
r3 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> 'S ((a + b) + c) :~: 'S (a + (b + c))
hyp Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> 'S (a + (b + c)) :~: ('S a + (b + c))
r4 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S a + (b + c)) :~: ((a + 1) + (b + c))
r5 Any a
a Any b
b Any c
c
r1 :: Any a -> p b -> q c -> ((a+1) + b) + c :~: (S a + b) + c
r2 :: Any a -> Any b -> Any c -> (S a + b) + c :~: S (a + b) + c
r3 :: Any a -> Any b -> Any c -> S (a + b) + c :~: S ((a + b) + c)
hyp :: Any a -> Any b -> Any c -> S ((a + b) + c) :~: S (a + (b + c))
r4 :: Any a -> Any b -> Any c -> S (a + (b + c)) :~: (S a + (b + c))
r5 :: Any a -> Any b -> Any c -> S a + (b + c) :~: (a+1) + (b + c)
r1 :: forall {k} {k} (a :: N') (p :: k -> Type) (b :: k) (q :: k -> Type)
(c :: k).
Any a -> p b -> q c -> (((a + 1) + b) + c) :~: (('S a + b) + c)
r1 Any a
_ p b
_ q c
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a + b) + c) :~: ('S (a + b) + c)
r2 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r3 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S (a + b) + c) :~: 'S ((a + b) + c)
r3 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> 'S ((a + b) + c) :~: 'S (a + (b + c))
hyp Any a
a Any b
b Any c
c = forall {k} {k} (x :: k) (y :: k) (f :: k -> k).
(x :~: y) -> f x :~: f y
lemma1 forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any a
a Any b
b Any c
c
r4 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> 'S (a + (b + c)) :~: ('S a + (b + c))
r4 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r5 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S a + (b + c)) :~: ((a + 1) + (b + c))
r5 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
lemmaAdd1 :: Any a -> Any b -> S a + b :~: a + S b
lemmaAdd1 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: (a + 'S b)
lemmaAdd1 W a
W0 Any b
_ = forall {k} (a :: k). a :~: a
Refl
lemmaAdd1 (SW W n
a) Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ('S (a + 1) + b) :~: ((a + 1) + 'S b)
qed W n
a Any b
b where
qed :: Any a -> Any b -> S (a+1) + b :~: (a+1) + S b
qed :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S (a + 1) + b) :~: ((a + 1) + 'S b)
qed Any a
a Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ('S (a + 1) + b) :~: ('S ('S a) + b)
r1 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ('S ('S a) + b) :~: 'S ('S a + b)
r2 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> 'S ('S a + b) :~: 'S (a + 'S b)
hyp Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> 'S (a + 'S b) :~: ('S a + 'S b)
r3 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + 'S b) :~: ((a + 1) + 'S b)
r4 Any a
a Any b
b
r1 :: Any a -> Any b -> S (a+1) + b :~: S (S a) + b
r2 :: Any a -> Any b -> S (S a) + b :~: S (S a + b)
hyp :: Any a -> Any b -> S (S a + b) :~: S (a + S b)
r3 :: Any a -> Any b -> S (a + S b) :~: S a + S b
r4 :: Any a -> Any b -> S a + S b :~: (a+1) + S b
r1 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S (a + 1) + b) :~: ('S ('S a) + b)
r1 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S ('S a) + b) :~: 'S ('S a + b)
r2 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N').
Any a -> Any b -> 'S ('S a + b) :~: 'S (a + 'S b)
hyp Any a
a Any b
b = forall {k} {k} (x :: k) (y :: k) (f :: k -> k).
(x :~: y) -> f x :~: f y
lemma1 forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: (a + 'S b)
lemmaAdd1 Any a
a Any b
b
r3 :: forall (a :: N') (b :: N').
Any a -> Any b -> 'S (a + 'S b) :~: ('S a + 'S b)
r3 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r4 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + 'S b) :~: ((a + 1) + 'S b)
r4 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
prpAddComm :: Any a -> Any b -> a + b :~: b + a
prpAddComm :: forall (a :: N') (b :: N'). Any a -> Any b -> (a + b) :~: (b + a)
prpAddComm W a
W0 Any b
b = forall (b :: N'). Any b -> (N0 + b) :~: (b + N0)
qed Any b
b where
qed :: Any b -> N0 + b :~: b + N0
qed :: forall (b :: N'). Any b -> (N0 + b) :~: (b + N0)
qed Any b
b = forall (b :: N'). Any b -> (N0 + b) :~: b
r1 Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (b :: N'). Any b -> b :~: (b + N0)
r2 Any b
b
r1 :: Any b -> N0 + b :~: b
r2 :: Any b -> b :~: b + N0
r1 :: forall (b :: N'). Any b -> (N0 + b) :~: b
r1 = forall (p :: N' -> Type) (a :: N'). p a -> (N0 + a) :~: a
prpAddNtrlL
r2 :: forall (b :: N'). Any b -> b :~: (b + N0)
r2 Any b
b = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N'). Any a -> (a + N0) :~: a
prpAddNtrlR Any b
b
prpAddComm (SW W n
a) Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) + b) :~: (b + (a + 1))
qed W n
a Any b
b where
qed :: Any a -> Any b -> (a+1) + b :~: b + (a+1)
qed :: forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) + b) :~: (b + (a + 1))
qed Any a
a Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) + b) :~: ('S a + b)
r1 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: 'S (a + b)
r2 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> 'S (a + b) :~: 'S (b + a)
hyp Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> 'S (b + a) :~: ('S b + a)
r3 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ('S b + a) :~: (b + 'S a)
r4 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b + 'S a) :~: (b + (a + 1))
r5 Any a
a Any b
b
r1 :: Any a -> Any b -> (a+1) + b :~: S a + b
r2 :: Any a -> Any b -> S a + b :~: S (a + b)
hyp :: Any a -> Any b -> S (a + b) :~: S (b + a)
r3 :: Any a -> Any b -> S (b + a) :~: S b + a
r4 :: Any a -> Any b -> S b + a :~: b + S a
r5 :: Any a -> Any b -> b + S a :~: b + (a+1)
r1 :: forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) + b) :~: ('S a + b)
r1 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: 'S (a + b)
r2 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N').
Any a -> Any b -> 'S (a + b) :~: 'S (b + a)
hyp Any a
a Any b
b = forall {k} {k} (x :: k) (y :: k) (f :: k -> k).
(x :~: y) -> f x :~: f y
lemma1 forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N'). Any a -> Any b -> (a + b) :~: (b + a)
prpAddComm Any a
a Any b
b
r3 :: forall (a :: N') (b :: N').
Any a -> Any b -> 'S (b + a) :~: ('S b + a)
r3 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r4 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S b + a) :~: (b + 'S a)
r4 Any a
a Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: (a + 'S b)
lemmaAdd1 Any b
b Any a
a
r5 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b + 'S a) :~: (b + (a + 1))
r5 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
prpMltNtrlL :: Any a -> N1*a :~: a
prpMltNtrlL :: forall (a :: N'). Any a -> (N1 * a) :~: a
prpMltNtrlL Any a
a = forall (a :: N'). Any a -> (N1 * a) :~: a
qed Any a
a where
qed :: Any a -> N1 * a :~: a
qed :: forall (a :: N'). Any a -> (N1 * a) :~: a
qed Any a
a = forall (a :: N'). Any a -> (N1 * a) :~: (N1 * a)
r1 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N1 * a) :~: (a + (N0 * a))
r2 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (a + (N0 * a)) :~: (a + N0)
r3 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (a + N0) :~: a
r4 Any a
a
r1 :: Any a -> N1 * a :~: (S N0)*a
r2 :: Any a -> (S N0)*a :~: a + N0*a
r3 :: Any a -> a + N0*a :~: a + N0
r4 :: Any a -> a + N0 :~: a
r1 :: forall (a :: N'). Any a -> (N1 * a) :~: (N1 * a)
r1 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N'). Any a -> (N1 * a) :~: (a + (N0 * a))
r2 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r3 :: forall (a :: N'). Any a -> (a + (N0 * a)) :~: (a + N0)
r3 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r4 :: forall (a :: N'). Any a -> (a + N0) :~: a
r4 Any a
a = forall (a :: N'). Any a -> (a + N0) :~: a
prpAddNtrlR Any a
a
prpMltNtrlR :: Any a -> a*N1 :~: a
prpMltNtrlR :: forall (a :: N'). Any a -> (a * N1) :~: a
prpMltNtrlR W a
W0 = forall {k} (a :: k). a :~: a
Refl
prpMltNtrlR (SW W n
a) = forall (a :: N'). Any a -> ((a + 1) * N1) :~: (a + 1)
qed W n
a where
qed :: Any a -> (a+1)*N1 :~: a+1
qed :: forall (a :: N'). Any a -> ((a + 1) * N1) :~: (a + 1)
qed Any a
a = forall (a :: N'). Any a -> ((a + 1) * N1) :~: ('S a * N1)
r1 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> ('S a * N1) :~: (N1 + (a * N1))
r2 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N1 + (a * N1)) :~: (N1 + a)
hyp Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N1 + a) :~: (N1 + a)
r3 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N1 + a) :~: (N0 + 'S a)
r4 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N0 + 'S a) :~: 'S a
r5 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> 'S a :~: (a + 1)
r6 Any a
a
r1 :: Any a -> (a+1)*N1 :~: S a * N1
r2 :: Any a -> S a * N1 :~: N1 + a*N1
hyp :: Any a -> N1 + a*N1 :~: N1 + a
r3 :: Any a -> N1 + a :~: S N0 + a
r4 :: Any a -> S N0 + a :~: N0 + S a
r5 :: Any a -> N0 + S a :~: S a
r6 :: Any a -> S a :~: a+1
r1 :: forall (a :: N'). Any a -> ((a + 1) * N1) :~: ('S a * N1)
r1 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N'). Any a -> ('S a * N1) :~: (N1 + (a * N1))
r2 Any a
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N'). Any a -> (N1 + (a * N1)) :~: (N1 + a)
hyp Any a
a = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl W N1
w1) (forall (a :: N'). Any a -> (a * N1) :~: a
prpMltNtrlR Any a
a)
r3 :: forall (a :: N'). Any a -> (N1 + a) :~: (N1 + a)
r3 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r4 :: forall (a :: N'). Any a -> (N1 + a) :~: (N0 + 'S a)
r4 Any a
a = forall (a :: N') (b :: N').
Any a -> Any b -> ('S a + b) :~: (a + 'S b)
lemmaAdd1 W N0
w0 Any a
a
r5 :: forall (a :: N'). Any a -> (N0 + 'S a) :~: 'S a
r5 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r6 :: forall (a :: N'). Any a -> 'S a :~: (a + 1)
r6 Any a
_ = forall {k} (a :: k). a :~: a
Refl
prpDstrL :: Any a -> Any b -> Any c -> (a + b)*c :~: a*c + b*c
prpDstrL :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) * c) :~: ((a * c) + (b * c))
prpDstrL W a
W0 Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpDstrL (SW W n
a) Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (((a + 1) + b) * c) :~: (((a + 1) * c) + (b * c))
qed W n
a Any b
b Any c
c where
qed :: Any a -> Any b -> Any c -> ((a+1) + b)*c :~: (a+1)*c + b*c
qed :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (((a + 1) + b) * c) :~: (((a + 1) * c) + (b * c))
qed Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (((a + 1) + b) * c) :~: (('S a + b) * c)
r1 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a + b) * c) :~: ('S (a + b) * c)
r2 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S (a + b) * c) :~: (c + ((a + b) * c))
r3 Any a
a Any b
b Any c
c
forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (c + ((a + b) * c)) :~: (c + ((a * c) + (b * c)))
hyp Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (c + ((a * c) + (b * c))) :~: ((c + (a * c)) + (b * c))
r4 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((c + (a * c)) + (b * c)) :~: (((a + 1) * c) + (b * c))
r5 Any a
a Any b
b Any c
c
r1 :: Any a -> Any b -> Any c -> ((a+1) + b)*c :~: (S a + b)*c
r2 :: Any a -> Any b -> Any c -> (S a + b)*c :~: S (a + b) * c
r3 :: Any a -> Any b -> Any c -> S (a + b) * c :~: c + (a + b)*c
hyp :: Any a -> Any b -> Any c -> c + (a + b)*c :~: c + a*c + b*c
r4 :: Any a -> Any b -> Any c -> c + a*c + b*c :~: (c + a*c) + b*c
r5 :: Any a -> Any b -> Any c -> (c + a*c) + b*c :~: (a+1)*c + b*c
r1 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (((a + 1) + b) * c) :~: (('S a + b) * c)
r1 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a + b) * c) :~: ('S (a + b) * c)
r2 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r3 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S (a + b) * c) :~: (c + ((a + b) * c))
r3 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (c + ((a + b) * c)) :~: (c + ((a * c) + (b * c)))
hyp Any a
a Any b
b Any c
c = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl Any c
c) (forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) * c) :~: ((a * c) + (b * c))
prpDstrL Any a
a Any b
b Any c
c)
r4 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (c + ((a * c) + (b * c))) :~: ((c + (a * c)) + (b * c))
r4 Any a
a Any b
b Any c
c = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any c
c (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c) (Any b
bforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c)
r5 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((c + (a * c)) + (b * c)) :~: (((a + 1) * c) + (b * c))
r5 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpMltAssoc :: Any a -> Any b -> Any c -> (a*b)*c :~: a*(b*c)
prpMltAssoc :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a * b) * c) :~: (a * (b * c))
prpMltAssoc W a
W0 Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpMltAssoc (SW W n
a) Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> (((a + 1) * b) * c) :~: ((a + 1) * (b * c))
qed W n
a Any b
b Any c
c where
qed :: Any a -> Any b -> Any c -> ((a+1)*b)*c :~: (a+1)*(b*c)
qed :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> (((a + 1) * b) * c) :~: ((a + 1) * (b * c))
qed Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (((a + 1) * b) * c) :~: (('S a * b) * c)
r1 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a * b) * c) :~: ((b + (a * b)) * c)
r2 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + (a * b)) * c) :~: ((b * c) + ((a * b) * c))
r3 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b * c) + ((a * b) * c)) :~: ((b * c) + (a * (b * c)))
hyp Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> ((b * c) + (a * (b * c))) :~: ('S a * (b * c))
r4 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S a * (b * c)) :~: ((a + 1) * (b * c))
r5 Any a
a Any b
b Any c
c
r1 :: Any a -> Any b -> Any c -> ((a+1)*b)*c :~: (S a * b)*c
r2 :: Any a -> Any b -> Any c -> (S a * b)*c :~: (b + a*b)*c
r3 :: Any a -> Any b -> Any c -> (b + a*b)*c :~: b*c + (a*b)*c
hyp :: Any a -> Any b -> Any c -> b*c + (a*b)*c :~: b*c + a*(b*c)
r4 :: Any a -> Any b -> Any c -> b*c + a*(b*c) :~: S a * (b*c)
r5 :: Any a -> Any b -> Any c -> S a * (b*c) :~: (a+1)*(b*c)
r1 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (((a + 1) * b) * c) :~: (('S a * b) * c)
r1 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (('S a * b) * c) :~: ((b + (a * b)) * c)
r2 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r3 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + (a * b)) * c) :~: ((b * c) + ((a * b) * c))
r3 Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) * c) :~: ((a * c) + (b * c))
prpDstrL Any b
b (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any b
b) Any c
c
hyp :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b * c) + ((a * b) * c)) :~: ((b * c) + (a * (b * c)))
hyp Any a
a Any b
b Any c
c = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl (Any b
bforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c)) (forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a * b) * c) :~: (a * (b * c))
prpMltAssoc Any a
a Any b
b Any c
c)
r4 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> ((b * c) + (a * (b * c))) :~: ('S a * (b * c))
r4 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r5 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ('S a * (b * c)) :~: ((a + 1) * (b * c))
r5 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
lemmaMlt1 :: Any a -> a*N0 :~: N0
lemmaMlt1 :: forall (a :: N'). Any a -> (a * N0) :~: N0
lemmaMlt1 W a
W0 = forall {k} (a :: k). a :~: a
Refl
lemmaMlt1 (SW W n
a) = forall (a :: N'). Any a -> ((a + 1) * N0) :~: N0
qed W n
a where
qed :: Any a -> (a+1)*N0 :~: N0
qed :: forall (a :: N'). Any a -> ((a + 1) * N0) :~: N0
qed Any a
a = forall (a :: N'). Any a -> ((a + 1) * N0) :~: ('S a * N0)
r1 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> ('S a * N0) :~: (N0 + (a * N0))
r2 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (N0 + (a * N0)) :~: (a * N0)
r3 Any a
a forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N'). Any a -> (a * N0) :~: N0
hyp Any a
a
r1 :: Any a -> (a+1)*N0 :~: (S a)*N0
r2 :: Any a -> (S a)*N0 :~: N0 + a*N0
r3 :: Any a -> N0 + a*N0 :~: a*N0
hyp :: Any a -> a*N0 :~: N0
r1 :: forall (a :: N'). Any a -> ((a + 1) * N0) :~: ('S a * N0)
r1 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N'). Any a -> ('S a * N0) :~: (N0 + (a * N0))
r2 Any a
_ = forall {k} (a :: k). a :~: a
Refl
r3 :: forall (a :: N'). Any a -> (N0 + (a * N0)) :~: (a * N0)
r3 Any a
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N'). Any a -> (a * N0) :~: N0
hyp Any a
a = forall (a :: N'). Any a -> (a * N0) :~: N0
lemmaMlt1 Any a
a
lemmaAdd2 :: Any a -> Any b -> Any c -> a + b + c :~: b + a + c
lemmaAdd2 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: (b + (a + c))
lemmaAdd2 Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: (b + (a + c))
qed Any a
a Any b
b Any c
c where
qed :: Any a -> Any b -> Any c -> a + b + c :~: b + a + c
qed :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: (b + (a + c))
qed Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: ((a + b) + c)
r1 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: ((b + a) + c)
r2 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((b + a) + c) :~: (b + (a + c))
r3 Any a
a Any b
b Any c
c
r1 :: Any a -> Any b -> Any c -> a + b + c :~: (a + b) + c
r2 :: Any a -> Any b -> Any c -> (a + b) + c :~: (b + a) + c
r3 :: Any a -> Any b -> Any c -> (b + a) + c :~: b + a + c
r1 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: ((a + b) + c)
r1 Any a
a Any b
b Any c
c = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any a
a Any b
b Any c
c
r2 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: ((b + a) + c)
r2 Any a
a Any b
b Any c
c = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (a :: N') (b :: N'). Any a -> Any b -> (a + b) :~: (b + a)
prpAddComm Any a
a Any b
b) (forall (x :: N'). Any x -> x :~: x
refl Any c
c)
r3 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((b + a) + c) :~: (b + (a + c))
r3 Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any b
b Any a
a Any c
c
prpDstrR :: Any a -> Any b -> Any c -> a*(b + c) :~: a*b + a*c
prpDstrR :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a * (b + c)) :~: ((a * b) + (a * c))
prpDstrR W a
W0 Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpDstrR (SW W n
a) Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((a + 1) * (b + c)) :~: (((a + 1) * b) + ((a + 1) * c))
qed W n
a Any b
b Any c
c where
qed :: Any a -> Any b -> Any c -> (a+1)*(b + c) :~: (a+1)*b + (a+1)*c
qed :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((a + 1) * (b + c)) :~: (((a + 1) * b) + ((a + 1) * c))
qed Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + 1) * (b + c)) :~: ('S a * (b + c))
r1 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> ('S a * (b + c)) :~: ((b + c) + (a * (b + c)))
r2 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + c) + (a * (b + c))) :~: ((b + c) + ((a * b) + (a * c)))
hyp Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + c) + ((a * b) + (a * c)))
:~: (b + (c + ((a * b) + (a * c))))
r3 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (b + (c + ((a * b) + (a * c))))
:~: (b + ((a * b) + (c + (a * c))))
r4 Any a
a Any b
b Any c
c
forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (b + ((a * b) + (c + (a * c))))
:~: ((b + (a * b)) + (c + (a * c)))
r5 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + (a * b)) + (c + (a * c))) :~: (('S a * b) + ('S a * c))
r6 Any a
a Any b
b Any c
c forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (('S a * b) + ('S a * c)) :~: (((a + 1) * b) + ((a + 1) * c))
r7 Any a
a Any b
b Any c
c
r1 :: Any a -> Any b -> Any c -> (a+1)*(b + c) :~: S a * (b + c)
r2 :: Any a -> Any b -> Any c -> S a * (b + c) :~: (b + c) + a*(b + c)
hyp :: Any a -> Any b -> Any c -> (b + c) + a*(b + c) :~: (b + c) + (a*b + a*c)
r3 :: Any a -> Any b -> Any c -> (b + c) + (a*b + a*c) :~: b + c + a*b + a*c
r4 :: Any a -> Any b -> Any c -> b + c + a*b + a*c :~: b + a*b + c + a*c
r5 :: Any a -> Any b -> Any c -> b + a*b + c + a*c :~: (b + a*b) + (c + a*c)
r6 :: Any a -> Any b -> Any c -> (b + a*b) + (c + a*c) :~: (S a)*b + (S a)*c
r7 :: Any a -> Any b -> Any c -> (S a)*b + (S a)*c :~: (a+1)*b + (a+1)*c
r1 :: forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + 1) * (b + c)) :~: ('S a * (b + c))
r1 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b -> Any c -> ('S a * (b + c)) :~: ((b + c) + (a * (b + c)))
r2 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + c) + (a * (b + c))) :~: ((b + c) + ((a * b) + (a * c)))
hyp Any a
a Any b
b Any c
c = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl (Any b
bforall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++Any c
c)) (forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a * (b + c)) :~: ((a * b) + (a * c))
prpDstrR Any a
a Any b
b Any c
c)
r3 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + c) + ((a * b) + (a * c)))
:~: (b + (c + ((a * b) + (a * c))))
r3 Any a
a Any b
b Any c
c = forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any b
b Any c
c (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any b
b forall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++ Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c)
r4 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (b + (c + ((a * b) + (a * c))))
:~: (b + ((a * b) + (c + (a * c))))
r4 Any a
a Any b
b Any c
c = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl Any b
b) forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a + (b + c)) :~: (b + (a + c))
lemmaAdd2 Any c
c (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any b
b) (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c)
r5 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (b + ((a * b) + (c + (a * c))))
:~: ((b + (a * b)) + (c + (a * c)))
r5 Any a
a Any b
b Any c
c = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
prpAddAssoc Any b
b (Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any b
b) (Any c
c forall (n :: N') (m :: N'). W n -> W m -> W (n + m)
++ Any a
aforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any c
c)
r6 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> ((b + (a * b)) + (c + (a * c))) :~: (('S a * b) + ('S a * c))
r6 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
r7 :: forall (a :: N') (b :: N') (c :: N').
Any a
-> Any b
-> Any c
-> (('S a * b) + ('S a * c)) :~: (((a + 1) * b) + ((a + 1) * c))
r7 Any a
_ Any b
_ Any c
_ = forall {k} (a :: k). a :~: a
Refl
prpMltComm :: Any a -> Any b -> a*b :~: b*a
prpMltComm :: forall (a :: N') (b :: N'). Any a -> Any b -> (a * b) :~: (b * a)
prpMltComm W a
W0 Any b
b = forall (b :: N'). Any b -> (N0 * b) :~: (b * N0)
qed Any b
b where
qed :: Any b -> N0 * b :~: b * N0
qed :: forall (b :: N'). Any b -> (N0 * b) :~: (b * N0)
qed Any b
b = forall (b :: N'). Any b -> (N0 * b) :~: N0
r1 Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (b :: N'). Any b -> N0 :~: (b * N0)
r2 Any b
b
r1 :: Any b -> N0 * b :~: N0
r2 :: Any b -> N0 :~: b * N0
r1 :: forall (b :: N'). Any b -> (N0 * b) :~: N0
r1 Any b
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (b :: N'). Any b -> N0 :~: (b * N0)
r2 Any b
b = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N'). Any a -> (a * N0) :~: N0
lemmaMlt1 Any b
b
prpMltComm (SW W n
a) Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) * b) :~: (b * (a + 1))
qed W n
a Any b
b where
qed :: Any a -> Any b -> (a+1)*b :~: b*(a+1)
qed :: forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) * b) :~: (b * (a + 1))
qed Any a
a Any b
b = forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) * b) :~: ('S a * b)
r1 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ('S a * b) :~: (b + (a * b))
r2 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b + (a * b)) :~: (b + (b * a))
hyp Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b + (b * a)) :~: ((b * N1) + (b * a))
r3 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> ((b * N1) + (b * a)) :~: (b * (N1 + a))
r4 Any a
a Any b
b
forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b * (N1 + a)) :~: (b * (N1 + a))
r5 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b * (N1 + a)) :~: (b * 'S (N0 + a))
r6 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b * 'S (N0 + a)) :~: (b * 'S a)
r7 Any a
a Any b
b forall {k} {a :: k} {b :: k} {c :: k}.
(a :~: b) -> (b :~: c) -> a :~: c
>> forall (a :: N') (b :: N').
Any a -> Any b -> (b * 'S a) :~: (b * (a + 1))
r8 Any a
a Any b
b
r1 :: Any a -> Any b -> (a+1)*b :~: (S a) * b
r2 :: Any a -> Any b -> (S a) * b :~: b + a*b
hyp :: Any a -> Any b -> b + a*b :~: b + b*a
r3 :: Any a -> Any b -> b + b*a :~: b*N1 + b*a
r4 :: Any a -> Any b -> b*N1 + b*a :~: b*(N1 + a)
r5 :: Any a -> Any b -> b*(N1 + a) :~: b*(S N0 + a)
r6 :: Any a -> Any b -> b*(S N0 + a) :~: b*(S (N0 + a))
r7 :: Any a -> Any b -> b*(S (N0 + a)) :~: b*(S a)
r8 :: Any a -> Any b -> b*(S a) :~: b*(a+1)
r1 :: forall (a :: N') (b :: N').
Any a -> Any b -> ((a + 1) * b) :~: ('S a * b)
r1 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r2 :: forall (a :: N') (b :: N').
Any a -> Any b -> ('S a * b) :~: (b + (a * b))
r2 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
hyp :: forall (a :: N') (b :: N').
Any a -> Any b -> (b + (a * b)) :~: (b + (b * a))
hyp Any a
a Any b
b = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall (x :: N'). Any x -> x :~: x
refl Any b
b) (forall (a :: N') (b :: N'). Any a -> Any b -> (a * b) :~: (b * a)
prpMltComm Any a
a Any b
b)
r3 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b + (b * a)) :~: ((b * N1) + (b * a))
r3 Any a
a Any b
b = forall {k} (a :: N') (a' :: N') (b :: k) (b' :: k).
(a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
sbstAdd (forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N'). Any a -> (a * N1) :~: a
prpMltNtrlR Any b
b) (forall (x :: N'). Any x -> x :~: x
refl (Any b
bforall (n :: N') (m :: N'). W n -> W m -> W (n * m)
**Any a
a))
r4 :: forall (a :: N') (b :: N').
Any a -> Any b -> ((b * N1) + (b * a)) :~: (b * (N1 + a))
r4 Any a
a Any b
b = forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a
sym forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall (a :: N') (b :: N') (c :: N').
Any a -> Any b -> Any c -> (a * (b + c)) :~: ((a * b) + (a * c))
prpDstrR Any b
b W N1
w1 Any a
a
r5 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b * (N1 + a)) :~: (b * (N1 + a))
r5 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r6 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b * (N1 + a)) :~: (b * 'S (N0 + a))
r6 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r7 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b * 'S (N0 + a)) :~: (b * 'S a)
r7 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
r8 :: forall (a :: N') (b :: N').
Any a -> Any b -> (b * 'S a) :~: (b * (a + 1))
r8 Any a
_ Any b
_ = forall {k} (a :: k). a :~: a
Refl
codeW :: N -> N -> String
codeW :: N -> N -> String
codeW N
i N
n = forall (m :: Type -> Type) a. Monad m => m (m a) -> m a
join forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall a. a -> [a] -> [a]
tween String
"\n" forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ N -> [String]
cdn N
i where
cdn :: N -> [String]
cdn N
0 = String
"type N0 = 'N0"
forall a. a -> [a] -> [a]
: String
"w0 :: W N0"
forall a. a -> [a] -> [a]
: String
"w0 = W0"
forall a. a -> [a] -> [a]
: N -> [String]
cdn N
1
cdn N
i | N
i forall a. Ord a => a -> a -> Bool
<= N
n = String
cdType forall a. a -> [a] -> [a]
: String
cdDcl forall a. a -> [a] -> [a]
: String
cdDef forall a. a -> [a] -> [a]
: N -> [String]
cdn (N
i forall a. Additive a => a -> a -> a
+ N
1)
| Bool
otherwise = []
where i' :: N
i' = N
iN -> N -> N
>-N
1
++ :: [a] -> [a] -> [a]
(++) = forall a. [a] -> [a] -> [a]
(L.++)
cdType :: String
cdType = String
"type N" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i forall a. [a] -> [a] -> [a]
++ String
" = S N" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i'
cdDcl :: String
cdDcl = String
"w" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i forall a. [a] -> [a] -> [a]
++ String
" :: W N" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i
cdDef :: String
cdDef = String
"w" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i forall a. [a] -> [a] -> [a]
++ String
" = SW " forall a. [a] -> [a] -> [a]
++ String
"w" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i'
itfW :: N -> N -> String
itfW :: N -> N -> String
itfW N
n N
m = forall (m :: Type -> Type) a. Monad m => m (m a) -> m a
join forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall a. a -> [a] -> [a]
tween String
"\n" forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
L.map forall (m :: Type -> Type) a. Monad m => m (m a) -> m a
join forall (h :: Type -> Type -> Type) a b.
Applicative h =>
h a b -> a -> b
$ forall {a}. [a] -> [[a]]
splt [String]
nats where
++ :: [a] -> [a] -> [a]
(++) = forall a. [a] -> [a] -> [a]
(L.++)
nats :: [String]
nats = [String
", type N" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i forall a. [a] -> [a] -> [a]
++ String
", w" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show N
i | N
i <- [N
n..N
m]]
splt :: [a] -> [[a]]
splt [] = []
splt [a]
ss = [a]
s forall a. a -> [a] -> [a]
: [a] -> [[a]]
splt [a]
ss' where
([a]
s,[a]
ss') = forall a. Int -> [a] -> ([a], [a])
L.splitAt Int
4 [a]
ss
type N0 = 'N0
w0 :: W N0
w0 :: W N0
w0 = W N0
W0
type N1 = S N0
w1 :: W N1
w1 :: W N1
w1 = forall (n :: N'). W n -> W (n + 1)
SW W N0
w0
type N2 = S N1
type N3 = S N2
type N4 = S N3
type N5 = S N4
type N6 = S N5
type N7 = S N6
type N8 = S N7
type N9 = S N8
type N10 = S N9