chore: update stage0

This commit is contained in:
Leonardo de Moura 2019-11-26 17:57:21 -08:00
parent 42fcf6e6e8
commit e08c6def07
4 changed files with 1753 additions and 1577 deletions

View file

@ -132,11 +132,11 @@ private def tmpStar := mkMVar tmpMVarId
instance {α} : Inhabited (DiscrTree α) := ⟨{}⟩
private partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Array Expr → MetaM (Array Expr)
private partial def pushArgsAux (infos : Array ParamInfo) (ignoreImplicit : Bool) : Nat → Expr → Array Expr → MetaM (Array Expr)
| i, Expr.app f a _, todo =>
if h : i < infos.size then
let info := infos.get ⟨i, h⟩;
if info.implicit || info.instImplicit then
if (info.implicit && ignoreImplicit) || info.instImplicit then
pushArgsAux (i-1) f (todo.push tmpStar)
else condM (isProof a)
(pushArgsAux (i-1) f (todo.push tmpStar))
@ -146,12 +146,12 @@ private partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Arr
(pushArgsAux (i-1) f (todo.push a))
| _, _, todo => pure todo
private def pushArgs (todo : Array Expr) (e : Expr) : MetaM (Key × Array Expr) :=
private def pushArgs (todo : Array Expr) (e : Expr) (ignoreImplicit : Bool) : MetaM (Key × Array Expr) :=
do e ← whnf e;
let fn := e.getAppFn;
let push (k : Key) (nargs : Nat) : MetaM (Key × Array Expr) := do {
info ← getFunInfoNArgs fn nargs;
todo ← pushArgsAux info.paramInfo (nargs-1) e todo;
todo ← pushArgsAux info.paramInfo ignoreImplicit (nargs-1) e todo;
pure (k, todo)
};
match fn with
@ -167,23 +167,23 @@ do e ← whnf e;
(pure (Key.star, todo))
| _ => pure (Key.other, todo)
partial def mkPathAux : Array Expr → Array Key → MetaM (Array Key)
partial def mkPathAux (ignoreImplicit : Bool) : Array Expr → Array Key → MetaM (Array Key)
| todo, keys =>
if todo.isEmpty then
pure keys
else do
let e := todo.back;
let todo := todo.pop;
(k, todo) ← pushArgs todo e;
(k, todo) ← pushArgs todo e ignoreImplicit;
mkPathAux todo (keys.push k)
private def initCapacity := 8
def mkPath (e : Expr) : MetaM (Array Key) :=
def mkPath (e : Expr) (ignoreImplicit : Bool) : MetaM (Array Key) :=
usingTransparency TransparencyMode.reducible $ do
let todo : Array Expr := Array.mkEmpty initCapacity;
let keys : Array Key := Array.mkEmpty initCapacity;
mkPathAux (todo.push e) keys
mkPathAux ignoreImplicit (todo.push e) keys
private partial def createNodes {α} (keys : Array Key) (v : α) : Nat → Trie α
| i =>
@ -222,8 +222,8 @@ else
let c := insertAux keys v 1 c;
{ root := d.root.insert k c }
def insert {α} [HasBeq α] (d : DiscrTree α) (e : Expr) (v : α) : MetaM (DiscrTree α) :=
do keys ← mkPath e;
def insert {α} [HasBeq α] (d : DiscrTree α) (e : Expr) (v : α) (ignoreImplicit : Bool := true) : MetaM (DiscrTree α) :=
do keys ← mkPath e ignoreImplicit;
pure $ d.insertCore keys v
partial def Trie.format {α} [HasFormat α] : Trie α → Format

View file

@ -13,24 +13,26 @@ structure InstanceEntry :=
(keys : Array DiscrTree.Key)
(val : Expr)
def addInstanceEntry (d : DiscrTree Expr) (e : InstanceEntry) : DiscrTree Expr :=
abbrev Instances := DiscrTree Expr
def addInstanceEntry (d : Instances) (e : InstanceEntry) : Instances :=
d.insertCore e.keys e.val
def mkInstanceExtension : IO (SimplePersistentEnvExtension InstanceEntry (DiscrTree Expr)) :=
def mkInstanceExtension : IO (SimplePersistentEnvExtension InstanceEntry Instances) :=
registerSimplePersistentEnvExtension {
name := `instanceExt,
addEntryFn := addInstanceEntry,
addImportedFn := fun es => (mkStateFromImportedEntries addInstanceEntry {} es)
addImportedFn := fun es => (mkStateFromImportedEntries addInstanceEntry DiscrTree.empty es)
}
@[init mkInstanceExtension]
constant instanceExtension : SimplePersistentEnvExtension InstanceEntry (DiscrTree Expr) := arbitrary _
constant instanceExtension : SimplePersistentEnvExtension InstanceEntry Instances := arbitrary _
private def mkInstanceKey (e : Expr) : MetaM (Array DiscrTree.Key) :=
do type ← inferType e;
withNewMCtxDepth $ do
(_, _, type) ← forallMetaTelescopeReducing type;
DiscrTree.mkPath type
DiscrTree.mkPath type false /- Do not ignore implicit arguments, only instImplicit -/
def addGlobalInstance (env : Environment) (constName : Name) : IO Environment :=
match env.find constName with
@ -40,7 +42,7 @@ match env.find constName with
(keys, env) ← IO.runMeta (mkInstanceKey c) env;
pure $ instanceExtension.addEntry env { keys := keys, val := c }
def getInstances (env : Environment) : DiscrTree Expr :=
def getInstances (env : Environment) : Instances :=
instanceExtension.getState env
@[init] def registerInstanceAttr : IO Unit :=

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@ lean_object* l_Lean_Meta_mkInstanceExtension___lambda__1___boxed(lean_object*);
lean_object* l_Lean_Meta_instanceExtension___elambda__4___boxed(lean_object*);
lean_object* l_Lean_Meta_DiscrTree_insertCore___at_Lean_Meta_addInstanceEntry___spec__1(lean_object*, lean_object*, lean_object*);
size_t l_USize_add(size_t, size_t);
lean_object* l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1;
lean_object* l_Lean_registerPersistentEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__5(lean_object*, lean_object*);
extern lean_object* l___private_Init_Lean_Environment_8__persistentEnvExtensionsRef;
lean_object* l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7___closed__1;
@ -107,7 +108,7 @@ lean_object* l_Lean_PersistentEnvExtension_addEntry___rarg(lean_object*, lean_ob
size_t l_USize_land(size_t, size_t);
lean_object* l_Lean_Meta_addGlobalInstance___closed__2;
lean_object* l_Lean_SimplePersistentEnvExtension_getState___rarg(lean_object*, lean_object*);
lean_object* l_Lean_Meta_DiscrTree_mkPath(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_DiscrTree_mkPath(lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_Meta_forallMetaTelescopeReducing(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_registerPersistentEnvExtensionUnsafe___rarg___closed__3;
lean_object* l_Lean_Meta_getInstances(lean_object*);
@ -180,6 +181,7 @@ lean_object* l_Lean_Meta_addGlobalInstance___closed__3;
size_t l_Lean_Meta_DiscrTree_Key_hash(lean_object*);
lean_object* l_PersistentHashMap_mkCollisionNode___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_anyRangeMAux___main___at_Lean_Meta_addInstanceEntry___spec__12___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_DiscrTree_empty(lean_object*);
lean_object* l_Lean_Meta_instanceExtension___elambda__2___boxed(lean_object*);
extern lean_object* l_Lean_NameGenerator_Inhabited___closed__3;
lean_object* l_Lean_Meta_instanceExtension___closed__6;
@ -2555,12 +2557,20 @@ x_9 = l_Lean_registerPersistentEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExten
return x_9;
}
}
lean_object* _init_l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_Meta_DiscrTree_empty(lean_box(0));
return x_1;
}
}
lean_object* l_Lean_Meta_mkInstanceExtension___lambda__1(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_2 = lean_unsigned_to_nat(0u);
x_3 = l_Lean_Meta_DiscrTree_empty___closed__1;
x_3 = l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1;
x_4 = l_Array_iterateMAux___main___at_Lean_Meta_mkInstanceExtension___spec__3(x_1, x_1, x_2, x_3);
return x_4;
}
@ -2850,7 +2860,7 @@ x_12 = l_Lean_Meta_forallMetaTelescopeReducing(x_5, x_7, x_2, x_6);
lean_dec(x_5);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_13, 1);
@ -2862,508 +2872,510 @@ lean_dec(x_12);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_Meta_DiscrTree_mkPath(x_16, x_2, x_15);
if (lean_obj_tag(x_17) == 0)
x_17 = 0;
x_18 = l_Lean_Meta_DiscrTree_mkPath(x_16, x_17, x_2, x_15);
if (lean_obj_tag(x_18) == 0)
{
uint8_t x_18;
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
uint8_t x_19;
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_19; uint8_t x_20;
x_19 = lean_ctor_get(x_17, 1);
x_20 = !lean_is_exclusive(x_19);
if (x_20 == 0)
lean_object* x_20; uint8_t x_21;
x_20 = lean_ctor_get(x_18, 1);
x_21 = !lean_is_exclusive(x_20);
if (x_21 == 0)
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_19, 2);
lean_dec(x_21);
x_22 = lean_ctor_get(x_19, 1);
lean_object* x_22; lean_object* x_23;
x_22 = lean_ctor_get(x_20, 2);
lean_dec(x_22);
lean_ctor_set(x_19, 2, x_10);
lean_ctor_set(x_19, 1, x_9);
return x_17;
x_23 = lean_ctor_get(x_20, 1);
lean_dec(x_23);
lean_ctor_set(x_20, 2, x_10);
lean_ctor_set(x_20, 1, x_9);
return x_18;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_19, 0);
x_24 = lean_ctor_get(x_19, 3);
x_25 = lean_ctor_get(x_19, 4);
x_26 = lean_ctor_get(x_19, 5);
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_24 = lean_ctor_get(x_20, 0);
x_25 = lean_ctor_get(x_20, 3);
x_26 = lean_ctor_get(x_20, 4);
x_27 = lean_ctor_get(x_20, 5);
lean_inc(x_27);
lean_inc(x_26);
lean_inc(x_25);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_19);
x_27 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_27, 0, x_23);
lean_ctor_set(x_27, 1, x_9);
lean_ctor_set(x_27, 2, x_10);
lean_ctor_set(x_27, 3, x_24);
lean_ctor_set(x_27, 4, x_25);
lean_ctor_set(x_27, 5, x_26);
lean_ctor_set(x_17, 1, x_27);
return x_17;
lean_dec(x_20);
x_28 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_28, 0, x_24);
lean_ctor_set(x_28, 1, x_9);
lean_ctor_set(x_28, 2, x_10);
lean_ctor_set(x_28, 3, x_25);
lean_ctor_set(x_28, 4, x_26);
lean_ctor_set(x_28, 5, x_27);
lean_ctor_set(x_18, 1, x_28);
return x_18;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_28 = lean_ctor_get(x_17, 1);
x_29 = lean_ctor_get(x_17, 0);
lean_inc(x_28);
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_29 = lean_ctor_get(x_18, 1);
x_30 = lean_ctor_get(x_18, 0);
lean_inc(x_29);
lean_dec(x_17);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_28, 3);
lean_dec(x_18);
x_31 = lean_ctor_get(x_29, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_28, 4);
x_32 = lean_ctor_get(x_29, 3);
lean_inc(x_32);
x_33 = lean_ctor_get(x_28, 5);
x_33 = lean_ctor_get(x_29, 4);
lean_inc(x_33);
if (lean_is_exclusive(x_28)) {
lean_ctor_release(x_28, 0);
lean_ctor_release(x_28, 1);
lean_ctor_release(x_28, 2);
lean_ctor_release(x_28, 3);
lean_ctor_release(x_28, 4);
lean_ctor_release(x_28, 5);
x_34 = x_28;
x_34 = lean_ctor_get(x_29, 5);
lean_inc(x_34);
if (lean_is_exclusive(x_29)) {
lean_ctor_release(x_29, 0);
lean_ctor_release(x_29, 1);
lean_ctor_release(x_29, 2);
lean_ctor_release(x_29, 3);
lean_ctor_release(x_29, 4);
lean_ctor_release(x_29, 5);
x_35 = x_29;
} else {
lean_dec_ref(x_28);
x_34 = lean_box(0);
lean_dec_ref(x_29);
x_35 = lean_box(0);
}
if (lean_is_scalar(x_34)) {
x_35 = lean_alloc_ctor(0, 6, 0);
if (lean_is_scalar(x_35)) {
x_36 = lean_alloc_ctor(0, 6, 0);
} else {
x_35 = x_34;
x_36 = x_35;
}
lean_ctor_set(x_35, 0, x_30);
lean_ctor_set(x_35, 1, x_9);
lean_ctor_set(x_35, 2, x_10);
lean_ctor_set(x_35, 3, x_31);
lean_ctor_set(x_35, 4, x_32);
lean_ctor_set(x_35, 5, x_33);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_29);
lean_ctor_set(x_36, 1, x_35);
return x_36;
lean_ctor_set(x_36, 0, x_31);
lean_ctor_set(x_36, 1, x_9);
lean_ctor_set(x_36, 2, x_10);
lean_ctor_set(x_36, 3, x_32);
lean_ctor_set(x_36, 4, x_33);
lean_ctor_set(x_36, 5, x_34);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_30);
lean_ctor_set(x_37, 1, x_36);
return x_37;
}
}
else
{
uint8_t x_37;
x_37 = !lean_is_exclusive(x_17);
if (x_37 == 0)
uint8_t x_38;
x_38 = !lean_is_exclusive(x_18);
if (x_38 == 0)
{
lean_object* x_38; uint8_t x_39;
x_38 = lean_ctor_get(x_17, 1);
x_39 = !lean_is_exclusive(x_38);
if (x_39 == 0)
lean_object* x_39; uint8_t x_40;
x_39 = lean_ctor_get(x_18, 1);
x_40 = !lean_is_exclusive(x_39);
if (x_40 == 0)
{
lean_object* x_40; lean_object* x_41;
x_40 = lean_ctor_get(x_38, 2);
lean_dec(x_40);
x_41 = lean_ctor_get(x_38, 1);
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_39, 2);
lean_dec(x_41);
lean_ctor_set(x_38, 2, x_10);
lean_ctor_set(x_38, 1, x_9);
return x_17;
x_42 = lean_ctor_get(x_39, 1);
lean_dec(x_42);
lean_ctor_set(x_39, 2, x_10);
lean_ctor_set(x_39, 1, x_9);
return x_18;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_42 = lean_ctor_get(x_38, 0);
x_43 = lean_ctor_get(x_38, 3);
x_44 = lean_ctor_get(x_38, 4);
x_45 = lean_ctor_get(x_38, 5);
lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_43 = lean_ctor_get(x_39, 0);
x_44 = lean_ctor_get(x_39, 3);
x_45 = lean_ctor_get(x_39, 4);
x_46 = lean_ctor_get(x_39, 5);
lean_inc(x_46);
lean_inc(x_45);
lean_inc(x_44);
lean_inc(x_43);
lean_inc(x_42);
lean_dec(x_38);
x_46 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_46, 0, x_42);
lean_ctor_set(x_46, 1, x_9);
lean_ctor_set(x_46, 2, x_10);
lean_ctor_set(x_46, 3, x_43);
lean_ctor_set(x_46, 4, x_44);
lean_ctor_set(x_46, 5, x_45);
lean_ctor_set(x_17, 1, x_46);
return x_17;
lean_dec(x_39);
x_47 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_47, 0, x_43);
lean_ctor_set(x_47, 1, x_9);
lean_ctor_set(x_47, 2, x_10);
lean_ctor_set(x_47, 3, x_44);
lean_ctor_set(x_47, 4, x_45);
lean_ctor_set(x_47, 5, x_46);
lean_ctor_set(x_18, 1, x_47);
return x_18;
}
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_47 = lean_ctor_get(x_17, 1);
x_48 = lean_ctor_get(x_17, 0);
lean_inc(x_47);
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_48 = lean_ctor_get(x_18, 1);
x_49 = lean_ctor_get(x_18, 0);
lean_inc(x_48);
lean_dec(x_17);
x_49 = lean_ctor_get(x_47, 0);
lean_inc(x_49);
x_50 = lean_ctor_get(x_47, 3);
lean_dec(x_18);
x_50 = lean_ctor_get(x_48, 0);
lean_inc(x_50);
x_51 = lean_ctor_get(x_47, 4);
x_51 = lean_ctor_get(x_48, 3);
lean_inc(x_51);
x_52 = lean_ctor_get(x_47, 5);
x_52 = lean_ctor_get(x_48, 4);
lean_inc(x_52);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
lean_ctor_release(x_47, 2);
lean_ctor_release(x_47, 3);
lean_ctor_release(x_47, 4);
lean_ctor_release(x_47, 5);
x_53 = x_47;
x_53 = lean_ctor_get(x_48, 5);
lean_inc(x_53);
if (lean_is_exclusive(x_48)) {
lean_ctor_release(x_48, 0);
lean_ctor_release(x_48, 1);
lean_ctor_release(x_48, 2);
lean_ctor_release(x_48, 3);
lean_ctor_release(x_48, 4);
lean_ctor_release(x_48, 5);
x_54 = x_48;
} else {
lean_dec_ref(x_47);
x_53 = lean_box(0);
lean_dec_ref(x_48);
x_54 = lean_box(0);
}
if (lean_is_scalar(x_53)) {
x_54 = lean_alloc_ctor(0, 6, 0);
if (lean_is_scalar(x_54)) {
x_55 = lean_alloc_ctor(0, 6, 0);
} else {
x_54 = x_53;
x_55 = x_54;
}
lean_ctor_set(x_54, 0, x_49);
lean_ctor_set(x_54, 1, x_9);
lean_ctor_set(x_54, 2, x_10);
lean_ctor_set(x_54, 3, x_50);
lean_ctor_set(x_54, 4, x_51);
lean_ctor_set(x_54, 5, x_52);
x_55 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_55, 0, x_48);
lean_ctor_set(x_55, 1, x_54);
return x_55;
lean_ctor_set(x_55, 0, x_50);
lean_ctor_set(x_55, 1, x_9);
lean_ctor_set(x_55, 2, x_10);
lean_ctor_set(x_55, 3, x_51);
lean_ctor_set(x_55, 4, x_52);
lean_ctor_set(x_55, 5, x_53);
x_56 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_56, 0, x_49);
lean_ctor_set(x_56, 1, x_55);
return x_56;
}
}
}
else
{
uint8_t x_56;
uint8_t x_57;
lean_dec(x_2);
x_56 = !lean_is_exclusive(x_12);
if (x_56 == 0)
x_57 = !lean_is_exclusive(x_12);
if (x_57 == 0)
{
lean_object* x_57; uint8_t x_58;
x_57 = lean_ctor_get(x_12, 1);
x_58 = !lean_is_exclusive(x_57);
if (x_58 == 0)
lean_object* x_58; uint8_t x_59;
x_58 = lean_ctor_get(x_12, 1);
x_59 = !lean_is_exclusive(x_58);
if (x_59 == 0)
{
lean_object* x_59; lean_object* x_60;
x_59 = lean_ctor_get(x_57, 2);
lean_dec(x_59);
x_60 = lean_ctor_get(x_57, 1);
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_58, 2);
lean_dec(x_60);
lean_ctor_set(x_57, 2, x_10);
lean_ctor_set(x_57, 1, x_9);
x_61 = lean_ctor_get(x_58, 1);
lean_dec(x_61);
lean_ctor_set(x_58, 2, x_10);
lean_ctor_set(x_58, 1, x_9);
return x_12;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65;
x_61 = lean_ctor_get(x_57, 0);
x_62 = lean_ctor_get(x_57, 3);
x_63 = lean_ctor_get(x_57, 4);
x_64 = lean_ctor_get(x_57, 5);
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_62 = lean_ctor_get(x_58, 0);
x_63 = lean_ctor_get(x_58, 3);
x_64 = lean_ctor_get(x_58, 4);
x_65 = lean_ctor_get(x_58, 5);
lean_inc(x_65);
lean_inc(x_64);
lean_inc(x_63);
lean_inc(x_62);
lean_inc(x_61);
lean_dec(x_57);
x_65 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_65, 0, x_61);
lean_ctor_set(x_65, 1, x_9);
lean_ctor_set(x_65, 2, x_10);
lean_ctor_set(x_65, 3, x_62);
lean_ctor_set(x_65, 4, x_63);
lean_ctor_set(x_65, 5, x_64);
lean_ctor_set(x_12, 1, x_65);
lean_dec(x_58);
x_66 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_66, 0, x_62);
lean_ctor_set(x_66, 1, x_9);
lean_ctor_set(x_66, 2, x_10);
lean_ctor_set(x_66, 3, x_63);
lean_ctor_set(x_66, 4, x_64);
lean_ctor_set(x_66, 5, x_65);
lean_ctor_set(x_12, 1, x_66);
return x_12;
}
}
else
{
lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74;
x_66 = lean_ctor_get(x_12, 1);
x_67 = lean_ctor_get(x_12, 0);
lean_inc(x_66);
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75;
x_67 = lean_ctor_get(x_12, 1);
x_68 = lean_ctor_get(x_12, 0);
lean_inc(x_67);
lean_dec(x_12);
x_68 = lean_ctor_get(x_66, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_66, 3);
lean_dec(x_12);
x_69 = lean_ctor_get(x_67, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_66, 4);
x_70 = lean_ctor_get(x_67, 3);
lean_inc(x_70);
x_71 = lean_ctor_get(x_66, 5);
x_71 = lean_ctor_get(x_67, 4);
lean_inc(x_71);
if (lean_is_exclusive(x_66)) {
lean_ctor_release(x_66, 0);
lean_ctor_release(x_66, 1);
lean_ctor_release(x_66, 2);
lean_ctor_release(x_66, 3);
lean_ctor_release(x_66, 4);
lean_ctor_release(x_66, 5);
x_72 = x_66;
x_72 = lean_ctor_get(x_67, 5);
lean_inc(x_72);
if (lean_is_exclusive(x_67)) {
lean_ctor_release(x_67, 0);
lean_ctor_release(x_67, 1);
lean_ctor_release(x_67, 2);
lean_ctor_release(x_67, 3);
lean_ctor_release(x_67, 4);
lean_ctor_release(x_67, 5);
x_73 = x_67;
} else {
lean_dec_ref(x_66);
x_72 = lean_box(0);
lean_dec_ref(x_67);
x_73 = lean_box(0);
}
if (lean_is_scalar(x_72)) {
x_73 = lean_alloc_ctor(0, 6, 0);
if (lean_is_scalar(x_73)) {
x_74 = lean_alloc_ctor(0, 6, 0);
} else {
x_73 = x_72;
x_74 = x_73;
}
lean_ctor_set(x_73, 0, x_68);
lean_ctor_set(x_73, 1, x_9);
lean_ctor_set(x_73, 2, x_10);
lean_ctor_set(x_73, 3, x_69);
lean_ctor_set(x_73, 4, x_70);
lean_ctor_set(x_73, 5, x_71);
x_74 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_74, 0, x_67);
lean_ctor_set(x_74, 1, x_73);
return x_74;
lean_ctor_set(x_74, 0, x_69);
lean_ctor_set(x_74, 1, x_9);
lean_ctor_set(x_74, 2, x_10);
lean_ctor_set(x_74, 3, x_70);
lean_ctor_set(x_74, 4, x_71);
lean_ctor_set(x_74, 5, x_72);
x_75 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_75, 0, x_68);
lean_ctor_set(x_75, 1, x_74);
return x_75;
}
}
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83;
x_75 = lean_ctor_get(x_6, 0);
x_76 = lean_ctor_get(x_6, 1);
x_77 = lean_ctor_get(x_6, 2);
x_78 = lean_ctor_get(x_6, 3);
x_79 = lean_ctor_get(x_6, 4);
x_80 = lean_ctor_get(x_6, 5);
lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_76 = lean_ctor_get(x_6, 0);
x_77 = lean_ctor_get(x_6, 1);
x_78 = lean_ctor_get(x_6, 2);
x_79 = lean_ctor_get(x_6, 3);
x_80 = lean_ctor_get(x_6, 4);
x_81 = lean_ctor_get(x_6, 5);
lean_inc(x_81);
lean_inc(x_80);
lean_inc(x_79);
lean_inc(x_78);
lean_inc(x_77);
lean_inc(x_76);
lean_inc(x_75);
lean_dec(x_6);
lean_inc(x_76);
x_81 = l_Lean_MetavarContext_incDepth(x_76);
lean_inc(x_77);
x_82 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_82, 0, x_75);
lean_ctor_set(x_82, 1, x_81);
lean_ctor_set(x_82, 2, x_77);
lean_ctor_set(x_82, 3, x_78);
lean_ctor_set(x_82, 4, x_79);
lean_ctor_set(x_82, 5, x_80);
x_82 = l_Lean_MetavarContext_incDepth(x_77);
lean_inc(x_78);
x_83 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_83, 0, x_76);
lean_ctor_set(x_83, 1, x_82);
lean_ctor_set(x_83, 2, x_78);
lean_ctor_set(x_83, 3, x_79);
lean_ctor_set(x_83, 4, x_80);
lean_ctor_set(x_83, 5, x_81);
lean_inc(x_2);
x_83 = l_Lean_Meta_forallMetaTelescopeReducing(x_5, x_7, x_2, x_82);
x_84 = l_Lean_Meta_forallMetaTelescopeReducing(x_5, x_7, x_2, x_83);
lean_dec(x_5);
if (lean_obj_tag(x_83) == 0)
if (lean_obj_tag(x_84) == 0)
{
lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_84 = lean_ctor_get(x_83, 0);
lean_inc(x_84);
x_85 = lean_ctor_get(x_84, 1);
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; uint8_t x_89; lean_object* x_90;
x_85 = lean_ctor_get(x_84, 0);
lean_inc(x_85);
lean_dec(x_84);
x_86 = lean_ctor_get(x_83, 1);
x_86 = lean_ctor_get(x_85, 1);
lean_inc(x_86);
lean_dec(x_83);
x_87 = lean_ctor_get(x_85, 1);
lean_inc(x_87);
lean_dec(x_85);
x_88 = l_Lean_Meta_DiscrTree_mkPath(x_87, x_2, x_86);
if (lean_obj_tag(x_88) == 0)
x_87 = lean_ctor_get(x_84, 1);
lean_inc(x_87);
lean_dec(x_84);
x_88 = lean_ctor_get(x_86, 1);
lean_inc(x_88);
lean_dec(x_86);
x_89 = 0;
x_90 = l_Lean_Meta_DiscrTree_mkPath(x_88, x_89, x_2, x_87);
if (lean_obj_tag(x_90) == 0)
{
lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98;
x_89 = lean_ctor_get(x_88, 1);
lean_inc(x_89);
x_90 = lean_ctor_get(x_88, 0);
lean_inc(x_90);
if (lean_is_exclusive(x_88)) {
lean_ctor_release(x_88, 0);
lean_ctor_release(x_88, 1);
x_91 = x_88;
} else {
lean_dec_ref(x_88);
x_91 = lean_box(0);
}
x_92 = lean_ctor_get(x_89, 0);
lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100;
x_91 = lean_ctor_get(x_90, 1);
lean_inc(x_91);
x_92 = lean_ctor_get(x_90, 0);
lean_inc(x_92);
x_93 = lean_ctor_get(x_89, 3);
lean_inc(x_93);
x_94 = lean_ctor_get(x_89, 4);
if (lean_is_exclusive(x_90)) {
lean_ctor_release(x_90, 0);
lean_ctor_release(x_90, 1);
x_93 = x_90;
} else {
lean_dec_ref(x_90);
x_93 = lean_box(0);
}
x_94 = lean_ctor_get(x_91, 0);
lean_inc(x_94);
x_95 = lean_ctor_get(x_89, 5);
x_95 = lean_ctor_get(x_91, 3);
lean_inc(x_95);
if (lean_is_exclusive(x_89)) {
lean_ctor_release(x_89, 0);
lean_ctor_release(x_89, 1);
lean_ctor_release(x_89, 2);
lean_ctor_release(x_89, 3);
lean_ctor_release(x_89, 4);
lean_ctor_release(x_89, 5);
x_96 = x_89;
} else {
lean_dec_ref(x_89);
x_96 = lean_box(0);
}
if (lean_is_scalar(x_96)) {
x_97 = lean_alloc_ctor(0, 6, 0);
} else {
x_97 = x_96;
}
lean_ctor_set(x_97, 0, x_92);
lean_ctor_set(x_97, 1, x_76);
lean_ctor_set(x_97, 2, x_77);
lean_ctor_set(x_97, 3, x_93);
lean_ctor_set(x_97, 4, x_94);
lean_ctor_set(x_97, 5, x_95);
if (lean_is_scalar(x_91)) {
x_98 = lean_alloc_ctor(0, 2, 0);
} else {
x_96 = lean_ctor_get(x_91, 4);
lean_inc(x_96);
x_97 = lean_ctor_get(x_91, 5);
lean_inc(x_97);
if (lean_is_exclusive(x_91)) {
lean_ctor_release(x_91, 0);
lean_ctor_release(x_91, 1);
lean_ctor_release(x_91, 2);
lean_ctor_release(x_91, 3);
lean_ctor_release(x_91, 4);
lean_ctor_release(x_91, 5);
x_98 = x_91;
} else {
lean_dec_ref(x_91);
x_98 = lean_box(0);
}
lean_ctor_set(x_98, 0, x_90);
lean_ctor_set(x_98, 1, x_97);
return x_98;
if (lean_is_scalar(x_98)) {
x_99 = lean_alloc_ctor(0, 6, 0);
} else {
x_99 = x_98;
}
lean_ctor_set(x_99, 0, x_94);
lean_ctor_set(x_99, 1, x_77);
lean_ctor_set(x_99, 2, x_78);
lean_ctor_set(x_99, 3, x_95);
lean_ctor_set(x_99, 4, x_96);
lean_ctor_set(x_99, 5, x_97);
if (lean_is_scalar(x_93)) {
x_100 = lean_alloc_ctor(0, 2, 0);
} else {
x_100 = x_93;
}
lean_ctor_set(x_100, 0, x_92);
lean_ctor_set(x_100, 1, x_99);
return x_100;
}
else
{
lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108;
x_99 = lean_ctor_get(x_88, 1);
lean_inc(x_99);
x_100 = lean_ctor_get(x_88, 0);
lean_inc(x_100);
if (lean_is_exclusive(x_88)) {
lean_ctor_release(x_88, 0);
lean_ctor_release(x_88, 1);
x_101 = x_88;
} else {
lean_dec_ref(x_88);
x_101 = lean_box(0);
}
x_102 = lean_ctor_get(x_99, 0);
lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110;
x_101 = lean_ctor_get(x_90, 1);
lean_inc(x_101);
x_102 = lean_ctor_get(x_90, 0);
lean_inc(x_102);
x_103 = lean_ctor_get(x_99, 3);
lean_inc(x_103);
x_104 = lean_ctor_get(x_99, 4);
if (lean_is_exclusive(x_90)) {
lean_ctor_release(x_90, 0);
lean_ctor_release(x_90, 1);
x_103 = x_90;
} else {
lean_dec_ref(x_90);
x_103 = lean_box(0);
}
x_104 = lean_ctor_get(x_101, 0);
lean_inc(x_104);
x_105 = lean_ctor_get(x_99, 5);
x_105 = lean_ctor_get(x_101, 3);
lean_inc(x_105);
if (lean_is_exclusive(x_99)) {
lean_ctor_release(x_99, 0);
lean_ctor_release(x_99, 1);
lean_ctor_release(x_99, 2);
lean_ctor_release(x_99, 3);
lean_ctor_release(x_99, 4);
lean_ctor_release(x_99, 5);
x_106 = x_99;
} else {
lean_dec_ref(x_99);
x_106 = lean_box(0);
}
if (lean_is_scalar(x_106)) {
x_107 = lean_alloc_ctor(0, 6, 0);
} else {
x_107 = x_106;
}
lean_ctor_set(x_107, 0, x_102);
lean_ctor_set(x_107, 1, x_76);
lean_ctor_set(x_107, 2, x_77);
lean_ctor_set(x_107, 3, x_103);
lean_ctor_set(x_107, 4, x_104);
lean_ctor_set(x_107, 5, x_105);
if (lean_is_scalar(x_101)) {
x_108 = lean_alloc_ctor(1, 2, 0);
} else {
x_106 = lean_ctor_get(x_101, 4);
lean_inc(x_106);
x_107 = lean_ctor_get(x_101, 5);
lean_inc(x_107);
if (lean_is_exclusive(x_101)) {
lean_ctor_release(x_101, 0);
lean_ctor_release(x_101, 1);
lean_ctor_release(x_101, 2);
lean_ctor_release(x_101, 3);
lean_ctor_release(x_101, 4);
lean_ctor_release(x_101, 5);
x_108 = x_101;
} else {
lean_dec_ref(x_101);
x_108 = lean_box(0);
}
lean_ctor_set(x_108, 0, x_100);
lean_ctor_set(x_108, 1, x_107);
return x_108;
if (lean_is_scalar(x_108)) {
x_109 = lean_alloc_ctor(0, 6, 0);
} else {
x_109 = x_108;
}
lean_ctor_set(x_109, 0, x_104);
lean_ctor_set(x_109, 1, x_77);
lean_ctor_set(x_109, 2, x_78);
lean_ctor_set(x_109, 3, x_105);
lean_ctor_set(x_109, 4, x_106);
lean_ctor_set(x_109, 5, x_107);
if (lean_is_scalar(x_103)) {
x_110 = lean_alloc_ctor(1, 2, 0);
} else {
x_110 = x_103;
}
lean_ctor_set(x_110, 0, x_102);
lean_ctor_set(x_110, 1, x_109);
return x_110;
}
}
else
{
lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118;
lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120;
lean_dec(x_2);
x_109 = lean_ctor_get(x_83, 1);
lean_inc(x_109);
x_110 = lean_ctor_get(x_83, 0);
lean_inc(x_110);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
lean_ctor_release(x_83, 1);
x_111 = x_83;
} else {
lean_dec_ref(x_83);
x_111 = lean_box(0);
}
x_112 = lean_ctor_get(x_109, 0);
x_111 = lean_ctor_get(x_84, 1);
lean_inc(x_111);
x_112 = lean_ctor_get(x_84, 0);
lean_inc(x_112);
x_113 = lean_ctor_get(x_109, 3);
lean_inc(x_113);
x_114 = lean_ctor_get(x_109, 4);
if (lean_is_exclusive(x_84)) {
lean_ctor_release(x_84, 0);
lean_ctor_release(x_84, 1);
x_113 = x_84;
} else {
lean_dec_ref(x_84);
x_113 = lean_box(0);
}
x_114 = lean_ctor_get(x_111, 0);
lean_inc(x_114);
x_115 = lean_ctor_get(x_109, 5);
x_115 = lean_ctor_get(x_111, 3);
lean_inc(x_115);
if (lean_is_exclusive(x_109)) {
lean_ctor_release(x_109, 0);
lean_ctor_release(x_109, 1);
lean_ctor_release(x_109, 2);
lean_ctor_release(x_109, 3);
lean_ctor_release(x_109, 4);
lean_ctor_release(x_109, 5);
x_116 = x_109;
} else {
lean_dec_ref(x_109);
x_116 = lean_box(0);
}
if (lean_is_scalar(x_116)) {
x_117 = lean_alloc_ctor(0, 6, 0);
} else {
x_117 = x_116;
}
lean_ctor_set(x_117, 0, x_112);
lean_ctor_set(x_117, 1, x_76);
lean_ctor_set(x_117, 2, x_77);
lean_ctor_set(x_117, 3, x_113);
lean_ctor_set(x_117, 4, x_114);
lean_ctor_set(x_117, 5, x_115);
if (lean_is_scalar(x_111)) {
x_118 = lean_alloc_ctor(1, 2, 0);
} else {
x_116 = lean_ctor_get(x_111, 4);
lean_inc(x_116);
x_117 = lean_ctor_get(x_111, 5);
lean_inc(x_117);
if (lean_is_exclusive(x_111)) {
lean_ctor_release(x_111, 0);
lean_ctor_release(x_111, 1);
lean_ctor_release(x_111, 2);
lean_ctor_release(x_111, 3);
lean_ctor_release(x_111, 4);
lean_ctor_release(x_111, 5);
x_118 = x_111;
} else {
lean_dec_ref(x_111);
x_118 = lean_box(0);
}
lean_ctor_set(x_118, 0, x_110);
lean_ctor_set(x_118, 1, x_117);
return x_118;
if (lean_is_scalar(x_118)) {
x_119 = lean_alloc_ctor(0, 6, 0);
} else {
x_119 = x_118;
}
lean_ctor_set(x_119, 0, x_114);
lean_ctor_set(x_119, 1, x_77);
lean_ctor_set(x_119, 2, x_78);
lean_ctor_set(x_119, 3, x_115);
lean_ctor_set(x_119, 4, x_116);
lean_ctor_set(x_119, 5, x_117);
if (lean_is_scalar(x_113)) {
x_120 = lean_alloc_ctor(1, 2, 0);
} else {
x_120 = x_113;
}
lean_ctor_set(x_120, 0, x_112);
lean_ctor_set(x_120, 1, x_119);
return x_120;
}
}
}
else
{
uint8_t x_119;
uint8_t x_121;
lean_dec(x_2);
x_119 = !lean_is_exclusive(x_4);
if (x_119 == 0)
x_121 = !lean_is_exclusive(x_4);
if (x_121 == 0)
{
return x_4;
}
else
{
lean_object* x_120; lean_object* x_121; lean_object* x_122;
x_120 = lean_ctor_get(x_4, 0);
x_121 = lean_ctor_get(x_4, 1);
lean_inc(x_121);
lean_inc(x_120);
lean_object* x_122; lean_object* x_123; lean_object* x_124;
x_122 = lean_ctor_get(x_4, 0);
x_123 = lean_ctor_get(x_4, 1);
lean_inc(x_123);
lean_inc(x_122);
lean_dec(x_4);
x_122 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_122, 0, x_120);
lean_ctor_set(x_122, 1, x_121);
return x_122;
x_124 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_124, 0, x_122);
lean_ctor_set(x_124, 1, x_123);
return x_124;
}
}
}
@ -3792,6 +3804,8 @@ l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7__
lean_mark_persistent(l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7___closed__1);
l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7___closed__2 = _init_l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7___closed__2();
lean_mark_persistent(l_Lean_registerEnvExtensionUnsafe___at_Lean_Meta_mkInstanceExtension___spec__7___closed__2);
l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1 = _init_l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1();
lean_mark_persistent(l_Lean_Meta_mkInstanceExtension___lambda__1___closed__1);
l_Lean_Meta_mkInstanceExtension___closed__1 = _init_l_Lean_Meta_mkInstanceExtension___closed__1();
lean_mark_persistent(l_Lean_Meta_mkInstanceExtension___closed__1);
l_Lean_Meta_mkInstanceExtension___closed__2 = _init_l_Lean_Meta_mkInstanceExtension___closed__2();