
(/VERSIONCHECK 2) 

(PUT '|GTSET;rep| '|SPADreplace| '(XLAM (|s|) |s|)) 

(DEFUN |GTSET;rep| (|s| $) |s|) 

(PUT '|GTSET;per| '|SPADreplace| '(XLAM (|l|) |l|)) 

(DEFUN |GTSET;per| (|l| $) |l|) 

(DEFUN |GTSET;copy;2$;3| (|ts| $)
  (|GTSET;per| (SPADCALL (|GTSET;rep| |ts| $) (QREFELT $ 11)) $)) 

(DEFUN |GTSET;empty;$;4| ($) (|GTSET;per| NIL $)) 

(DEFUN |GTSET;empty?;$B;5| (|ts| $) (NULL (|GTSET;rep| |ts| $))) 

(DEFUN |GTSET;parts;$L;6| (|ts| $) (|GTSET;rep| |ts| $)) 

(DEFUN |GTSET;members;$L;7| (|ts| $) (|GTSET;rep| |ts| $)) 

(DEFUN |GTSET;map;M2$;8| (|f| |ts| $)
  (SPADCALL (SPADCALL |f| (|GTSET;rep| |ts| $) (QREFELT $ 19)) (QREFELT $ 20))) 

(DEFUN |GTSET;map!;M2$;9| (|f| |ts| $)
  (SPADCALL (SPADCALL |f| (|GTSET;rep| |ts| $) (QREFELT $ 22)) (QREFELT $ 20))) 

(DEFUN |GTSET;member?;P$B;10| (|p| |ts| $)
  (SPADCALL |p| (|GTSET;rep| |ts| $) (QREFELT $ 24))) 

(PUT '|GTSET;roughUnitIdeal?;$B;11| '|SPADreplace| '(XLAM (|ts|) 'NIL)) 

(DEFUN |GTSET;roughUnitIdeal?;$B;11| (|ts| $) 'NIL) 

(DEFUN |GTSET;coerce;$Of;12| (|ts| $)
  (PROG (#1=#:G690 |p| #2=#:G689 |lp|)
    (RETURN
     (SEQ
      (LETT |lp| (REVERSE (|GTSET;rep| |ts| $)) . #3=(|GTSET;coerce;$Of;12|))
      (EXIT
       (SPADCALL
        (PROGN
         (LETT #2# NIL . #3#)
         (SEQ (LETT |p| NIL . #3#) (LETT #1# |lp| . #3#) G190
              (COND
               ((OR (ATOM #1#) (PROGN (LETT |p| (CAR #1#) . #3#) NIL))
                (GO G191)))
              (SEQ
               (EXIT
                (LETT #2# (CONS (SPADCALL |p| (QREFELT $ 28)) #2#) . #3#)))
              (LETT #1# (CDR #1#) . #3#) (GO G190) G191
              (EXIT (NREVERSE0 #2#))))
        (QREFELT $ 30))))))) 

(DEFUN |GTSET;mvar;$V;13| (|ts| $)
  (COND
   ((SPADCALL |ts| (QREFELT $ 15))
    (|error| "failed in mvar : % -> V from GTSET"))
   ('T (SPADCALL (|SPADfirst| (|GTSET;rep| |ts| $)) (QREFELT $ 32))))) 

(DEFUN |GTSET;first;$U;14| (|ts| $)
  (COND ((SPADCALL |ts| (QREFELT $ 15)) (CONS 1 "failed"))
        ('T (CONS 0 (|SPADfirst| (|GTSET;rep| |ts| $)))))) 

(DEFUN |GTSET;last;$U;15| (|ts| $)
  (COND ((SPADCALL |ts| (QREFELT $ 15)) (CONS 1 "failed"))
        ('T (CONS 0 (SPADCALL (|GTSET;rep| |ts| $) (QREFELT $ 36)))))) 

(DEFUN |GTSET;rest;$U;16| (|ts| $)
  (COND ((SPADCALL |ts| (QREFELT $ 15)) (CONS 1 "failed"))
        ('T (CONS 0 (|GTSET;per| (CDR (|GTSET;rep| |ts| $)) $))))) 

(DEFUN |GTSET;coerce;$L;17| (|ts| $) (|GTSET;rep| |ts| $)) 

(DEFUN |GTSET;collectUpper;$V$;18| (|ts| |v| $)
  (PROG (|lp| |newlp|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |ts| (QREFELT $ 15)) |ts|)
            ('T
             (SEQ
              (LETT |lp| (|GTSET;rep| |ts| $)
                    . #1=(|GTSET;collectUpper;$V$;18|))
              (LETT |newlp| NIL . #1#)
              (SEQ G190
                   (COND
                    ((NULL
                      (COND ((NULL |lp|) 'NIL)
                            ('T
                             (SPADCALL |v|
                                       (SPADCALL (|SPADfirst| |lp|)
                                                 (QREFELT $ 32))
                                       (QREFELT $ 41)))))
                     (GO G191)))
                   (SEQ (LETT |newlp| (CONS (|SPADfirst| |lp|) |newlp|) . #1#)
                        (EXIT (LETT |lp| (CDR |lp|) . #1#)))
                   NIL (GO G190) G191 (EXIT NIL))
              (EXIT (|GTSET;per| (REVERSE |newlp|) $))))))))) 

(DEFUN |GTSET;collectUnder;$V$;19| (|ts| |v| $)
  (PROG (|lp|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |ts| (QREFELT $ 15)) |ts|)
            ('T
             (SEQ
              (LETT |lp| (|GTSET;rep| |ts| $)
                    . #1=(|GTSET;collectUnder;$V$;19|))
              (SEQ G190
                   (COND
                    ((NULL
                      (COND
                       ((OR (NULL |lp|)
                            (SPADCALL
                             (SPADCALL (|SPADfirst| |lp|) (QREFELT $ 32)) |v|
                             (QREFELT $ 41)))
                        'NIL)
                       ('T 'T)))
                     (GO G191)))
                   (SEQ (EXIT (LETT |lp| (CDR |lp|) . #1#))) NIL (GO G190) G191
                   (EXIT NIL))
              (EXIT (|GTSET;per| |lp| $))))))))) 

(DEFUN |GTSET;extendIfCan;$PU;20| (|ts| |p| $)
  (COND ((SPADCALL |p| (QREFELT $ 44)) (CONS 1 "failed"))
        ((SPADCALL |ts| (QREFELT $ 15))
         (CONS 0 (|GTSET;per| (LIST (SPADCALL |p| (QREFELT $ 45))) $)))
        ((NULL
          (SPADCALL (SPADCALL |ts| (QREFELT $ 33))
                    (SPADCALL |p| (QREFELT $ 32)) (QREFELT $ 41)))
         (CONS 1 "failed"))
        ('T (CONS 0 (|GTSET;per| (CONS |p| (|GTSET;rep| |ts| $)) $))))) 

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

(DEFUN |GeneralTriangularSet;| (|#1| |#2| |#3| |#4|)
  (PROG (#1=#:G750 |pv$| #2=#:G749 $ |dv$| DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #3=(|GeneralTriangularSet|))
      (LETT DV$2 (|devaluate| |#2|) . #3#)
      (LETT DV$3 (|devaluate| |#3|) . #3#)
      (LETT DV$4 (|devaluate| |#4|) . #3#)
      (LETT |dv$| (LIST '|GeneralTriangularSet| DV$1 DV$2 DV$3 DV$4) . #3#)
      (LETT $ (GETREFV 66) . #3#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#4|
                                                         '(|ConvertibleTo|
                                                           (|InputForm|)))
                                          (LETT #2#
                                                (|HasCategory| |#4|
                                                               '(|SetCategory|))
                                                . #3#)
                                          (AND #2#
                                               (|HasCategory| |#4|
                                                              (LIST '|Evalable|
                                                                    (|devaluate|
                                                                     |#4|))))
                                          (|HasCategory| |#1|
                                                         '(|IntegralDomain|))
                                          (|HasCategory| |#3| '(|Finite|))))
                      . #3#))
      (|haddProp| |$ConstructorCache| '|GeneralTriangularSet|
                  (LIST DV$1 DV$2 DV$3 DV$4) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      (AND (|HasCategory| $ '(|shallowlyMutable|)) (|augmentPredVector| $ 32))
      (AND (LETT #1# (|HasCategory| $ '(|finiteAggregate|)) . #3#)
           (|augmentPredVector| $ 64))
      (AND #1# #2# (|augmentPredVector| $ 128))
      $)))) 

(MAKEPROP '|GeneralTriangularSet| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|local| |#4|) (|List| 9) (0 . |copy|)
              |GTSET;copy;2$;3| |GTSET;empty;$;4| (|Boolean|)
              |GTSET;empty?;$B;5| |GTSET;parts;$L;6| |GTSET;members;$L;7|
              (|Mapping| 9 9) (5 . |map|) (11 . |construct|) |GTSET;map;M2$;8|
              (16 . |map!|) |GTSET;map!;M2$;9| (22 . |member?|)
              |GTSET;member?;P$B;10| |GTSET;roughUnitIdeal?;$B;11|
              (|OutputForm|) (28 . |coerce|) (|List| $) (33 . |brace|)
              |GTSET;coerce;$Of;12| (38 . |mvar|) |GTSET;mvar;$V;13|
              (|Union| 9 '#1="failed") |GTSET;first;$U;14| (43 . |last|)
              |GTSET;last;$U;15| (|Union| $ '#1#) |GTSET;rest;$U;16|
              |GTSET;coerce;$L;17| (48 . <) |GTSET;collectUpper;$V$;18|
              |GTSET;collectUnder;$V$;19| (54 . |ground?|)
              (59 . |unitCanonical|) |GTSET;extendIfCan;$PU;20|
              (|NonNegativeInteger|) (|Mapping| 9 9 9) (|List| 50)
              (|Equation| 9) (|Mapping| 14 9) (|InputForm|)
              (|Record| (|:| |num| 9) (|:| |den| 6))
              (|Record| (|:| |rnum| 6) (|:| |polnum| 9) (|:| |den| 6))
              (|List| 8) (|Record| (|:| |close| $) (|:| |open| 10)) (|List| 56)
              (|Mapping| 14 9 9) (|Mapping| 14 9 10)
              (|Record| (|:| |close| 10) (|:| |open| 10))
              (|Record| (|:| |bas| $) (|:| |top| 10)) (|Union| 61 '#1#)
              (|Record| (|:| |under| $) (|:| |floor| $) (|:| |upper| $))
              (|SingleInteger|) (|String|))
           '#(~= 64 |zeroSetSplitIntoTriangularSystems| 70 |zeroSetSplit| 75
              |variables| 80 |trivialIdeal?| 85 |triangular?| 90
              |stronglyReduced?| 95 |stronglyReduce| 106 |sort| 112 |size?| 118
              |select| 124 |sample| 136 |roughUnitIdeal?| 140 |roughSubIdeal?|
              145 |roughEqualIdeals?| 151 |roughBase?| 157
              |rewriteSetWithReduction| 162 |rewriteIdealWithRemainder| 170
              |rewriteIdealWithHeadRemainder| 176 |retractIfCan| 182 |retract|
              187 |rest| 192 |removeZero| 197 |removeDuplicates| 203 |remove|
              208 |remainder| 220 |reduced?| 226 |reduceByQuasiMonic| 233
              |reduce| 239 |quasiComponent| 268 |parts| 273 |normalized?| 278
              |mvar| 289 |more?| 294 |members| 300 |member?| 305 |map!| 311
              |map| 317 |mainVariables| 323 |mainVariable?| 328 |less?| 334
              |latex| 340 |last| 345 |initials| 350 |initiallyReduced?| 355
              |initiallyReduce| 366 |infRittWu?| 372 |iexactQuo| 378
              |headRemainder| 384 |headReduced?| 390 |headReduce| 401 |hash|
              407 |first| 412 |find| 417 |extendIfCan| 423 |extend| 429
              |every?| 435 |eval| 441 |eq?| 467 |empty?| 473 |empty| 478
              |degree| 482 |count| 487 |copy| 499 |convert| 504 |construct| 509
              |collectUpper| 514 |collectUnder| 520 |collectQuasiMonic| 526
              |collect| 531 |coerce| 537 |coHeight| 547 |basicSet| 552
              |autoReduced?| 565 |any?| 571 |algebraicVariables| 577
              |algebraic?| 582 = 588 |#| 594)
           'NIL
           (CONS (|makeByteWordVec2| 3 '(0 0 0 0 0 0 3 0 0 0 0 0 0 3 1))
                 (CONS
                  '#(|TriangularSetCategory&| |PolynomialSetCategory&|
                     |Collection&| |HomogeneousAggregate&| |SetCategory&|
                     |Aggregate&| |Evalable&| |BasicType&| NIL NIL NIL NIL NIL
                     |InnerEvalable&| NIL)
                  (CONS
                   '#((|TriangularSetCategory| 6 7 8 9)
                      (|PolynomialSetCategory| 6 7 8 9) (|Collection| 9)
                      (|HomogeneousAggregate| 9) (|SetCategory|) (|Aggregate|)
                      (|Evalable| 9) (|BasicType|) (|shallowlyMutable|)
                      (|finiteAggregate|) (|CoercibleTo| (|List| 9)) (|Type|)
                      (|CoercibleTo| 27) (|InnerEvalable| 9 9)
                      (|ConvertibleTo| 52))
                   (|makeByteWordVec2| 65
                                       '(1 10 0 0 11 2 10 0 18 0 19 1 0 0 10 20
                                         2 10 0 18 0 22 2 10 14 9 0 24 1 9 27 0
                                         28 1 27 0 29 30 1 9 8 0 32 1 10 9 0 36
                                         2 8 14 0 0 41 1 9 14 0 44 1 9 0 0 45 2
                                         0 14 0 0 1 1 0 57 10 1 1 0 29 10 1 1 0
                                         55 0 1 1 0 14 0 1 1 4 14 0 1 1 0 14 0
                                         1 2 0 14 9 0 1 2 0 9 9 0 1 2 0 63 0 8
                                         1 2 0 14 0 47 1 2 7 0 51 0 1 2 0 34 0
                                         8 1 0 0 0 1 1 4 14 0 26 2 4 14 0 0 1 2
                                         4 14 0 0 1 1 4 14 0 1 4 0 10 10 0 48
                                         58 1 2 4 10 10 0 1 2 4 10 10 0 1 1 0
                                         38 10 1 1 0 0 10 1 1 0 38 0 39 2 0 9 9
                                         0 1 1 8 0 0 1 2 8 0 9 0 1 2 7 0 51 0 1
                                         2 4 54 9 0 1 3 0 14 9 0 58 1 2 0 9 9 0
                                         1 4 8 9 48 0 9 9 1 2 7 9 48 0 1 3 7 9
                                         48 0 9 1 4 0 9 9 0 48 58 1 1 0 60 0 1
                                         1 7 10 0 16 2 0 14 9 0 1 1 0 14 0 1 1
                                         0 8 0 33 2 0 14 0 47 1 1 7 10 0 17 2 8
                                         14 9 0 25 2 6 0 18 0 23 2 0 0 18 0 21
                                         1 0 55 0 1 2 0 14 8 0 1 2 0 14 0 47 1
                                         1 0 65 0 1 1 0 34 0 37 1 0 10 0 1 1 0
                                         14 0 1 2 0 14 9 0 1 2 0 9 9 0 1 2 0 14
                                         0 0 1 2 4 6 6 6 1 2 4 53 9 0 1 1 0 14
                                         0 1 2 0 14 9 0 1 2 0 9 9 0 1 1 0 64 0
                                         1 1 0 34 0 35 2 0 34 51 0 1 2 0 38 0 9
                                         46 2 0 0 0 9 1 2 7 14 51 0 1 2 3 0 0
                                         49 1 2 3 0 0 50 1 3 3 0 0 10 10 1 3 3
                                         0 0 9 9 1 2 0 14 0 0 1 1 0 14 0 15 0 0
                                         0 13 1 0 47 0 1 2 8 47 9 0 1 2 7 47 51
                                         0 1 1 0 0 0 12 1 1 52 0 1 1 0 0 10 20
                                         2 0 0 0 8 42 2 0 0 0 8 43 1 0 0 0 1 2
                                         0 0 0 8 1 1 0 10 0 40 1 0 27 0 31 1 5
                                         47 0 1 3 0 62 10 51 58 1 2 0 62 10 58
                                         1 2 0 14 0 59 1 2 7 14 51 0 1 1 0 55 0
                                         1 2 0 14 8 0 1 2 0 14 0 0 1 1 7 47 0
                                         1)))))
           '|lookupComplete|)) 
