CLACL

Last updated

CLACL
Paradigm Logic programming
Designed by Mauro Gazzelloni
Developer Mauro Gazzelloni
First appearedJanuary 2000
Stable release
1.04 / April 2013
Implementation language C++
OS Microsoft Windows
License proprietary software
Website Project Site
Influenced by
Prolog, C

CLACL (logical composition with the assistance of computers) is the result of ongoing theoretical research which aims to provide a formal description of the logical choices relating to the definition of organizational processes of composition.

Contents

The logic of CLACL is based on 'spatial-relational' information rather than on the processing of numerical information. It generates a logical configuration and, with a tool called Plasma, shapes the created domain in a physical form such as music or graphics.

CLACL is a computing language that integrates into a production environment to provide several tools to facilitate writing code and representing it graphically.

The first version (00.02.00) of the language was made available to the Internet in 2000 at the project site. The version 00.06.00 was distributed at the 2009 Festival of Mathematics held in Rome, during which the project CLAC was presented.

Characteristics of the language

The target users of the language are those who work within creative fields, including design and music.

Example of creative generation created with CLACL. Creative-Sierpinski-1.png
Example of creative generation created with CLACL.

Every design produces an organism, in which all its parts are related to create a complex and complete whole. For a better understanding, consider the graphic planning that is the design and realization of a graphic pattern. Those who have had a chance to prepare a composition know that every element should be in precise relation with the others, and only when all of the elements are balanced will the composition be considered complete. This process can be proven and verified.

The closely logic-driven syntax, somewhat challenging for anyone not accustomed to working in the field of artificial intelligence (AI), was supplemented by constructs more readily usable in practice.

As an example, see the description of a cycle (loop) implemented in prolog and CLACL.

With the following example in prolog, a loop is a run that prints the loop index:

loop(X,Y):-!,X<Y,print(X),X2isX+1,loop(X2,Y).

In CLACL, a similar process is carried out using the following code:

 @PRINT("$x $y",NL)  FOR ( $x, $y ) IN II[]  {    @PRINT($x,$y,NL)  }

result:

$x $y !a !a !a !b !a !c !b !a !b !b !b !c !c !a !c !b !c !c 

The formation of the cycle in CLACL is carried out in a very similar way to the C-Language. The language adopts a combination of the declarative and procedural paradigms. The two languages are Prolog and C. The declarative aspect comes from Prolog, and is used in statements and in scanning the tree of alternatives (backtracking). The procedural aspect is derived from C, and is highlighted in particular in the control structures of the procedural flow.

Structure of the language

The commands are listed in a script, that is subjected to an interpreter that generates the result. The purpose of carrying out command controls is to produce a logical configuration of entities, and represent them in graphic form and, as a product of processing, it will generate a graph. The set of entities that form part of the graph are called a domain.

CLACL has three groups of statements:

The declarations reflect the situations of the domain and are the most similar to Prolog.
The controls implement constructs for controlling the flow of the code with loops and expressions.
The commands require or set conditions on the domain.

As with all programming languages, CLACL implements the following key concepts:

In addition CLACL will also implement specialist concepts of the domain and of the issues which address:

The entities that can be generated via the interpretation of the script are:

Instance
An instance can be seen as a geometric point in the plane, but we are not interested in its position; our interest is its existence within the domain and its relationship with other entities.
Relation
A relation describes the relationship between different instances.
Model
A model allows the description of complex relations.
Shape
The shape describes the characteristics of a logical figure."
Figure
A logical figure can be seen as a geometrical figure.
Application of figures realized with CLACL CLACL directions.png
Application of figures realized with CLACL

Examples

Generation of an instance:

instance:a

or

!a

Generation of a relation:

relation:rl1(instance:a, instance:b)

or:

&rl1(!a, !b)

Definition of a model that represents a triangular configuration:

define model: tris(!a,!b,!c) {     &rr(!a,!b)     &rr(!b,!c)     &rr(!c,!a) }

Implementation of a cycle:

FOR ($a$,b) in SET[] {     @PRINT(“Instances “,$a,“ - “,$b,NL) }

Implementation of a condition:

CASE ($x == 0) {     @PRINT(“The value of $x is zero“,NL) }

Definition of a function:

define function: switch($a$,b$,c) {     CASE ($a == 1)     {         @PRINT($b,” - “,$c,NL)     }     CASE ($a == 2)     {         @PRINT($c,” - “,$b,NL)     } }

Some operations on the set:

def INSI1[4]  // definition of the set of 4 items
ST1[] = [ ST1[] + ST2[] ]    // add
ST1[] = [ ST1[] - ST2[] ]    // subtract
( ST1[] == ST2[] )    // equals

Example of a logic expression:

(( ST1[] == ST2[] ) AND (( ST3[] == ST2[] ) OR ( ST4[] == ST1[] )) AND pos(!a == !b))

Spatial expression example

Using spatial expression with CLACL CLACL stat exp.png
Using spatial expression with CLACL
!a !b model:modSquare4(!a,!b,!c,!d) #f=shape:frmSquare4(!a,!b,!c,!d) I[]=cloud(!a,UNIFORM,100,1)
@GRFILL(Red) FOR ($x) IN I[] {   CASE(pos(!$x IN #f))     shape:plate(!$x,20) }

CLAC tutorials

Further reading

Related Research Articles

First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over non-logical objects, and allows the use of sentences that contain variables, so that rather than propositions such as "Socrates is a man", one can have expressions in the form "there exists x such that x is Socrates and x is a man", where "there exists" is a quantifier, while x is a variable. This distinguishes it from propositional logic, which does not use quantifiers or relations; in this sense, propositional logic is the foundation of first-order logic.

Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic programming language families include Prolog, answer set programming (ASP) and Datalog. In all of these languages, rules are written in the form of clauses:

Prolog is a logic programming language associated with artificial intelligence and computational linguistics.

The relational model (RM) is an approach to managing data using a structure and language consistent with first-order predicate logic, first described in 1969 by English computer scientist Edgar F. Codd, where all data is represented in terms of tuples, grouped into relations. A database organized in terms of the relational model is a relational database.

In formal logic and related branches of mathematics, a functional predicate, or function symbol, is a logical symbol that may be applied to an object term to produce another object term. Functional predicates are also sometimes called mappings, but that term has additional meanings in mathematics. In a model, a function symbol will be modelled by a function.

Constraint programming (CP) is a paradigm for solving combinatorial problems that draws on a wide range of techniques from artificial intelligence, computer science, and operations research. In constraint programming, users declaratively state the constraints on the feasible solutions for a set of decision variables. Constraints differ from the common primitives of imperative programming languages in that they do not specify a step or sequence of steps to execute, but rather the properties of a solution to be found. In addition to constraints, users also need to specify a method to solve these constraints. This typically draws upon standard methods like chronological backtracking and constraint propagation, but may use customized code like a problem-specific branching heuristic.

In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.

Reification is the process by which an abstract idea about a computer program is turned into an explicit data model or other object created in a programming language. A computable/addressable object—a resource—is created in a system as a proxy for a non computable/addressable object. By means of reification, something that was previously implicit, unexpressed, and possibly inexpressible is explicitly formulated and made available to conceptual manipulation. Informally, reification is often referred to as "making something a first-class citizen" within the scope of a particular system. Some aspect of a system can be reified at language design time, which is related to reflection in programming languages. It can be applied as a stepwise refinement at system design time. Reification is one of the most frequently used techniques of conceptual analysis and knowledge representation.

Finite model theory is a subarea of model theory. Model theory is the branch of logic which deals with the relation between a formal language (syntax) and its interpretations (semantics). Finite model theory is a restriction of model theory to interpretations on finite structures, which have a finite universe.

Answer set programming (ASP) is a form of declarative programming oriented towards difficult search problems. It is based on the stable model semantics of logic programming. In ASP, search problems are reduced to computing stable models, and answer set solvers—programs for generating stable models—are used to perform search. The computational process employed in the design of many answer set solvers is an enhancement of the DPLL algorithm and, in principle, it always terminates.

In computer science, higher-order abstract syntax is a technique for the representation of abstract syntax trees for languages with variable binders.

A "production system" is a computer program typically used to provide some form of artificial intelligence, which consists primarily of a set of rules about behavior but it also includes the mechanism necessary to follow those rules as the system responds to states of the world. Those rules, termed productions, are a basic representation found useful in automated planning, expert systems and action selection.

An Abstract Agent Programming Language or Artificial Autonomous Agents Programming Language or 3APL is an experimental tool and programming language for the development, implementation and testing of multiple cognitive agents using the Belief-Desire-Intention (BDI) approach.

A deductive language is a computer programming language in which the program is a collection of predicates ('facts') and rules that connect them. Such a language is used to create knowledge based systems or expert systems which can deduce answers to problem sets by applying the rules to the facts they have been given. An example of a deductive language is Prolog, or its database-query cousin, Datalog.

In logic, the formal languages used to create expressions consist of symbols, which can be broadly divided into constants and variables. The constants of a language can further be divided into logical symbols and non-logical symbols.

Logtalk is an object-oriented logic programming language that extends and leverages the Prolog language with a feature set suitable for programming in the large. It provides support for encapsulation and data hiding, separation of concerns and enhanced code reuse. Logtalk uses standard Prolog syntax with the addition of a few operators and directives.

B-Prolog was a high-performance implementation of the standard Prolog language with several extended features including matching clauses, action rules for event handling, finite-domain constraint solving, arrays and hash tables, declarative loops, and tabling. First released in 1994, B-Prolog is now a widely used CLP system. The constraint solver of B-Prolog was ranked top in two categories in the Second International Solvers Competition, and it also took the second place in P class in the second ASP solver competition and the second place overall in the third ASP solver competition. B-Prolog underpins the PRISM system, a logic-based probabilistic reasoning and learning system. B-Prolog is a commercial product, but it can be used for learning and non-profit research purposes free of charge. B-Prolog is not anymore actively developed, but it forms the basis for the Picat programming language.

An interpretation is an assignment of meaning to the symbols of a formal language. Many formal languages used in mathematics, logic, and theoretical computer science are defined in solely syntactic terms, and as such do not have any meaning until they are given some interpretation. The general study of interpretations of formal languages is called formal semantics.

The syntax and semantics of Prolog, a programming language, are the sets of rules that define how a Prolog program is written and how it is interpreted, respectively. The rules are laid out in ISO standard ISO/IEC 13211 although there are differences in the Prolog implementations.

Logic programming is a programming paradigm that includes languages based on formal logic, including Datalog and Prolog. This article describes the syntax and semantics of the purely declarative subset of these languages. Confusingly, the name "logic programming" also refers to a specific programming language that roughly corresponds to the declarative subset of Prolog. Unfortunately, the term must be used in both senses in this article.