Select language: english | cesky | deutsch | italiano | simplified chinese | traditional chinese | hindi Concept: English word: Home

# list length fn (ListLengthFn)

A Function that takes a List as its sole argument and returns the number of items in the List. For example, (ListLengthFn (ListFn Monday Tuesday Wednesday)) would return the value 3.

## Ontology

SUMO / BASE-ONTOLOGY

## Class(es)

 class

inheritable relation

unary function

list length fn

## Coordinate term(s)

absolute value fn  abstraction fn  arc cosine fn  arc sine fn  arc tangent fn  back fn  begin fn  begin node fn  cardinality fn  ceiling fn  complement fn  cosine fn  cut set fn  denominator fn  end fn  end node fn  extension fn  floor fn  front fn  future fn  generalized intersection fn  generalized union fn  giga fn  imaginary part fn  immediate future fn  immediate past fn  initial node fn  integer square root fn  kilo fn  magnitude fn  mega fn  micro fn  milli fn  minimal cut set fn  nano fn  numerator fn  organization fn  past fn  path weight fn  pico fn  power set fn  predecessor fn  principal host fn  probability fn  property fn  rational number fn  real number fn  reciprocal fn  round fn  signum fn  sine fn  skin fn  square root fn  successor fn  tangent fn  tera fn  terminal node fn  wealth fn  when fn  year fn

## Type restrictions

nonnegative integer ListLengthFn(list)

## Axioms (7)

If "length of list" is equal to number1, then for all number2 holds: there exists item so that "number2th element of list" is equal to item if and only if number2 is less than or equal to number1.
```(=>
(equal
(ListLengthFn ?LIST)
?NUMBER1)
(forall
(?NUMBER2)
(<=>
(exists
(?ITEM)
(equal
(ListOrderFn ?LIST ?NUMBER2)
?ITEM))
(lessThanOrEqualTo ?NUMBER2 ?NUMBER1))))```

"length of "(,item)"" is equal to "("length of "()""+1)".
```(equal
(ListLengthFn
(ListFn @ROW ?ITEM))
(SuccessorFn
(ListLengthFn
(ListFn @ROW))))```

""length of "(,item)""th element of "(,item)"" is equal to item.
```(equal
(ListOrderFn
(ListFn @ROW ?ITEM)
(ListLengthFn
(ListFn @ROW ?ITEM)))
?ITEM)```

```(=>
(valence ?REL ?NUMBER)
(forall
(@ROW)
(=>
(holds ?REL @ROW)
(equal
(ListLengthFn
(ListFn @ROW))
?NUMBER))))```

If "length of list1" is equal to number, then there exists list2 so that list1 starts list2 and "(number+1)" is equal to "length of list2" and ""(number+1)"th element of list2" is equal to item.
```(=>
(equal
(ListLengthFn ?LIST1)
?NUMBER)
(exists
(?LIST2)
(and
(initialList ?LIST1 ?LIST2)
(equal
(SuccessorFn ?NUMBER)
(ListLengthFn ?LIST2))
(equal
(ListOrderFn
?LIST2
(SuccessorFn ?NUMBER))
?ITEM))))```

list3 is equal to "the list composed of list1 and list2" if and only if for all number1,number2 holds: if number1 is less than or equal to "length of list1" and number2 is less than or equal to "length of list2" and number1 is an instance of positive integer and number2 is an instance of positive integer, then "number1th element of list3" is equal to "number1th element of list1" and ""("length of list1"+number2)"th element of list3" is equal to "number2th element of list2".
```(<=>
(equal
?LIST3
(ListConcatenateFn ?LIST1 ?LIST2))
(forall
(?NUMBER1 ?NUMBER2)
(=>
(and
(lessThanOrEqualTo
?NUMBER1
(ListLengthFn ?LIST1))
(lessThanOrEqualTo
?NUMBER2
(ListLengthFn ?LIST2))
(instance ?NUMBER1 PositiveInteger)
(instance ?NUMBER2 PositiveInteger))
(and
(equal
(ListOrderFn ?LIST3 ?NUMBER1)
(ListOrderFn ?LIST1 ?NUMBER1))
(equal
(ListOrderFn
?LIST3
(ListLengthFn ?LIST1)
?NUMBER2))
(ListOrderFn ?LIST2 ?NUMBER2))))))```

• if list1 starts list2,
• then for all number1,number2 holds: if "length of list1" is equal to number1 and number2 is less than or equal to number1, then "number2th element of list1" is equal to "number2th element of list2"
• .
```(=>
(initialList ?LIST1 ?LIST2)
(forall
(?NUMBER1 ?NUMBER2)
(=>
(and
(equal
(ListLengthFn ?LIST1)
?NUMBER1)
(lessThanOrEqualTo ?NUMBER2 ?NUMBER1))
(equal
(ListOrderFn ?LIST1 ?NUMBER2)
(ListOrderFn ?LIST2 ?NUMBER2)))))```