Specification of Chemical Formulæ in XL with Operator Overloading

Size: px
Start display at page:

Download "Specification of Chemical Formulæ in XL with Operator Overloading"

Transcription

1 Formulæ in with Specification of Formulæ in with University of Göttingen 28 February 2012

2 Formulæ in with Outline

3 Formulæ in with ultimately we want to specify reactions like 2H 2 + O 2 k f kb 2H 2 O use operator overloading to enable this in automatically derive differential equations from this and solve these numerically possible for elementary reactions via law of mass action

4 Formulæ in with Functions like in C++ define function with special name name is operator<symbol>, where <symbol> is one of +, -, *, /, %,... unary vs. binary operators count parameters of function plus one extra for non-static functions (left operand is this)

5 Formulæ in with Functions Example class Complex { double real, imag ; public Complex ( double real, double imag ) { this. r e a l = r e a l ; this. imag = imag ; public s t a t i c Complex operator+ ( Complex a, Complex b ) { return new Complex ( a. r e a l + b. real, a. imag + b. imag ) ;...

6 Formulæ in with Functions Conclusion allows: but not yet: Complex a = new Complex ( 1, 2 ) ; Complex b = new Complex ( 3, 4 ) ; Complex c = a + b ; Complex d = 1 + a ; Complex e = a + 1; could be resolved by providing additional operator overloads better solutions are implicit conversions

7 Formulæ in with Implicit Conversion like in C++ extends autoboxing from primitive to reference types can be defined in any of the following ways: class C { C(S source ) ; s t a t i c C valueof (S source ) ; T tot ( ) ; t tvalue ( ) ; follows existing patterns like tostring(), intvalue(), etc.

8 Formulæ in with Implicit Conversion Example class Complex grogra. x l. lang. ConversionConstructor public C( double d ) { r e a l = d ; imag = 0;

9 Formulæ in with Introduction reaction equation: reaction rate: r = 1 ν 1 d[a] dt ν 1 A + ν 2 B +... ν 1A + ν 2B +... = 1 ν 2 d[b] dt = 1 ν 1 d[a ] dt = 1 ν 2 d[b ] dt =... rate law: r = k[a] ν 1 [B] ν 2...

10 Formulæ in with Parse Tree Generation Reaction left right Expression Expression Term Term Term 2H 2 O 2 2H 2 O in : 2*H2 + O2 <=> 2*H2O;

11 Formulæ in with Molecule / / each e n t i t y i n the r e a c t i o n i s a molecule class Molecule { / / predefine some instances of Molecule so t h a t they / / can be s t a t i c a l l y imported i n t o c u r r e n t scope public s t a t i c f i n a l Molecule H2 = new Molecule ( "H2" ) ; public s t a t i c f i n a l Molecule H2O = new Molecule ( "H2O" ) ; public s t a t i c f i n a l Molecule O2 = new Molecule ( "O2" ) ; S t r i n g name ; public Molecule ( S t r i n g name) { this. name = name ; public S t r i n g t o S t r i n g ( ) { return name ;

12 Formulæ in with Reaction Arrow / / stores the whole r e a c t i o n class Reaction { Expression l e f t, r i g h t ; double kf, kb ; / / i n f e r r e a c t i o n from l e f t and r i g h t side public s t a t i c Reaction operator <=> ( Expression lhs, Expression rhs ) { Reaction r e s u l t = new Reaction ( ) ; r e s u l t. l e f t = l h s ; r e s u l t. r i g h t = rhs ; return r e s u l t ;

13 Formulæ in with Expressions / / an expression i s a l i s t of terms class Expression { f i n a l ArrayList <Term> terms = new ArrayList <Term > ( ) ; public void add ( Term term ) { terms. add ( term ) ; / / terms are combined by + operator public s t a t i c Expression operator+ ( Expression expr, Term term ) { expr. add ( term ) ; return expr ;

14 Formulæ in with Term / / f a c t o r i s s t o i c h i o m e t r i c c o e f f i c i e n t f o r molecule class Term { double f a c t o r ; Molecule m; public Term ( Molecule m) { this ( 1, m) ; public Term ( double factor, Molecule m) { this. f a c t o r = f a c t o r ; this.m = m; public s t a t i c Term operator ( double factor, Term term ) { term. f a c t o r = f a c t o r ; return term ;

15 Formulæ in with Implicit Conversions Some implicit conversions are needed to cover remaining cases: 1) Molecule Term 2) Molecule Expression 3) Term Expression

16 Formulæ in with Application put all reactions into a Model derive ODEs from reaction equation for numerical integration use law of mass action need to assign indices to each Molecule map Molecule int with java.util.hashmap can then use any standard method for integration

17 Formulæ in with Example 1 Reaction A k 1 B k 2 C const Molecule A = new Molecule ( "A" ) ; const Molecule B = new Molecule ( "B" ) ; const Molecule C = new Molecule ( "C" ) ; public void run ( ) { Reaction r1 = A <=> B ; / / f i r s t reaction : A > B r1. setforwardrateconstant ( 2 ) ; f i n a l Model model = new Model ( ) ; model. addslope ( r1 ) ; model. add (B <=> C, 1 ) ; / / second r e a c t i o n : B > C...

18 Formulæ in with Example 1 Reaction A k 1 B k 2 C 10 8 concentration 6 4 A B C time

19 Formulæ in with Example 2 Michaelis-Menten reaction: in : E + S k f kr ES k cat E + P f i n a l Model model = new Model ( ) ; model. add (E + S <=> ES, 3, 0. 1 ) ; model. add (ES <=> E + P, 2 ) ;

20 Formulæ in with Example 2 Michaelis-Menten 10 8 concentration 6 4 E S ES P time

21 Formulæ in with operator overloading very versatile makes chemical reactions part of the language syntax checking included also other applications right-hand sides of rules iostreams-like input/output retrofit existing classes like BigInteger and BigDecimal with overloaded operators

22 Formulæ in with Thank you for your attention.

23 Formulæ in with

24 Formulæ in with Backup Slides

25 Formulæ in with Example 1 Reaction A k 1 B k 2 C... / / assign i n d i c e s f i n a l HashMap m = new HashMap ( ) ; i n t count = model. assignindices ( 0, m) ; / / a l l o c a t e memory double [ ] y0 = new double [ count ] ; double [ ] y = new double [ count ] ; / / set i n i t i a l c o n d i t i o n s setvalue (m, y0, A, 10);...

26 Formulæ in with Example 1 Reaction A k 1 B k 2 C... / / prepare d i f f e r e n t i a l equations / / getrate ( ) w i l l be c a l l e d by the i n t e g r a t o r ODE ode = new ODE( ) { public void getrate ( double [ ] out, double t, double [ ] y ) { Arrays. f i l l ( out, 0 ) ; model. eval ( out, t, y ) ; ;...

27 Formulæ in with Example 1 Reaction A k 1 B k 2 C... / / create numerical s o l v e r Solver s o l v e r = new F i r s t O r d e r I n t e g r a t o r A d a p t e r ( new C l a s s i c a l R u n g e K u t t a I n t e g r a t o r ( ) ) ;...

28 Formulæ in with Example 1 Reaction A k 1 B k 2 C... / / setup monitor f u n c t i o n to p l o t s t a t e over time solver. setmonitor ( 1, new Monitor ( ) { public void g ( double [ ] out, double t, double [ ] y ) { / / t r i g g e r at 20Hz out [ 0 ] = s i n ( PI t 2 0 ) ; public boolean handleevent ( i n t i, double t, double [ ] y ) { / / p l o t data or whatever return false ; ) ;...

29 Formulæ in with Example 1 Reaction A k 1 B k 2 C... / / perform i n t e g r a t i o n s o l v e r. i n t e g r a t e ( ode, 0, y0, 5, y ) ;

Compiling Techniques

Compiling Techniques Lecture 7: Abstract Syntax 13 October 2015 Table of contents Syntax Tree 1 Syntax Tree Semantic Actions Examples Abstract Grammar 2 Internal Representation AST Builder 3 Visitor Processing Semantic Actions

More information

Computer Science Introductory Course MSc - Introduction to Java

Computer Science Introductory Course MSc - Introduction to Java Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow

More information

Introduction to Computing II (ITI1121) FINAL EXAMINATION

Introduction to Computing II (ITI1121) FINAL EXAMINATION Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of engineering School of Electrical Engineering and Computer Science Identification

More information

Compiling Techniques

Compiling Techniques Lecture 6: 9 October 2015 Announcement New tutorial session: Friday 2pm check ct course webpage to find your allocated group Table of contents 1 2 Ambiguity s Bottom-Up Parser A bottom-up parser builds

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!

More information

A brief introduction to Logic. (slides from

A brief introduction to Logic. (slides from A brief introduction to Logic (slides from http://www.decision-procedures.org/) 1 A Brief Introduction to Logic - Outline Propositional Logic :Syntax Propositional Logic :Semantics Satisfiability and validity

More information

Introduction to Programming (Java) 3/12

Introduction to Programming (Java) 3/12 Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

Analysis and Design of Sequential Circuits: Examples

Analysis and Design of Sequential Circuits: Examples COSC3410 Analysis and Design of Sequential Circuits: Examples J. C. Huang Department of Computer Science University of Houston Sequential machine slide 1 inputs combinational circuit outputs memory elements

More information

Sharing Objects. Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. February 15, 2017

Sharing Objects. Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. February 15, 2017 Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 15, 2017 and /FHTenL February 15, 2017 is safe Idioms 1/34 and and is safe Idioms /FHTenL February 15, 2017 2/34 visibility

More information

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies Valentin Stockholm University September 2016 Propositions Proposition:

More information

One Year Later. Iliano Cervesato. ITT Industries, NRL Washington, DC. MSR 3.0:

One Year Later. Iliano Cervesato. ITT Industries, NRL Washington, DC.  MSR 3.0: MSR 3.0: The Logical Meeting Point of Multiset Rewriting and Process Algebra MSR 3: Iliano Cervesato iliano@itd.nrl.navy.mil One Year Later ITT Industries, inc @ NRL Washington, DC http://www.cs.stanford.edu/~iliano

More information

THe use of mixed data-type expressions, although not

THe use of mixed data-type expressions, although not ARTICLE PREPRINT: AUGUST 24 1 Mixed Data-Type Circuit Modeling: The Ideal Diode John Rugis Abstract This article presents a mixed numeric plus Boolean data-type algebraic representation that can be used

More information

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

1 Total Gadha s Complete Book of NUMBER SYSTEM TYPES OF NUMBERS Natural Numbers The group of numbers starting from 1 and including 1,,, 4, 5, and so on, are known as natural numbers. Zero, negative numbers,

More information

6.001 Recitation 22: Streams

6.001 Recitation 22: Streams 6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris

More information

Enzyme Reactions. Lecture 13: Kinetics II Michaelis-Menten Kinetics. Margaret A. Daugherty Fall v = k 1 [A] E + S ES ES* EP E + P

Enzyme Reactions. Lecture 13: Kinetics II Michaelis-Menten Kinetics. Margaret A. Daugherty Fall v = k 1 [A] E + S ES ES* EP E + P Lecture 13: Kinetics II Michaelis-Menten Kinetics Margaret A. Daugherty Fall 2003 Enzyme Reactions E + S ES ES* EP E + P E = enzyme ES = enzyme-substrate complex ES* = enzyme/transition state complex EP

More information

Michaelis-Menten Kinetics. Lecture 13: Kinetics II. Enzyme Reactions. Margaret A. Daugherty. Fall Substrates bind to the enzyme s active site

Michaelis-Menten Kinetics. Lecture 13: Kinetics II. Enzyme Reactions. Margaret A. Daugherty. Fall Substrates bind to the enzyme s active site Lecture 13: Kinetics II Michaelis-Menten Kinetics Margaret A. Daugherty Fall 2003 Enzyme Reactions E + S ES ES* EP E + P E = enzyme ES = enzyme-substrate complex ES* = enzyme/transition state complex EP

More information

Syntax Directed Transla1on

Syntax Directed Transla1on Syntax Directed Transla1on Syntax Directed Transla1on CMPT 379: Compilers Instructor: Anoop Sarkar anoopsarkar.github.io/compilers-class Syntax directed Translation Models for translation from parse trees

More information

Introduction to Arti Intelligence

Introduction to Arti Intelligence Introduction to Arti Intelligence cial Lecture 4: Constraint satisfaction problems 1 / 48 Constraint satisfaction problems: Today Exploiting the representation of a state to accelerate search. Backtracking.

More information

Binary Logic and Gates

Binary Logic and Gates 1 COE 202- Digital Logic Binary Logic and Gates Dr. Abdulaziz Y. Barnawi COE Department KFUPM 2 Outline Introduction Boolean Algebra Elements of Boolean Algebra (Binary Logic) Logic Operations & Logic

More information

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

BOOLEAN ALGEBRA INTRODUCTION SUBSETS BOOLEAN ALGEBRA M. Ragheb 1/294/2018 INTRODUCTION Modern algebra is centered around the concept of an algebraic system: A, consisting of a set of elements: ai, i=1, 2,, which are combined by a set of operations

More information

Automatic Reverse-Mode Differentiation: Lecture Notes

Automatic Reverse-Mode Differentiation: Lecture Notes Automatic Reverse-Mode Differentiation: Lecture Notes William W. Cohen October 17, 2016 1 Background: Automatic Differentiation 1.1 Why automatic differentiation is important Most neural network packages

More information

An Introduction to Z3

An Introduction to Z3 An Introduction to Z3 Huixing Fang National Trusted Embedded Software Engineering Technology Research Center April 12, 2017 Outline 1 SMT 2 Z3 Huixing Fang (ECNU) An Introduction to Z3 April 12, 2017 2

More information

A Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35

A Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35 EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2014 A Logic Primer Stavros Tripakis University of California, Berkeley Stavros Tripakis (UC Berkeley) EE 144/244,

More information

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic

More information

A Logic Primer. Stavros Tripakis University of California, Berkeley

A Logic Primer. Stavros Tripakis University of California, Berkeley EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2015 A Logic Primer Stavros Tripakis University of California, Berkeley Stavros Tripakis (UC Berkeley) EE 144/244,

More information

Implementation of a simple dimensionality checking system in Ada 2012

Implementation of a simple dimensionality checking system in Ada 2012 Implementation of a simple dimensionality checking system in Ada 2012 Vincent Pucci and Edmond Schonberg Adacore Inc., New York NY 10011, USA, pucci@adacore.com, schonberg@adacore.com, http://www.adacore.com

More information

1. Introduction to Chemical Kinetics

1. Introduction to Chemical Kinetics 1. Introduction to Chemical Kinetics objectives of chemical kinetics 1) Determine empirical rate laws H 2 + I 2 2HI How does the concentration of H 2, I 2, and HI change with time? 2) Determine the mechanism

More information

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm CS 7B - Fall 2017 - Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm Write your responses to following questions on separate paper. Use complete sentences where appropriate and write out code

More information

1 ListElement l e = f i r s t ; / / s t a r t i n g p o i n t 2 while ( l e. next!= n u l l ) 3 { l e = l e. next ; / / next step 4 } Removal

1 ListElement l e = f i r s t ; / / s t a r t i n g p o i n t 2 while ( l e. next!= n u l l ) 3 { l e = l e. next ; / / next step 4 } Removal Präsenzstunden Today In the same room as in the first week Assignment 5 Felix Friedrich, Lars Widmer, Fabian Stutz TA lecture, Informatics II D-BAUG March 18, 2014 HIL E 15.2 15:00-18:00 Timon Gehr (arriving

More information

Chemical kinetics and catalysis

Chemical kinetics and catalysis Chemical kinetics and catalysis Outline Classification of chemical reactions Definition of chemical kinetics Rate of chemical reaction The law of chemical raction rate Collision theory of reactions, transition

More information

Modeling Biological Systems in Stochastic Concurrent Constraint Programming

Modeling Biological Systems in Stochastic Concurrent Constraint Programming Modeling Biological Systems in Stochastic Concurrent Constraint Programming Luca Bortolussi 1 Alberto Policriti 1 1 Department of Mathematics and Computer Science University of Udine, Italy. Workshop on

More information

Künstliche Intelligenz

Künstliche Intelligenz Künstliche Intelligenz 4. Wissensrepräsentation Dr. Claudia Schon schon@uni-koblenz.de Institute for Web Science and Technologies 1 Except for some small changes these slides are transparencies from Poole,

More information

Elementary Sorts 1 / 18

Elementary Sorts 1 / 18 Elementary Sorts 1 / 18 Outline 1 Rules of the Game 2 Selection Sort 3 Insertion Sort 4 Shell Sort 5 Visualizing Sorting Algorithms 6 Comparing Sorting Algorithms 2 / 18 Rules of the Game Sorting is the

More information

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom. Knowledge representation Introduction Knowledge is the progression that starts with data which s limited utility. Data when processed become information, information when interpreted or evaluated becomes

More information

CSCI Compiler Construction

CSCI Compiler Construction CSCI 742 - Compiler Construction Lecture 12 Cocke-Younger-Kasami (CYK) Algorithm Instructor: Hossein Hojjat February 20, 2017 Recap: Chomsky Normal Form (CNF) A CFG is in Chomsky Normal Form if each rule

More information

Bringing machine learning & compositional semantics together: central concepts

Bringing machine learning & compositional semantics together: central concepts Bringing machine learning & compositional semantics together: central concepts https://githubcom/cgpotts/annualreview-complearning Chris Potts Stanford Linguistics CS 244U: Natural language understanding

More information

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10 Merge Sort 1 / 10 Outline 1 Merging 2 Merge Sort 3 Complexity of Sorting 4 Merge Sort and Other Sorts 2 / 10 Merging Merge sort is based on a simple operation known as merging: combining two ordered arrays

More information

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA. Outline CS21 Decidability and Tractability Lecture 5 January 16, 219 and Languages equivalence of NPDAs and CFGs non context-free languages January 16, 219 CS21 Lecture 5 1 January 16, 219 CS21 Lecture

More information

Chapter 5 Synchronous Sequential Logic

Chapter 5 Synchronous Sequential Logic Chapter 5 Synchronous Sequential Logic Sequential circuit: A circuit that includes memory elements. In this case the output depends not only on the current input but also on the past inputs. Memory A synchronous

More information

ELCT201: DIGITAL LOGIC DESIGN

ELCT201: DIGITAL LOGIC DESIGN ELCT2: DIGITAL LOGIC DESIGN Dr. Eng. Haitham Omran, haitham.omran@guc.edu.eg Dr. Eng. Wassim Alexan, wassim.joseph@guc.edu.eg Lecture 4 Following the slides of Dr. Ahmed H. Madian محرم 439 ه Winter 28

More information

Introduction to Computational Linguistics

Introduction to Computational Linguistics Introduction to Computational Linguistics Olga Zamaraeva (2018) Based on Bender (prev. years) University of Washington May 3, 2018 1 / 101 Midterm Project Milestone 2: due Friday Assgnments 4& 5 due dates

More information

ChemLab Project Proposal COMS W4115

ChemLab Project Proposal COMS W4115 ChemLab Project Proposal COMS W4115 Alice Chang (Syst. Architect, Lang Guru), Gabriel Lu (PM, Lang Guru), Martin Ong (Syst. Architect, Tester) avc2120, ggl2110, mo2454 1. Description September 24, 2014

More information

More About Methods. Hsuan-Tien Lin. Deptartment of CSIE, NTU. OOP Class, March 8-9, 2010

More About Methods. Hsuan-Tien Lin. Deptartment of CSIE, NTU. OOP Class, March 8-9, 2010 More About Methods Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 8-9, 2010 H.-T. Lin (NTU CSIE) More About Methods OOP 03/08-09/2010 0 / 24 Methods: the Basic Method (1/2, Callee s View) 1 p

More information

The TLA + proof system

The TLA + proof system The TLA + proof system Stephan Merz Kaustuv Chaudhuri, Damien Doligez, Leslie Lamport INRIA Nancy & INRIA-MSR Joint Centre, France Amir Pnueli Memorial Symposium New York University, May 8, 2010 Stephan

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) You will be expected to know Basic definitions Inference, derive, sound, complete Conjunctive Normal Form (CNF) Convert a Boolean formula to CNF Do a short

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky Based on slides Dr. M. P. Frank and Dr. J.L. Gross

More information

CS415 Compilers Syntax Analysis Top-down Parsing

CS415 Compilers Syntax Analysis Top-down Parsing CS415 Compilers Syntax Analysis Top-down Parsing These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Announcements Midterm on Thursday, March 13

More information

Adders, subtractors comparators, multipliers and other ALU elements

Adders, subtractors comparators, multipliers and other ALU elements CSE4: Components and Design Techniques for Digital Systems Adders, subtractors comparators, multipliers and other ALU elements Adders 2 Circuit Delay Transistors have instrinsic resistance and capacitance

More information

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World School of Informatics, University of Edinburgh 26/01/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Outline Knowledge-based

More information

Automata-based Verification - III

Automata-based Verification - III CS3172: Advanced Algorithms Automata-based Verification - III Howard Barringer Room KB2.20/22: email: howard.barringer@manchester.ac.uk March 2005 Third Topic Infinite Word Automata Motivation Büchi Automata

More information

Lab: Conservation of Linear Momentum There is a quantity called linear momentum defined as the mass of an object times its velocity, i.e.

Lab: Conservation of Linear Momentum There is a quantity called linear momentum defined as the mass of an object times its velocity, i.e. Lab: Conservation of Linear Momentum There is a quantity called linear momentum defined as the of an object times its velocity, i.e. p = m v, (1) where p is the symbol for linear momentum. Notice that

More information

An Introduction to Modal Logic III

An Introduction to Modal Logic III An Introduction to Modal Logic III Soundness of Normal Modal Logics Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, October 24 th 2013 Marco Cerami

More information

MiniMat: Matrix Language in OCaml LLVM

MiniMat: Matrix Language in OCaml LLVM Terence Lim - tl2735@columbia.edu August 17, 2016 Contents 1 Introduction 4 1.1 Goals........................................ 4 1.1.1 Flexible matrix notation......................... 4 1.1.2 Uncluttered................................

More information

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

Algorithms for NLP. Language Modeling III. Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley

Algorithms for NLP. Language Modeling III. Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley Algorithms for NLP Language Modeling III Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley Announcements Office hours on website but no OH for Taylor until next week. Efficient Hashing Closed address

More information

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional) Discrete Math Review Discrete Math Review (Rosen, Chapter 1.1 1.6) TOPICS Propositional Logic Logical Operators Truth Tables Implication Logical Equivalence Inference Rules What you should know about propositional

More information

Lambda Calculus! Gunnar Gotshalks! LC-1

Lambda Calculus! Gunnar Gotshalks! LC-1 Lambda Calculus! LC-1 λ Calculus History! Developed by Alonzo Church during mid 1930 s! One fundamental goal was to describe what can be computed.! Full definition of λ-calculus is equivalent in power

More information

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001 Logic Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001 Last Lecture Games Cont. α-β pruning Outline Games with chance, e.g. Backgammon Logical Agents and thewumpus World

More information

Introduction to Z3. Bow-Yaw Wang. December 19, Institute of Information Science Academia Sinica, Taiwan

Introduction to Z3. Bow-Yaw Wang. December 19, Institute of Information Science Academia Sinica, Taiwan Introduction to Z3 Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan December 19, 2017 Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, 2017 1 / 26 Outline 1 Introduction

More information

Module 6 : Reaction Kinetics and Dynamics Lecture 28 : Elementary Reactions and Reaction Mechanisms

Module 6 : Reaction Kinetics and Dynamics Lecture 28 : Elementary Reactions and Reaction Mechanisms Module 6 : Reaction Kinetics and Dynamics Lecture 28 : Elementary Reactions and Reaction Mechanisms Objectives In this Lecture you will learn to do the following Define what is an elementary reaction.

More information

Notes. Corneliu Popeea. May 3, 2013

Notes. Corneliu Popeea. May 3, 2013 Notes Corneliu Popeea May 3, 2013 1 Propositional logic Syntax We rely on a set of atomic propositions, AP, containing atoms like p, q. A propositional logic formula φ Formula is then defined by the following

More information

In this chapter, we explore the parsing problem, which encompasses several questions, including:

In this chapter, we explore the parsing problem, which encompasses several questions, including: Chapter 12 Parsing Algorithms 12.1 Introduction In this chapter, we explore the parsing problem, which encompasses several questions, including: Does L(G) contain w? What is the highest-weight derivation

More information

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control Logic and Computer Design Fundamentals Chapter 8 Sequencing and Control Datapath and Control Datapath - performs data transfer and processing operations Control Unit - Determines enabling and sequencing

More information

d(ν) = max{n N : ν dmn p n } N. p d(ν) (ν) = ρ.

d(ν) = max{n N : ν dmn p n } N. p d(ν) (ν) = ρ. 1. Trees; context free grammars. 1.1. Trees. Definition 1.1. By a tree we mean an ordered triple T = (N, ρ, p) (i) N is a finite set; (ii) ρ N ; (iii) p : N {ρ} N ; (iv) if n N + and ν dmn p n then p n

More information

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) First-Order Theorem Proving and Vampire Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) Outline Introduction First-Order Logic and TPTP Inference Systems

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

A First Course on Kinetics and Reaction Engineering. Class 9 on Unit 9

A First Course on Kinetics and Reaction Engineering. Class 9 on Unit 9 A First Course on Kinetics and Reaction Engineering Class 9 on Unit 9 Part I - Chemical Reactions Part II - Chemical Reaction Kinetics Where We re Going A. Rate Expressions - 4. Reaction Rates and Temperature

More information

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw Applied Logic Lecture 1 - Propositional logic Marcin Szczuka Institute of Informatics, The University of Warsaw Monographic lecture, Spring semester 2017/2018 Marcin Szczuka (MIMUW) Applied Logic 2018

More information

Artificial Intelligence Chapter 7: Logical Agents

Artificial Intelligence Chapter 7: Logical Agents Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent State University February 20, 2006 AI: Chapter 7: Logical Agents 1 Contents Knowledge Based Agents

More information

CS560 Knowledge Discovery and Management. CS560 - Lecture 3 1

CS560 Knowledge Discovery and Management. CS560 - Lecture 3 1 CS560 Knowledge Discovery and Management Yugi Lee STB #560D (816) 235-5932 leeyu@umkc.edu www.sce.umkc.edu/~leeyu CS560 - Lecture 3 1 Logic A logic allows the axiomatization of the domain information,

More information

Sharpening the empirical claims of generative syntax through formalization

Sharpening the empirical claims of generative syntax through formalization Sharpening the empirical claims of generative syntax through formalization Tim Hunter University of Minnesota, Twin Cities NASSLLI, June 2014 Part 1: Grammars and cognitive hypotheses What is a grammar?

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.

More information

Solution suggestions for examination of Logic, Algorithms and Data Structures,

Solution suggestions for examination of Logic, Algorithms and Data Structures, Department of VT12 Software Engineering and Managment DIT725 (TIG023) Göteborg University, Chalmers 24/5-12 Solution suggestions for examination of Logic, Algorithms and Data Structures, Date : April 26,

More information

Compiling Techniques

Compiling Techniques Lecture 5: Top-Down Parsing 6 October 2015 The Parser Context-Free Grammar (CFG) Lexer Source code Scanner char Tokeniser token Parser AST Semantic Analyser AST IR Generator IR Errors Checks the stream

More information

Computational Study of System Dynamics (Chemical Kinetics)

Computational Study of System Dynamics (Chemical Kinetics) Computational Study of System Dynamics (Chemical Kinetics) 1 Review of Rate Laws J. Andraos, J. Chem. Ed., 76 (11), 1578-1583 (1999). 2 Computational Methods PDynamics Methods < Chemical Kinetics Simlulator

More information

Principles of Program Analysis: Control Flow Analysis

Principles of Program Analysis: Control Flow Analysis Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

Data Converter Fundamentals

Data Converter Fundamentals Data Converter Fundamentals David Johns and Ken Martin (johns@eecg.toronto.edu) (martin@eecg.toronto.edu) slide 1 of 33 Introduction Two main types of converters Nyquist-Rate Converters Generate output

More information

HYBRIDIZATION THEORY

HYBRIDIZATION THEORY HYBRIDIZATION THEORY According to carbon's orbital diagram, it should only be able to form two bonds... 1s 2s 2p But we know carbon forms 4 bonds, not 2!!! Dec 5 8:19 PM HYBRIDIZATION THEORY Scientists

More information

UNIT-I: Propositional Logic

UNIT-I: Propositional Logic 1. Introduction to Logic: UNIT-I: Propositional Logic Logic: logic comprises a (formal) language for making statements about objects and reasoning about properties of these objects. Statements in a logical

More information

Verifying Properties of Parallel Programs: An Axiomatic Approach

Verifying Properties of Parallel Programs: An Axiomatic Approach Verifying Properties of Parallel Programs: An Axiomatic Approach By Susan Owicki and David Gries (1976) Nathan Wetzler nwetzler@cs.utexas.edu University of Texas, Austin November 3, 2009 Outline Introduction

More information

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF) CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour

More information

Functional Programming with F# Overview and Basic Concepts

Functional Programming with F# Overview and Basic Concepts Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference

More information

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements

More information

CONTEXT FREE GRAMMAR AND

CONTEXT FREE GRAMMAR AND CONTEXT FREE GRAMMAR AND PARSING STATIC ANALYSIS - PARSING Source language Scanner (lexical analysis) tokens Parser (syntax analysis) Syntatic structure Semantic Analysis (IC generator) Syntatic/sema ntic

More information

RELATION OF WHITEHEAD AND RUSSELL'S THEORY OF DEDUCTION TO THE BOOLEAN LOGIC OF PROPOSITIONS*

RELATION OF WHITEHEAD AND RUSSELL'S THEORY OF DEDUCTION TO THE BOOLEAN LOGIC OF PROPOSITIONS* 932.] BOOLEAN LOGIC OF PROPOSITIONS 589 RELATION OF WHITEHEAD AND RUSSELL'S THEORY OF DEDUCTION TO THE BOOLEAN LOGIC OF PROPOSITIONS* BY B. A. BERNSTEIN. Introduction. Whitehead and Russell's theory of

More information

Satisfiability Modulo Theories (SMT)

Satisfiability Modulo Theories (SMT) CS510 Software Engineering Satisfiability Modulo Theories (SMT) Slides modified from those by Aarti Gupta Textbook: The Calculus of Computation by A. Bradley and Z. Manna 1 Satisfiability Modulo Theory

More information

The Logical Meeting Point of Multiset Rewriting and Process Algebra

The Logical Meeting Point of Multiset Rewriting and Process Algebra MFPS 20 @ MU May 25, 2004 The Logical Meeting Point of Multiset Rewriting and Process Algebra Iliano ervesato iliano@itd.nrl.navy.mil ITT Industries, inc @ NRL Washington, D http://theory.stanford.edu/~iliano

More information

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing CSCI 267 Introduction to Theory of Computing Agenda Last class Reviewed syllabus Reviewed material in Chapter of Sipser Assigned pages Chapter of Sipser Questions? This class Begin Chapter Goal for the

More information

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412 COMP 412 FALL 2018 Syntax Analysis, VII The Canonical LR(1) Table Construction Comp 412 source code IR IR target Front End Optimizer Back End code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.5 Direct Proof and Counterexample V: Floor and Ceiling Copyright Cengage Learning. All

More information

Lecture 11: Enzyme Kinetics, Part I

Lecture 11: Enzyme Kinetics, Part I Biological Chemistry Laboratory Biology 3515/Chemistry 3515 Spring 2018 Lecture 11: Enzyme Kinetics, Part I 13 February 2018 c David P. Goldenberg University of Utah goldenberg@biology.utah.edu Back to

More information

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Combinational Logic ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2017 ldvan@cs.nctu.edu.tw http://www.cs.nctu.edu.tw/~ldvan/ Combinational Circuits

More information

Measuring Goodness of an Algorithm. Asymptotic Analysis of Algorithms. Measuring Efficiency of an Algorithm. Algorithm and Data Structure

Measuring Goodness of an Algorithm. Asymptotic Analysis of Algorithms. Measuring Efficiency of an Algorithm. Algorithm and Data Structure Measuring Goodness of an Algorithm Asymptotic Analysis of Algorithms EECS2030 B: Advanced Object Oriented Programming Fall 2018 CHEN-WEI WANG 1. Correctness : Does the algorithm produce the expected output?

More information

Prioritized Garbage Collection Using the Garbage Collector to Support Caching

Prioritized Garbage Collection Using the Garbage Collector to Support Caching Prioritized Garbage Collection Using the Garbage Collector to Support Caching Diogenes Nunez, Samuel Z. Guyer, Emery D. Berger Tufts University, University of Massachusetts Amherst November 2, 2016 D.

More information

Denotational semantics

Denotational semantics Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.

More information

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4 CSE 20 Lecture 4: Introduction to Boolean algebra Reminder First quiz will be on Friday (17th January) in class. It is a paper quiz. Syllabus is all that has been done till Wednesday. If you want you may

More information

CMPT-825 Natural Language Processing. Why are parsing algorithms important?

CMPT-825 Natural Language Processing. Why are parsing algorithms important? CMPT-825 Natural Language Processing Anoop Sarkar http://www.cs.sfu.ca/ anoop October 26, 2010 1/34 Why are parsing algorithms important? A linguistic theory is implemented in a formal system to generate

More information