210 likes | 341 Views
Language. A system of symbols and rules used to communicate knowledge Between humans: (e.g., Natural Language) Between machines: (e.g., Binary Code) Between human and machine (e.g., Programming Language, GUI) etc. Two Flavors of Knowledge. Explicit Facts (Potentially Infinite)
E N D
Language • A system of symbols and rules used to communicate knowledge • Between humans: (e.g., Natural Language) • Between machines: (e.g., Binary Code) • Between human and machine (e.g., Programming Language, GUI) • etc.
Two Flavors of Knowledge • Explicit • Facts (Potentially Infinite) • No computation required • Communication can be prohibitively inefficient • E.g., Table of multiplication facts rather than a procedure • Implicit • Finite Facts + Computation Procedure • Computation procedure is finite and explicit • Communication can become very efficient • Concise representations allows for communication (computations as needed) potentially infinite knowledge
Logic as Language • Origins are Pre-Aristotle • A language for the explicit communication of one’s knowledge between humans • Explicit Facts + General purpose inference procedure • Frege (1879) develops modern symbolic logic, the predicate calculus, complete with proof theory - a formal language…for pure thought • Exploited by mathematicians and philosophers demanding tools for rigorous expression and formal, unambiguous human communication • Becomes the foundation for mathematical reasoning. • Principal developmental constraint: Human cognitive processes
The Role of Computers: Communication • Store and & communicate knowledge between humans • Use finitely expressed procedures to infer & communicate a potentially infinite amount of otherwise implicit knowledge • Like a Book? • Can afford MORE EFFICIENT COMMUNICATION • Like a Human?: • Can in many cases compute faster and more accurately.
The Role of Communication In Computing • Step 1: Formulation - Human Focus • Human communicates with Human • Step 2 : Program - Machine Focus • Human conforms and communicates with the computer • Step 3: Application - Human Focus • Computer conforms and communicates with Human
Step 1: Formulation • Human prepares to communicate with machine by formulating knowledge. • Typically communicates with other humans for accuracy and validation. • Logic is a classic and fundamental language. • Identify Goal • body of knowledge and • form of human-machine communication for step 3 (input/output) • Identify base knowledge • explicit facts required to derive body of knowledge • Identify computation procedure • Explicit procedure “algorithm” used to derive subset of knowledge representing output given input and base knowledge
Steps 2 and 3 • Step 2 : Program • Human conforms and communicates with machine • Human reformulates in a language the computer can process • Programming language becomes means of expression for human to communicate knowledge and computation procedure to machine. • Step 3: Application • Machine comforts to communicate with Human • Human user “queries”/”dialogs” with computer providing input • Computer executes program, derives, forms and communicates response to human
Programming Languages • Origins -- 1940’s • Developed for Two Purposes: • For Controlling the operations of a computer AND • For humans to express knowledge • Conflicting Developmental Constraints: • The con Neumann architecture • Human cognitive processes • Knowledge formulation in logic is not sufficient • Must program the machine • The “program” becomes the persistent artifact of communication not the human formulation
Bridging the Gap Objects and Attributes Automatic Inference (Inheritance) Automatic Memory Management Assembler C ALGOL Family Functional Family Logic Programming 01011 01010 Programming Languages Bridging the Gap Logic Designed for Formal Expression and Communication of Human Knowledge Designed to operate a machine designed to add binary numbers
Logic as Program • Program • set of axioms • declarative logic statement of knowledge • Computation • Constructive proof of goal statement from a program • Not part of program -- an abstract machine -- like the accumulator in a VN • Answer: “natural” logic consequent of the program • Original Motivation • Desire to automate the proof procedure of predicate calculus so that theorems could be automatically generated by the computer • In general, however, this is not possible (proof by Godel) • Positive Impact • For a class of interesting problems a limited proof procedure can be useful • A declarative logic-based language can afford precise logical syntax and semantics based on general-purpose and “natural” computation procedure • A classic logic-based expression is transformed into effective computation
Logic Programming: Historical Highlights • 1965: Robinson’s Unification Algorithm and Resolution Principle mechanizes proof procedure • 1970’s: • Kowaski formulates a procedural interpretation of Horn Clause Logic. Shows that an axiom of the form: • A if B1 and B2 and …BN • Can be interpreted and executed as a procedure of a recursive program based on resolution proof procedure with unification algorithm. • Colmerauer develops Prolog based on Kowlaski’s procedural interpretation • vanEmden and Kowalski develop formal semantics for Logic Programming • Warren dispels myths of impracticability with an efficient implementation based on easily programmed abstract machine (the WAM) • 1980’s - • Advanced techniques execute more “logical specs” as efficient programs • Constraint Logic Programming as a generalization of LP allows for a framework that maintains declarative logic syntax and semantics while solving classes of CSPs as efficiently as theoretically possible.
The Ideal and The Reality • Ideal • A problem decoratively stated in symbolic logic executes on a vonNeuman machine as efficient program • Benefits • Programming becomes classic logical specification and inherits the known benefits of formal logic as language (precise semantics and natural inference mechanism) • Intent and correctness of programs are more easily accessible, understood and validated by humans (and by machines) • Expression/Communication of domain/problem knowledge is not cluttered with knowledge about the machine or about the idiosyncrasies of managing machine resources. • Reality • Currently not ALL clear, elegant logic specifications in LP execute as efficient logic programs • None the less LP allows for specialized algorithms to be expressed as declarative logic programs. • Research in LP is focused on broaden the class of specs that do execute as efficient logic programs
LP’s Role in this Course • Course focus • AI and Knowledge Representation and Automated Reasoning • How computers can help HUMANS capture, compute and communicate knowledge. • Logic Programming • Has close ties to formal logic - the tried and true foundation for the formal representation and communication of human knowledge • Provides a programming foundation for formally representing knowledge and inference • Allows us, as software engineers, to write programs ignoring machine issues (e.g., memory structure and management) and to concentrate on knowledge representation, human reasoning and formal human communication.
Why Applications in Document Generation • Encompass a broad range of AI topics and techniques • Documents are themselves human communication artifacts • They are produced by some process • The represent and communicate knowledge through language • The act of authoring documents can range • From the very creative (fictional literature) • To the very unimaginative and simplistic (filling in a form) • And include things in between like finding, weaving together and refining previous written text to form a new document • Exploring how we might model the human processes involved in document authoring requires ideas about how we might represent and reason about knowledge, language and the human creative processes. • Great foundation for exploring the potential and the limits of the role of computers in human creativity and communication
Course Overview • Logical Foundations • Properties and Mechanics of Classic Symbolic Logic • Logic Programming and PROLOG • Practical tool kit for implementing knowledge-based systems • Knowledge Representation • Basic techniques for modeling common-sense domains • Three Applications • Brutus -- Creative Writing • DocCon -- Business document authoring, knowledge management and reuse • Test Generation
Brutus • Background • Academic research in automatic story generation • Designed to explore computational models of human creative authorship • Developed in Prolog (FLEX) • Focus • What kinds of knowledge is represented • What kinds of processes are modeled • What kinds of automatic reasoning techniques are used • How is natural language used • Students will have an opportunity to explore and extend the code
DocCon • Background • Commercial System developed at an RPI incubator company, Document Development Corporation, in collaboration with IBM Research • Designed to assist in managing and reusing document knowledge to assist in authoring business documents • Carefully engineered and developed a variety of languages (Java, C, Delphi) • Focus • Business Problem • System architecture • Document Knowledge Representation Scheme • Interactive Document Configuration • Students will have an opportunity to develop authoring solutions for a class of documents using DocCon
Transitive Closure Version 0 %-------------------------------------------------------------- %Version 0 % - Direct Rep of logic % - Does not terminate (Try :- closure(1,3) for test0) % - Inefficient %-------------------------------------------------------------- closure0(X,Y) :- base(X,Y). %arcs in graph closure0(X,Z) :- closure0(X,Y), closure0(Y,Z). %transitive step
Transitive Closure Version 1 %-------------------------------------------------------------- %Version 1 % - A little less Direct Rep of logic % - Terminates for acyclic graphs % - works on test0 but not on test1. % - Still Inefficient %-------------------------------------------------------------- closure1(X,Y) :- base(X,Y). closure1(X,Z) :- base(X,Y), closure1(Y,Z).
Transitive Closure Version 2 %-------------------------------------------------------------- %Version 2 % - A little less direct rep of logic % - Terminates for cyclic and acyclic graphs % - skips visited nodes % - works on test0 and test1 % - Inefficient - Traverses all paths when only need one. %-------------------------------------------------------------- closure2(X,Y) :- closure2a(X,Y,[X]). closure2a(X,Y,_) :- base(X,Y). closure2a(X,Z,Avoiding) :- base(X,Y), not(on(Y,Avoiding)), closure2a(Y,Z,[Y | Avoiding]).
Transitive Closure Version 3 %-------------------------------------------------------------- %Version 3 % - Warshalls algorithm for transitive closure in Prolog % - Indirect Rep of logic % - Terminates for cyclic and acyclic graphs % - Efficient (Does not visit unnecessary paths) %-------------------------------------------------------------- % "Very often you will be tempted to think that it is time % to abandon Prolog for C. Often you will do better to replace % a specification (in Prolog) by a program (in Prolog)." % % Good algorithms are important no matter what programming Language.