mathematical structures in programming · introduction first steps mathematical structures in...

Post on 19-Jun-2020

13 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

IntroductionFirst Steps

Mathematical Structures in Programming– Introduction to Calculational Programming –

Zhenjiang Hu

SOKENDAI/National Institute of InformaticsEmail: hu@nii.ac.jp

URL: http://research.nii.ac.jp/˜ hu

Sokendai, 2015

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Self Introduction

1988: BS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1991: MS, Dept. of Computer Science, Shanghai Jiaotong Univ.

1996: PhD, Information Engineering, University of Tokyo

1996: Research Associate (Assistant Professor), Univ. of Tokyo

1997: Lecturer, Univ. of Tokyo

2000: Associate Professor, Univ. of Tokyo

2008: Full Professor, National Institute of Informatics (NII)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Research Interests

Functional Programming (FP)

Learned FP from Prof. Yonggiang Sun in SJTU since 1986Serving on steering committees of ICFP, Haskell, APLAS

Algorithmic Languages and Calculi

PhD thesis: Calculational Approach to Program OptimizationServing as an IFIP WG 2.1 member (TC 2 JapanRepresentative)

Bidirectional Programming & Software Engineering

Started in 2003Serving on BX steering committee, IEEE TSE Associate Editor

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Research Interests

Functional Programming (FP)

Learned FP from Prof. Yonggiang Sun in SJTU since 1986Serving on steering committees of ICFP, Haskell, APLAS

Algorithmic Languages and Calculi

PhD thesis: Calculational Approach to Program OptimizationServing as an IFIP WG 2.1 member (TC 2 JapanRepresentative)

Bidirectional Programming & Software Engineering

Started in 2003Serving on BX steering committee, IEEE TSE Associate Editor

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Research Interests

Functional Programming (FP)

Learned FP from Prof. Yonggiang Sun in SJTU since 1986Serving on steering committees of ICFP, Haskell, APLAS

Algorithmic Languages and Calculi

PhD thesis: Calculational Approach to Program OptimizationServing as an IFIP WG 2.1 member (TC 2 JapanRepresentative)

Bidirectional Programming & Software Engineering

Started in 2003Serving on BX steering committee, IEEE TSE Associate Editor

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Related Lectures

Mathematical Structures in ProgramsPreliminary topics given to undergraduate students inDepartment of Mathematical Informatics, Univ. of Tokyo,1997-2011Advanced topics given to graduate school of InformationScience and Engineering, Univ. of Tokyo, 1997-2008, andSokendai, 2008-.Intensive course for graduate students in Kyoto Univ., 2009,and in Peking Univ., 2012.

Introduction to Program Calculation/TransformationSummer School on Generative and TransformationalTechniques in Software Engineering (GTTSE 2005, Braga,Portugal, 4 - 8 July, 2005)BASICS Summer School on Types and ProgrammingLanguages (BASICS 2010, Hangzhou, China, October 12-16,2010)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Related Lectures

Mathematical Structures in ProgramsPreliminary topics given to undergraduate students inDepartment of Mathematical Informatics, Univ. of Tokyo,1997-2011Advanced topics given to graduate school of InformationScience and Engineering, Univ. of Tokyo, 1997-2008, andSokendai, 2008-.Intensive course for graduate students in Kyoto Univ., 2009,and in Peking Univ., 2012.

Introduction to Program Calculation/TransformationSummer School on Generative and TransformationalTechniques in Software Engineering (GTTSE 2005, Braga,Portugal, 4 - 8 July, 2005)BASICS Summer School on Types and ProgrammingLanguages (BASICS 2010, Hangzhou, China, October 12-16,2010)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Tsuru-Kame-Zan

The Tsuru-Kame Problem

Some cranes (tsuru) and tortoises (kame) are mixed in a cage.Known is that there are 6 heads and 20 legs. Find out thenumbers of cranes and tortoises.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Kindergarten Approach

A simple enumeration

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Kindergarten Approach

A simple enumeration

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Kindergarten Approach

A simple enumeration

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Primary School

Reasoning

if all 6 animals were cranes, there ought to be 6× 2 = 12 legs.

However, there are in fact 20 legs, the extra 20− 12 = 8 legsmust belong to some tortoises.

Since one tortoise can add 2 legs, we have 8/2 = 4 tortoises.

So there must be 6− 4 = 2 cranes.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Middle School

Algebra (Equation Theory)

x + y = 62x + 4y = 20

which givesx = 2y = 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Middle School

Algebra (Equation Theory)

x + y = 62x + 4y = 20

which givesx = 2y = 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Middle School

Algebra (Equation Theory)

x + y = 62x + 4y = 20

which givesx = 2y = 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Middle School

Algebra (Equation Theory)

x + y = 62x + 4y = 20

which givesx = 2y = 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

The same problem may have different difficulties dependingon what weapons we have in hand.

Many arithmetic problems can be easily solvedif we use the equation theory.

What are weapons for solving programming problems? Do wehave an “equation theory” for constructing correct andefficient programs?

⇓Calculational Programming

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

The same problem may have different difficulties dependingon what weapons we have in hand.

Many arithmetic problems can be easily solvedif we use the equation theory.

What are weapons for solving programming problems? Do wehave an “equation theory” for constructing correct andefficient programs?

⇓Calculational Programming

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

The same problem may have different difficulties dependingon what weapons we have in hand.

Many arithmetic problems can be easily solvedif we use the equation theory.

What are weapons for solving programming problems? Do wehave an “equation theory” for constructing correct andefficient programs?

⇓Calculational Programming

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Programming Problem

Can you develop a correct linear-time program for solving thefollowing problem?

Maximum Segment Sum Problem

Given a list of numbers, find the maximum of sums of allconsecutive sublists.

[−1, 3, 3,−4,−1, 4, 2,−1] =⇒ 7

[−1, 3, 1,−4,−1, 4, 2,−1] =⇒ 6

[−1, 3, 1,−4,−1, 1, 2,−1] =⇒ 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

A Simple Solution

1 Enumerating all segments (segs);

2 Computing sum for each segment(sums);

3 Calculating the maximum of all the sums (max).

Exercise

How many segments does a list of length n have?

Exercise

What is the time complexity of this simple solution?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There indeed exists a clever solution!

mss=0; s=0;

for(i=0;i<n;i++){

s += x[i];

if(s<0) s=0;

if(mss<s) mss= s;

}

x [i ] 3 1 −4 −1 1 2 −1s 0 3 4 0 0 1 3 2

mss 0 3 4 4 4 4 4 4

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There is a big gap between the simple and clever solutions!

Can we calculate the clever solution from the simple solution?

What rules and theorems are necessary to do so?

How to apply the rules and theorems to do so?

Can we reuse the derivation procedure to solve similarproblems, say maximum increasing segment sum problme?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There is a big gap between the simple and clever solutions!

Can we calculate the clever solution from the simple solution?

What rules and theorems are necessary to do so?

How to apply the rules and theorems to do so?

Can we reuse the derivation procedure to solve similarproblems, say maximum increasing segment sum problme?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There is a big gap between the simple and clever solutions!

Can we calculate the clever solution from the simple solution?

What rules and theorems are necessary to do so?

How to apply the rules and theorems to do so?

Can we reuse the derivation procedure to solve similarproblems, say maximum increasing segment sum problme?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There is a big gap between the simple and clever solutions!

Can we calculate the clever solution from the simple solution?

What rules and theorems are necessary to do so?

How to apply the rules and theorems to do so?

Can we reuse the derivation procedure to solve similarproblems, say maximum increasing segment sum problme?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

There is a big gap between the simple and clever solutions!

Can we calculate the clever solution from the simple solution?

What rules and theorems are necessary to do so?

How to apply the rules and theorems to do so?

Can we reuse the derivation procedure to solve similarproblems, say maximum increasing segment sum problme?

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Transformational Programming

One starts by writing clean and correct programs, and then useprogram transformation techniques to transform them step-by-stepto more efficient equivalents.

Specification: Clean and Correct programs

⇓Folding/Unfolding Program Transformation

⇓Efficient Programs

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Program Calculation

Program calculation is a kind of program transformation based onConstructive Algorithmics, a framework for developinglaws/rules/theories for manipulating programs.

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Program Calculation

Program calculation is a kind of program transformation based onConstructive Algorithmics, a framework for developinglaws/rules/theories for manipulating programs.

Specification: Clean and Correct programs

⇓Folding-free Program Transformation

⇓Efficient Programs

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Work on Program Calculation

Algorithm Derivation

Fold/Unfold-based Transformational Programming(Darlington&Burstall:77)

Bird-Meertens Formalism (BMF) (Bird:87)

Algebra of Programming (Bird&de Moor:96)

Our Work on Program Transformation in Calculation Form

Fusion (ICFP’96)

Tupling (ICFP’97)

Accumulation (NGC’99)

Inversion/Bidirectionalization (MPC’04, PEPM’07, ICFP’07, MPC’10, ICFP’10)

Dynamic Programming (ICFP’00, ICFP’03, ICFP’08)

Parallelization (POPL’98, ESOP’02, PLDI’07, POPL’09, ESOP’12)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Work on Program Calculation

Algorithm Derivation

Fold/Unfold-based Transformational Programming(Darlington&Burstall:77)

Bird-Meertens Formalism (BMF) (Bird:87)

Algebra of Programming (Bird&de Moor:96)

Our Work on Program Transformation in Calculation Form

Fusion (ICFP’96)

Tupling (ICFP’97)

Accumulation (NGC’99)

Inversion/Bidirectionalization (MPC’04, PEPM’07, ICFP’07, MPC’10, ICFP’10)

Dynamic Programming (ICFP’00, ICFP’03, ICFP’08)

Parallelization (POPL’98, ESOP’02, PLDI’07, POPL’09, ESOP’12)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

What I will talk in this course?

Algorithm DerivationFold/Unfold-based Transformational Programming(Darlington&Burstall:77)

Bird-Meertens Formalism (BMF) (Bird:87)

Algebra of Programming (Bird&de Moor:96)

Our Work on Program Transformation in Calculation FormFusion (ICFP’96)

Tupling (ICFP’97)

Accumulation (NGC’99)

Inversion/Bidirectionalization (MPC’04, PEPM’07, ICFP’07, MPC’10, ICFP’10)

Dynamic Programming (ICFP’00, ICFP’03, ICFP’08)

Parallelization (POPL’98, ESOP’02, PLDI’07, POPL’09, ESOP’12)

⇑Functional Programming

(basic concepts of algorithmic languages, program specification and reasoning)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

What I will talk in this course?

Algorithm DerivationFold/Unfold-based Transformational Programming(Darlington&Burstall:77)

Bird-Meertens Formalism (BMF) (Bird:87)

Algebra of Programming (Bird&de Moor:96)

Our Work on Program Transformation in Calculation FormFusion (ICFP’96)

Tupling (ICFP’97)

Accumulation (NGC’99)

Inversion/Bidirectionalization (MPC’04, PEPM’07, ICFP’07, MPC’10, ICFP’10)

Dynamic Programming (ICFP’00, ICFP’03, ICFP’08)

Parallelization (POPL’98, ESOP’02, PLDI’07, POPL’09, ESOP’12)

⇑Functional Programming

(basic concepts of algorithmic languages, program specification and reasoning)

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Course Plan

1 Introduction to Functional Programming (about 4 lectures)

Learn basic concepts of programming languages (FP as a metalanguage)Learn how to build programs constructively and how to reasonabout programs (FP as a programming language)

2 Program Calculus: BMF (about 4 lectures)

Learn basic programming theory for calculating programs fromproblem specificationsLearn basic techniques for calculating programs

3 Applications of Calculational Programming (about 4 lectures)

Learn how to solve a wide class of optimization problemsLearn how to automatic parallelize sequential programs

4 In-class Discussion (about 2 lectures)

Discuss solutions to programming exercises in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Course Plan

1 Introduction to Functional Programming (about 4 lectures)

Learn basic concepts of programming languages (FP as a metalanguage)Learn how to build programs constructively and how to reasonabout programs (FP as a programming language)

2 Program Calculus: BMF (about 4 lectures)

Learn basic programming theory for calculating programs fromproblem specificationsLearn basic techniques for calculating programs

3 Applications of Calculational Programming (about 4 lectures)

Learn how to solve a wide class of optimization problemsLearn how to automatic parallelize sequential programs

4 In-class Discussion (about 2 lectures)

Discuss solutions to programming exercises in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Course Plan

1 Introduction to Functional Programming (about 4 lectures)

Learn basic concepts of programming languages (FP as a metalanguage)Learn how to build programs constructively and how to reasonabout programs (FP as a programming language)

2 Program Calculus: BMF (about 4 lectures)

Learn basic programming theory for calculating programs fromproblem specificationsLearn basic techniques for calculating programs

3 Applications of Calculational Programming (about 4 lectures)

Learn how to solve a wide class of optimization problemsLearn how to automatic parallelize sequential programs

4 In-class Discussion (about 2 lectures)

Discuss solutions to programming exercises in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Course Plan

1 Introduction to Functional Programming (about 4 lectures)

Learn basic concepts of programming languages (FP as a metalanguage)Learn how to build programs constructively and how to reasonabout programs (FP as a programming language)

2 Program Calculus: BMF (about 4 lectures)

Learn basic programming theory for calculating programs fromproblem specificationsLearn basic techniques for calculating programs

3 Applications of Calculational Programming (about 4 lectures)

Learn how to solve a wide class of optimization problemsLearn how to automatic parallelize sequential programs

4 In-class Discussion (about 2 lectures)

Discuss solutions to programming exercises in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Evaluation

No Final Written Examination :-)

In-class activity: 50%

Report: 20%

Final Presentation: 30%

You can get 100% unconditionally, if you can solve the openproblem which will be discussed in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Evaluation

No Final Written Examination :-)

In-class activity: 50%

Report: 20%

Final Presentation: 30%

You can get 100% unconditionally, if you can solve the openproblem which will be discussed in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

Evaluation

No Final Written Examination :-)

In-class activity: 50%

Report: 20%

Final Presentation: 30%

You can get 100% unconditionally, if you can solve the openproblem which will be discussed in the class

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

IntroductionFirst Steps

References

Graham Hutton, Programming in Haskell, CambridgeUniversity Press, 2007.

Richard Bird, Lecture Notes on Constructive FunctionalProgramming, Technical Monograph PRG-69, OxfordUniversity, 1988.

Anne Kaldewaij, Programming: The Derivation of Algorithms,Prentice Hall, 1990.

Richard Bird and Oege de Moor, The Algebra ofProgramming, Prentice-Hall, 1996.

Roland Backhouse, Program Construction: CalculatingImplementation from Specification, Wiley, 2003.

Slides will be available at the following website after the class.http://www.prg.nii.ac.jp/course/2015/msp15

Zhenjiang Hu Mathematical Structures in Programming – Introduction to Calculational Programming –

top related