![]()
Prolog 起源於 1970 初期, 由 Edinburgh University 的 Robert A. Kowalski (目前在 Imperial College, London) 與 University of Aix-Marseille 的 Alain Colmerauer 所發展。在 1972 年, 他們努力的成果, 誕生了 Prolog 這個以 formal Logic 為基本的程式語言。 Kowalski 的研究提供了理論框架, 而 Colmerauer 完成了語言的設計。Colmerauer 的研究小組建構了第一個 Prolog 解譯器 (interpreter)。而愛丁堡大學 (University of Edinburgh) 的 David Warren 則是建構第一個 Prolog 編譯器 (compiler)。
兩項重要的發展突顯了 Prolog 在 1980 年代的重要性: Borland 出品的 Turbo Prolog (後來發展成 Prolog Development Center 的 Visual Prolog) ,以及日本決定以 Prolog 作為他們第五代電腦程式的基礎。
至此, Prolog 已逐漸成熟, 成為一項有力且多元化技術。Prolog ISO 標準化, Prolog Vendors Group 的成立, Second International Conference on the Practical Applications 會議上所發表的論文等 , 皆反應了 Prolog 成熟的過程。
《代理產品》
LPA
Prolog++
LPA
32-bits Prolog Compiler
IF/Prolog
IF/Prolog
V5.0 Constraint Technology Package
Visual
Prolog Professional Version
prolog
什麼是prolog?
prolog是Programming in LOGic的縮寫,意思就是使用邏輯的語言編寫程式。prolog不是很高深的語言,相反,比較起其他的一些程式語言,例如c、basic等等語言, prolog是更加容易理解的語言。如果你從來沒有接觸過電腦編程,那麼恭喜你,你將很容易的進入prolog世界。如果你已經是其他語言的高手,你就需要完全丟棄你原來的編程思路,否則是很難掌握prolog的。
為什麼要prolog
看完上面的例子,不知道是否提起了你對prolog的興趣。如果你感興趣的話,那麼讓我們繼續來看prolog能夠做一些什麼事情吧。
理論上來說使用c語言可以編制任何種類的程式,甚至連prolog語言都是使用c語言編寫的。不過對於急於開發應用程式的用戶,最關心的是如何最經濟最有效率的開發程式,prolog為你多提供了一個選擇的餘地。
prolog很適合於開發有關人工智慧方面的程式,例如:專家系統、自然語言理解、定理證明以及許多智力遊戲。曾經有人預言prolog將成為下一代電腦的主要語言,雖然這個夢想目前還很難實現,不過世界上已經有許多prolog的應用實例了。你要堅信,它絕對不是那種只在實驗室發揮作用的語言,之所以大多數人都不瞭解它,是因為它的應用範圍比較特殊而已。
prolog有許多不足之處,但是這並不影響它在邏輯推理方面的強大功能,不過最好的方法是使用某種一般語言和prolog結合,一般語言完成計算、介面之類的操作,而prolog則專心實現邏輯運算的操作。例如:你編寫一個下棋程式,用prolog來讓電腦思考如何下棋,而用Visual
Basic來編寫介面。我們將在以後介紹這方面的技術。
prolog的特點
我個人總結了prolog的以下幾個特點,因為叫做特點,所以自然要和其他的語言進行比較。
1. prolog程式沒有特定的運行順序,其運行順序是由電腦決定的,而不是編程式的人。
從這個意義上來說,prolog程式不是真正意義上的程式。所謂程式就是按照一定的步驟運行的電腦指令,而prolog程式的運行步驟不由人來決定。它更像一種描述型的語言,用特定的方法描述一個問題,然後由電腦自動找到這個問題的答案。舉個極端的例子,你只需要把某個數學題目告訴它,它就會自動的找到答案,而不像使用其他的語言一樣,必須人工的編制出某種演算法。
2. prolog程式中沒有if、when、case、for這樣的控制流程語句
前面已經說了,程式的運行方式有電腦自己決定,當然就用不到這些控制流程的語句了。通常情況下,程式師不需要瞭解程式的運行過程,只需要注重程式的描述是否全面,不過prolog也提供了一些控制流程的方法,這些方法和其他語言中的方法有很大的區別,希望你在以後的學習當中能夠融會貫通。
3. prolog程式和資料高度統一
在prolog程式中,是很難分清楚哪些是程式,哪些是資料的。事實上,prolog中的所有東西都有相同的形式,也就是說資料就是程式,程式就是資料。舉一個其他語言的例子:如果想用c語言編寫一個計算某個數學運算式的程式很簡單(比如:a=2+54),因為這是一段程式。但是如果想編寫一個計算用戶輸入的運算式的值的程式就很困難了。因為用戶輸入的是一段資料(字串),如果想讓c語言處理這個字串,就需要很多方面的技術。則正是因為在c語言中,程式和資料是分開的。而在prolog就不存在這個問題,你甚至可以很輕鬆的編寫處理其他prolog程式的程式。
4. prolog程式實際上是一個智慧資料庫
prolog的原理就是關聯資料庫,它是建立在關聯資料庫的基礎上的。在以後的學習中你會發現它和SQL資料庫查詢語言有很多相似之處。使用prolog可以很方便的處理資料。
5. 強大的遞迴功能
在其他的語言中,你也許已經接觸過遞迴程式了。遞迴是一種非常簡潔的方式,它能夠有效的解決許多難題。而在prolog中,遞迴的功能得到了充分的體現,你甚至都會感到驚奇,遞迴居然又如此巨大的能力。
LPA Prolog++ |
|
| 產品名稱 | LPA Prolog++ v2.0 |
| 出品公司 | Logic Programming Associates Ltd. (England) |
| 產品說明 | Prolog++ provides a complete OOP language with objects, instances, methods, attributes, daemons and supports multiple inheritance and message passing. Prolog++ supports both static and dynamic objects and combines the best of AI and Logic Programming techniques with object-oriented programming. The Prolog++ environment provides various graphical browsers, inspectors and editors for building and managing object hierarchies. |
| 產品特性 | a powerful object-oriented
applications development tool Complete OOP language featuring . dynamic objects with attributes . functions and methods . complete message-passing . multiple inheritance All the power of Prolog . high-level rule-based language . with powerful pattern-matching facilities . dynamic data structures Key features: Development environment: . 32-bit architecture |
| 應用範圍 | 人工智慧應用程式 |
| 其他相關產品 | LPA
Prolog for Windows Database Interface toolkit Portable Dialog Manager (PDM) Flex (a high-level expert system toolkit) |
| 版本 | Programmer Edition Developer Edition |
| 支援平台 | Windows, Macintosh and DOS |
|
|
| 產品名稱 | LPA 32-bits Prolog Compiler |
| 出品公司 | Logic Programming Associates Ltd. (England) |
| 產品說明與特性 | LPA Prolog for Windows is a powerful 32-bit application running under Windows3.1. The SAA-compliant, mouse-driven development environment supports the Multiple Document Interface (MDI) and enables programs to be edited, compiled, executed and debugged in an intuitive manner. All products use incremental compilation which combines the execution speed of a compiler with the interactive nature of an interpreter. This makes for extremely fast and effective program development. |
| 應用範圍 | 人工智慧應用程式 |
| 其他相關產品 | Database Interface toolkit Portable Dialog Manager (PDM) Flex (a high-level expert system toolkit) Prolog++ |
| 支援平台 | |
|
|
| 產品名稱 | IF/Prolog |
| 出品公司 | IF Computer (Germany) |
| 產品特性 | Prolog Engine: . Compiled assert . Incremental optimizing compiler . Efficient and flexible memory management Features: Application development and delivery Prolog Library: DEC10 public domain
Prolog library |
| 應用範圍 | 人工智慧應用程式 |
| 其他相關產品 | IF/Prolog V5.0 Constraint Technology Package |
| 支援平台 | UNIX and UNIX-derived system,
MACH, VMS, MS-DOS 386, OS-9, Interactive UNIX, SCO UNIX |
|
||||||||||||||||||||
| 產品名稱 | IF/Prolog V5.0 Constraint Technology Package | |||||||||||||||||||
| 出品公司 | IF Computer (Germany) | |||||||||||||||||||
| 產品特性 | Main Features . Big integers and rationals . Coroutines . Linear constraints . Finite domains . Boolean constraints Integrated Development Environment Improving Programmer Productivity Increased Execution Efficiency
CPU time given in Seconds per 100 evaluations |
|||||||||||||||||||
| 發展歷史 | IF/Prolog Constraint
Technology Package is based on the theoretical research system CHIP developed by the ECRC (European Computer Research Centre). The package is directly derived from SNI Prolog 3.1 and includes additional development of the constraint technology together with all what was prototyped in the former CHIP system. Great Care has been taken to package this technology in a modular, industrial oriented manner, consistent with the product as a whole. |
|||||||||||||||||||
| 應用範圍 | . Railway Signaling and
traffic control . System Verification Tool: used by several Siemens industrial units . Circuit Verification Tool: in operational use at ASIC Design Centres of Siemens |
|||||||||||||||||||
| 其他相關產品 | IF/Prolog | |||||||||||||||||||
| 支援平台 | UNIX and UNIX-derived system,
MACH, VMS, MS-DOS 386, OS-9, Interactive UNIX, SCO UNIX |
|||||||||||||||||||
| 產品名稱 | Visual Prolog Professional |
| 出品公司 | Prolog Development Center (Denmark) |
| 產品特性 |
|
| 應用範圍 | 人工智慧應用程式 |
| 其他相關產品 | 無 |
| 支援平台 | Windows 95, Windows NT, Windows 3.x, OS/2 Warp, OS/2 2.x , DOS |
中崗科技有限公司 台北市和平東路二段259號9樓 Tel:02-27045535 / Fax:02-2754-1785
Ixon Technology 9F, No.259,Sec. 2, Ho Ping East Road, Taipei, Taiwan, R.O.C. 106
Copyright 1998中崗科技Web站所登載的文章係屬本公司,版權所有,勿任意轉載,違者必究