if ((typeof(basics$ElabTopdec$$7)) == "undefined") {basics$ElabTopdec$$7 = {};
};
(function(){basics$ElabTopdec$$7.eq_bal$4832 = function(v$4834,v$4835){switch (v$4834) { case 0: {switch (v$4835) { case 0: {return true;
 break; }default: {return false;
} };
 break; }case 1: {switch (v$4835) { case 1: {return true;
 break; }default: {return false;
} };
 break; }case 2: {switch (v$4835) { case 2: {return true;
 break; }default: {return false;
} };
 break; } };
};
basics$ElabTopdec$$7.s$j$3940 = function(v$3945,v$3946){return basics$ElabTopdec$$6.lt$3901(v$3945,v$3946);
};
basics$ElabTopdec$$7.s$kk$3947 = function(v$3956,v$3957){return ((basics$ElabTopdec$$6.lt$3901(v$3956,v$3957))?true:(basics$ElabTopdec$$6.lt$3901(v$3957,v$3956)))?false:true;
};
basics$ElabTopdec$$7.en$Impossible$3958 = new String("Impossible");
basics$ElabTopdec$$7.impossible$3959 = function(s$3962){var s$3963 = "Impossible.OrderSet." + s$3962;
basis$General$.print$156(s$3963);
throw [basics$ElabTopdec$$7.en$Impossible$3958,s$3963];
};
basics$ElabTopdec$$7.empty$3971 = null;
basics$ElabTopdec$$7.singleton$3972 = function(i$3975){return [i$3975,null,null,2];
};
var fix$5175 = {};
fix$5175.$size = function(v$3979){if (v$3979 == null) {return 0;
} else {var v$3986 = v$3979;
var v$3987 = v$3986[1];
var v$3988 = v$3986[2];
return SmlPrims.chk_ovf_i32((SmlPrims.chk_ovf_i32(1 + (fix$5175.$size(v$3987)))) + (fix$5175.$size(v$3988)));
};
};
basics$ElabTopdec$$7.size$3976 = fix$5175.$size;
basics$ElabTopdec$$7.isEmpty$3989 = function(v$3992){return (v$3992 == null)?true:false;
};
basics$ElabTopdec$$7.member$3997 = function(i$4000,s$4003){var fix$5176 = {};
fix$5176.$search = function(v$4007){lab$search: while (true) {if (v$4007 == null) {return false;
} else {var v$4023 = v$4007;
var v$4024 = v$4023[0];
var v$4025 = v$4023[1];
var v$4026 = v$4023[2];
if (((basics$ElabTopdec$$6.lt$3901(i$4000,v$4024))?true:(basics$ElabTopdec$$6.lt$3901(v$4024,i$4000)))?false:true) {return true;
} else {if (basics$ElabTopdec$$6.lt$3901(i$4000,v$4024)) {var t$5177 = v$4025;
var v$4007 = t$5177;
continue lab$search;
} else {var t$5178 = v$4026;
var v$4007 = t$5178;
continue lab$search;
};
};
};
};
};
var search$4004 = fix$5176.$search;
return search$4004(s$4003);
};
basics$ElabTopdec$$7.eq$4027 = function(s1$4030,s2$4033){if ((basics$ElabTopdec$$7.size$3976(s1$4030)) == (basics$ElabTopdec$$7.size$3976(s2$4033))) {var fix$5179 = {};
fix$5179.$eq$ = function(v$4041){lab$eq$: while (true) {if (v$4041 == null) {return true;
} else {var v$4057 = v$4041;
var v$4058 = v$4057[0];
var v$4059 = v$4057[1];
var v$4060 = v$4057[2];
if (basics$ElabTopdec$$7.member$3997(v$4058,s2$4033)) {if (fix$5179.$eq$(v$4059)) {var t$5180 = v$4060;
var v$4041 = t$5180;
continue lab$eq$;
} else {return false;
};
} else {return false;
};
};
};
};
var eq$$4038 = fix$5179.$eq$;
return eq$$4038(s1$4030);
} else {return false;
};
};
basics$ElabTopdec$$7.en$ALREADYTHERE$4061 = new String("ALREADYTHERE");
basics$ElabTopdec$$7.exn$ALREADYTHERE$4061 = [basics$ElabTopdec$$7.en$ALREADYTHERE$4061];
basics$ElabTopdec$$7.insert$4062 = function(k0$4065,t$4068){var fix$5181 = {};
fix$5181.$ins = function(v$4072){if (v$4072 == null) {return [true,[k0$4065,null,null,2]];
} else {var v$4225 = v$4072;
var v$4226 = v$4225[0];
var v$4227 = v$4225[1];
var v$4228 = v$4225[2];
var v$4229 = v$4225[3];
if (((basics$ElabTopdec$$6.lt$3901(k0$4065,v$4226))?true:(basics$ElabTopdec$$6.lt$3901(v$4226,k0$4065)))?false:true) {throw basics$ElabTopdec$$7.exn$ALREADYTHERE$4061;
} else {if (basics$ElabTopdec$$6.lt$3901(k0$4065,v$4226)) {var v$4154 = fix$5181.$ins(v$4227);
var v$4155 = v$4154[0];
var v$4156 = v$4154[1];
switch (v$4229) { case 2: {return v$4155?[true,[v$4226,v$4156,v$4228,1]]:[false,[v$4226,v$4156,v$4228,2]];
 break; }case 0: {return v$4155?[false,[v$4226,v$4156,v$4228,2]]:[false,[v$4226,v$4156,v$4228,0]];
 break; }default: {if (v$4155) {var v$4142;
if (v$4156 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree01!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree01!"];
} else {v$4142 = v$4156;
};
var v$4143 = v$4142[0];
var v$4144 = v$4142[1];
var v$4145 = v$4142[2];
var v$4146 = v$4142[3];
var t$5184;
var v$5060 = 1;
switch (v$4146) { case 0: {switch (v$5060) { case 0: {t$5184 = true;
 break; }default: {t$5184 = false;
} };
 break; }case 1: {switch (v$5060) { case 1: {t$5184 = true;
 break; }default: {t$5184 = false;
} };
 break; }case 2: {switch (v$5060) { case 2: {t$5184 = true;
 break; }default: {t$5184 = false;
} };
 break; } };
if (t$5184) {return [false,[v$4143,v$4144,[v$4226,v$4145,v$4228,2],2]];
} else {var v$4130;
if (v$4145 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree02!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree02!"];
} else {v$4130 = v$4145;
};
var v$4131 = v$4130[0];
var v$4132 = v$4130[1];
var v$4133 = v$4130[2];
var v$4134 = v$4130[3];
var t$5202 = false;
var t$5201;
var t$5200;
var t$5199 = v$4131;
var t$5198;
var t$5197;
var t$5196 = v$4143;
var t$5195 = v$4144;
var t$5194 = v$4132;
var t$5193;
var t$5192;
var v$5064 = 0;
switch (v$4134) { case 0: {switch (v$5064) { case 0: {t$5192 = true;
 break; }default: {t$5192 = false;
} };
 break; }case 1: {switch (v$5064) { case 1: {t$5192 = true;
 break; }default: {t$5192 = false;
} };
 break; }case 2: {switch (v$5064) { case 2: {t$5192 = true;
 break; }default: {t$5192 = false;
} };
 break; } };
t$5193 = (t$5192?1:2);
t$5197 = [t$5196,t$5195,t$5194,t$5193];
t$5198 = t$5197;
var t$5191;
var t$5190;
var t$5189 = v$4226;
var t$5188 = v$4133;
var t$5187 = v$4228;
var t$5186;
var t$5185;
var v$5066 = 1;
switch (v$4134) { case 0: {switch (v$5066) { case 0: {t$5185 = true;
 break; }default: {t$5185 = false;
} };
 break; }case 1: {switch (v$5066) { case 1: {t$5185 = true;
 break; }default: {t$5185 = false;
} };
 break; }case 2: {switch (v$5066) { case 2: {t$5185 = true;
 break; }default: {t$5185 = false;
} };
 break; } };
t$5186 = (t$5185?0:2);
t$5190 = [t$5189,t$5188,t$5187,t$5186];
t$5191 = t$5190;
t$5200 = [t$5199,t$5198,t$5191,2];
t$5201 = t$5200;
return [t$5202,t$5201];
};
} else {return [false,[v$4226,v$4156,v$4228,1]];
};
} };
} else {var v$4222 = fix$5181.$ins(v$4228);
var v$4223 = v$4222[0];
var v$4224 = v$4222[1];
switch (v$4229) { case 2: {return v$4223?[true,[v$4226,v$4227,v$4224,0]]:[false,[v$4226,v$4227,v$4224,2]];
 break; }case 1: {return v$4223?[false,[v$4226,v$4227,v$4224,2]]:[false,[v$4226,v$4227,v$4224,1]];
 break; }default: {if (v$4223) {var v$4210;
if (v$4224 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree03!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree03!"];
} else {v$4210 = v$4224;
};
var v$4211 = v$4210[0];
var v$4212 = v$4210[1];
var v$4213 = v$4210[2];
var v$4214 = v$4210[3];
var t$5203;
var v$5072 = 0;
switch (v$4214) { case 0: {switch (v$5072) { case 0: {t$5203 = true;
 break; }default: {t$5203 = false;
} };
 break; }case 1: {switch (v$5072) { case 1: {t$5203 = true;
 break; }default: {t$5203 = false;
} };
 break; }case 2: {switch (v$5072) { case 2: {t$5203 = true;
 break; }default: {t$5203 = false;
} };
 break; } };
if (t$5203) {return [false,[v$4211,[v$4226,v$4227,v$4212,2],v$4213,2]];
} else {var v$4198;
if (v$4212 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree04!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree04!"];
} else {v$4198 = v$4212;
};
var v$4199 = v$4198[0];
var v$4200 = v$4198[1];
var v$4201 = v$4198[2];
var v$4202 = v$4198[3];
var t$5221 = false;
var t$5220;
var t$5219;
var t$5218 = v$4199;
var t$5217;
var t$5216;
var t$5215 = v$4226;
var t$5214 = v$4227;
var t$5213 = v$4200;
var t$5212;
var t$5211;
var v$5076 = 0;
switch (v$4202) { case 0: {switch (v$5076) { case 0: {t$5211 = true;
 break; }default: {t$5211 = false;
} };
 break; }case 1: {switch (v$5076) { case 1: {t$5211 = true;
 break; }default: {t$5211 = false;
} };
 break; }case 2: {switch (v$5076) { case 2: {t$5211 = true;
 break; }default: {t$5211 = false;
} };
 break; } };
t$5212 = (t$5211?1:2);
t$5216 = [t$5215,t$5214,t$5213,t$5212];
t$5217 = t$5216;
var t$5210;
var t$5209;
var t$5208 = v$4211;
var t$5207 = v$4201;
var t$5206 = v$4213;
var t$5205;
var t$5204;
var v$5078 = 1;
switch (v$4202) { case 0: {switch (v$5078) { case 0: {t$5204 = true;
 break; }default: {t$5204 = false;
} };
 break; }case 1: {switch (v$5078) { case 1: {t$5204 = true;
 break; }default: {t$5204 = false;
} };
 break; }case 2: {switch (v$5078) { case 2: {t$5204 = true;
 break; }default: {t$5204 = false;
} };
 break; } };
t$5205 = (t$5204?0:2);
t$5209 = [t$5208,t$5207,t$5206,t$5205];
t$5210 = t$5209;
t$5219 = [t$5218,t$5217,t$5210,2];
t$5220 = t$5219;
return [t$5221,t$5220];
};
} else {return [false,[v$4226,v$4227,v$4224,0]];
};
} };
};
};
};
};
var ins$4069 = fix$5181.$ins;
try {return (ins$4069(t$4068))[1];
} catch(v$5182) {return (function(ALREADYTHERE$4236){var t$5183 = ALREADYTHERE$4236;
if (t$5183[0] == basics$ElabTopdec$$7.en$ALREADYTHERE$4061) {return t$4068;
} else {throw ALREADYTHERE$4236;
};
})(v$5182);
};
};
basics$ElabTopdec$$7.list$4237 = function(s$4240){var fix$5222 = {};
fix$5222.$f = function(v$4244,v$4247){lab$f: while (true) {if (v$4244 == null) {return v$4247;
} else {var v$4259 = v$4244;
var v$4260 = v$4259[0];
var v$4261 = v$4259[1];
var v$4262 = v$4259[2];
var t$5223 = v$4261;
var t$5224 = [v$4260,fix$5222.$f(v$4262,v$4247)];
var v$4244 = t$5223;
var v$4247 = t$5224;
continue lab$f;
};
};
};
var f$4241 = fix$5222.$f;
return f$4241(s$4240,null);
};
var fix$5225 = {};
fix$5225.$fromList = function(l$4267){lab$fromList: while (true) {if (l$4267 == null) {return basics$ElabTopdec$$7.empty$3971;
} else {var v$4274 = l$4267;
var v$4275 = v$4274[0];
var v$4276 = v$4274[1];
return basics$ElabTopdec$$7.insert$4062(v$4275,fix$5225.$fromList(v$4276));
};
};
};
basics$ElabTopdec$$7.fromList$4264 = fix$5225.$fromList;
var fix$5226 = {};
fix$5226.$union = function(s1$4280,s2$4283){lab$union: while (true) {if (s2$4283 == null) {return s1$4280;
} else {var v$4291 = s2$4283;
var v$4292 = v$4291[0];
var v$4293 = v$4291[1];
var v$4294 = v$4291[2];
var t$5227 = fix$5226.$union(basics$ElabTopdec$$7.insert$4062(v$4292,s1$4280),v$4293);
var t$5228 = v$4294;
var s1$4280 = t$5227;
var s2$4283 = t$5228;
continue lab$union;
};
};
};
basics$ElabTopdec$$7.union$4277 = fix$5226.$union;
var fix$5229 = {};
fix$5229.$addList = function(v$4298,v$4301){lab$addList: while (true) {if (v$4298 == null) {return v$4301;
} else {var v$4312 = v$4298;
var v$4313 = v$4312[0];
var v$4314 = v$4312[1];
var t$5230 = v$4314;
var t$5231 = basics$ElabTopdec$$7.insert$4062(v$4313,v$4301);
var v$4298 = t$5230;
var v$4301 = t$5231;
continue lab$addList;
};
};
};
basics$ElabTopdec$$7.addList$4295 = fix$5229.$addList;
basics$ElabTopdec$$7.en$NOTFOUND$4316 = new String("NOTFOUND");
basics$ElabTopdec$$7.exn$NOTFOUND$4316 = [basics$ElabTopdec$$7.en$NOTFOUND$4316];
basics$ElabTopdec$$7.remove$4317 = function(k0$4320,t$4323){var balance1$4324 = function(v$4327){if (v$4327 == null) {basis$General$.print$156("Impossible.OrderSet.(balance1 on an empty tree)");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.(balance1 on an empty tree)"];
} else {var v$4392 = v$4327;
var v$4393 = v$4392[0];
var v$4394 = v$4392[1];
var v$4395 = v$4392[2];
switch (v$4392[3]) { case 1: {return [[v$4393,v$4394,v$4395,2],true];
 break; }case 2: {return [[v$4393,v$4394,v$4395,0],false];
 break; }default: {var v$4380;
if (v$4395 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree11!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree11!"];
} else {v$4380 = v$4395;
};
var v$4381 = v$4380[0];
var v$4382 = v$4380[1];
var v$4383 = v$4380[2];
switch (v$4380[3]) { case 1: {var v$4368;
if (v$4382 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree12!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree12!"];
} else {v$4368 = v$4382;
};
var v$4369 = v$4368[0];
var v$4370 = v$4368[1];
var v$4371 = v$4368[2];
var v$4372 = v$4368[3];
var t$5248;
var t$5247;
var t$5246 = v$4369;
var t$5245;
var t$5244;
var t$5243 = v$4393;
var t$5242 = v$4394;
var t$5241 = v$4370;
var t$5240;
var t$5239;
var v$5090 = 0;
switch (v$4372) { case 0: {switch (v$5090) { case 0: {t$5239 = true;
 break; }default: {t$5239 = false;
} };
 break; }case 1: {switch (v$5090) { case 1: {t$5239 = true;
 break; }default: {t$5239 = false;
} };
 break; }case 2: {switch (v$5090) { case 2: {t$5239 = true;
 break; }default: {t$5239 = false;
} };
 break; } };
t$5240 = (t$5239?1:2);
t$5244 = [t$5243,t$5242,t$5241,t$5240];
t$5245 = t$5244;
var t$5238;
var t$5237;
var t$5236 = v$4381;
var t$5235 = v$4371;
var t$5234 = v$4383;
var t$5233;
var t$5232;
var v$5092 = 1;
switch (v$4372) { case 0: {switch (v$5092) { case 0: {t$5232 = true;
 break; }default: {t$5232 = false;
} };
 break; }case 1: {switch (v$5092) { case 1: {t$5232 = true;
 break; }default: {t$5232 = false;
} };
 break; }case 2: {switch (v$5092) { case 2: {t$5232 = true;
 break; }default: {t$5232 = false;
} };
 break; } };
t$5233 = (t$5232?0:2);
t$5237 = [t$5236,t$5235,t$5234,t$5233];
t$5238 = t$5237;
t$5247 = [t$5246,t$5245,t$5238,2];
t$5248 = t$5247;
return [t$5248,true];
 break; }case 2: {return [[v$4381,[v$4393,v$4394,v$4382,0],v$4383,1],false];
 break; }default: {return [[v$4381,[v$4393,v$4394,v$4382,2],v$4383,2],true];
} };
} };
};
};
var balance2$4397 = function(v$4400){if (v$4400 == null) {basis$General$.print$156("Impossible.OrderSet.(balance2 on an empty tree)");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.(balance2 on an empty tree)"];
} else {var v$4465 = v$4400;
var v$4466 = v$4465[0];
var v$4467 = v$4465[1];
var v$4468 = v$4465[2];
switch (v$4465[3]) { case 0: {return [[v$4466,v$4467,v$4468,2],true];
 break; }case 2: {return [[v$4466,v$4467,v$4468,1],false];
 break; }default: {var v$4453;
if (v$4467 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree21!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree21!"];
} else {v$4453 = v$4467;
};
var v$4454 = v$4453[0];
var v$4455 = v$4453[1];
var v$4456 = v$4453[2];
switch (v$4453[3]) { case 0: {var v$4441;
if (v$4456 == null) {basis$General$.print$156("Impossible.OrderSet.empty tree22!");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.empty tree22!"];
} else {v$4441 = v$4456;
};
var v$4442 = v$4441[0];
var v$4443 = v$4441[1];
var v$4444 = v$4441[2];
var v$4445 = v$4441[3];
var t$5265;
var t$5264;
var t$5263 = v$4442;
var t$5262;
var t$5261;
var t$5260 = v$4454;
var t$5259 = v$4455;
var t$5258 = v$4443;
var t$5257;
var t$5256;
var v$5102 = 0;
switch (v$4445) { case 0: {switch (v$5102) { case 0: {t$5256 = true;
 break; }default: {t$5256 = false;
} };
 break; }case 1: {switch (v$5102) { case 1: {t$5256 = true;
 break; }default: {t$5256 = false;
} };
 break; }case 2: {switch (v$5102) { case 2: {t$5256 = true;
 break; }default: {t$5256 = false;
} };
 break; } };
t$5257 = (t$5256?1:2);
t$5261 = [t$5260,t$5259,t$5258,t$5257];
t$5262 = t$5261;
var t$5255;
var t$5254;
var t$5253 = v$4466;
var t$5252 = v$4444;
var t$5251 = v$4468;
var t$5250;
var t$5249;
var v$5100 = 1;
switch (v$4445) { case 0: {switch (v$5100) { case 0: {t$5249 = true;
 break; }default: {t$5249 = false;
} };
 break; }case 1: {switch (v$5100) { case 1: {t$5249 = true;
 break; }default: {t$5249 = false;
} };
 break; }case 2: {switch (v$5100) { case 2: {t$5249 = true;
 break; }default: {t$5249 = false;
} };
 break; } };
t$5250 = (t$5249?0:2);
t$5254 = [t$5253,t$5252,t$5251,t$5250];
t$5255 = t$5254;
t$5264 = [t$5263,t$5262,t$5255,2];
t$5265 = t$5264;
return [t$5265,true];
 break; }case 2: {return [[v$4454,v$4455,[v$4466,v$4456,v$4468,1],0],false];
 break; }default: {return [[v$4454,v$4455,[v$4466,v$4456,v$4468,2],2],true];
} };
} };
};
};
var fix$5266 = {};
fix$5266.$remove_rightmost = function(v$4473){if (v$4473 == null) {basis$General$.print$156("Impossible.OrderSet.(remove_rightmost on empty tree)");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.(remove_rightmost on empty tree)"];
} else {var v$4487 = v$4473;
var v$4488 = v$4487[2];
if (v$4488 == null) {return [v$4487[1],v$4487[0],true];
} else {var v$4510 = v$4487[0];
var v$4511 = v$4487[1];
var v$4512 = v$4487[3];
var v$4506 = fix$5266.$remove_rightmost(v$4488);
var v$4507 = v$4506[0];
var v$4508 = v$4506[1];
if (v$4506[2]) {var v$4503 = balance2$4397([v$4510,v$4511,v$4507,v$4512]);
return [v$4503[0],v$4508,v$4503[1]];
} else {return [[v$4510,v$4511,v$4507,v$4512],v$4508,false];
};
};
};
};
var remove_rightmost$4470 = fix$5266.$remove_rightmost;
var fix$5267 = {};
fix$5267.$del = function(v$4516){lab$del: while (true) {if (v$4516 == null) {throw basics$ElabTopdec$$7.exn$NOTFOUND$4316;
} else {var v$4573 = v$4516;
var v$4574 = v$4573[0];
var v$4575 = v$4573[1];
var v$4576 = v$4573[2];
var v$4577 = v$4573[3];
if (basics$ElabTopdec$$6.lt$3901(k0$4320,v$4574)) {var v$4536 = fix$5267.$del(v$4575);
var v$4537 = v$4536[0];
if (v$4536[1]) {return balance1$4324([v$4574,v$4537,v$4576,v$4577]);
} else {return [[v$4574,v$4537,v$4576,v$4577],false];
};
} else {if (basics$ElabTopdec$$6.lt$3901(v$4574,k0$4320)) {var v$4550 = fix$5267.$del(v$4576);
var v$4551 = v$4550[0];
if (v$4550[1]) {return balance2$4397([v$4574,v$4575,v$4551,v$4577]);
} else {return [[v$4574,v$4575,v$4551,v$4577],false];
};
} else {if (v$4576 == null) {return [v$4575,true];
} else {if (v$4575 == null) {return [v$4576,true];
} else {var v$4569 = remove_rightmost$4470(v$4575);
var v$4570 = v$4569[0];
var v$4571 = v$4569[1];
if (v$4569[2]) {return balance1$4324([v$4571,v$4570,v$4576,v$4577]);
} else {return [[v$4571,v$4570,v$4576,v$4577],false];
};
};
};
};
};
};
};
};
var del$4513 = fix$5267.$del;
try {return (del$4513(t$4323))[0];
} catch(v$5268) {return (function(NOTFOUND$4584){var t$5269 = NOTFOUND$4584;
if (t$5269[0] == basics$ElabTopdec$$7.en$NOTFOUND$4316) {return t$4323;
} else {throw NOTFOUND$4584;
};
})(v$5268);
};
};
var fix$5270 = {};
fix$5270.$difference = function(s1$4588,s2$4591){lab$difference: while (true) {if (s1$4588 == null) {return null;
} else {if (s2$4591 == null) {return s1$4588;
} else {var v$4603 = s2$4591;
var v$4604 = v$4603[0];
var v$4605 = v$4603[1];
var v$4606 = v$4603[2];
var t$5271 = fix$5270.$difference(basics$ElabTopdec$$7.remove$4317(v$4604,s1$4588),v$4605);
var t$5272 = v$4606;
var s1$4588 = t$5271;
var s2$4591 = t$5272;
continue lab$difference;
};
};
};
};
basics$ElabTopdec$$7.difference$4585 = fix$5270.$difference;
basics$ElabTopdec$$7.intersect$4607 = function(s1$4610,s2$4613){var fix$5273 = {};
fix$5273.$inters = function(v$4617,v$4620){lab$inters: while (true) {if (v$4617 == null) {return v$4620;
} else {var v$4636 = v$4617;
var v$4637 = v$4636[0];
var v$4638 = v$4636[1];
var v$4639 = v$4636[2];
var t$5274 = v$4638;
var t$5275 = fix$5273.$inters(v$4639,(basics$ElabTopdec$$7.member$3997(v$4637,s2$4613))?(basics$ElabTopdec$$7.insert$4062(v$4637,v$4620)):v$4620);
var v$4617 = t$5274;
var v$4620 = t$5275;
continue lab$inters;
};
};
};
var inters$4614 = fix$5273.$inters;
return inters$4614(s1$4610,basics$ElabTopdec$$7.empty$3971);
};
basics$ElabTopdec$$7.partition$4641 = function(f$4644,s$4647){var fix$5276 = {};
fix$5276.$g = function(v$4651,v$4654){lab$g: while (true) {if (v$4651 == null) {return v$4654;
} else {var v$4672 = v$4651;
var v$4673 = v$4672[0];
var v$4674 = v$4672[1];
var v$4675 = v$4672[2];
var v$4677 = v$4654[0];
var v$4678 = v$4654[1];
var b$4667 = (f$4644(v$4673))?[basics$ElabTopdec$$7.insert$4062(v$4673,v$4677),v$4678]:[v$4677,basics$ElabTopdec$$7.insert$4062(v$4673,v$4678)];
var t$5277 = v$4675;
var t$5278 = fix$5276.$g(v$4674,b$4667);
var v$4651 = t$5277;
var v$4654 = t$5278;
continue lab$g;
};
};
};
var g$4648 = fix$5276.$g;
return g$4648(s$4647,[basics$ElabTopdec$$7.empty$3971,basics$ElabTopdec$$7.empty$3971]);
};
basics$ElabTopdec$$7.fold$4679 = function(f$4682,e$4685,t$4688){var fix$5279 = {};
fix$5279.$fold$ = function(v$4692,v$4695){lab$fold$: while (true) {if (v$4692 == null) {return v$4695;
} else {var v$4707 = v$4692;
var v$4708 = v$4707[0];
var v$4709 = v$4707[1];
var v$4710 = v$4707[2];
var t$5280 = v$4710;
var t$5281 = (f$4682(v$4708))(fix$5279.$fold$(v$4709,v$4695));
var v$4692 = t$5280;
var v$4695 = t$5281;
continue lab$fold$;
};
};
};
var fold$$4689 = fix$5279.$fold$;
return fold$$4689(t$4688,e$4685);
};
basics$ElabTopdec$$7.listmap$4712 = function(f$4977,l$4978){var fix$5282 = {};
fix$5282.$map = function(v$4980){if (v$4980 == null) {return null;
} else {var v$4981 = v$4980;
var v$4982 = v$4981[0];
var v$4983 = v$4981[1];
return [f$4977(v$4982),fix$5282.$map(v$4983)];
};
};
var map$4979 = fix$5282.$map;
return map$4979(l$4978);
};
basics$ElabTopdec$$7.map$4713 = function(f$4716,t$4719){var t$5288 = basics$ElabTopdec$$7.fromList$4264;
var t$5286;
var l$4985;
var fix$5283 = {};
fix$5283.$f = function(v$4993,v$4994){lab$f: while (true) {if (v$4993 == null) {return v$4994;
} else {var v$4997 = v$4993;
var v$4998 = v$4997[0];
var v$4999 = v$4997[1];
var v$5000 = v$4997[2];
var t$5284 = v$4999;
var t$5285 = [v$4998,fix$5283.$f(v$5000,v$4994)];
var v$4993 = t$5284;
var v$4994 = t$5285;
continue lab$f;
};
};
};
var f$4992 = fix$5283.$f;
l$4985 = (f$4992(t$4719,null));
var fix$5287 = {};
fix$5287.$map = function(v$4987){if (v$4987 == null) {return null;
} else {var v$4988 = v$4987;
var v$4989 = v$4988[0];
var v$4990 = v$4988[1];
return [f$4716(v$4989),fix$5287.$map(v$4990)];
};
};
var map$4986 = fix$5287.$map;
t$5286 = (map$4986(l$4985));
return t$5288(t$5286);
};
basics$ElabTopdec$$7.subst$4720 = function(v$4732,v$4733){return function(s$4727){if (basics$ElabTopdec$$7.member$3997(v$4733,s$4727)) {return basics$ElabTopdec$$7.insert$4062(v$4732,basics$ElabTopdec$$7.remove$4317(v$4733,s$4727));
} else {return s$4727;
};
};
};
basics$ElabTopdec$$7.apply$4734 = function(f$4737,s$4740){var fix$5289 = {};
fix$5289.$appl = function(v$4744){lab$appl: while (true) {if (v$4744 == null) {return 0;
} else {var v$4756 = v$4744;
var v$4757 = v$4756[0];
var v$4758 = v$4756[1];
var v$4759 = v$4756[2];
fix$5289.$appl(v$4758);
f$4737(v$4757);
var t$5290 = v$4759;
var v$4744 = t$5290;
continue lab$appl;
};
};
};
var appl$4741 = fix$5289.$appl;
return appl$4741(s$4740);
};
basics$ElabTopdec$$7.layoutSet$4760 = function(v$4779,v$4778,v$4777){return function(layoutItem$4768){return function(s$4771){var t$5291;
var v$4775 = [0,v$4778];
var t$5295;
var l$5003;
var fix$5292 = {};
fix$5292.$f = function(v$5011,v$5012){lab$f: while (true) {if (v$5011 == null) {return v$5012;
} else {var v$5015 = v$5011;
var v$5016 = v$5015[0];
var v$5017 = v$5015[1];
var v$5018 = v$5015[2];
var t$5293 = v$5017;
var t$5294 = [v$5016,fix$5292.$f(v$5018,v$5012)];
var v$5011 = t$5293;
var v$5012 = t$5294;
continue lab$f;
};
};
};
var f$5010 = fix$5292.$f;
l$5003 = (f$5010(s$4771,null));
var fix$5296 = {};
fix$5296.$map = function(v$5005){if (v$5005 == null) {return null;
} else {var v$5006 = v$5005;
var v$5007 = v$5006[0];
var v$5008 = v$5006[1];
return [layoutItem$4768(v$5007),fix$5296.$map(v$5008)];
};
};
var map$5004 = fix$5296.$map;
t$5295 = (map$5004(l$5003));
t$5291 = [t$5295,v$4775,v$4779,3,v$4777];
return [0,t$5291];
};
};
};
basics$ElabTopdec$$7.pu_bal$4780 = pickle$pickle$.enumGen$2149(function(v$5020){var v$5021 = v$5020[0];
var v$5022 = v$5020[1];
switch (v$5021) { case 0: {switch (v$5022) { case 0: {return true;
 break; }default: {return false;
} };
 break; }case 1: {switch (v$5022) { case 1: {return true;
 break; }default: {return false;
} };
 break; }case 2: {switch (v$5022) { case 2: {return true;
 break; }default: {return false;
} };
 break; } };
},["OrderSet.bal",[1,[2,[0,null]]]]);
basics$ElabTopdec$$7.pu$4781 = function(pu_elt$4784){var funE$4793;
var v$5173 = null;
funE$4793 = (function(v$5174){return pickle$pickle$.con0$1979(v$5173,v$5174);
});
return pickle$pickle$.dataGen$1479(["OrderSet.Set",function(v$5026){return (v$5026 == null)?0:1;
},[funE$4793,[function(pu$5027){return pickle$pickle$.con1$2005(function(v$5028){return v$5028;
},function(v$5029){if (v$5029 == null) {basis$General$.print$156("Impossible.OrderSet.pu.N");
throw [basics$ElabTopdec$$7.en$Impossible$3958,"Impossible.OrderSet.pu.N"];
} else {return v$5029;
};
},pickle$pickle$.tup4Gen0$2368(pu_elt$4784,pu$5027,pu$5027,basics$ElabTopdec$$7.pu_bal$4780));
},null]]]);
};
return 0;
})();
