misc: supported-ops


supported-ops:
    description:
        supported-ops
        a special operator defined for all known kets that returns the list of operators supported by that ket
        say you know the mother, father, age and friends for Fred, then Fred's supported-ops will show this
        also useful to define the star operator
        note that supported-ops are automatically generated, and can't be manually modified

    examples:
        -- learn some basic knowledge about Fred:
        mother |Fred> => |Liz>
        father |Fred> => |Ted>
        age |Fred> => |49>
        friends |Fred> => |Sam> + |Emma> + |Tom> + |Hugo>

        -- now learn a little knowledge about Sam:
        mother |Sam> => |Amy>
        age |Sam> => |51>

        -- now see what we know, using verbose dump mode:
        -- in standard dump mode, supported-ops rules are not displayed
        sa: dump verbose
            ------------------------------------------
            |context> => |Global context>

            supported-ops |Fred> => |op: mother> + |op: father> + |op: age> + |op: friends>
            mother |Fred> => |Liz>
            father |Fred> => |Ted>
            age |Fred> => |49>
            friends |Fred> => |Sam> + |Emma> + |Tom> + |Hugo>

            supported-ops |Sam> => |op: mother> + |op: age>
            mother |Sam> => |Amy>
            age |Sam> => |51>
            ------------------------------------------

        -- now define the star operator:
        -- basically a superposition of everything known about a ket
        star |*> #=> seq2sp apply( supported-ops |_self>, |_self>)

        -- now apply it to Fred:
        star |Fred>
            |Liz> + |Ted> + |49> + |Sam> + |Emma> + |Tom> + |Hugo>

        -- now apply it to Sam:
        star |Sam>
            |Amy> + |51>

    see also:
        dump, apply

Home