This file is indexed.

/usr/share/axiom-20170501/src/algebra/HOAGG.spad is in axiom-source 20170501-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
)abbrev category HOAGG HomogeneousAggregate
++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks
++ Date Created: August 87 through August 88
++ Date Last Updated: April 1991, May 1995
++ Description:
++ A homogeneous aggregate is an aggregate of elements all of the
++ same type.
++ In the current system, all aggregates are homogeneous.
++ Two attributes characterize classes of aggregates.
++ Aggregates from domains with attribute \spadatt{finiteAggregate}
++ have a finite number of members.
++ Those with attribute \spadatt{shallowlyMutable} allow an element
++ to be modified or updated without changing its overall value.

HomogeneousAggregate(S) : Category == SIG where
  S : Type

  SIG ==> Aggregate with

    if S has SetCategory then SetCategory
  
    if S has SetCategory then
       if S has Evalable S then Evalable S
  
    map : (S->S,%) -> %
      ++ map(f,u) returns a copy of u with each element x replaced by f(x).
      ++ For collections, \axiom{map(f,u) = [f(x) for x in u]}.
  
    if % has shallowlyMutable then
  
      map_! : (S->S,%) -> %
        ++ map!(f,u) destructively replaces each element x of u 
        ++ by \axiom{f(x)}.
  
    if % has finiteAggregate then
  
       any? : (S->Boolean,%) -> Boolean
         ++ any?(p,u) tests if \axiom{p(x)} is true for any element x of u.
         ++ Note that for collections,
         ++ \axiom{any?(p,u) = reduce(or,map(f,u),false,true)}.
  
       every? : (S->Boolean,%) -> Boolean
         ++ every?(f,u) tests if p(x) is true for all elements x of u.
         ++ Note that for collections,
         ++ \axiom{every?(p,u) = reduce(and,map(f,u),true,false)}.
  
       count : (S->Boolean,%) -> NonNegativeInteger
         ++ count(p,u) returns the number of elements x in u
         ++ such that \axiom{p(x)} is true. For collections,
         ++ \axiom{count(p,u) = reduce(+,[1 for x in u | p(x)],0)}.
  
       parts : % -> List S
         ++ parts(u) returns a list of the consecutive elements of u.
         ++ For collections, \axiom{parts([x,y,...,z]) = (x,y,...,z)}.
  
       members : % -> List S
         ++ members(u) returns a list of the consecutive elements of u.
         ++ For collections, \axiom{parts([x,y,...,z]) = (x,y,...,z)}.
  
       if S has SetCategory then
  
         count : (S,%) -> NonNegativeInteger
           ++ count(x,u) returns the number of occurrences of x in u. For
           ++ collections, \axiom{count(x,u) = reduce(+,[x=y for y in u],0)}.
  
         member? : (S,%) -> Boolean
           ++ member?(x,u) tests if x is a member of u.
           ++ For collections,
           ++ \axiom{member?(x,u) = reduce(or,[x=y for y in u],false)}.

   add

     if S has Evalable S then

       eval(u:%,l:List Equation S):% == map(x +-> eval(x,l),u)

     if % has finiteAggregate then

       #c == # parts c

       any?(f, c)  == _or/[f x for x in parts c]

       every?(f, c) == _and/[f x for x in parts c]

       count(f:S -> Boolean, c:%) == _+/[1 for x in parts c | f x]

       members x == parts x

       if S has SetCategory then

         count(s:S, x:%) == count(y +-> s = y, x)

         member?(e, c) == any?(x +-> e = x,c)

         x = y ==
            size?(x, #y) and _and/[a = b for a in parts x for b in parts y]

         coerce(x:%):OutputForm ==
           bracket
              commaSeparate [a::OutputForm for a in parts x]$List(OutputForm)