5.2.6 maxComSubType

Introduction

The maxComSubType goal is used to find the maximum common subtype of two types.

Signature

maxComSubType(Type1,Type2,T)

Operation

This goal returns, in the variable T, the maximum common subtype of Type1 and Type2.

If Type1 and Type2 have no explicit maximum common subtype, then the built-in type "Absurd" is returned.

Example

// Type hierarchy
Entity > Male, Female, Adult.
Adult > Man, Woman.
Male > Man.
Female > Woman.

This example is available in the AAU directory as maxComSubType.plgCG.

Explanation

This example only has a very simple type-hierarchy.

Usage

If we ask the following query:

?- maxComSubType(Female, Adult, T).

we get the following answer:

{T = Woman}

This is precisely the maximum common subtype of Female and Adult.

Similarly, if we ask the following query:

?-maxComSubType(Male, Adult, T).

we get the following answer:

{T = Man}

This is also the maximum common subtype of Male and Adult.

Summary

Thus the maxComSubType goal finds the maximum common subtype of two types.


PrevLite: 5.2.5 immediateSubTypes
NextLite: 5.2.7 minComSuperType

Prev: 5.2.5 immediateSubTypes
Up: 5.2 Type goals
Next: 5.2.7 minComSuperType