Many-sorted logic

From Wikipedia, the free encyclopedia
(Redirected from Order-sorted logic)
Jump to navigation Jump to search

Many-sorted logic can reflect formally our intention not to handle the universe as a homogeneous collection of objects, but to partition it in a way that is similar to types in typeful programming. Both functional and assertive "parts of speech" in the language of the logic reflect this typeful partitioning of the universe, even on the syntax level: substitution and argument passing can be done only accordingly, respecting the "sorts".

There are various ways to formalize the intention mentioned above; a many-sorted logic is any package of information which fulfils it. In most cases, the following are given:

The domain of discourse of any structure of that signature is then fragmented into disjoint subsets, one for every sort.

Example

[edit | edit source]

When reasoning about biological organisms, it is useful to distinguish two sorts: plant and animal. While a function mother:animalanimal makes sense, a similar function mother:plantplant usually does not. Many-sorted logic allows one to have terms like mother(lassie), but to discard terms like mother(my_favorite_oak) as syntactically ill-formed.

Algebraization

[edit | edit source]

The algebraization of many-sorted logic is explained in an article by Caleiro and Gonçalves,[1] which generalizes abstract algebraic logic to the many-sorted case, but can also be used as introductory material.

Order-sorted logic

[edit | edit source]
File:Sort hierarchy.png
Example sort hierarchy

While many-sorted logic requires two distinct sorts to have disjoint universe sets, order-sorted logic allows one sort s1 to be declared a subsort of another sort s2, usually by writing s1s2 or similar syntax. In the above biology example, it is desirable to declare

dogcarnivore,
dogmammal,
carnivoreanimal,
mammalanimal,
animalorganism,
plantorganism,

and so on; cf. picture.

Wherever a term of some sort s is required, a term of any subsort of s may be supplied instead (Liskov substitution principle). For example, assuming a function declaration mother:animalanimal, and a constant declaration lassie:dog, the term mother(lassie) is perfectly valid and has the sort animal. In order to supply the information that the mother of a dog is a dog in turn, another declaration mother:dogdog may be issued; this is called function overloading, similar to overloading in programming languages.

Order-sorted logic can be translated into unsorted logic, using a unary predicate pi(x) for each sort si, and an axiom x(pi(x)pj(x)) for each subsort declaration sisj. The reverse approach was successful in automated theorem proving: in 1985, Christoph Walther could solve a then benchmark problem by translating it into order-sorted logic, thereby boiling it down an order of magnitude, as many unary predicates turned into sorts.[2]

In order to incorporate order-sorted logic into a clause-based automated theorem prover, a corresponding order-sorted unification algorithm is necessary, which requires for any two declared sorts s1,s2 their intersection s1s2 to be declared, too: if x1 and x2 are variables of sort s1 and s2, respectively, the equation x1=?x2 has the solution {x1=x,x2=x}, where x:s1s2.

Smolka generalized order-sorted logic to allow for parametric polymorphism.[3][4] In his framework, subsort declarations are propagated to complex type expressions. As a programming example, a parametric sort list(X) may be declared (with X being a type parameter as in a C++ template), and from a subsort declaration intfloat the relation list(int)list(float) is automatically inferred, meaning that each list of integers is also a list of floats.

Schmidt-Schauß generalized order-sorted logic to allow for term declarations.[5] As an example, assuming subsort declarations evenint and oddint, a term declaration like i:int.(i+i):even allows to declare a property of integer addition that could not be expressed by ordinary overloading.

See also

[edit | edit source]

Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).

Early papers on many-sorted logic include:

  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)., collected in the author's Computation, Logic, Philosophy. A Collection of Essays, Beijing: Science Press; Dordrecht: Kluwer Academic, 1990.
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
[edit | edit source]