Seeing the wood through the trees

Size: px
Start display at page:

Download "Seeing the wood through the trees"

Transcription

1 Seeing the wood through the trees A DIY guide to reasoning about effects Graham Hutton and Diana Fulger University of Nottingham December 16, 2007 Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

2 Background Monads Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

3 Background Monads make writing programmes easier Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

4 Background Monads make writing programmes easier should make reasoning about them easier too? Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

5 Background Monads make writing programmes easier should make reasoning about them easier too? But Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

6 Background Monads make writing programmes easier should make reasoning about them easier too? But existing techniques have not gone mainstream Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

7 Background Monads make writing programmes easier should make reasoning about them easier too? But existing techniques have not gone mainstream Let s try a simple example! Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

8 Reasoning on trees data Tree a = Leaf a Node (Tree a) (Tree a) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

9 Reasoning on trees data Tree a = Leaf a Node (Tree a) (Tree a) label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

10 Reasoning on trees data Tree a = Leaf a Node (Tree a) (Tree a) label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n Prove label correct? raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

11 Reasoning on trees data Tree a = Leaf a Node (Tree a) (Tree a) label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n Prove label correct? equationally! raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

12 Define correct? Specification preserves shape raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

13 Define correct? Specification preserves shape distinct labels Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

14 Simple correctness labels :: Tree a [a] labels (Leaf x) = [x] labels (Node l r) = labels l ++ labels r raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

15 Simple correctness labels :: Tree a [a] labels (Leaf x) = [x] labels (Node l r) = labels l ++ labels r Theorem (Correctness of label) For all finite trees t: nodups (labels (fst (label t 0))) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

16 Simple correctness labels :: Tree a [a] labels (Leaf x) = [x] labels (Node l r) = labels l ++ labels r Theorem (Correctness of label) For all finite trees t: nodups (labels (fst (label t 0))) nodups :: Eq a [a] Bool nodups [] = True nodups (x:xs) = not(elem x xs) && nodups xs Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

17 Proof steps identify generated labels raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

18 Proof steps identify generated labels Lemma (Behaviour of label) For every finite tree t and initial integer label n, label t n = (t, n ) n < n labels t = [n.. n 1] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

19 Proof steps identify generated labels Lemma (Behaviour of label) For every finite tree t and initial integer label n, label t n = (t, n ) n < n labels t = [n.. n 1] labels are unique raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

20 Proof steps identify generated labels Lemma (Behaviour of label) For every finite tree t and initial integer label n, label t n = (t, n ) n < n labels t = [n.. n 1] labels are unique Lemma (Haskell) Intervals have no duplicates: for all integers a b: nodups [a.. b] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

21 State monad label :: Tree a Int (Tree Int, Int) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

22 State monad label :: Tree a Int (Tree Int, Int) type ST s a = s (a,s) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

23 State monad label :: Tree a Int (Tree Int, Int) type ST s a = s (a,s) instance Monad (ST s) where -- return :: a ST s a return v = λs (v,s) -- (>>=) :: ST s a (a ST s b) ST s b st >>= f = λs let (v,s ) = st s in (f v) s Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

24 Monadic labelling label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

25 Monadic labelling label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

26 Monadic labelling label :: Tree a Int (Tree Int, Int) label (Leaf x) n = (Leaf n, n+1) label (Node l r) n = (Node l r, n") where (l, n ) = label l n (r, n") = label r n label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) fresh :: ST Int Int fresh = λn (n, n+1) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

27 Monadic labelling label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

28 Monadic labelling label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) single-assignment variables Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

29 Monadic labelling label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) single-assignment variables refreshing fresh Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

30 Monadic labelling label :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) single-assignment variables refreshing fresh reasoning any easier? Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

31 What we would like to see Leaf x Leaf fresh Node l r Node (label l) (label r) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

32 Applicative functors Effectful generalisation of application Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

33 Applicative functors Effectful generalisation of application class Functor f Applicative f where pure :: a f a ( ) :: f (a b) f a f b Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

34 Applicative functors Effectful generalisation of application class Functor f Applicative f where pure :: a f a ( ) :: f (a b) f a f b Monad Applicative return pure ap Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

35 Applicative functors class Functor f Applicative f where pure :: a f a ( ) :: f (a b) f a f b Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

36 Applicative functors class Functor f Applicative f where pure :: a f a ( ) :: f (a b) f a f b pure id v =v pure ( ) u v w =u (v w) pure f pure x =pure (f x) u pure y =pure (λf f y) u identity composition homomorphism interchange raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

37 Applicative functors class Functor f Applicative f where pure :: a f a ( ) :: f (a b) f a f b pure id v =v pure ( ) u v w =u (v w) pure f pure x =pure (f x) u pure y =pure (λf f y) u identity composition homomorphism interchange pure f x1... xn = [[f x1 x2... xn]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

38 State applicative functor instance Applicative (ST s) where -- pure :: a ST s a pure v = λs (v,s) --( ) :: ST s (a b) ST s a ST s b mf mx = λs let (f, s ) = mf s (x, s") = mx s in (f x, s") Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

39 Applicative labelling label :: Tree a ST Int (Tree Int) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

40 Applicative labelling label monadic expression :: Tree a ST Int (Tree Int) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

41 Applicative labelling label monadic expression :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

42 Applicative labelling label monadic expression :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) applicative expression raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

43 Applicative labelling label monadic expression :: Tree a ST Int (Tree Int) label (Leaf x) = do n fresh return (Leaf n) label (Node l r) = do l label l r label r return (Node l r ) applicative expression label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

44 Applicative approach Theorem (Correctness of label) For all finite trees t: nodups (append (labels from) label t) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

45 Applicative approach Theorem (Correctness of label) For all finite trees t: nodups (append (labels from) label t) Lemma (Behaviour of label) For all finite trees t: append (labels from) label t = from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

46 Applicative labelling label :: Tree a ST Int (Tree Int) label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

47 Applicative labelling label :: Tree a ST Int (Tree Int) label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] state threading Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

48 Applicative labelling label :: Tree a ST Int (Tree Int) label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] state threading fresh label generation raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

49 Applicative labelling label :: Tree a ST Int (Tree Int) label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] state threading fresh label generation label :: Tree a ST [b] (Tree b) label (Leaf _) = [[ Leaf fetch ]] label (Node l r) = [[ Node (label l) (label r) ]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

50 Applicative labelling label :: Tree a ST Int (Tree Int) label (Leaf _) = [[ Leaf fresh ]] label (Node l r) = [[ Node (label l) (label r) ]] state threading fresh label generation label :: Tree a ST [b] (Tree b) label (Leaf _) = [[ Leaf fetch ]] label (Node l r) = [[ Node (label l) (label r) ]] fetch :: [b] (b, [b]) fetch (x:xs) = (x, xs) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

51 Factorisation Theorem (Factorising label) For all finite trees t: (id from) label t = (label t) from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

52 Factorisation Theorem (Factorising label) For all finite trees t: (id from) label t = (label t) from Proof by induction, using equational reasoning Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

53 Base case (id from) label (Leaf ) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

54 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

55 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

56 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

57 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh = (Leaf id) fetch from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

58 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh = (Leaf id) fetch from = [[Leaf fetch]] from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

59 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh = (Leaf id) fetch from = [[Leaf fetch]] from = label (Leaf ) from raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

60 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh = (Leaf id) fetch from = [[Leaf fetch]] from = label (Leaf ) from Did we just expand ST out raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

61 Base case (id from) label (Leaf ) = (id from) [[Leaf fresh]] = (id from) (Leaf id) fresh = (Leaf id) (id from) fresh = (Leaf id) fetch from = [[Leaf fetch]] from = label (Leaf ) from Did we just expand ST out (only to rebuild back again)?? raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

62 What ST does... Lemma (Bracket notation) For all f : a b and x : ST s a: [[f x]] = (f id) x Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

63 Base case revisited (id from) label (Leaf ) Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

64 Base case revisited (id from) label (Leaf ) = (id from) [[Leaf fresh]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

65 Base case revisited (id from) label (Leaf ) = (id from) [[Leaf fresh]] = [[Leaf ((id from) fresh)]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

66 Base case revisited (id from) label (Leaf ) = (id from) [[Leaf fresh]] = [[Leaf ((id from) fresh)]] = [[Leaf (fetch from)]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

67 Base case revisited (id from) label (Leaf ) = (id from) [[Leaf fresh]] = [[Leaf ((id from) fresh)]] = [[Leaf (fetch from)]] = [[Leaf fetch]] from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

68 Base case revisited (id from) label (Leaf ) = (id from) [[Leaf fresh]] = [[Leaf ((id from) fresh)]] = [[Leaf (fetch from)]] = [[Leaf fetch]] from = label (Leaf ) from Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

69 State fusions Lemma (Input state fusion) For all f : a b, x : ST s a and g : s s : [[f x]] g = [[f (x g)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

70 State fusions Lemma (Input state fusion) For all f : a b, x : ST s a and g : s s : [[f x]] g = [[f (x g)]] Typing issue [[f (x g)]] :: s (s, a), raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

71 State fusions Lemma (Input state fusion) For all f : a b, x : ST s a and g : s s : [[f x]] g = [[f (x g)]] Typing issue [[f (x g)]] :: s (s, a), not a valid ST applicative expression! raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

72 State fusions Lemma (Input state fusion) For all f : a b, x : ST s a and g : s s : [[f x]] g = [[f (x g)]] Typing issue [[f (x g)]] :: s (s, a), not a valid ST applicative expression! Expand out the ST types and the problem goes away Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

73 State fusions Lemma (Input state fusion) For all f : a b, x : ST s a and g : s s : [[f x]] g = [[f (x g)]] Typing issue [[f (x g)]] :: s (s, a), not a valid ST applicative expression! Expand out the ST types and the problem goes away Lemma (Output state fusion) For all f : s s, g : a b and x : ST s a: (id f ) [[g x]] = [[g ((id f ) x)]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

74 What ST does... for functions with 2 arguments raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

75 What ST does... for functions with 2 arguments Lemma For all f : a b c, x : ST s a and y : ST s b: [[f x y]] = (uncurry f id) assoc (id y) x Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

76 Inductive step (id from) label (Node l r) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

77 Inductive step (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

78 Inductive step (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = (id from) (uncurry Node id) assoc (id label r) label l raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

79 Inductive step (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = (id from) (uncurry Node id) assoc (id label r) label l = (uncurry Node id) (id from) assoc (id label r) label l = (uncurry Node id) assoc (id ((id from) label r)) label l = (uncurry Node id) assoc (id (label r from)) label l = (uncurry Node id) assoc (id label r) (id from) label l = (uncurry Node id) assoc (id label r) label l from = [[Node (label l) (label r)]] from = label (Node l r) from raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

80 State fusions Lemma (Input state fusion) [[f x y]] g = [[f (x g) y]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

81 State fusions Lemma (Input state fusion) [[f x y]] g = [[f (x g) y]] Lemma (State shifting) [[f ((id g) x) y]] = [[f x (y g)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

82 State fusions Lemma (Input state fusion) [[f x y]] g = [[f (x g) y]] Lemma (State shifting) [[f ((id g) x) y]] = [[f x (y g)]] Lemma (Output state fusion) (id f ) [[g x y]] = [[g x ((id f ) y)]] Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

83 Inductive step revisited (id from) label (Node l r) raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

84 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

85 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

86 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] = [[Node (label l) (label r from)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

87 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] = [[Node (label l) (label r from)]] = [[Node ((id from) label l) (label r)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

88 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] = [[Node (label l) (label r from)]] = [[Node ((id from) label l) (label r)]] = [[Node (label l from) (label r)]] raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

89 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] = [[Node (label l) (label r from)]] = [[Node ((id from) label l) (label r)]] = [[Node (label l from) (label r)]] = [[Node (label l) (label r)]] from raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

90 Inductive step revisited (id from) label (Node l r) = (id from) [[Node (label l) (label r)]] = [[Node (label l) ((id from) label r)]] = [[Node (label l) (label r from)]] = [[Node ((id from) label l) (label r)]] = [[Node (label l from) (label r)]] = [[Node (label l) (label r)]] from = label (Node l r) from raham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

91 Conclusions Equational proof of correctness on monadic/applicative expression Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

92 Conclusions Equational proof of correctness on monadic/applicative expression Factorisation Loosening the type system Applicative properties of the ST state transformer Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

93 Conclusions Equational proof of correctness on monadic/applicative expression Factorisation Loosening the type system Applicative properties of the ST state transformer Similar proof for the prefix-based labelling with Reader monad, without typing problems Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

94 Conclusions Equational proof of correctness on monadic/applicative expression Factorisation Loosening the type system Applicative properties of the ST state transformer Similar proof for the prefix-based labelling with Reader monad, without typing problems... and further work Alternative labellings Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

95 Conclusions Equational proof of correctness on monadic/applicative expression Factorisation Loosening the type system Applicative properties of the ST state transformer Similar proof for the prefix-based labelling with Reader monad, without typing problems... and further work Alternative labellings Traversable... and further along Compiler correctness Graham Hutton and Diana Fulger (University of Nottingham) Seeing the wood through the trees December 16, / 1

The countdown problem

The countdown problem JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON

More information

Applicative programming with effects

Applicative programming with effects Under consideration for publication in J. Functional Programming 1 F U N C T I O N A L P E A R L Applicative programming with effects CONOR MCBRIDE University of Nottingham ROSS PATERSON City University,

More information

Full and Complete Binary Trees

Full and Complete Binary Trees Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

More information

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)! Math 7 Fall 205 HOMEWORK 5 SOLUTIONS Problem. 2008 B2 Let F 0 x = ln x. For n 0 and x > 0, let F n+ x = 0 F ntdt. Evaluate n!f n lim n ln n. By directly computing F n x for small n s, we obtain the following

More information

The cyclotomic polynomials

The cyclotomic polynomials The cyclotomic polynomials Notes by G.J.O. Jameson 1. The definition and general results We use the notation e(t) = e 2πit. Note that e(n) = 1 for integers n, e(s + t) = e(s)e(t) for all s, t. e( 1 ) =

More information

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/

More information

Lemma 5.2. Let S be a set. (1) Let f and g be two permutations of S. Then the composition of f and g is a permutation of S.

Lemma 5.2. Let S be a set. (1) Let f and g be two permutations of S. Then the composition of f and g is a permutation of S. Definition 51 Let S be a set bijection f : S S 5 Permutation groups A permutation of S is simply a Lemma 52 Let S be a set (1) Let f and g be two permutations of S Then the composition of f and g is a

More information

A tutorial on the universality and expressiveness of fold

A tutorial on the universality and expressiveness of fold J. Functional Programming 9 (4): 355 372, July 1999. Printed in the United Kingdom c 1999 Cambridge University Press 355 A tutorial on the universality and expressiveness of fold GRAHAM HUTTON University

More information

Programming and Reasoning with Algebraic Effects and Dependent Types

Programming and Reasoning with Algebraic Effects and Dependent Types Programming and Reasoning with Algebraic Effects and Dependent Types Edwin C. Brady School of Computer Science, University of St Andrews, St Andrews, Scotland. Email: ecb10@st-andrews.ac.uk Abstract One

More information

Faster deterministic integer factorisation

Faster deterministic integer factorisation David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers

More information

Midlands Graduate School in the Foundations of Computer Science

Midlands Graduate School in the Foundations of Computer Science Midlands Graduate chool in the Foundations of omputer cience Operational emantics, Abstract Machines, and orrectness Roy L. role University of Leicester, 8th to 12th April 2006 University of Nottingham,

More information

Denotational design with type class morphisms (extended version)

Denotational design with type class morphisms (extended version) LambdaPix technical report 2009-01, March 2009 (minor revisions February 15, 2011) 1 Denotational design with type class morphisms (extended version) Conal Elliott LambdaPix conal@conal.net Abstract Type

More information

Az előző rész tartalmából...

Az előző rész tartalmából... Az előző rész tartalmából... [2..26] Programozás burritokkal [3..26] Programozás monádokkal programstruktúrálás type IO a = World -> (a, World) -- putstr :: String -> IO () -- getline :: IO String (>>=)

More information

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H. Yarmand and Douglas G.

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H. Yarmand and Douglas G. Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H Yarmand and Douglas G Down Appendix A Lemma 1 - the remaining cases In this appendix,

More information

Lecture 5 - CPA security, Pseudorandom functions

Lecture 5 - CPA security, Pseudorandom functions Lecture 5 - CPA security, Pseudorandom functions Boaz Barak October 2, 2007 Reading Pages 82 93 and 221 225 of KL (sections 3.5, 3.6.1, 3.6.2 and 6.5). See also Goldreich (Vol I) for proof of PRF construction.

More information

6.2 Permutations continued

6.2 Permutations continued 6.2 Permutations continued Theorem A permutation on a finite set A is either a cycle or can be expressed as a product (composition of disjoint cycles. Proof is by (strong induction on the number, r, of

More information

FACTORING AFTER DEDEKIND

FACTORING AFTER DEDEKIND FACTORING AFTER DEDEKIND KEITH CONRAD Let K be a number field and p be a prime number. When we factor (p) = po K into prime ideals, say (p) = p e 1 1 peg g, we refer to the data of the e i s, the exponents

More information

Fun with Phantom Types

Fun with Phantom Types 1 Fun with Phantom Types RALF HINZE Institut für Informatik III, Universität Bonn Römerstraße 164, 53117 Bonn, Germany Email: ralf@informatik.uni-bonn.de Homepage: http://www.informatik.uni-bonn.de/~ralf

More information

Introduction to Algebraic Geometry. Bézout s Theorem and Inflection Points

Introduction to Algebraic Geometry. Bézout s Theorem and Inflection Points Introduction to Algebraic Geometry Bézout s Theorem and Inflection Points 1. The resultant. Let K be a field. Then the polynomial ring K[x] is a unique factorisation domain (UFD). Another example of a

More information

it is easy to see that α = a

it is easy to see that α = a 21. Polynomial rings Let us now turn out attention to determining the prime elements of a polynomial ring, where the coefficient ring is a field. We already know that such a polynomial ring is a UF. Therefore

More information

Direct models of the computational lambda-calculus

Direct models of the computational lambda-calculus Electronic Notes in Theoretical Computer Science 20 (1999) URL: http://www.elsevier.nl/locate/entcs/volume20.html 49 pages Direct models of the computational lambda-calculus Carsten Führmann 1 Division

More information

Paper 2 Revision. (compiled in light of the contents of paper1) Higher Tier Edexcel

Paper 2 Revision. (compiled in light of the contents of paper1) Higher Tier Edexcel Paper 2 Revision (compiled in light of the contents of paper1) Higher Tier Edexcel 1 Topic Areas 1. Data Handling 2. Number 3. Shape, Space and Measure 4. Algebra 2 Data Handling Averages Two-way table

More information

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch Today Two more models of computation: Nondeterministic Finite Automata (NFAs)

More information

Introduction to Automata Theory. Reading: Chapter 1

Introduction to Automata Theory. Reading: Chapter 1 Introduction to Automata Theory Reading: Chapter 1 1 What is Automata Theory? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a

More information

Lecture 6 Online and streaming algorithms for clustering

Lecture 6 Online and streaming algorithms for clustering CSE 291: Unsupervised learning Spring 2008 Lecture 6 Online and streaming algorithms for clustering 6.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line

More information

Types, Polymorphism, and Type Reconstruction

Types, Polymorphism, and Type Reconstruction Types, Polymorphism, and Type Reconstruction Sources This material is based on the following sources: Pierce, B.C., Types and Programming Languages. MIT Press, 2002. Kanellakis, P.C., Mairson, H.G. and

More information

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology First Name: Family Name: Student Number: Class/Tutorial: WOLLONGONG COLLEGE AUSTRALIA A College of the University of Wollongong Diploma in Information Technology Mid-Session Test Summer Session 008-00

More information

Testing and Tracing Lazy Functional Programs using QuickCheck and Hat

Testing and Tracing Lazy Functional Programs using QuickCheck and Hat Testing and Tracing Lazy Functional Programs using QuickCheck and Hat Koen Claessen 1, Colin Runciman 2, Olaf Chitil 2, John Hughes 1, and Malcolm Wallace 2 1 Chalmers University of Technology, Sweden

More information

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors. The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,

More information

IV.2 (b) Higher level programming concepts for URMs Anton Setzer

IV.2 (b) Higher level programming concepts for URMs Anton Setzer CS 275 Automata and Formal Language Theory Course Notes Additional Material Part IV: Limits of Computation Chapt. IV.2: The URM IV.2 (a) Definition of the URM IV.2 (b) Higher level programming concepts

More information

Examination paper for MA0301 Elementær diskret matematikk

Examination paper for MA0301 Elementær diskret matematikk Department of Mathematical Sciences Examination paper for MA0301 Elementær diskret matematikk Academic contact during examination: Iris Marjan Smit a, Sverre Olaf Smalø b Phone: a 9285 0781, b 7359 1750

More information

Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p. Page 331, 38.2 Assignment #11 Solutions Factor the following positive integers into primes. a. 25 = 5 2. b. 4200 = 2 3 3 5 2 7. c. 10 10 = 2 10 5 10. d. 19 = 19. e. 1 = 1. Page 331, 38.4 Suppose a is a

More information

NOTES ON LINEAR TRANSFORMATIONS

NOTES ON LINEAR TRANSFORMATIONS NOTES ON LINEAR TRANSFORMATIONS Definition 1. Let V and W be vector spaces. A function T : V W is a linear transformation from V to W if the following two properties hold. i T v + v = T v + T v for all

More information

Taylor and Maclaurin Series

Taylor and Maclaurin Series Taylor and Maclaurin Series In the preceding section we were able to find power series representations for a certain restricted class of functions. Here we investigate more general problems: Which functions

More information

15-150 Lecture 11: Tail Recursion; Continuations

15-150 Lecture 11: Tail Recursion; Continuations 15-150 Lecture 11: Tail Recursion; Continuations Lecture by Dan Licata February 21, 2011 In this lecture we will discuss space usage: analyzing the memory it takes your program to run tail calls and tail

More information

1 Local Brouwer degree

1 Local Brouwer degree 1 Local Brouwer degree Let D R n be an open set and f : S R n be continuous, D S and c R n. Suppose that the set f 1 (c) D is compact. (1) Then the local Brouwer degree of f at c in the set D is defined.

More information

GROUPS ACTING ON A SET

GROUPS ACTING ON A SET GROUPS ACTING ON A SET MATH 435 SPRING 2012 NOTES FROM FEBRUARY 27TH, 2012 1. Left group actions Definition 1.1. Suppose that G is a group and S is a set. A left (group) action of G on S is a rule for

More information

Gluing things together with Haskell. Neil Mitchell http://nmitchell.co.uk/

Gluing things together with Haskell. Neil Mitchell http://nmitchell.co.uk/ Gluing things together with Haskell Neil Mitchell http://nmitchell.co.uk/ Code Elegantly designed Build system Test harness Continuous integration Release bundling Installer generator Release distribution

More information

1 Operational Semantics for While

1 Operational Semantics for While Models of Computation, 2010 1 1 Operational Semantics for While The language While of simple while programs has a grammar consisting of three syntactic categories: numeric expressions, which represent

More information

Productive Coprogramming with Guarded Recursion

Productive Coprogramming with Guarded Recursion Productive Coprogramming with Guarded Recursion Robert Atkey bob.atkey@gmail.com Conor McBride University of Strathclyde Conor.McBride@strath.ac.uk Abstract Total functional programming offers the beguiling

More information

COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS

COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS Bull Austral Math Soc 77 (2008), 31 36 doi: 101017/S0004972708000038 COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS IGOR V EROVENKO and B SURY (Received 12 April 2007) Abstract We compute

More information

Fair testing vs. must testing in a fair setting

Fair testing vs. must testing in a fair setting Fair testing vs. must testing in a fair setting Tom Hirschowitz and Damien Pous Amsterdam, Novembre 2010 Laboratoire de Mathématiques Université de Savoie UMR 5127 Tom Hirschowitz and Damien Pous Fair

More information

Chapter 7. Homotopy. 7.1 Basic concepts of homotopy. Example: z dz. z dz = but

Chapter 7. Homotopy. 7.1 Basic concepts of homotopy. Example: z dz. z dz = but Chapter 7 Homotopy 7. Basic concepts of homotopy Example: but γ z dz = γ z dz γ 2 z dz γ 3 z dz. Why? The domain of /z is C 0}. We can deform γ continuously into γ 2 without leaving C 0}. Intuitively,

More information

8.1 Min Degree Spanning Tree

8.1 Min Degree Spanning Tree CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree

More information

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question

More information

COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS

COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS COMMUTATIVITY DEGREES OF WREATH PRODUCTS OF FINITE ABELIAN GROUPS IGOR V. EROVENKO AND B. SURY ABSTRACT. We compute commutativity degrees of wreath products A B of finite abelian groups A and B. When B

More information

CSc 372. Comparative Programming Languages. 21 : Haskell Accumulative Recursion. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 21 : Haskell Accumulative Recursion. Department of Computer Science University of Arizona 1/18 CSc 372 Comparative Programming Languages 21 : Haskell Accumulative Recursion Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/18 Stack

More information

3. Prime and maximal ideals. 3.1. Definitions and Examples.

3. Prime and maximal ideals. 3.1. Definitions and Examples. COMMUTATIVE ALGEBRA 5 3.1. Definitions and Examples. 3. Prime and maximal ideals Definition. An ideal P in a ring A is called prime if P A and if for every pair x, y of elements in A\P we have xy P. Equivalently,

More information

Lecture 4 Online and streaming algorithms for clustering

Lecture 4 Online and streaming algorithms for clustering CSE 291: Geometric algorithms Spring 2013 Lecture 4 Online and streaming algorithms for clustering 4.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line

More information

UNIVERSITY OF LONDON (University College London) M.Sc. DEGREE 1998 COMPUTER SCIENCE D16: FUNCTIONAL PROGRAMMING. Answer THREE Questions.

UNIVERSITY OF LONDON (University College London) M.Sc. DEGREE 1998 COMPUTER SCIENCE D16: FUNCTIONAL PROGRAMMING. Answer THREE Questions. UNIVERSITY OF LONDON (University College London) M.Sc. DEGREE 1998 COMPUTER SCIENCE D16: FUNCTIONAL PROGRAMMING Answer THREE Questions. The Use of Electronic Calculators: is NOT Permitted. -1- Answer Question

More information

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples Brian Hilley Boston College MT695 Honors Seminar March 3, 2006 1 Introduction 1.1 Mazur s Theorem Let C be a

More information

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR-00-7 ISSN 600 600 February 00

More information

Find-The-Number. 1 Find-The-Number With Comps

Find-The-Number. 1 Find-The-Number With Comps Find-The-Number 1 Find-The-Number With Comps Consider the following two-person game, which we call Find-The-Number with Comps. Player A (for answerer) has a number x between 1 and 1000. Player Q (for questioner)

More information

Monads for functional programming

Monads for functional programming Monads for functional programming Philip Wadler, University of Glasgow Department of Computing Science, University of Glasgow, G12 8QQ, Scotland (wadler@dcs.glasgow.ac.uk) Abstract. The use of monads to

More information

Functional Programming

Functional Programming FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling

More information

Limits and Continuity

Limits and Continuity Math 20C Multivariable Calculus Lecture Limits and Continuity Slide Review of Limit. Side limits and squeeze theorem. Continuous functions of 2,3 variables. Review: Limits Slide 2 Definition Given a function

More information

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

More information

Chapter 7: Functional Programming Languages

Chapter 7: Functional Programming Languages Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language

More information

Cloud Haskell. Distributed Programming with. Andres Löh. 14 June 2013, Big Tech Day 6 Copyright 2013 Well-Typed LLP. .Well-Typed

Cloud Haskell. Distributed Programming with. Andres Löh. 14 June 2013, Big Tech Day 6 Copyright 2013 Well-Typed LLP. .Well-Typed Distributed Programming with Cloud Haskell Andres Löh 14 June 2013, Big Tech Day 6 Copyright 2013 Well-Typed LLP Well-Typed The Haskell Consultants Overview Introduction Haskell Cloud Haskell Communication

More information

Indiana State Core Curriculum Standards updated 2009 Algebra I

Indiana State Core Curriculum Standards updated 2009 Algebra I Indiana State Core Curriculum Standards updated 2009 Algebra I Strand Description Boardworks High School Algebra presentations Operations With Real Numbers Linear Equations and A1.1 Students simplify and

More information

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming. Functional Programming Languages. Chapter 14. Introduction Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

More information

A Branch and Bound Algorithm for Solving the Binary Bi-level Linear Programming Problem

A Branch and Bound Algorithm for Solving the Binary Bi-level Linear Programming Problem A Branch and Bound Algorithm for Solving the Binary Bi-level Linear Programming Problem John Karlof and Peter Hocking Mathematics and Statistics Department University of North Carolina Wilmington Wilmington,

More information

MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

More information

Algebraic Structures II

Algebraic Structures II MAS 305 Algebraic Structures II Notes 12 Autumn 2006 Factorization in integral domains Lemma If a, b, c are elements of an integral domain R and ab = ac then either a = 0 R or b = c. Proof ab = ac a(b

More information

Since [L : K(α)] < [L : K] we know from the inductive assumption that [L : K(α)] s < [L : K(α)]. It follows now from Lemma 6.

Since [L : K(α)] < [L : K] we know from the inductive assumption that [L : K(α)] s < [L : K(α)]. It follows now from Lemma 6. Theorem 7.1. Let L K be a finite extension. Then a)[l : K] [L : K] s b) the extension L K is separable iff [L : K] = [L : K] s. Proof. Let M be a normal closure of L : K. Consider first the case when L

More information

ML for the Working Programmer

ML for the Working Programmer ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

More information

THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS

THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS KEITH CONRAD 1. Introduction The Fundamental Theorem of Algebra says every nonconstant polynomial with complex coefficients can be factored into linear

More information

If n is odd, then 3n + 7 is even.

If n is odd, then 3n + 7 is even. Proof: Proof: We suppose... that 3n + 7 is even. that 3n + 7 is even. Since n is odd, there exists an integer k so that n = 2k + 1. that 3n + 7 is even. Since n is odd, there exists an integer k so that

More information

FIRST YEAR CALCULUS. Chapter 7 CONTINUITY. It is a parabola, and we can draw this parabola without lifting our pencil from the paper.

FIRST YEAR CALCULUS. Chapter 7 CONTINUITY. It is a parabola, and we can draw this parabola without lifting our pencil from the paper. FIRST YEAR CALCULUS WWLCHENW L c WWWL W L Chen, 1982, 2008. 2006. This chapter originates from material used by the author at Imperial College, University of London, between 1981 and 1990. It It is is

More information

UNCORRECTED PAGE PROOFS

UNCORRECTED PAGE PROOFS number and and algebra TopIC 17 Polynomials 17.1 Overview Why learn this? Just as number is learned in stages, so too are graphs. You have been building your knowledge of graphs and functions over time.

More information

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

More information

Finitely Additive Dynamic Programming and Stochastic Games. Bill Sudderth University of Minnesota

Finitely Additive Dynamic Programming and Stochastic Games. Bill Sudderth University of Minnesota Finitely Additive Dynamic Programming and Stochastic Games Bill Sudderth University of Minnesota 1 Discounted Dynamic Programming Five ingredients: S, A, r, q, β. S - state space A - set of actions q(

More information

Class Notes CS 3137. 1 Creating and Using a Huffman Code. Ref: Weiss, page 433

Class Notes CS 3137. 1 Creating and Using a Huffman Code. Ref: Weiss, page 433 Class Notes CS 3137 1 Creating and Using a Huffman Code. Ref: Weiss, page 433 1. FIXED LENGTH CODES: Codes are used to transmit characters over data links. You are probably aware of the ASCII code, a fixed-length

More information

Left-Handed Completeness

Left-Handed Completeness Left-Handed Completeness Dexter Kozen Computer Science Department Cornell University RAMiCS, September 19, 2012 Joint work with Alexandra Silva Radboud University Nijmegen and CWI Amsterdam Result A new

More information

Deterministic Discrete Modeling

Deterministic Discrete Modeling Deterministic Discrete Modeling Formal Semantics of Firewalls in Isabelle/HOL Cornelius Diekmann, M.Sc. Dr. Heiko Niedermayer Prof. Dr.-Ing. Georg Carle Lehrstuhl für Netzarchitekturen und Netzdienste

More information

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

More information

For each learner you will need: mini-whiteboard. For each small group of learners you will need: Card set A Factors; Card set B True/false.

For each learner you will need: mini-whiteboard. For each small group of learners you will need: Card set A Factors; Card set B True/false. Level A11 of challenge: D A11 Mathematical goals Starting points Materials required Time needed Factorising cubics To enable learners to: associate x-intercepts with finding values of x such that f (x)

More information

Programming Languages in Artificial Intelligence

Programming Languages in Artificial Intelligence Programming Languages in Artificial Intelligence Günter Neumann, German Research Center for Artificial Intelligence (LT Lab, DFKI) I. AI programming languages II. Functional programming III. Functional

More information

Interactive Proof Documents

Interactive Proof Documents Interactive Proof Documents Theorem Provers for User Interfaces Makarius November 2008 Motivation Aims Renovate and reform traditional LCF-style theorem proving for coming generations of users. Catch up

More information

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

More information

Binary Multiplication

Binary Multiplication Binary Multiplication Q: How do we multiply two numbers? eg. 12, 345 6, 789 111105 987600 8641500 + 74070000 83, 810, 205 10111 10101 10111 00000 1011100 0000000 + 101110000 111100011 Pad, multiply and

More information

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization

More information

On the k-path cover problem for cacti

On the k-path cover problem for cacti On the k-path cover problem for cacti Zemin Jin and Xueliang Li Center for Combinatorics and LPMC Nankai University Tianjin 300071, P.R. China zeminjin@eyou.com, x.li@eyou.com Abstract In this paper we

More information

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

More information

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety

More information

FACTORING SPARSE POLYNOMIALS

FACTORING SPARSE POLYNOMIALS FACTORING SPARSE POLYNOMIALS Theorem 1 (Schinzel): Let r be a positive integer, and fix non-zero integers a 0,..., a r. Let F (x 1,..., x r ) = a r x r + + a 1 x 1 + a 0. Then there exist finite sets S

More information

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014! GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!!! Challenge Problem 2 (Mastermind) due Fri. 9/26 Find a fourth guess whose scoring will allow you to determine the secret code (repetitions are

More information

263-2200 Types and Programming Languages

263-2200 Types and Programming Languages 263-2200 Types and Programming Languages 1 / 49 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress

More information

INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS

INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS STEVEN P. LALLEY AND ANDREW NOBEL Abstract. It is shown that there are no consistent decision rules for the hypothesis testing problem

More information

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity.

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity. 7 Catalan Numbers Thomas A. Dowling, Department of Mathematics, Ohio State Uni- Author: versity. Prerequisites: The prerequisites for this chapter are recursive definitions, basic counting principles,

More information

OPERATIONAL TYPE THEORY by Adam Petcher Prepared under the direction of Professor Aaron Stump A thesis presented to the School of Engineering of

OPERATIONAL TYPE THEORY by Adam Petcher Prepared under the direction of Professor Aaron Stump A thesis presented to the School of Engineering of WASHINGTON NIVERSITY SCHOOL OF ENGINEERING AND APPLIED SCIENCE DEPARTMENT OF COMPTER SCIENCE AND ENGINEERING DECIDING JOINABILITY MODLO GROND EQATIONS IN OPERATIONAL TYPE THEORY by Adam Petcher Prepared

More information

GREATEST COMMON DIVISOR

GREATEST COMMON DIVISOR DEFINITION: GREATEST COMMON DIVISOR The greatest common divisor (gcd) of a and b, denoted by (a, b), is the largest common divisor of integers a and b. THEOREM: If a and b are nonzero integers, then their

More information

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform MATH 433/533, Fourier Analysis Section 11, The Discrete Fourier Transform Now, instead of considering functions defined on a continuous domain, like the interval [, 1) or the whole real line R, we wish

More information

A result of Gabber. by A.J. de Jong

A result of Gabber. by A.J. de Jong A result of Gabber by A.J. de Jong 1 The result Let X be a scheme endowed with an ample invertible sheaf L. See EGA II, Definition 4.5.3. In particular, X is supposed quasi-compact and separated. 1.1 Theorem.

More information

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

The Clean programming language. Group 25, Jingui Li, Daren Tuzi The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was

More information

Group Theory. Contents

Group Theory. Contents Group Theory Contents Chapter 1: Review... 2 Chapter 2: Permutation Groups and Group Actions... 3 Orbits and Transitivity... 6 Specific Actions The Right regular and coset actions... 8 The Conjugation

More information

How to Estimate the Change Frequencies of a Web Crawler

How to Estimate the Change Frequencies of a Web Crawler Estimating Frequency of Change Junghoo Cho University of California, LA and Hector Garcia-Molina Stanford University Many online data sources are updated autonomously and independently. In this paper,

More information

SOLUTIONS TO ASSIGNMENT 1 MATH 576

SOLUTIONS TO ASSIGNMENT 1 MATH 576 SOLUTIONS TO ASSIGNMENT 1 MATH 576 SOLUTIONS BY OLIVIER MARTIN 13 #5. Let T be the topology generated by A on X. We want to show T = J B J where B is the set of all topologies J on X with A J. This amounts

More information

Bounded Treewidth in Knowledge Representation and Reasoning 1

Bounded Treewidth in Knowledge Representation and Reasoning 1 Bounded Treewidth in Knowledge Representation and Reasoning 1 Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien Luminy, October 2010 1 Joint work with G.

More information

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation) Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic

More information