text: // Lean compiler output
  // Module: Lean.Meta.Tactic.Delta
  // Imports: Init Lean.Meta.Transform Lean.Meta.Tactic.Replace
  #include <lean/lean.h>
  #if defined(__clang__)
  #pragma clang diagnostic ignored "-Wunused-parameter"
  #pragma clang diagnostic ignored "-Wunused-label"
  #elif defined(__GNUC__) && !defined(__CLANG__)
  #pragma GCC diagnostic ignored "-Wunused-parameter"
  #pragma GCC diagnostic ignored "-Wunused-label"
  #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  #endif
  #ifdef __cplusplus
  extern "C" {
  #endif
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_mk_empty_array_with_capacity(lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_name_mk_string(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_environment_find(lean_object*, lean_object*);
  lean_object* lean_st_ref_get(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_deltaTarget___closed__1;
  static lean_object* l_Lean_Meta_deltaTarget___closed__2;
  lean_object* l_Lean_ConstantInfo_levelParams(lean_object*);
  uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getMVarType(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaLocalDecl___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_ConstantInfo_name(lean_object*);
  uint8_t l_Lean_ConstantInfo_hasValue(lean_object*);
  lean_object* l___private_Lean_Expr_0__Lean_Expr_getAppRevArgsAux(lean_object*, lean_object*);
  lean_object* l_Lean_Core_transform___at_Lean_Core_betaReduce___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_delta_x3f(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_instantiate_value_lparams(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_changeLocalDecl(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Expr_getAppNumArgsAux(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_checkNotAssigned(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getLocalDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaTarget___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_delta_x3f___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Expr_betaRev(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_List_lengthTRAux___rarg(lean_object*, lean_object*);
  lean_object* l_Lean_Expr_getAppFn(lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaTarget(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_deltaExpand___closed__1;
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaLocalDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_Lean_Meta_delta_x3f(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; 
  x_6 = l_Lean_Expr_getAppFn(x_1);
  if (lean_obj_tag(x_6) == 4)
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10; 
  x_7 = lean_ctor_get(x_6, 0);
  lean_inc(x_7);
  x_8 = lean_ctor_get(x_6, 1);
  lean_inc(x_8);
  lean_dec(x_6);
  x_9 = lean_st_ref_get(x_4, x_5);
  x_10 = !lean_is_exclusive(x_9);
  if (x_10 == 0)
  {
  lean_object* x_11; lean_object* x_12; lean_object* x_13; 
  x_11 = lean_ctor_get(x_9, 0);
  x_12 = lean_ctor_get(x_11, 0);
  lean_inc(x_12);
  lean_dec(x_11);
  x_13 = lean_environment_find(x_12, x_7);
  if (lean_obj_tag(x_13) == 0)
  {
  lean_object* x_14; 
  lean_dec(x_8);
  lean_dec(x_2);
  lean_dec(x_1);
  x_14 = lean_box(0);
  lean_ctor_set(x_9, 0, x_14);
  return x_9;
  }
  else
  {
  uint8_t x_15; 
  x_15 = !lean_is_exclusive(x_13);
  if (x_15 == 0)
  {
  lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19; 
  x_16 = lean_ctor_get(x_13, 0);
  x_17 = l_Lean_ConstantInfo_name(x_16);
  x_18 = lean_apply_1(x_2, x_17);
  x_19 = lean_unbox(x_18);
  lean_dec(x_18);
  if (x_19 == 0)
  {
  lean_object* x_20; 
  lean_free_object(x_13);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_1);
  x_20 = lean_box(0);
  lean_ctor_set(x_9, 0, x_20);
  return x_9;
  }
  else
  {
  uint8_t x_21; 
  x_21 = l_Lean_ConstantInfo_hasValue(x_16);
  if (x_21 == 0)
  {
  lean_object* x_22; 
  lean_free_object(x_13);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_1);
  x_22 = lean_box(0);
  lean_ctor_set(x_9, 0, x_22);
  return x_9;
  }
  else
  {
  lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27; 
  x_23 = l_Lean_ConstantInfo_levelParams(x_16);
  x_24 = lean_unsigned_to_nat(0u);
  x_25 = l_List_lengthTRAux___rarg(x_23, x_24);
  lean_dec(x_23);
  x_26 = l_List_lengthTRAux___rarg(x_8, x_24);
  x_27 = lean_nat_dec_eq(x_25, x_26);
  lean_dec(x_26);
  lean_dec(x_25);
  if (x_27 == 0)
  {
  lean_object* x_28; 
  lean_free_object(x_13);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_1);
  x_28 = lean_box(0);
  lean_ctor_set(x_9, 0, x_28);
  return x_9;
  }
  else
  {
  lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_29 = lean_instantiate_value_lparams(x_16, x_8);
  lean_dec(x_8);
  lean_dec(x_16);
  x_30 = l_Lean_Expr_getAppNumArgsAux(x_1, x_24);
  x_31 = lean_mk_empty_array_with_capacity(x_30);
  lean_dec(x_30);
  x_32 = l___private_Lean_Expr_0__Lean_Expr_getAppRevArgsAux(x_1, x_31);
  x_33 = l_Lean_Expr_betaRev(x_29, x_32);
  lean_dec(x_32);
  lean_dec(x_29);
  lean_ctor_set(x_13, 0, x_33);
  lean_ctor_set(x_9, 0, x_13);
  return x_9;
  }
  }
  }
  }
  else
  {
  lean_object* x_34; lean_object* x_35; lean_object* x_36; uint8_t x_37; 
  x_34 = lean_ctor_get(x_13, 0);
  lean_inc(x_34);
  lean_dec(x_13);
  x_35 = l_Lean_ConstantInfo_name(x_34);
  x_36 = lean_apply_1(x_2, x_35);
  x_37 = lean_unbox(x_36);
  lean_dec(x_36);
  if (x_37 == 0)
  {
  lean_object* x_38; 
  lean_dec(x_34);
  lean_dec(x_8);
  lean_dec(x_1);
  x_38 = lean_box(0);
  lean_ctor_set(x_9, 0, x_38);
  return x_9;
  }
  else
  {
  uint8_t x_39; 
  x_39 = l_Lean_ConstantInfo_hasValue(x_34);
  if (x_39 == 0)
  {
  lean_object* x_40; 
  lean_dec(x_34);
  lean_dec(x_8);
  lean_dec(x_1);
  x_40 = lean_box(0);
  lean_ctor_set(x_9, 0, x_40);
  return x_9;
  }
  else
  {
  lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45; 
  x_41 = l_Lean_ConstantInfo_levelParams(x_34);
  x_42 = lean_unsigned_to_nat(0u);
  x_43 = l_List_lengthTRAux___rarg(x_41, x_42);
  lean_dec(x_41);
  x_44 = l_List_lengthTRAux___rarg(x_8, x_42);
  x_45 = lean_nat_dec_eq(x_43, x_44);
  lean_dec(x_44);
  lean_dec(x_43);
  if (x_45 == 0)
  {
  lean_object* x_46; 
  lean_dec(x_34);
  lean_dec(x_8);
  lean_dec(x_1);
  x_46 = lean_box(0);
  lean_ctor_set(x_9, 0, x_46);
  return x_9;
  }
  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; 
  x_47 = lean_instantiate_value_lparams(x_34, x_8);
  lean_dec(x_8);
  lean_dec(x_34);
  x_48 = l_Lean_Expr_getAppNumArgsAux(x_1, x_42);
  x_49 = lean_mk_empty_array_with_capacity(x_48);
  lean_dec(x_48);
  x_50 = l___private_Lean_Expr_0__Lean_Expr_getAppRevArgsAux(x_1, x_49);
  x_51 = l_Lean_Expr_betaRev(x_47, x_50);
  lean_dec(x_50);
  lean_dec(x_47);
  x_52 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_52, 0, x_51);
  lean_ctor_set(x_9, 0, x_52);
  return x_9;
  }
  }
  }
  }
  }
  }
  else
  {
  lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; 
  x_53 = lean_ctor_get(x_9, 0);
  x_54 = lean_ctor_get(x_9, 1);
  lean_inc(x_54);
  lean_inc(x_53);
  lean_dec(x_9);
  x_55 = lean_ctor_get(x_53, 0);
  lean_inc(x_55);
  lean_dec(x_53);
  x_56 = lean_environment_find(x_55, x_7);
  if (lean_obj_tag(x_56) == 0)
  {
  lean_object* x_57; lean_object* x_58; 
  lean_dec(x_8);
  lean_dec(x_2);
  lean_dec(x_1);
  x_57 = lean_box(0);
  x_58 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_58, 0, x_57);
  lean_ctor_set(x_58, 1, x_54);
  return x_58;
  }
  else
  {
  lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; uint8_t x_63; 
  x_59 = lean_ctor_get(x_56, 0);
  lean_inc(x_59);
  if (lean_is_exclusive(x_56)) {
   lean_ctor_release(x_56, 0);
   x_60 = x_56;
  } else {
   lean_dec_ref(x_56);
   x_60 = lean_box(0);
  }
  x_61 = l_Lean_ConstantInfo_name(x_59);
  x_62 = lean_apply_1(x_2, x_61);
  x_63 = lean_unbox(x_62);
  lean_dec(x_62);
  if (x_63 == 0)
  {
  lean_object* x_64; lean_object* x_65; 
  lean_dec(x_60);
  lean_dec(x_59);
  lean_dec(x_8);
  lean_dec(x_1);
  x_64 = lean_box(0);
  x_65 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_65, 0, x_64);
  lean_ctor_set(x_65, 1, x_54);
  return x_65;
  }
  else
  {
  uint8_t x_66; 
  x_66 = l_Lean_ConstantInfo_hasValue(x_59);
  if (x_66 == 0)
  {
  lean_object* x_67; lean_object* x_68; 
  lean_dec(x_60);
  lean_dec(x_59);
  lean_dec(x_8);
  lean_dec(x_1);
  x_67 = lean_box(0);
  x_68 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_68, 0, x_67);
  lean_ctor_set(x_68, 1, x_54);
  return x_68;
  }
  else
  {
  lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; uint8_t x_73; 
  x_69 = l_Lean_ConstantInfo_levelParams(x_59);
  x_70 = lean_unsigned_to_nat(0u);
  x_71 = l_List_lengthTRAux___rarg(x_69, x_70);
  lean_dec(x_69);
  x_72 = l_List_lengthTRAux___rarg(x_8, x_70);
  x_73 = lean_nat_dec_eq(x_71, x_72);
  lean_dec(x_72);
  lean_dec(x_71);
  if (x_73 == 0)
  {
  lean_object* x_74; lean_object* x_75; 
  lean_dec(x_60);
  lean_dec(x_59);
  lean_dec(x_8);
  lean_dec(x_1);
  x_74 = lean_box(0);
  x_75 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_75, 0, x_74);
  lean_ctor_set(x_75, 1, x_54);
  return x_75;
  }
  else
  {
  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; 
  x_76 = lean_instantiate_value_lparams(x_59, x_8);
  lean_dec(x_8);
  lean_dec(x_59);
  x_77 = l_Lean_Expr_getAppNumArgsAux(x_1, x_70);
  x_78 = lean_mk_empty_array_with_capacity(x_77);
  lean_dec(x_77);
  x_79 = l___private_Lean_Expr_0__Lean_Expr_getAppRevArgsAux(x_1, x_78);
  x_80 = l_Lean_Expr_betaRev(x_76, x_79);
  lean_dec(x_79);
  lean_dec(x_76);
  if (lean_is_scalar(x_60)) {
   x_81 = lean_alloc_ctor(1, 1, 0);
  } else {
   x_81 = x_60;
  }
  lean_ctor_set(x_81, 0, x_80);
  x_82 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_82, 0, x_81);
  lean_ctor_set(x_82, 1, x_54);
  return x_82;
  }
  }
  }
  }
  }
  }
  else
  {
  lean_object* x_83; lean_object* x_84; 
  lean_dec(x_6);
  lean_dec(x_2);
  lean_dec(x_1);
  x_83 = lean_box(0);
  x_84 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_84, 0, x_83);
  lean_ctor_set(x_84, 1, x_5);
  return x_84;
  }
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_delta_x3f___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; 
  x_6 = l_Lean_Meta_delta_x3f(x_1, x_2, x_3, x_4, x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  return x_6;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; lean_object* x_7; 
  lean_inc(x_2);
  x_6 = l_Lean_Meta_delta_x3f(x_2, x_1, x_3, x_4, x_5);
  x_7 = lean_ctor_get(x_6, 0);
  lean_inc(x_7);
  if (lean_obj_tag(x_7) == 0)
  {
  uint8_t x_8; 
  x_8 = !lean_is_exclusive(x_6);
  if (x_8 == 0)
  {
  lean_object* x_9; lean_object* x_10; 
  x_9 = lean_ctor_get(x_6, 0);
  lean_dec(x_9);
  x_10 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_10, 0, x_2);
  lean_ctor_set(x_6, 0, x_10);
  return x_6;
  }
  else
  {
  lean_object* x_11; lean_object* x_12; lean_object* x_13; 
  x_11 = lean_ctor_get(x_6, 1);
  lean_inc(x_11);
  lean_dec(x_6);
  x_12 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_12, 0, x_2);
  x_13 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_13, 0, x_12);
  lean_ctor_set(x_13, 1, x_11);
  return x_13;
  }
  }
  else
  {
  uint8_t x_14; 
  lean_dec(x_2);
  x_14 = !lean_is_exclusive(x_6);
  if (x_14 == 0)
  {
  lean_object* x_15; lean_object* x_16; lean_object* x_17; 
  x_15 = lean_ctor_get(x_6, 0);
  lean_dec(x_15);
  x_16 = lean_ctor_get(x_7, 0);
  lean_inc(x_16);
  lean_dec(x_7);
  x_17 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_17, 0, x_16);
  lean_ctor_set(x_6, 0, x_17);
  return x_6;
  }
  else
  {
  lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  x_18 = lean_ctor_get(x_6, 1);
  lean_inc(x_18);
  lean_dec(x_6);
  x_19 = lean_ctor_get(x_7, 0);
  lean_inc(x_19);
  lean_dec(x_7);
  x_20 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_20, 0, x_19);
  x_21 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_21, 0, x_20);
  lean_ctor_set(x_21, 1, x_18);
  return x_21;
  }
  }
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; 
  x_5 = lean_alloc_ctor(0, 1, 0);
  lean_ctor_set(x_5, 0, x_1);
  x_6 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_6, 0, x_5);
  lean_ctor_set(x_6, 1, x_4);
  return x_6;
  }
  }
  static lean_object* _init_l_Lean_Meta_deltaExpand___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_alloc_closure((void*)(l_Lean_Meta_deltaExpand___lambda__2___boxed), 4, 0);
  return x_1;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_6 = lean_alloc_closure((void*)(l_Lean_Meta_deltaExpand___lambda__1___boxed), 5, 1);
  lean_closure_set(x_6, 0, x_2);
  x_7 = l_Lean_Meta_deltaExpand___closed__1;
  x_8 = l_Lean_Core_transform___at_Lean_Core_betaReduce___spec__1(x_1, x_6, x_7, x_3, x_4, x_5);
  return x_8;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; 
  x_6 = l_Lean_Meta_deltaExpand___lambda__1(x_1, x_2, x_3, x_4, x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  return x_6;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaExpand___lambda__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; 
  x_5 = l_Lean_Meta_deltaExpand___lambda__2(x_1, x_2, x_3, x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaTarget___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_5);
  lean_inc(x_1);
  x_9 = l_Lean_Meta_checkNotAssigned(x_1, x_2, x_4, x_5, x_6, x_7, x_8);
  if (lean_obj_tag(x_9) == 0)
  {
  lean_object* x_10; lean_object* x_11; 
  x_10 = lean_ctor_get(x_9, 1);
  lean_inc(x_10);
  lean_dec(x_9);
  lean_inc(x_1);
  x_11 = l_Lean_Meta_getMVarType(x_1, x_4, x_5, x_6, x_7, x_10);
  if (lean_obj_tag(x_11) == 0)
  {
  lean_object* x_12; lean_object* x_13; lean_object* x_14; 
  x_12 = lean_ctor_get(x_11, 0);
  lean_inc(x_12);
  x_13 = lean_ctor_get(x_11, 1);
  lean_inc(x_13);
  lean_dec(x_11);
  lean_inc(x_7);
  lean_inc(x_6);
  x_14 = l_Lean_Meta_deltaExpand(x_12, x_3, x_6, x_7, x_13);
  if (lean_obj_tag(x_14) == 0)
  {
  lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_ctor_get(x_14, 1);
  lean_inc(x_16);
  lean_dec(x_14);
  x_17 = 0;
  x_18 = l_Lean_Meta_change(x_1, x_15, x_17, x_4, x_5, x_6, x_7, x_16);
  return x_18;
  }
  else
  {
  uint8_t x_19; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_1);
  x_19 = !lean_is_exclusive(x_14);
  if (x_19 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_20; lean_object* x_21; lean_object* x_22; 
  x_20 = lean_ctor_get(x_14, 0);
  x_21 = lean_ctor_get(x_14, 1);
  lean_inc(x_21);
  lean_inc(x_20);
  lean_dec(x_14);
  x_22 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_22, 0, x_20);
  lean_ctor_set(x_22, 1, x_21);
  return x_22;
  }
  }
  }
  else
  {
  uint8_t x_23; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_23 = !lean_is_exclusive(x_11);
  if (x_23 == 0)
  {
  return x_11;
  }
  else
  {
  lean_object* x_24; lean_object* x_25; lean_object* x_26; 
  x_24 = lean_ctor_get(x_11, 0);
  x_25 = lean_ctor_get(x_11, 1);
  lean_inc(x_25);
  lean_inc(x_24);
  lean_dec(x_11);
  x_26 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_26, 0, x_24);
  lean_ctor_set(x_26, 1, x_25);
  return x_26;
  }
  }
  }
  else
  {
  uint8_t x_27; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_27 = !lean_is_exclusive(x_9);
  if (x_27 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_28; lean_object* x_29; lean_object* x_30; 
  x_28 = lean_ctor_get(x_9, 0);
  x_29 = lean_ctor_get(x_9, 1);
  lean_inc(x_29);
  lean_inc(x_28);
  lean_dec(x_9);
  x_30 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_30, 0, x_28);
  lean_ctor_set(x_30, 1, x_29);
  return x_30;
  }
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_deltaTarget___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("delta");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_deltaTarget___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_deltaTarget___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaTarget(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
  _start:
  {
  lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_8 = l_Lean_Meta_deltaTarget___closed__2;
  lean_inc(x_1);
  x_9 = lean_alloc_closure((void*)(l_Lean_Meta_deltaTarget___lambda__1), 8, 3);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_8);
  lean_closure_set(x_9, 2, x_2);
  x_10 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_9, x_3, x_4, x_5, x_6, x_7);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaLocalDecl___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; 
  lean_inc(x_6);
  lean_inc(x_1);
  x_10 = l_Lean_Meta_checkNotAssigned(x_1, x_2, x_5, x_6, x_7, x_8, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  lean_object* x_11; lean_object* x_12; 
  x_11 = lean_ctor_get(x_10, 1);
  lean_inc(x_11);
  lean_dec(x_10);
  lean_inc(x_5);
  lean_inc(x_3);
  x_12 = l_Lean_Meta_getLocalDecl(x_3, x_5, x_6, x_7, x_8, x_11);
  if (lean_obj_tag(x_12) == 0)
  {
  lean_object* x_13; lean_object* x_14; 
  x_13 = lean_ctor_get(x_12, 1);
  lean_inc(x_13);
  lean_dec(x_12);
  lean_inc(x_1);
  x_14 = l_Lean_Meta_getMVarType(x_1, x_5, x_6, x_7, x_8, x_13);
  if (lean_obj_tag(x_14) == 0)
  {
  lean_object* x_15; lean_object* x_16; lean_object* x_17; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_ctor_get(x_14, 1);
  lean_inc(x_16);
  lean_dec(x_14);
  lean_inc(x_8);
  lean_inc(x_7);
  x_17 = l_Lean_Meta_deltaExpand(x_15, x_4, x_7, x_8, x_16);
  if (lean_obj_tag(x_17) == 0)
  {
  lean_object* x_18; lean_object* x_19; uint8_t x_20; lean_object* x_21; 
  x_18 = lean_ctor_get(x_17, 0);
  lean_inc(x_18);
  x_19 = lean_ctor_get(x_17, 1);
  lean_inc(x_19);
  lean_dec(x_17);
  x_20 = 0;
  x_21 = l_Lean_Meta_changeLocalDecl(x_1, x_3, x_18, x_20, x_5, x_6, x_7, x_8, x_19);
  return x_21;
  }
  else
  {
  uint8_t x_22; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_1);
  x_22 = !lean_is_exclusive(x_17);
  if (x_22 == 0)
  {
  return x_17;
  }
  else
  {
  lean_object* x_23; lean_object* x_24; lean_object* x_25; 
  x_23 = lean_ctor_get(x_17, 0);
  x_24 = lean_ctor_get(x_17, 1);
  lean_inc(x_24);
  lean_inc(x_23);
  lean_dec(x_17);
  x_25 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_25, 0, x_23);
  lean_ctor_set(x_25, 1, x_24);
  return x_25;
  }
  }
  }
  else
  {
  uint8_t x_26; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_26 = !lean_is_exclusive(x_14);
  if (x_26 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_27; lean_object* x_28; lean_object* x_29; 
  x_27 = lean_ctor_get(x_14, 0);
  x_28 = lean_ctor_get(x_14, 1);
  lean_inc(x_28);
  lean_inc(x_27);
  lean_dec(x_14);
  x_29 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_29, 0, x_27);
  lean_ctor_set(x_29, 1, x_28);
  return x_29;
  }
  }
  }
  else
  {
  uint8_t x_30; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_30 = !lean_is_exclusive(x_12);
  if (x_30 == 0)
  {
  return x_12;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_31 = lean_ctor_get(x_12, 0);
  x_32 = lean_ctor_get(x_12, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_12);
  x_33 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_33, 0, x_31);
  lean_ctor_set(x_33, 1, x_32);
  return x_33;
  }
  }
  }
  else
  {
  uint8_t x_34; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_34 = !lean_is_exclusive(x_10);
  if (x_34 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_35; lean_object* x_36; lean_object* x_37; 
  x_35 = lean_ctor_get(x_10, 0);
  x_36 = lean_ctor_get(x_10, 1);
  lean_inc(x_36);
  lean_inc(x_35);
  lean_dec(x_10);
  x_37 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_37, 0, x_35);
  lean_ctor_set(x_37, 1, x_36);
  return x_37;
  }
  }
  }
  }
  LEAN_EXPORT lean_object* l_Lean_Meta_deltaLocalDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; lean_object* x_10; lean_object* x_11; 
  x_9 = l_Lean_Meta_deltaTarget___closed__2;
  lean_inc(x_1);
  x_10 = lean_alloc_closure((void*)(l_Lean_Meta_deltaLocalDecl___lambda__1), 9, 4);
  lean_closure_set(x_10, 0, x_1);
  lean_closure_set(x_10, 1, x_9);
  lean_closure_set(x_10, 2, x_2);
  lean_closure_set(x_10, 3, x_3);
  x_11 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_10, x_4, x_5, x_6, x_7, x_8);
  return x_11;
  }
  }
  lean_object* initialize_Init(lean_object*);
  lean_object* initialize_Lean_Meta_Transform(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Replace(lean_object*);
  static bool _G_initialized = false;
  LEAN_EXPORT lean_object* initialize_Lean_Meta_Tactic_Delta(lean_object* w) {
  lean_object * res;
  if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
  _G_initialized = true;
  res = initialize_Init(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Transform(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Replace(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  l_Lean_Meta_deltaExpand___closed__1 = _init_l_Lean_Meta_deltaExpand___closed__1();
  lean_mark_persistent(l_Lean_Meta_deltaExpand___closed__1);
  l_Lean_Meta_deltaTarget___closed__1 = _init_l_Lean_Meta_deltaTarget___closed__1();
  lean_mark_persistent(l_Lean_Meta_deltaTarget___closed__1);
  l_Lean_Meta_deltaTarget___closed__2 = _init_l_Lean_Meta_deltaTarget___closed__2();
  lean_mark_persistent(l_Lean_Meta_deltaTarget___closed__2);
  return lean_io_result_mk_ok(lean_box(0));
  }
  #ifdef __cplusplus
  }
  #endif
  