function 1: is-subset


is-subset:
    description:
        is-subset(sp) input-sp
        returns |yes> if sp is a "subset" of input-sp, else |no>
        where subset means: for all kets in sp, they have value <= the value in input-sp
        it generalizes the idea of sets and their subsets, since it allows elements to have corresponding coefficients
        so for example: asking if {a,c} is a subset of {a,b,c,d,e}
        is equivalent to: is-subset(|a> + |c>) (|a> + |b> + |c> + |d> + |e>)
        or more compactly: is-subset(split |ac>) split |abcde>
        this extends the notion that sets can be represented by "clean" superpositions
        and non-clean superpositions represent fuzzy sets
        where "clean" means all coefficients of kets are either 0 or 1

    examples:
        is-subset(|b>) split |abc>
            |yes>

        is-subset(split |bd>) split |abc>
            |no>

        -- note, the order of the elements in the superpositions do not matter:
        is-subset(8|c> + 13|d> + 0.2|a>) (0.3|a> + 2|b> + 9.7|c> + 13|d>)
            |yes>

        friends |Fred> => |Sam> + |Emma> + |Rob> + |Liz> + |Harold> + |Tom>
        friends |Sam> => |Emma> + |Tom> + |Liz>
        friends |Harold> => |Rob> + |Liz> + |Tom> + |Beth>

        -- are Sam's friends a subset of Fred's friends?
        is-subset(friends |Sam>) friends |Fred>
            |yes>

        -- are Harold's friends a subset of Fred's friends?
        is-subset(friends |Harold>) friends |Fred>
            |no>

    see also:
        is-mbr, union, intersection, superposition

Home