Finite model theory is a subarea ofmodel theory. Model theory is the branch oflogic which deals with the relation between a formal language (syntax) and its interpretations (semantics). Finite model theory is a restriction of model theory tointerpretations on finitestructures, which have a finite universe.
Since many central theorems of model theory do not hold when restricted to finite structures, finite model theory is quite different from model theory in its methods of proof. Central results of classical model theory that fail for finite structures under finite model theory include thecompactness theorem,Gödel's completeness theorem, and the method ofultraproducts forfirst-order logic (FO). These invalidities all follow fromTrakhtenbrot's theorem.[1]
While model theory has many applications tomathematical algebra, finite model theory became an "unusually effective"[2] instrument in computer science. In other words: "In the history of mathematical logic most interest has concentrated on infinite structures. [...] Yet, the objects computers have and hold are always finite. To study computation we need a theory of finite structures."[3] Thus the main application areas of finite model theory are:descriptive complexity theory,database theory andformal language theory.
A common motivating question in finite model theory is whether a given class of structures can be described in a given language. For instance, one might ask whether the class of cyclic graphs can be distinguished among graphs by a FO sentence, which can also be phrased as asking whether cyclicity is FO-expressible.
A single finite structure can always be axiomatized in first-order logic, where axiomatized in a languageL means described uniquely up to isomorphism by a singleL-sentence. Similarly, any finite collection of finite structures can always be axiomatized in first-order logic. Some, but not all, infinite collections of finite structures can also be axiomatized by a single first-order sentence.
Is a languageL expressive enough to axiomatize a single finite structureS?

A structure like (1) in the figure can be described by FO sentences in thelogic of graphs like
However, these properties do not axiomatize the structure, since for structure (1') the above properties hold as well, yet structures (1) and (1') are not isomorphic.
Informally the question is whether by adding enough properties, these properties together describe exactly (1) and are valid (all together) for no other structure (up to isomorphism).
For a single finite structure it is always possible to precisely describe the structure by a single FO sentence. The principle is illustrated here for a structure with one binary relation and without constants:
all for the same tuple, yielding the FO sentence.
The method of describing a single finite structure by means of a first-order sentence can easily be extended for any fixed number of structures. A unique description can be obtained by the disjunction of the descriptions for each structure. For instance, for two finite structures and with defining sentences and this would be
By definition, a set containing an infinite structure falls outside the area that FMT deals with. Note that infinite structures can never be discriminated in FO, because of theLöwenheim–Skolem theorem, which implies that no first-order theory with an infinite model can have a unique model up to isomorphism.
The most famous example is probablySkolem's theorem, that there is a countable non-standard model of arithmetic.
Is a languageL expressive enough to describe exactly (up to isomorphism) those finite structures that have certain propertyP?

The descriptions given so far all specify the number of elements of the universe. Unfortunately most interesting sets of structures are not restricted to a certain size, like all graphs that are trees, are connected or are acyclic. Thus to discriminate a finite number of structures is of special importance.
Instead of a general statement, the following is a sketch of a methodology to differentiate between structures that can and cannot be discriminated.
We want to show that the property that the size of an ordered structureA = (A, ≤) is even, can not be expressed in FO.
(*) Note that the proof of the result of theEhrenfeucht–Fraïssé game has been omitted, since it is not the main focus here.
Glebskiĭ et al. (1969) and, independently,Fagin (1976) proved a zero–one law for first-order sentences in finite models; Fagin's proof used thecompactness theorem. According to this result, every first-order sentence in a relational signature is eitheralmost always true or almost always false in finite-structures. That is, letS be a fixed first-order sentence, and choose a random-structure with domain, uniformly among all-structures with domain. Then in the limit asn tends to infinity, the probability thatGn modelsS will tend either to zero or to one:
The problem of determining whether a given sentence has probability tending to zero or to one isPSPACE-complete.[4]
A similar analysis has been performed for more expressive logics than first-order logic. The 0-1 law has been shown to hold for sentences inFO(LFP), first-order logic augmented with a least fixed point operator, and more generally for sentences in the infinitary logic, which allows for potentially arbitrarily long conjunctions and disjunctions.Another important variant is the unlabelled 0-1 law, where instead of considering the fraction of structures with domain, one considers the fraction of isomorphism classes of structures withn elements. This fraction is well-defined, since any two isomorphic structures satisfy the same sentences. The unlabelled 0-1 law also holds for and therefore in particular for FO(LFP) and first-order logic.[5]
An important goal of finite model theory is the characterisation ofcomplexity classes by the type oflogic needed to express the languages in them. For example,PH, the union of all complexity classes in the polynomial hierarchy, is precisely the class of languages expressible by statements ofsecond-order logic. This connection between complexity and the logic of finite structures allows results to be transferred easily from one area to the other, facilitating new proof methods and providing additional evidence that the main complexity classes are somehow "natural" and not tied to the specificabstract machines used to define them.
Specifically, eachlogical system produces a set ofqueries expressible in it. The queries – when restricted to finite structures – correspond to thecomputational problems of traditional complexity theory.
Some well-known complexity classes are captured by logical languages as follows:
A substantial fragment ofSQL (namely that which is effectivelyrelational algebra) is based on first-order logic (more precisely can be translated indomain relational calculus by means ofCodd's theorem), as the following example illustrates: Think of a database table "GIRLS" with the columns "FIRST_NAME" and "LAST_NAME". This corresponds to a binary relation, say G(f, l) on FIRST_NAME × LAST_NAME. The FO query, which returns all the last names where the first name is 'Judy', would look in SQL like this:
selectLAST_NAMEfromGIRLSwhereFIRST_NAME='Judy'
Notice, we assume here, that all last names appear only once (or we should use SELECT DISTINCT since we assume that relations and answers are sets, not bags).
Next we want to make a more complex statement. Therefore, in addition to the "GIRLS" table we have a table "BOYS" also with the columns "FIRST_NAME" and "LAST_NAME". Now we want to query the names of all the girls that have the same last name as at least one of the boys. The FO query is, and the corresponding SQL statement is:
selectFIRST_NAME,LAST_NAMEfromGIRLSwhereLAST_NAMEIN(selectLAST_NAMEfromBOYS);
Notice that in order to express the "∧" we introduced the new language element "IN" with a subsequent select statement. This makes the language more expressive for the price of higher difficulty to learn and implement. This is a common trade-off in formal language design. The way shown above ("IN") is by far not the only one to extend the language. An alternative way is e.g. to introduce a "JOIN" operator, that is:
selectdistinctg.FIRST_NAME,g.LAST_NAMEfromGIRLSg,BOYSbwhereg.LAST_NAME=b.LAST_NAME;
First-order logic is too restrictive for some database applications, for instance because of its inability to expresstransitive closure. This has led to more powerful constructs being added to database query languages, such asrecursive WITH inSQL:1999. More expressive logics, likefixpoint logics, have therefore been studied in finite model theory because of their relevance to database theory and applications.
Narrative data contains no defined relations. Thus the logical structure of text search queries can be expressed inpropositional logic, like in:
("Java" AND NOT "island") OR ("C#" AND NOT "music")Note that the challenges in full text search are different from database querying, like ranking of results.