
(/VERSIONCHECK 2) 

(DEFUN |SETMN;=;2$B;1| (|s1| |s2| $)
  (SPADCALL (QCAR |s1|) (QCAR |s2|) (QREFELT $ 20))) 

(DEFUN |SETMN;coerce;$Of;2| (|s| $)
  (PROG (#1=#:G684 |i| #2=#:G683)
    (RETURN
     (SEQ
      (SPADCALL
       (PROGN
        (LETT #2# NIL . #3=(|SETMN;coerce;$Of;2|))
        (SEQ (LETT |i| NIL . #3#)
             (LETT #1# (SPADCALL |s| (QREFELT $ 23)) . #3#) G190
             (COND
              ((OR (ATOM #1#) (PROGN (LETT |i| (CAR #1#) . #3#) NIL))
               (GO G191)))
             (SEQ
              (EXIT (LETT #2# (CONS (SPADCALL |i| (QREFELT $ 26)) #2#) . #3#)))
             (LETT #1# (CDR #1#) . #3#) (GO G190) G191 (EXIT (NREVERSE0 #2#))))
       (QREFELT $ 28)))))) 

(DEFUN |SETMN;random;$;3| ($)
  (PROG (#1=#:G685)
    (RETURN
     (SPADCALL
      (PROG1
          (LETT #1# (+ (RANDOM (SPADCALL (QREFELT $ 30))) 1)
                |SETMN;random;$;3|)
        (|check-subtype| (> #1# 0) '(|PositiveInteger|) #1#))
      (QREFELT $ 31))))) 

(DEFUN |SETMN;reallyEnumerate| ($)
  (PROG (|i| #1=#:G691 |b| #2=#:G690 #3=#:G689)
    (RETURN
     (SEQ
      (PROGN
       (LETT #3#
             (GETREFV
              (SIZE
               #4=(|SETMN;enum| (QREFELT $ 6) (QREFELT $ 7) (QREFELT $ 7) $)))
             . #5=(|SETMN;reallyEnumerate|))
       (SEQ (LETT #2# 0 . #5#) (LETT |b| NIL . #5#) (LETT #1# #4# . #5#)
            (LETT |i| 1 . #5#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |b| (CAR #1#) . #5#) NIL))
              (GO G191)))
            (SEQ (EXIT (SETELT #3# #2# (CONS |b| |i|))))
            (LETT |i|
                  (PROG1 (QSADD1 |i|)
                    (LETT #1# (PROG1 (CDR #1#) (LETT #2# (QSADD1 #2#) . #5#))
                          . #5#))
                  . #5#)
            (GO G190) G191 (EXIT NIL))
       #3#))))) 

(DEFUN |SETMN;member?;Pi$B;5| (|p| |s| $)
  (SPADCALL (QCAR |s|) |p| (QREFELT $ 34))) 

(DEFUN |SETMN;enumerate;V;6| ($)
  (SEQ
   (COND
    ((SPADCALL (SPADCALL (QREFELT $ 13) (QREFELT $ 36)) (QREFELT $ 37))
     (SPADCALL (QREFELT $ 13) (|SETMN;reallyEnumerate| $) (QREFELT $ 38))))
   (EXIT (SPADCALL (QREFELT $ 13) (QREFELT $ 36))))) 

(DEFUN |SETMN;enum| (|p| |q| |n| $)
  (PROG (#1=#:G708 |s| |l| #2=#:G702 |q1| #3=#:G701 |i| |b|)
    (RETURN
     (SEQ
      (COND ((OR (ZEROP |p|) (ZEROP |q|)) NIL)
            ('T
             (COND
              ((EQL |p| |q|)
               (SEQ
                (LETT |b| (SPADCALL (QREFELT $ 7) 'NIL (QREFELT $ 41))
                      . #4=(|SETMN;enum|))
                (SEQ (LETT |i| 1 . #4#) G190
                     (COND ((QSGREATERP |i| |p|) #5=(GO G191)))
                     (SEQ (EXIT (SPADCALL |b| |i| 'T (QREFELT $ 42))))
                     (LETT |i| (QSADD1 |i|) . #4#) #6=(GO G190) G191
                     (EXIT NIL))
                (EXIT (LIST |b|))))
              ('T
               (SEQ
                (LETT |q1|
                      (PROG1 (LETT #3# (- |q| 1) . #4#)
                        (|check-subtype| (>= #3# 0) '(|NonNegativeInteger|)
                                         #3#))
                      . #4#)
                (LETT |l|
                      (|SETMN;enum|
                       (PROG1 (LETT #2# (- |p| 1) . #4#)
                         (|check-subtype| (>= #2# 0) '(|NonNegativeInteger|)
                                          #2#))
                       |q1| (QREFELT $ 7) $)
                      . #4#)
                (COND
                 ((NULL |l|)
                  (LETT |l| (LIST (SPADCALL (QREFELT $ 7) 'NIL (QREFELT $ 41)))
                        . #4#)))
                (SEQ (LETT |s| NIL . #4#) (LETT #1# |l| . #4#) G190
                     (COND
                      ((OR (ATOM #1#) (PROGN (LETT |s| (CAR #1#) . #4#) NIL))
                       #5#))
                     (SEQ (EXIT (SPADCALL |s| |q| 'T (QREFELT $ 42))))
                     (LETT #1# (CDR #1#) . #4#) #6# G191 (EXIT NIL))
                (EXIT
                 (SPADCALL (|SETMN;enum| |p| |q1| (QREFELT $ 7) $) |l|
                           (QREFELT $ 44)))))))))))) 

(DEFUN |SETMN;size;Nni;8| ($)
  (PROG (#1=#:G709)
    (RETURN
     (SEQ
      (COND
       ((ZEROP (SPADCALL (QREFELT $ 17) (QREFELT $ 45)))
        (SPADCALL (QREFELT $ 17)
                  (PROG1
                      (LETT #1#
                            (SPADCALL (QREFELT $ 7) (QREFELT $ 6)
                                      (QREFELT $ 47))
                            |SETMN;size;Nni;8|)
                    (|check-subtype| (>= #1# 0) '(|NonNegativeInteger|) #1#))
                  (QREFELT $ 48))))
      (EXIT (SPADCALL (QREFELT $ 17) (QREFELT $ 45))))))) 

(DEFUN |SETMN;lookup;$Pi;9| (|s| $)
  (PROG (#1=#:G716 #2=#:G714)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL (SPADCALL (QREFELT $ 13) (QREFELT $ 36)) (QREFELT $ 37))
        (SPADCALL (QREFELT $ 13) (|SETMN;reallyEnumerate| $) (QREFELT $ 38))))
      (COND
       ((ZEROP (QCDR |s|))
        (PROGN
         (RPLACD |s|
                 (PROG1
                     (LETT #2#
                           (SPADCALL |s|
                                     (SPADCALL (QREFELT $ 13) (QREFELT $ 36))
                                     (QREFELT $ 49))
                           . #3=(|SETMN;lookup;$Pi;9|))
                   (|check-subtype| (>= #2# 0) '(|NonNegativeInteger|) #2#)))
         (QCDR |s|))))
      (EXIT
       (PROG1 (LETT #1# (QCDR |s|) . #3#)
         (|check-subtype| (> #1# 0) '(|PositiveInteger|) #1#))))))) 

(DEFUN |SETMN;index;Pi$;10| (|p| $)
  (SEQ
   (COND
    ((< (SPADCALL (QREFELT $ 30)) |p|) (|error| "index: argument too large"))
    ('T
     (SEQ
      (COND
       ((SPADCALL (SPADCALL (QREFELT $ 13) (QREFELT $ 36)) (QREFELT $ 37))
        (SPADCALL (QREFELT $ 13) (|SETMN;reallyEnumerate| $) (QREFELT $ 38))))
      (EXIT
       (SPADCALL (SPADCALL (QREFELT $ 13) (QREFELT $ 36)) |p|
                 (QREFELT $ 51)))))))) 

(DEFUN |SETMN;setOfMinN;L$;11| (|l| $)
  (PROG (|count| #1=#:G729 |i| |s|)
    (RETURN
     (SEQ
      (LETT |s| (SPADCALL (QREFELT $ 7) 'NIL (QREFELT $ 41))
            . #2=(|SETMN;setOfMinN;L$;11|))
      (LETT |count| 0 . #2#)
      (SEQ (LETT |i| NIL . #2#) (LETT #1# |l| . #2#) G190
           (COND
            ((OR (ATOM #1#) (PROGN (LETT |i| (CAR #1#) . #2#) NIL)) (GO G191)))
           (SEQ (LETT |count| (+ |count| 1) . #2#)
                (COND
                 ((OR (< (QREFELT $ 6) |count|)
                      (OR (OR (ZEROP |i|) (< (QREFELT $ 7) |i|))
                          (SPADCALL |s| |i| (QREFELT $ 34))))
                  (EXIT (|error| "setOfMinN: improper set of integers"))))
                (EXIT (SPADCALL |s| |i| 'T (QREFELT $ 42))))
           (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT
       (COND
        ((< |count| (QREFELT $ 6))
         (|error| "setOfMinN: improper set of integers"))
        ('T (CONS |s| 0)))))))) 

(DEFUN |SETMN;elements;$L;12| (|s| $)
  (PROG (|i| |found| |l| |b|)
    (RETURN
     (SEQ (LETT |b| (QCAR |s|) . #1=(|SETMN;elements;$L;12|))
          (LETT |l| NIL . #1#) (LETT |found| 0 . #1#) (LETT |i| 1 . #1#)
          (SEQ G190 (COND ((NULL (< |found| (QREFELT $ 6))) (GO G191)))
               (SEQ
                (COND
                 ((SPADCALL |b| |i| (QREFELT $ 34))
                  (SEQ (LETT |l| (CONS |i| |l|) . #1#)
                       (EXIT (LETT |found| (+ |found| 1) . #1#)))))
                (EXIT (LETT |i| (+ |i| 1) . #1#)))
               NIL (GO G190) G191 (EXIT NIL))
          (EXIT (NREVERSE |l|)))))) 

(DEFUN |SETMN;incrementKthElement;$PiU;13| (|s| |k| $)
  (PROG (#1=#:G746 |newb| |i| |found| |b|)
    (RETURN
     (SEQ (LETT |b| (QCAR |s|) . #2=(|SETMN;incrementKthElement;$PiU;13|))
          (LETT |found| 0 . #2#) (LETT |i| 1 . #2#)
          (SEQ G190 (COND ((NULL (< |found| |k|)) (GO G191)))
               (SEQ
                (COND
                 ((SPADCALL |b| |i| (QREFELT $ 34))
                  (LETT |found| (+ |found| 1) . #2#)))
                (EXIT (LETT |i| (+ |i| 1) . #2#)))
               NIL (GO G190) G191 (EXIT NIL))
          (COND
           ((OR (< (QREFELT $ 7) |i|) (SPADCALL |b| |i| (QREFELT $ 34)))
            (EXIT (CONS 1 "failed"))))
          (LETT |newb| (SPADCALL |b| (QREFELT $ 53)) . #2#)
          (SPADCALL |newb| |i| 'T (QREFELT $ 42))
          (SPADCALL |newb|
                    (PROG1 (LETT #1# (- |i| 1) . #2#)
                      (|check-subtype| (>= #1# 0) '(|NonNegativeInteger|) #1#))
                    'NIL (QREFELT $ 42))
          (EXIT (CONS 0 (CONS |newb| 0))))))) 

(DEFUN |SETMN;delta;$2PiNni;14| (|s| |k| |p| $)
  (PROG (|i| |count| |found| |b|)
    (RETURN
     (SEQ (LETT |b| (QCAR |s|) . #1=(|SETMN;delta;$2PiNni;14|))
          (LETT |count| (LETT |found| 0 . #1#) . #1#) (LETT |i| 1 . #1#)
          (SEQ G190 (COND ((NULL (< |found| |k|)) (GO G191)))
               (SEQ
                (COND
                 ((SPADCALL |b| |i| (QREFELT $ 34))
                  (SEQ (LETT |found| (+ |found| 1) . #1#)
                       (EXIT
                        (COND
                         ((< |p| |i|)
                          (COND
                           ((< |found| |k|)
                            (LETT |count| (+ |count| 1) . #1#)))))))))
                (EXIT (LETT |i| (+ |i| 1) . #1#)))
               NIL (GO G190) G191 (EXIT NIL))
          (EXIT |count|))))) 

(DEFUN |SETMN;replaceKthElement;$2PiU;15| (|s| |k| |p| $)
  (PROG (|newb| |i| |found| |b|)
    (RETURN
     (SEQ (LETT |b| (QCAR |s|) . #1=(|SETMN;replaceKthElement;$2PiU;15|))
          (LETT |found| 0 . #1#) (LETT |i| 1 . #1#)
          (SEQ G190 (COND ((NULL (< |found| |k|)) (GO G191)))
               (SEQ
                (COND
                 ((SPADCALL |b| |i| (QREFELT $ 34))
                  (LETT |found| (+ |found| 1) . #1#)))
                (EXIT (COND ((< |found| |k|) (LETT |i| (+ |i| 1) . #1#)))))
               NIL (GO G190) G191 (EXIT NIL))
          (COND
           ((SPADCALL |b| |p| (QREFELT $ 34))
            (COND ((NULL (EQL |i| |p|)) (EXIT (CONS 1 "failed"))))))
          (LETT |newb| (SPADCALL |b| (QREFELT $ 53)) . #1#)
          (SPADCALL |newb| |p| 'T (QREFELT $ 42))
          (SPADCALL |newb| |i| 'NIL (QREFELT $ 42))
          (EXIT
           (CONS 0 (CONS |newb| (COND ((EQL |i| |p|) (QCDR |s|)) ('T 0))))))))) 

(DEFUN |SetOfMIntegersInOneToN| (&REST #1=#:G769)
  (PROG ()
    (RETURN
     (PROG (#2=#:G770)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (|devaluateList| #1#)
                                           (HGET |$ConstructorCache|
                                                 '|SetOfMIntegersInOneToN|)
                                           '|domainEqualList|)
                . #3=(|SetOfMIntegersInOneToN|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT
              (PROG1 (APPLY (|function| |SetOfMIntegersInOneToN;|) #1#)
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#)
              (HREM |$ConstructorCache| '|SetOfMIntegersInOneToN|))))))))))) 

(DEFUN |SetOfMIntegersInOneToN;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|SetOfMIntegersInOneToN|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|SetOfMIntegersInOneToN| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 60) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|SetOfMIntegersInOneToN|
                  (LIST DV$1 DV$2) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8
                (|Record| (|:| |bits| (|Bits|))
                          (|:| |pos| (|NonNegativeInteger|))))
      (QSETREFV $ 13 (SPADCALL (SPADCALL (QREFELT $ 10)) (QREFELT $ 12)))
      (QSETREFV $ 17 (SPADCALL 0 (QREFELT $ 16)))
      $)))) 

(MAKEPROP '|SetOfMIntegersInOneToN| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) '|Rep|
              (|Vector| $$) (0 . |empty|) (|Reference| 9) (4 . |ref|) '|all|
              (|NonNegativeInteger|) (|Reference| 14) (9 . |ref|) '|sz|
              (|Boolean|) (|Bits|) (14 . =) |SETMN;=;2$B;1| (|List| 25)
              |SETMN;elements;$L;12| (|OutputForm|) (|PositiveInteger|)
              (20 . |coerce|) (|List| $) (25 . |brace|) |SETMN;coerce;$Of;2|
              |SETMN;size;Nni;8| |SETMN;index;Pi$;10| |SETMN;random;$;3|
              (|Integer|) (30 . |elt|) |SETMN;member?;Pi$B;5| (36 . |elt|)
              (41 . |empty?|) (46 . |setelt|) (|Vector| $)
              |SETMN;enumerate;V;6| (52 . |new|) (58 . |setelt|) (|List| 19)
              (65 . |concat!|) (71 . |elt|) (|IntegerCombinatoricFunctions| 33)
              (76 . |binomial|) (82 . |setelt|) (88 . |position|)
              |SETMN;lookup;$Pi;9| (94 . |elt|) |SETMN;setOfMinN;L$;11|
              (100 . |copy|) (|Union| $ '"failed")
              |SETMN;incrementKthElement;$PiU;13| |SETMN;delta;$2PiNni;14|
              |SETMN;replaceKthElement;$2PiU;15| (|SingleInteger|) (|String|))
           '#(~= 105 |size| 111 |setOfMinN| 115 |replaceKthElement| 120
              |random| 127 |member?| 131 |lookup| 137 |latex| 142 |index| 147
              |incrementKthElement| 152 |hash| 158 |enumerate| 163 |elements|
              171 |delta| 176 |coerce| 183 = 188)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0 0 0))
                 (CONS '#(|Finite&| |SetCategory&| |BasicType&| NIL)
                       (CONS
                        '#((|Finite|) (|SetCategory|) (|BasicType|)
                           (|CoercibleTo| 24))
                        (|makeByteWordVec2| 59
                                            '(0 9 0 10 1 11 0 9 12 1 15 0 14 16
                                              2 19 18 0 0 20 1 25 24 0 26 1 24
                                              0 27 28 2 19 18 0 33 34 1 11 9 0
                                              36 1 9 18 0 37 2 11 9 0 9 38 2 19
                                              0 14 18 41 3 19 18 0 33 18 42 2
                                              43 0 0 0 44 1 15 14 0 45 2 46 33
                                              33 33 47 2 15 14 0 14 48 2 9 33 2
                                              0 49 2 9 2 0 33 51 1 19 0 0 53 2
                                              0 18 0 0 1 0 0 14 30 1 0 0 22 52
                                              3 0 54 0 25 25 57 0 0 0 32 2 0 18
                                              25 0 35 1 0 25 0 50 1 0 59 0 1 1
                                              0 0 25 31 2 0 54 0 25 55 1 0 58 0
                                              1 0 0 39 40 0 0 27 1 1 0 22 0 23
                                              3 0 14 0 25 25 56 1 0 24 0 29 2 0
                                              18 0 0 21)))))
           '|lookupComplete|)) 
