Personal tools

Formal Languages

Stanford_P1010983
(Stanford University - Jaclyn Chen)


- Overview

A formal language in computer science is a finite or infinite set of strings that are based on a finite set of symbols. The set of symbols is called an alphabet. The structured strings created using the alphabet, based on defined grammar rules, make up the formal language. 

Formal languages are used in mathematical and computer science applications to represent ideas and concepts in a precise and unambiguous way. They are an important tool for AI researchers, as they allow us to express ideas in a way that can be understood by computers. 

In applied computer science, formal language is used in the form of programming languages. For example, if you take an alphabet consisting of the letters a, b, and c, a formal language over this alphabet could be a set {a, aa, aba, ca}. 

A formal language can be specified either by a set of rules (such as regular expressions or a context-free grammar) that generates the language, or by a formal machine that accepts (recognizes) the language. 

In computational complexity theory, decision problems are typically defined as formal languages. Complexity classes are defined as the sets of the formal languages that can be parsed by machines with limited computational power. 

In computer science, formal languages are used among others as the basis for defining the grammar of programming languages and formalized versions of subsets of natural languages in which the words of the language represent concepts that are associated with meanings or semantics.

- Examples of Formal Languages in AI

Formal languages are defined by two sets of rules: 

  • Syntax: Precise rules that tell you the symbols you are allowed to use.
  • Formal grammar: A specific set of rules that words must follow to be well-formed.

 

Formal languages can be used to represent knowledge in AI in many ways. For example, formal language can be used to represent facts and rules. 

Here are some examples of formal languages in AI: 

  • Programming languages: Examples include C, Java, and Python.
  • Mathematical notations: Examples include calculus and set theory.
  • Architecture description languages (ADLs): These are formal languages that can be used to represent the architecture of a software-intensive system.
  • CLANG: This is the formal language used in the RoboCup Coach Competition. In the competition, teams of agents compete on a simulated soccer field and receive advice from a team coach in CLANG.

 

Other examples of formal languages include: 

  • C++, Java, JavaScript, and Python as object-oriented programming
  • Haskell, LISP, and Scheme as functional programming
  • ALGOL, Cobol, C, and FORTRAN as imperative programming
  • The patterns of ones and zeros that make up the machine code of a processor
 
Python is widely used for AI, with packages for several applications including general AI, machine learning, natural language processing, and artificial neural networks.

 

 

[More to come ...]



Document Actions