Catriel Beeri Pls/Winter 2004/5 inductive-revisited 1 Inductive definitions revisited  Generated and Freely generated sets oPattern match, unification.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Completeness and Expressiveness
CPSC 388 – Compiler Design and Construction
THE WELL ORDERING PROPERTY Definition: Let B be a set of integers. An integer m is called a least element of B if m is an element of B, and for every x.
Type Inference David Walker COS 320. Criticisms of Typed Languages Types overly constrain functions & data polymorphism makes typed constructs useful.
Continuing Abstract Interpretation We have seen: 1.How to compile abstract syntax trees into control-flow graphs 2.Lattices, as structures that describe.
SLD-resolution Introduction Most general unifiers SLD-resolution
Semantics Static semantics Dynamic semantics attribute grammars
ML Datatypes.1 Standard ML Data types. ML Datatypes.2 Concrete Datatypes  The datatype declaration creates new types  These are concrete data types,
1 Introduction to Prolog References: – – Bratko, I., Prolog Programming.
1 PROPERTIES OF A TYPE ABSTRACT INTERPRETATER. 2 MOTIVATION OF THE EXPERIMENT § a well understood case l type inference in functional programming à la.
Translator Architecture Code Generator ParserTokenizer string of characters (source code) string of tokens abstract program string of integers (object.
© M. Winter COSC 4P41 – Functional Programming Testing vs Proving Testing –uses a set of “typical” examples, –symbolic testing, –may find errors,
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Winter 2004/5Pls – expresssion-lang – Catriel Beeri22 Informal Analysis Goal: prove the semantics is deterministic Stages: Values --- we know they have.
Catriel Beeri Pls/Winter 2004/5 last 55 Two comments on let polymorphism I. What is the (time, space) complexity of type reconstruction? In practice –
Compiler Principle and Technology Prof. Dongming LU Mar. 28th, 2014.
Catriel Beeri Pls/Winter 2004/5 functional-language 1 Substitution Semantics of FL – a simple functional language FL is EL + (non-recursive) function creation.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Inference and Resolution for Problem Solving
Catriel Beeri Pls/Winter 2004/5 types 1 Types Three chapters:  General introduction to types  A simple static monomorphic type system (with type checking.
Catriel Beeri Pls/Winter 2004/5 type reconstruction 1 Type Reconstruction & Parametric Polymorphism  Introduction  Unification and type reconstruction.
Winter 2004/5Pls – inductive – Catriel Beeri1 Inductive Definitions (our meta-language for specifications)  Examples  Syntax  Semantics  Proof Trees.
Catriel Beeri Pls/Winter 2004/5 environment 68  Some details of implementation As part of / extension of type-checking: Each declaration d(x) associated.
Catriel Beeri Pls/Winter 2004/5 interpreters 1 Language processors for EL  An interpreter transEval from  An interpreter natEval from An important theme:
Catriel Beeri Pls/Winter 2004/05 types 65  A type-checking algorithm The task: (since we start with empty H, why is the goal not just E?) The rule set.
Type Inference David Walker COS 441. Criticisms of Typed Languages Types overly constrain functions & data polymorphism makes typed constructs useful.
Type Inference David Walker CS 510, Fall Criticisms of Typed Languages Types overly constrain functions & data polymorphism makes typed constructs.
Catriel Beeri Pls/Winter 2004/5 environment1 1 The Environment Model  Introduction and overview  A look at the execution model  Dynamic scoping  Static.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Winter 2004/5Pls – analysis – Catriel Beeri1 A precise analysis  Determinism, soundness, completeness for  Determinism for  Additional properties of.
After today Week 9 –Tu: Pat Rondon –Th: Ravi/Nathan Week 10 –Tu: Nathan/Ravi –Th: Class canceled Finals week –Th: Zach, John.
Formal Aspects of Computer Science – Week 12 RECAP Lee McCluskey, room 2/07
Winter 2003/4Pls – syntax – Catriel Beeri1 SYNTAX Syntax: form, structure The syntax of a pl: The set of its well-formed programs The rules that define.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
Problem of the DAY Create a regular context-free grammar that generates L= {w  {a,b}* : the number of a’s in w is not divisible by 3} Hint: start by designing.
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
9/18/20151 Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC Based in part on slides by Mattox.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 2: Operational Semantics I Roman Manevich Ben-Gurion University.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Type Safety Kangwon National University 임현승 Programming Languages.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
PROLOG SYNTAX AND MEANING Ivan Bratko University of Ljubljana Faculty of Computer and Info. Sc. Ljubljana, Slovenia.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Logic Programming and Prolog Goal: use formalism of first-order logic Output described by logical formula (theorem) Input described by set of formulae.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
CS6133 Software Specification and Verification
1 / 48 Formal a Language Theory and Describing Semantics Principles of Programming Languages 4.
Programming Languages Third Edition Chapter 4 Logic Programming.
INM175 Topic 8 1 Module INM175 Discrete Mathematics Topic 8 Algebraic Theories.
1 Finite Model Theory Lecture 1: Overview and Background.
Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Course 2D1453, Some material from B. Pierce: TAPL + some from.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
1 Proving Properties of Recursive List Functions CS 270 Math Foundations of CS Jeremy Johnson.
COMP 412, FALL Type Systems C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
5. Context-Free Grammars and Languages
Prolog Concepts.
A lightening tour in 45 minutes
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
Proving Properties of Recursive List Functions
5. Context-Free Grammars and Languages
PROGRAMMING IN HASKELL
Computer Aided Geometric Design
Prolog Concepts.
Presentation transcript:

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 1 Inductive definitions revisited  Generated and Freely generated sets oPattern match, unification oSyntax-directed definitions (of semantics,..)

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 2 Generated set: Least set that includes certain constants closed under certain operations (may require elements of some given sets) Examples: NN generated from 0, succ, N generated from 0, 1, addition Int list generated from integers, [], ::  Generated & freely generated sets

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 3 Each element has expression tree Leaves labeled by constants/ elements of given sets Internal nodes labeled by operations Can be formulated as inductive definition expression tree isomorphic to proof tree Freely generated: each element has unique tree Example: N generated from 0, succ

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 4 Every domain of labeled trees is freely generated A label ~ an operation to construct trees --- a constructor Examples: all data types of OCAML abstract syntax trees

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 5 Properties of freely generated domains: inductively defined functions are always well- defined (explains their use in functional pl’s) Membership is decidable Pattern: expression p that has constants and variables as leaves, constructors as internal nodes Pattern match: given expression E, pattern p, is there a variable assignment that maps p to E Has a simple algorithm (Result is the satisfying assignment, or FAIL)

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 6 Unification: (a generalization of pattern matching) Given two patterns, is there a variable assignment that makes them equal? (and, is there a best one?) Used in theorem provers, logic programming (prolog), and in type inference (ML) Has an (almost) linear time algorithm

Catriel Beeri Pls/Winter 2004/5 inductive-revisited 7 Of interest to us: Goal resolution for semantics relations inductively defined over abstract syntax (a freely generated set) The semantics is syntax-directed The rules are organized by syntax classes Allows to select for each expression candidate applicable rules (pattern match) Conditions in the rules allow to select a unique new goal for recursive calls – no backtracking The goals in premises of a rule are sub-expressions of the goal in the rule’s head –Each recursive call of next, natEval has a smaller argument  termination is guaranteed where do we use here the free generation?