chore: update stage0

This commit is contained in:
Leonardo de Moura 2020-03-09 15:41:36 -07:00
parent 970ee59fc6
commit 3f4d0d78b2
16 changed files with 6521 additions and 3716 deletions

View file

@ -417,8 +417,10 @@ if optType.isNone then
else
(optType.getArg 0).getArg 1
/- If `useLetExpr` is true, then a kernel let-expression `let x : type := val; body` is created.
Otherwise, we create a term of the form `(fun (x : type) => body) val` -/
def elabLetDeclAux (ref : Syntax) (n : Name) (binders : Array Syntax) (typeStx : Syntax) (valStx : Syntax) (body : Syntax)
(expectedType? : Option Expr) : TermElabM Expr := do
(expectedType? : Option Expr) (useLetExpr : Bool) : TermElabM Expr := do
(type, val) ← elabBinders binders $ fun xs => do {
type ← elabType typeStx;
val ← elabTerm valStx type;
@ -428,25 +430,25 @@ def elabLetDeclAux (ref : Syntax) (n : Name) (binders : Array Syntax) (typeStx :
pure (type, val)
};
trace `Elab.let.decl ref $ fun _ => n ++ " : " ++ type ++ " := " ++ val;
withLetDecl ref n type val $ fun x => do
body ← elabTerm body expectedType?;
body ← instantiateMVars ref body;
mkLet ref x body
def elabLetIdDecl (ref : Syntax) (decl body : Syntax) (expectedType? : Option Expr) : TermElabM Expr :=
-- `decl` is of the form: ident bracktedBinder+ (`:` term)? `:=` term
let n := decl.getIdAt 0;
let binders := (decl.getArg 1).getArgs;
let type := expandOptType ref (decl.getArg 2);
let val := decl.getArg 4;
elabLetDeclAux ref n binders type val body expectedType?
if useLetExpr then
withLetDecl ref n type val $ fun x => do
body ← elabTerm body expectedType?;
body ← instantiateMVars ref body;
mkLet ref x body
else do
f ← withLocalDecl ref n BinderInfo.default type $ fun x => do {
body ← elabTerm body expectedType?;
body ← instantiateMVars ref body;
mkLambda ref #[x] body
};
pure $ mkApp f val
@[builtinTermElab «let»] def elabLetDecl : TermElab :=
fun stx expectedType? => match_syntax stx with
| `(let $id:ident $args* := $val; $body) =>
elabLetDeclAux stx id.getId args (mkHole stx) val body expectedType?
elabLetDeclAux stx id.getId args (mkHole stx) val body expectedType? true
| `(let $id:ident $args* : $type := $val; $body) =>
elabLetDeclAux stx id.getId args type val body expectedType?
elabLetDeclAux stx id.getId args type val body expectedType? true
| `(let $pat:term := $val; $body) => do
stxNew ← `(let x := $val; match x with $pat => $body);
withMacroExpansion stx stxNew $ elabTerm stxNew expectedType?
@ -455,6 +457,20 @@ fun stx expectedType? => match_syntax stx with
withMacroExpansion stx stxNew $ elabTerm stxNew expectedType?
| _ => throwUnsupportedSyntax
@[builtinTermElab «let!»] def elabLetBangDecl : TermElab :=
fun stx expectedType? => match_syntax stx with
| `(let! $id:ident $args* := $val; $body) =>
elabLetDeclAux stx id.getId args (mkHole stx) val body expectedType? false
| `(let! $id:ident $args* : $type := $val; $body) =>
elabLetDeclAux stx id.getId args type val body expectedType? false
| `(let! $pat:term := $val; $body) => do
stxNew ← `(let! x := $val; match x with $pat => $body);
withMacroExpansion stx stxNew $ elabTerm stxNew expectedType?
| `(let! $pat:term : $type := $val; $body) => do
stxNew ← `(let! x : $type := $val; match x with $pat => $body);
withMacroExpansion stx stxNew $ elabTerm stxNew expectedType?
| _ => throwUnsupportedSyntax
@[init] private def regTraceClasses : IO Unit := do
registerTraceClass `Elab.let;
pure ()

View file

@ -60,15 +60,15 @@ fun stx expectedType? => match_syntax stx with
@[builtinMacro Lean.Parser.Term.show] def expandShow : Macro :=
fun stx => match_syntax stx with
| `(show $type from $val) => let thisId := mkTermIdFrom stx `this; `((fun ($thisId : $type) => $thisId) $val)
| `(show $type from $val) => let thisId := mkIdentFrom stx `this; `(let! $thisId : $type := $val; $thisId)
| _ => Macro.throwUnsupported
@[builtinMacro Lean.Parser.Term.have] def expandHave : Macro :=
fun stx => match_syntax stx with
| `(have $type from $val; $body) => let thisId := mkTermIdFrom stx `this; `((fun ($thisId : $type) => $body) $val)
| `(have $type := $val; $body) => let thisId := mkTermIdFrom stx `this; `((fun ($thisId : $type) => $body) $val)
| `(have $x : $type from $val; $body) => `((fun ($x:ident : $type) => $body) $val)
| `(have $x : $type := $val; $body) => `((fun ($x:ident : $type) => $body) $val)
| `(have $type from $val; $body) => let thisId := mkIdentFrom stx `this; `(let! $thisId : $type := $val; $body)
| `(have $type := $val; $body) => let thisId := mkIdentFrom stx `this; `(let! $thisId : $type := $val; $body)
| `(have $x : $type from $val; $body) => `(let! $x:ident : $type := $val; $body)
| `(have $x : $type := $val; $body) => `(let! $x:ident : $type := $val; $body)
| _ => Macro.throwUnsupported
@[builtinMacro Lean.Parser.Term.where] def expandWhere : Macro :=

View file

@ -151,10 +151,10 @@ match recInfo? with
| _ => throwError ref ("invalid recursor name '" ++ baseRecName ++ "'")
/- Create `RecInfo` assuming builtin recursor -/
private def getRecInfoDefault (ref : Syntax) (major : Expr) (withAlts : Syntax) : TacticM RecInfo := do
private def getRecInfoDefault (ref : Syntax) (major : Expr) (withAlts : Syntax) (allowMissingAlts : Bool) : TacticM (RecInfo × Array Name) := do
indVal ← getInductiveValFromMajor ref major;
let recName := mkRecFor indVal.name;
if withAlts.isNone then pure { recName := recName }
if withAlts.isNone then pure ({ recName := recName }, #[])
else do
let ctorNames := indVal.ctors;
let alts := getAlts withAlts;
@ -173,11 +173,15 @@ else do
| none => match prevAnonymousAlt? with
| some alt =>
pure (altVars.push (getAltVarNames alt).toList, altRHSs.push (getAltRHS alt), remainingAlts, prevAnonymousAlt?)
| none => throwError ref ("alternative for constructor '" ++ toString ctorName ++ "' is missing"))
| none =>
if allowMissingAlts then
pure (altVars.push [], altRHSs.push Syntax.missing, remainingAlts, prevAnonymousAlt?)
else
throwError ref ("alternative for constructor '" ++ toString ctorName ++ "' is missing"))
(#[], #[], alts, none);
unless remainingAlts.isEmpty $
throwError (remainingAlts.get! 0) "unused alternative";
pure { recName := recName, altVars := altVars, altRHSs := altRHSs }
pure ({ recName := recName, altVars := altVars, altRHSs := altRHSs }, ctorNames.toArray)
/-
Recall that
@ -192,7 +196,8 @@ let ref := stx;
let usingRecStx := stx.getArg 2;
let withAlts := stx.getArg 4;
if usingRecStx.isNone then do
getRecInfoDefault ref major withAlts
(rinfo, _) ← getRecInfoDefault ref major withAlts false;
pure rinfo
else do
let baseRecName := (usingRecStx.getIdAt 1).eraseMacroScopes;
recInfo ← getRecFromUsing ref major baseRecName;
@ -225,16 +230,16 @@ else do
throwError (remainingAlts.get! 0) "unused alternative";
pure { recName := recName, altVars := altVars, altRHSs := altRHSs }
private def processResult (ref : Syntax) (recInfo : RecInfo) (result : Array Meta.InductionSubgoal) : TacticM Unit := do
if recInfo.altRHSs.isEmpty then
private def processResult (ref : Syntax) (altRHSs : Array Syntax) (result : Array Meta.InductionSubgoal) : TacticM Unit := do
if altRHSs.isEmpty then
setGoals $ result.toList.map $ fun s => s.mvarId
else do
unless (recInfo.altRHSs.size == result.size) $
unless (altRHSs.size == result.size) $
throwError ref ("mistmatch on the number of subgoals produced (" ++ toString result.size ++ ") and " ++
"alternatives provided (" ++ toString recInfo.altRHSs.size ++ ")");
"alternatives provided (" ++ toString altRHSs.size ++ ")");
result.size.forM $ fun i => do
let subgoal := result.get! i;
let rhs := recInfo.altRHSs.get! i;
let rhs := altRHSs.get! i;
let mvarId := subgoal.mvarId;
withMVarContext mvarId $ do
mvarDecl ← getMVarDecl mvarId;
@ -254,7 +259,33 @@ fun stx => focusAux stx $ do
recInfo ← getRecInfo stx major;
(mvarId, _) ← getMainGoal stx;
result ← liftMetaM stx $ Meta.induction mvarId major.fvarId! recInfo.recName recInfo.altVars;
processResult stx recInfo result
processResult stx recInfo.altRHSs result
private partial def checkCasesResultAux (ref : Syntax) (casesResult : Array Meta.CasesSubgoal) (ctorNames : Array Name) (altRHSs : Array Syntax)
: Nat → Nat → TacticM Unit
| i, j =>
if h : j < altRHSs.size then do
let altRHS := altRHSs.get ⟨j, h⟩;
if altRHS.isMissing then
checkCasesResultAux i (j+1)
else
let ctorName := ctorNames.get! j;
if h : i < casesResult.size then
let subgoal := casesResult.get ⟨i, h⟩;
if ctorName == subgoal.ctorName then
checkCasesResultAux (i+1) (j+1)
else
throwError ref ("alternative for '" ++ subgoal.ctorName ++ "' has not been provided")
else
throwError ref ("alternative for '" ++ ctorName ++ "' is not needed")
else if h : i < casesResult.size then
let subgoal := casesResult.get ⟨i, h⟩;
throwError ref ("alternative for '" ++ subgoal.ctorName ++ "' has not been provided")
else
pure ()
private def checkCasesResult (ref : Syntax) (casesResult : Array Meta.CasesSubgoal) (ctorNames : Array Name) (altRHSs : Array Syntax) : TacticM Unit :=
unless altRHSs.isEmpty $ checkCasesResultAux ref casesResult ctorNames altRHSs 0 0
@[builtinTactic «cases»] def evalCases : Tactic :=
fun stx => focusAux stx $ do
@ -264,10 +295,12 @@ fun stx => focusAux stx $ do
major ← generalizeMajor stx major;
(mvarId, _) ← getMainGoal stx;
let withAlts := stx.getArg 2;
recInfo ← getRecInfoDefault stx major withAlts;
(recInfo, ctorNames) ← getRecInfoDefault stx major withAlts true;
result ← liftMetaM stx $ Meta.cases mvarId major.fvarId! recInfo.altVars;
let result := result.map (fun s => s.toInductionSubgoal);
processResult stx recInfo result
checkCasesResult stx result ctorNames recInfo.altRHSs;
let result := result.map (fun s => s.toInductionSubgoal);
let altRHSs := recInfo.altRHSs.filter $ fun stx => !stx.isMissing;
processResult stx altRHSs result
end Tactic
end Elab

View file

@ -16,6 +16,10 @@ private def getInjectionNewIds (stx : Syntax) : List Name :=
if stx.isNone then []
else (stx.getArg 1).getArgs.toList.map Syntax.getId
private def checkUnusedIds (mvarId : MVarId) (unusedIds : List Name) : MetaM Unit :=
unless unusedIds.isEmpty $
Meta.throwTacticEx `injection mvarId ("too many identifiers provided, unused: " ++ toString unusedIds)
@[builtinTactic «injection»] def evalInjection : Tactic :=
fun stx => do
-- parser! nonReservedSymbol "injection " >> termParser >> withIds
@ -24,8 +28,8 @@ fun stx => do
liftMetaTactic stx $ fun mvarId => do
r ← Meta.injection mvarId fvarId ids (!ids.isEmpty);
match r with
| Meta.InjectionResult.solved => pure []
| Meta.InjectionResult.subgoal mvarId _ _ => pure [mvarId]
| Meta.InjectionResult.solved => do checkUnusedIds mvarId ids; pure []
| Meta.InjectionResult.subgoal mvarId' _ unusedIds => do checkUnusedIds mvarId unusedIds; pure [mvarId']
end Tactic
end Elab

View file

@ -6,6 +6,7 @@ Authors: Leonardo de Moura
prelude
import Init.Lean.Meta.AppBuilder
import Init.Lean.Meta.Tactic.Induction
import Init.Lean.Meta.Tactic.Injection
import Init.Lean.Meta.Tactic.Assert
import Init.Lean.Meta.Tactic.Subst
@ -203,14 +204,20 @@ private partial def unifyEqsAux : Nat → CasesSubgoal → MetaM (Option CasesSu
.. s
}
};
condM (isDefEq a b) (skip ()) $
let inj : Unit → MetaM (Option CasesSubgoal) := fun _ => do {
r ← injectionCore mvarId eqFVarId;
match r with
| InjectionResultCore.solved => pure none -- this alternative has been solved
| InjectionResultCore.subgoal mvarId numEqs => unifyEqsAux (n+numEqs) { mvarId := mvarId, .. s }
};
condM (isDefEq a b) (skip ()) $ do
a ← whnf a;
b ← whnf b;
match a, b with
| Expr.fvar aFVarId _, Expr.fvar bFVarId _ => do aDecl ← getLocalDecl aFVarId; bDecl ← getLocalDecl bFVarId; substEq (aDecl.index < bDecl.index)
| Expr.fvar _ _, _ => substEq false
| _, Expr.fvar _ _ => substEq true
| _, _ =>
-- TODO
pure $ some { mvarId := mvarId, .. s }
| _, _ => inj ()
| none => throwTacticEx `cases mvarId "equality expected"
private def unifyEqs (numEqs : Nat) (subgoals : Array CasesSubgoal) : MetaM (Array CasesSubgoal) :=

View file

@ -16,14 +16,20 @@ inductive InjectionResultCore
| solved
| subgoal (mvarId : MVarId) (numNewEqs : Nat)
def constructorApp? (e : Expr) : MetaM (Option ConstructorVal) := do
let f := e.getAppFn;
let nargs := e.getAppNumArgs;
private def getConstructorVal (ctorName : Name) (numArgs : Nat) : MetaM (Option ConstructorVal) := do
env ← getEnv;
matchConst env f (fun _ => pure none) $ fun cinfo _ =>
match cinfo with
| ConstantInfo.ctorInfo v => if e.getAppNumArgs == v.nparams + v.nfields then pure (some v) else pure none
| _ => pure none
match env.find? ctorName with
| some (ConstantInfo.ctorInfo v) => if numArgs == v.nparams + v.nfields then pure (some v) else pure none
| _ => pure none
def constructorApp? (e : Expr) : MetaM (Option ConstructorVal) := do
match e with
| Expr.lit (Literal.natVal n) _ =>
if n == 0 then getConstructorVal `Nat.zero 0 else getConstructorVal `Nat.succ 1
| _ =>
match e.getAppFn with
| Expr.const n _ _ => getConstructorVal n e.getAppNumArgs
| _ => pure none
def injectionCore (mvarId : MVarId) (fvarId : FVarId) : MetaM InjectionResultCore := do
withMVarContext mvarId $ do
@ -62,13 +68,37 @@ inductive InjectionResult
| solved
| subgoal (mvarId : MVarId) (newEqs : Array FVarId) (remainingNames : List Name)
private def heqToEq (mvarId : MVarId) (fvarId : FVarId) : MetaM (FVarId × MVarId) :=
withMVarContext mvarId $ do
decl ← getLocalDecl fvarId;
type ← whnf decl.type;
match type.heq? with
| none => pure (fvarId, mvarId)
| some (α, a, β, b) => do
pr ← mkEqOfHEq (mkFVar fvarId);
eq ← mkEq a b;
mvarId ← assert mvarId decl.userName eq pr;
mvarId ← clear mvarId fvarId;
(fvarId, mvarId) ← intro1 mvarId false;
pure (fvarId, mvarId)
def injectionIntro : Nat → MVarId → Array FVarId → List Name → MetaM InjectionResult
| 0, mvarId, fvarIds, remainingNames =>
pure $ InjectionResult.subgoal mvarId fvarIds remainingNames
| n+1, mvarId, fvarIds, name::remainingNames => do
(fvarId, mvarId) ← intro mvarId name;
(fvarId, mvarId) ← heqToEq mvarId fvarId;
injectionIntro n mvarId (fvarIds.push fvarId) remainingNames
| n+1, mvarId, fvarIds, [] => do
(fvarId, mvarId) ← intro1 mvarId true;
(fvarId, mvarId) ← heqToEq mvarId fvarId;
injectionIntro n mvarId (fvarIds.push fvarId) []
def injection (mvarId : MVarId) (fvarId : FVarId) (newNames : List Name := []) (useUnusedNames : Bool := true) : MetaM InjectionResult := do
r ← injectionCore mvarId fvarId;
match r with
| InjectionResultCore.solved => pure InjectionResult.solved
| InjectionResultCore.subgoal mvarId numEqs => do
(fvarIds, mvarId) ← introN mvarId numEqs newNames useUnusedNames;
pure $ InjectionResult.subgoal mvarId fvarIds (newNames.drop numEqs)
| InjectionResultCore.solved => pure InjectionResult.solved
| InjectionResultCore.subgoal mvarId numEqs => injectionIntro numEqs mvarId #[] newNames
end Meta
end Lean

View file

@ -22,9 +22,10 @@ withMVarContext mvarId $ do
hLocalDecl ← getLocalDecl hFVarId;
match hLocalDecl.type.eq? with
| none => throwTacticEx `subst mvarId "argument must be an equality proof"
| some (α, lhs, rhs) =>
| some (α, lhs, rhs) => do
let a := if symm then rhs else lhs;
let b := if symm then lhs else rhs;
a ← whnf a;
match a with
| Expr.fvar aFVarId _ => do
mctx ← getMCtx;

View file

@ -532,7 +532,7 @@ partial def main : Expr → M Expr
instArgs f
else do
newVal ← visit main val;
if newVal.hasMVar then
if newVal.hasExprMVar then
instArgs f
else do
args ← args.mapM (visit main);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,26 +17,34 @@ lean_object* l_Lean_Elab_Tactic_withMVarContext___rarg(lean_object*, lean_object
lean_object* l_Lean_Elab_Tactic_liftMetaM___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_Elab_Tactic_liftMetaTactic___closed__1;
lean_object* l_List_toString___at_Lean_Elab_OpenDecl_HasToString___spec__2(lean_object*);
lean_object* l_ReaderT_bind___at_Lean_Elab_Tactic_monadLog___spec__2___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__1;
extern lean_object* l_Lean_Elab_Tactic_declareBuiltinTactic___closed__3;
lean_object* l_Lean_Syntax_getId(lean_object*);
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3;
lean_object* lean_name_mk_string(lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_getMainGoal(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection___closed__1;
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2;
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_1__getInjectionNewIds(lean_object*);
lean_object* l_List_map___main___at___private_Init_Lean_Elab_Tactic_Injection_1__getInjectionNewIds___spec__1(lean_object*);
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1;
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_Parser_Tactic_injection___elambda__1___closed__1;
lean_object* l_Lean_Meta_throwTacticEx___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection(lean_object*);
lean_object* l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__2;
lean_object* l_Lean_Meta_injection___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Syntax_getArgs(lean_object*);
lean_object* l_Lean_Elab_Tactic_addBuiltinTactic(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_elabAsFVar(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Syntax_isNone(lean_object*);
lean_object* l_Array_toList___rarg(lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4;
lean_object* l_Lean_Syntax_getArg(lean_object*, lean_object*);
uint8_t l_List_isEmpty___rarg(lean_object*);
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_1__getInjectionNewIds___boxed(lean_object*);
@ -121,42 +129,211 @@ lean_dec(x_1);
return x_2;
}
}
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
lean_object* _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1() {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_box(0);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_1, 0);
x_7 = lean_box(0);
lean_inc(x_6);
x_8 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_8, 0, x_6);
lean_ctor_set(x_8, 1, x_7);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_3);
return x_9;
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Parser_Tactic_injection___elambda__1___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
}
lean_object* _init_l_Lean_Elab_Tactic_evalInjection___closed__1() {
lean_object* _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_evalInjection___lambda__1___boxed), 3, 0);
x_1 = lean_mk_string("too many identifiers provided, unused: ");
return x_1;
}
}
lean_object* _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2;
x_2 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
lean_object* _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_List_isEmpty___rarg(x_2);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_6 = l_List_toString___at_Lean_Elab_OpenDecl_HasToString___spec__2(x_2);
x_7 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_7, 0, x_6);
x_8 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_8, 0, x_7);
x_9 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4;
x_10 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_8);
x_11 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1;
x_12 = l_Lean_Meta_throwTacticEx___rarg(x_11, x_1, x_10, x_3, x_4);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14;
lean_dec(x_2);
lean_dec(x_1);
x_13 = lean_box(0);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_4);
return x_14;
}
}
}
lean_object* l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___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___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_6;
x_6 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds(x_1, x_2, x_4, x_5);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_7;
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_dec(x_8);
x_9 = lean_box(0);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_6, 1);
lean_inc(x_10);
lean_dec(x_6);
x_11 = lean_box(0);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
}
else
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_6);
if (x_13 == 0)
{
return x_6;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_6, 0);
x_15 = lean_ctor_get(x_6, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_6);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
lean_dec(x_2);
x_17 = lean_ctor_get(x_3, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_3, 2);
lean_inc(x_18);
lean_dec(x_3);
x_19 = l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds(x_1, x_18, x_4, x_5);
if (lean_obj_tag(x_19) == 0)
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_19);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_19, 0);
lean_dec(x_21);
x_22 = lean_box(0);
x_23 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_23, 0, x_17);
lean_ctor_set(x_23, 1, x_22);
lean_ctor_set(x_19, 0, x_23);
return x_19;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_24 = lean_ctor_get(x_19, 1);
lean_inc(x_24);
lean_dec(x_19);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_17);
lean_ctor_set(x_26, 1, x_25);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_24);
return x_27;
}
}
else
{
uint8_t x_28;
lean_dec(x_17);
x_28 = !lean_is_exclusive(x_19);
if (x_28 == 0)
{
return x_19;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = lean_ctor_get(x_19, 0);
x_30 = lean_ctor_get(x_19, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_19);
x_31 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_31, 0, x_29);
lean_ctor_set(x_31, 1, x_30);
return x_31;
}
}
}
}
}
lean_object* l_Lean_Elab_Tactic_evalInjection(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
@ -183,7 +360,7 @@ lean_inc(x_1);
x_13 = l_Lean_Elab_Tactic_getMainGoal(x_1, x_2, x_9);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; lean_object* x_19;
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; lean_object* x_19; lean_object* x_20;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
@ -195,23 +372,27 @@ x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
lean_dec(x_14);
x_18 = l_List_isEmpty___rarg(x_12);
x_19 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_liftMetaTacticAux___rarg___lambda__1___boxed), 4, 1);
lean_closure_set(x_19, 0, x_17);
lean_inc(x_12);
lean_inc(x_16);
x_19 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_evalInjection___lambda__1___boxed), 5, 2);
lean_closure_set(x_19, 0, x_16);
lean_closure_set(x_19, 1, x_12);
x_20 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_liftMetaTacticAux___rarg___lambda__1___boxed), 4, 1);
lean_closure_set(x_20, 0, x_17);
if (x_18 == 0)
{
uint8_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_20 = 1;
x_21 = lean_box(x_20);
uint8_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_21 = 1;
x_22 = lean_box(x_21);
lean_inc(x_16);
x_22 = lean_alloc_closure((void*)(l_Lean_Meta_injection___boxed), 6, 4);
lean_closure_set(x_22, 0, x_16);
lean_closure_set(x_22, 1, x_8);
lean_closure_set(x_22, 2, x_12);
lean_closure_set(x_22, 3, x_21);
x_23 = l_Lean_Elab_Tactic_evalInjection___closed__1;
x_23 = lean_alloc_closure((void*)(l_Lean_Meta_injection___boxed), 6, 4);
lean_closure_set(x_23, 0, x_16);
lean_closure_set(x_23, 1, x_8);
lean_closure_set(x_23, 2, x_12);
lean_closure_set(x_23, 3, x_22);
x_24 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_24, 0, x_22);
lean_closure_set(x_24, 1, x_23);
lean_closure_set(x_24, 0, x_23);
lean_closure_set(x_24, 1, x_19);
x_25 = l_Lean_Elab_Tactic_liftMetaTactic___closed__1;
x_26 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_26, 0, x_24);
@ -221,14 +402,14 @@ lean_closure_set(x_27, 0, x_1);
lean_closure_set(x_27, 1, x_26);
x_28 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Elab_Tactic_monadLog___spec__2___rarg), 4, 2);
lean_closure_set(x_28, 0, x_27);
lean_closure_set(x_28, 1, x_19);
lean_closure_set(x_28, 1, x_20);
x_29 = l_Lean_Elab_Tactic_withMVarContext___rarg(x_16, x_28, x_2, x_15);
lean_dec(x_16);
return x_29;
}
else
{
uint8_t 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; lean_object* x_38; lean_object* x_39;
uint8_t 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; lean_object* x_38;
x_30 = 0;
x_31 = lean_box(x_30);
lean_inc(x_16);
@ -237,86 +418,84 @@ lean_closure_set(x_32, 0, x_16);
lean_closure_set(x_32, 1, x_8);
lean_closure_set(x_32, 2, x_12);
lean_closure_set(x_32, 3, x_31);
x_33 = l_Lean_Elab_Tactic_evalInjection___closed__1;
x_34 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_34, 0, x_32);
lean_closure_set(x_34, 1, x_33);
x_35 = l_Lean_Elab_Tactic_liftMetaTactic___closed__1;
x_36 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_36, 0, x_34);
x_33 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_33, 0, x_32);
lean_closure_set(x_33, 1, x_19);
x_34 = l_Lean_Elab_Tactic_liftMetaTactic___closed__1;
x_35 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_35, 0, x_33);
lean_closure_set(x_35, 1, x_34);
x_36 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_liftMetaM___rarg), 4, 2);
lean_closure_set(x_36, 0, x_1);
lean_closure_set(x_36, 1, x_35);
x_37 = lean_alloc_closure((void*)(l_Lean_Elab_Tactic_liftMetaM___rarg), 4, 2);
lean_closure_set(x_37, 0, x_1);
lean_closure_set(x_37, 1, x_36);
x_38 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Elab_Tactic_monadLog___spec__2___rarg), 4, 2);
lean_closure_set(x_38, 0, x_37);
lean_closure_set(x_38, 1, x_19);
x_39 = l_Lean_Elab_Tactic_withMVarContext___rarg(x_16, x_38, x_2, x_15);
x_37 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Elab_Tactic_monadLog___spec__2___rarg), 4, 2);
lean_closure_set(x_37, 0, x_36);
lean_closure_set(x_37, 1, x_20);
x_38 = l_Lean_Elab_Tactic_withMVarContext___rarg(x_16, x_37, x_2, x_15);
lean_dec(x_16);
return x_39;
return x_38;
}
}
else
{
uint8_t x_40;
uint8_t x_39;
lean_dec(x_12);
lean_dec(x_8);
lean_dec(x_2);
lean_dec(x_1);
x_40 = !lean_is_exclusive(x_13);
if (x_40 == 0)
x_39 = !lean_is_exclusive(x_13);
if (x_39 == 0)
{
return x_13;
}
else
{
lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_41 = lean_ctor_get(x_13, 0);
x_42 = lean_ctor_get(x_13, 1);
lean_inc(x_42);
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_13, 0);
x_41 = lean_ctor_get(x_13, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_13);
x_43 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_43, 0, x_41);
lean_ctor_set(x_43, 1, x_42);
return x_43;
x_42 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_42, 0, x_40);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
}
else
{
uint8_t x_44;
uint8_t x_43;
lean_dec(x_2);
lean_dec(x_1);
x_44 = !lean_is_exclusive(x_7);
if (x_44 == 0)
x_43 = !lean_is_exclusive(x_7);
if (x_43 == 0)
{
return x_7;
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_45 = lean_ctor_get(x_7, 0);
x_46 = lean_ctor_get(x_7, 1);
lean_inc(x_46);
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_7, 0);
x_45 = lean_ctor_get(x_7, 1);
lean_inc(x_45);
lean_inc(x_44);
lean_dec(x_7);
x_47 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_47, 0, x_45);
lean_ctor_set(x_47, 1, x_46);
return x_47;
x_46 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_46, 0, x_44);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
}
}
lean_object* l_Lean_Elab_Tactic_evalInjection___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
lean_object* l_Lean_Elab_Tactic_evalInjection___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_4;
x_4 = l_Lean_Elab_Tactic_evalInjection___lambda__1(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
lean_object* x_6;
x_6 = l_Lean_Elab_Tactic_evalInjection___lambda__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__1() {
@ -369,8 +548,14 @@ lean_dec_ref(res);
res = initialize_Init_Lean_Elab_Tactic_ElabTerm(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_Elab_Tactic_evalInjection___closed__1 = _init_l_Lean_Elab_Tactic_evalInjection___closed__1();
lean_mark_persistent(l_Lean_Elab_Tactic_evalInjection___closed__1);
l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1 = _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1();
lean_mark_persistent(l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__1);
l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2 = _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2();
lean_mark_persistent(l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__2);
l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3 = _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3();
lean_mark_persistent(l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__3);
l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4 = _init_l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4();
lean_mark_persistent(l___private_Init_Lean_Elab_Tactic_Injection_2__checkUnusedIds___closed__4);
l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__1 = _init_l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__1();
lean_mark_persistent(l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__1);
l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__2 = _init_l___regBuiltinTactic_Lean_Elab_Tactic_evalInjection___closed__2();

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -75,6 +75,7 @@ lean_object* l_Lean_Meta_substCore___lambda__3___closed__10;
lean_object* l_Lean_Meta_subst___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_findSomeMAux___main___at_Lean_Meta_subst___spec__6(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_PersistentArray_findSomeMAux___main___at_Lean_Meta_subst___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_whnf(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkFVar(lean_object*);
lean_object* l_Nat_foldMAux___main___at_Lean_Meta_substCore___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_isAppOfArity___main(lean_object*, lean_object*, lean_object*);
@ -1829,406 +1830,446 @@ lean_dec(x_26);
x_28 = l_Lean_Expr_getRevArg_x21___main(x_13, x_27);
if (x_3 == 0)
{
uint8_t x_114;
x_114 = 0;
x_29 = x_114;
goto block_113;
uint8_t x_121;
x_121 = 0;
x_29 = x_121;
goto block_120;
}
else
{
uint8_t x_115;
x_115 = 1;
x_29 = x_115;
goto block_113;
uint8_t x_122;
x_122 = 1;
x_29 = x_122;
goto block_120;
}
block_113:
block_120:
{
lean_object* x_30; lean_object* x_40;
lean_object* x_30;
if (x_29 == 0)
{
lean_inc(x_24);
x_40 = x_24;
goto block_112;
x_30 = x_24;
goto block_119;
}
else
{
lean_inc(x_28);
x_40 = x_28;
goto block_112;
x_30 = x_28;
goto block_119;
}
block_39:
block_119:
{
lean_object* x_31; lean_object* x_32;
lean_dec(x_30);
x_31 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_31, 0, x_13);
x_32 = l_Lean_indentExpr(x_31);
if (x_29 == 0)
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = l_Lean_Meta_substCore___lambda__3___closed__12;
x_34 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_32);
x_35 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_34, x_5, x_12);
lean_dec(x_5);
return x_35;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = l_Lean_Meta_substCore___lambda__3___closed__16;
x_37 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_32);
x_38 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_37, x_5, x_12);
lean_dec(x_5);
return x_38;
}
}
block_112:
{
lean_object* x_41;
lean_object* x_31;
if (x_29 == 0)
{
lean_dec(x_24);
x_41 = x_28;
goto block_111;
x_31 = x_28;
goto block_118;
}
else
{
lean_dec(x_28);
x_41 = x_24;
goto block_111;
x_31 = x_24;
goto block_118;
}
block_111:
block_118:
{
if (lean_obj_tag(x_40) == 1)
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_95; uint8_t x_96;
lean_dec(x_13);
x_42 = lean_ctor_get(x_40, 0);
lean_inc(x_42);
x_43 = lean_ctor_get(x_12, 1);
lean_inc(x_43);
lean_inc(x_41);
x_95 = l_Lean_MetavarContext_exprDependsOn(x_43, x_41, x_42);
x_96 = lean_unbox(x_95);
lean_dec(x_95);
if (x_96 == 0)
{
lean_dec(x_41);
lean_dec(x_40);
x_44 = x_12;
goto block_94;
}
else
{
lean_object* x_97; lean_object* x_98; 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; uint8_t x_106;
lean_dec(x_42);
lean_dec(x_4);
lean_dec(x_2);
x_97 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_97, 0, x_40);
x_98 = l_Array_forMAux___main___at_Lean_Meta_clear___spec__5___closed__8;
x_99 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_99, 0, x_98);
lean_ctor_set(x_99, 1, x_97);
x_100 = l_Lean_Meta_substCore___lambda__3___closed__19;
x_101 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_101, 0, x_99);
lean_ctor_set(x_101, 1, x_100);
x_102 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_102, 0, x_41);
x_103 = l_Lean_indentExpr(x_102);
x_104 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_104, 0, x_101);
lean_ctor_set(x_104, 1, x_103);
x_105 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_104, x_5, x_12);
lean_dec(x_5);
x_106 = !lean_is_exclusive(x_105);
if (x_106 == 0)
{
return x_105;
}
else
{
lean_object* x_107; lean_object* x_108; lean_object* x_109;
x_107 = lean_ctor_get(x_105, 0);
x_108 = lean_ctor_get(x_105, 1);
lean_inc(x_108);
lean_inc(x_107);
lean_dec(x_105);
x_109 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_109, 0, x_107);
lean_ctor_set(x_109, 1, x_108);
return x_109;
}
}
block_94:
{
lean_object* x_45;
lean_object* x_32;
lean_inc(x_5);
lean_inc(x_42);
x_45 = l_Lean_Meta_getLocalDecl(x_42, x_5, x_44);
if (lean_obj_tag(x_45) == 0)
x_32 = l_Lean_Meta_whnf(x_30, x_5, x_12);
if (lean_obj_tag(x_32) == 0)
{
lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; uint8_t x_50; lean_object* x_51;
x_46 = lean_ctor_get(x_45, 1);
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
if (lean_obj_tag(x_33) == 1)
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_98; uint8_t x_99;
lean_dec(x_13);
x_45 = lean_ctor_get(x_33, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_34, 1);
lean_inc(x_46);
lean_dec(x_45);
x_47 = l_Lean_mkAppStx___closed__9;
x_48 = lean_array_push(x_47, x_42);
x_49 = lean_array_push(x_48, x_2);
x_50 = 1;
x_51 = l_Lean_Meta_revert(x_1, x_49, x_50, x_5, x_46);
if (lean_obj_tag(x_51) == 0)
lean_inc(x_31);
x_98 = l_Lean_MetavarContext_exprDependsOn(x_46, x_31, x_45);
x_99 = lean_unbox(x_98);
lean_dec(x_98);
if (x_99 == 0)
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; uint8_t x_57; lean_object* x_58;
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_ctor_get(x_52, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_52, 1);
lean_dec(x_33);
lean_dec(x_31);
x_47 = x_34;
goto block_97;
}
else
{
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; uint8_t x_109;
lean_dec(x_45);
lean_dec(x_4);
lean_dec(x_2);
x_100 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_100, 0, x_33);
x_101 = l_Array_forMAux___main___at_Lean_Meta_clear___spec__5___closed__8;
x_102 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_102, 0, x_101);
lean_ctor_set(x_102, 1, x_100);
x_103 = l_Lean_Meta_substCore___lambda__3___closed__19;
x_104 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_104, 0, x_102);
lean_ctor_set(x_104, 1, x_103);
x_105 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_105, 0, x_31);
x_106 = l_Lean_indentExpr(x_105);
x_107 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_107, 0, x_104);
lean_ctor_set(x_107, 1, x_106);
x_108 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_107, x_5, x_34);
lean_dec(x_5);
x_109 = !lean_is_exclusive(x_108);
if (x_109 == 0)
{
return x_108;
}
else
{
lean_object* x_110; lean_object* x_111; lean_object* x_112;
x_110 = lean_ctor_get(x_108, 0);
x_111 = lean_ctor_get(x_108, 1);
lean_inc(x_111);
lean_inc(x_110);
lean_dec(x_108);
x_112 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_112, 0, x_110);
lean_ctor_set(x_112, 1, x_111);
return x_112;
}
}
block_97:
{
lean_object* x_48;
lean_inc(x_5);
lean_inc(x_45);
x_48 = l_Lean_Meta_getLocalDecl(x_45, x_5, x_47);
if (lean_obj_tag(x_48) == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; uint8_t x_53; lean_object* x_54;
x_49 = lean_ctor_get(x_48, 1);
lean_inc(x_49);
lean_dec(x_48);
x_50 = l_Lean_mkAppStx___closed__9;
x_51 = lean_array_push(x_50, x_45);
x_52 = lean_array_push(x_51, x_2);
x_53 = 1;
x_54 = l_Lean_Meta_revert(x_1, x_52, x_53, x_5, x_49);
if (lean_obj_tag(x_54) == 0)
{
lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; uint8_t x_60; lean_object* x_61;
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
lean_dec(x_52);
x_56 = lean_box(0);
x_57 = 0;
x_58 = l_Lean_Meta_introNCore___at_Lean_Meta_introN___spec__1(x_57, x_55, x_25, x_56, x_5, x_53);
if (lean_obj_tag(x_58) == 0)
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; 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;
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = lean_ctor_get(x_59, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_59, 1);
lean_inc(x_62);
lean_dec(x_59);
x_63 = l_Lean_Name_inhabited;
x_64 = lean_array_get(x_63, x_61, x_19);
lean_inc(x_64);
x_65 = l_Lean_mkFVar(x_64);
x_66 = lean_array_get(x_63, x_61, x_21);
lean_dec(x_61);
lean_inc(x_66);
x_67 = l_Lean_mkFVar(x_66);
lean_inc(x_62);
x_68 = lean_alloc_closure((void*)(l_Lean_Meta_getMVarDecl___boxed), 3, 1);
lean_closure_set(x_68, 0, x_62);
x_69 = lean_box(x_29);
lean_inc(x_62);
x_70 = lean_alloc_closure((void*)(l_Lean_Meta_substCore___lambda__2___boxed), 14, 11);
lean_closure_set(x_70, 0, x_66);
lean_closure_set(x_70, 1, x_65);
lean_closure_set(x_70, 2, x_4);
lean_closure_set(x_70, 3, x_62);
lean_closure_set(x_70, 4, x_64);
lean_closure_set(x_70, 5, x_54);
lean_closure_set(x_70, 6, x_56);
lean_closure_set(x_70, 7, x_69);
lean_closure_set(x_70, 8, x_67);
lean_closure_set(x_70, 9, x_47);
lean_closure_set(x_70, 10, x_14);
x_71 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_71, 0, x_68);
lean_closure_set(x_71, 1, x_70);
x_72 = l_Lean_Meta_getMVarDecl(x_62, x_5, x_60);
if (lean_obj_tag(x_72) == 0)
{
lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
x_74 = lean_ctor_get(x_72, 1);
lean_inc(x_74);
lean_dec(x_72);
x_75 = lean_ctor_get(x_73, 1);
lean_inc(x_75);
x_76 = lean_ctor_get(x_73, 4);
lean_inc(x_76);
lean_dec(x_73);
x_77 = l_Lean_Meta_withLocalContext___rarg(x_75, x_76, x_71, x_5, x_74);
lean_dec(x_5);
return x_77;
}
else
{
uint8_t x_78;
lean_dec(x_71);
lean_dec(x_5);
x_78 = !lean_is_exclusive(x_72);
if (x_78 == 0)
{
return x_72;
}
else
{
lean_object* x_79; lean_object* x_80; lean_object* x_81;
x_79 = lean_ctor_get(x_72, 0);
x_80 = lean_ctor_get(x_72, 1);
lean_inc(x_80);
lean_inc(x_79);
lean_dec(x_72);
x_81 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_81, 0, x_79);
lean_ctor_set(x_81, 1, x_80);
return x_81;
}
}
}
else
{
uint8_t x_82;
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
lean_dec(x_54);
lean_dec(x_5);
lean_dec(x_4);
x_82 = !lean_is_exclusive(x_58);
if (x_82 == 0)
x_57 = lean_ctor_get(x_55, 0);
lean_inc(x_57);
x_58 = lean_ctor_get(x_55, 1);
lean_inc(x_58);
lean_dec(x_55);
x_59 = lean_box(0);
x_60 = 0;
x_61 = l_Lean_Meta_introNCore___at_Lean_Meta_introN___spec__1(x_60, x_58, x_25, x_59, x_5, x_56);
if (lean_obj_tag(x_61) == 0)
{
return x_58;
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; 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; lean_object* x_75;
x_62 = lean_ctor_get(x_61, 0);
lean_inc(x_62);
x_63 = lean_ctor_get(x_61, 1);
lean_inc(x_63);
lean_dec(x_61);
x_64 = lean_ctor_get(x_62, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_62, 1);
lean_inc(x_65);
lean_dec(x_62);
x_66 = l_Lean_Name_inhabited;
x_67 = lean_array_get(x_66, x_64, x_19);
lean_inc(x_67);
x_68 = l_Lean_mkFVar(x_67);
x_69 = lean_array_get(x_66, x_64, x_21);
lean_dec(x_64);
lean_inc(x_69);
x_70 = l_Lean_mkFVar(x_69);
lean_inc(x_65);
x_71 = lean_alloc_closure((void*)(l_Lean_Meta_getMVarDecl___boxed), 3, 1);
lean_closure_set(x_71, 0, x_65);
x_72 = lean_box(x_29);
lean_inc(x_65);
x_73 = lean_alloc_closure((void*)(l_Lean_Meta_substCore___lambda__2___boxed), 14, 11);
lean_closure_set(x_73, 0, x_69);
lean_closure_set(x_73, 1, x_68);
lean_closure_set(x_73, 2, x_4);
lean_closure_set(x_73, 3, x_65);
lean_closure_set(x_73, 4, x_67);
lean_closure_set(x_73, 5, x_57);
lean_closure_set(x_73, 6, x_59);
lean_closure_set(x_73, 7, x_72);
lean_closure_set(x_73, 8, x_70);
lean_closure_set(x_73, 9, x_50);
lean_closure_set(x_73, 10, x_14);
x_74 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Meta_isClassExpensive___main___spec__4___rarg), 4, 2);
lean_closure_set(x_74, 0, x_71);
lean_closure_set(x_74, 1, x_73);
x_75 = l_Lean_Meta_getMVarDecl(x_65, x_5, x_63);
if (lean_obj_tag(x_75) == 0)
{
lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80;
x_76 = lean_ctor_get(x_75, 0);
lean_inc(x_76);
x_77 = lean_ctor_get(x_75, 1);
lean_inc(x_77);
lean_dec(x_75);
x_78 = lean_ctor_get(x_76, 1);
lean_inc(x_78);
x_79 = lean_ctor_get(x_76, 4);
lean_inc(x_79);
lean_dec(x_76);
x_80 = l_Lean_Meta_withLocalContext___rarg(x_78, x_79, x_74, x_5, x_77);
lean_dec(x_5);
return x_80;
}
else
{
lean_object* x_83; lean_object* x_84; lean_object* x_85;
x_83 = lean_ctor_get(x_58, 0);
x_84 = lean_ctor_get(x_58, 1);
lean_inc(x_84);
uint8_t x_81;
lean_dec(x_74);
lean_dec(x_5);
x_81 = !lean_is_exclusive(x_75);
if (x_81 == 0)
{
return x_75;
}
else
{
lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_82 = lean_ctor_get(x_75, 0);
x_83 = lean_ctor_get(x_75, 1);
lean_inc(x_83);
lean_dec(x_58);
x_85 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_85, 0, x_83);
lean_ctor_set(x_85, 1, x_84);
return x_85;
lean_inc(x_82);
lean_dec(x_75);
x_84 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_84, 0, x_82);
lean_ctor_set(x_84, 1, x_83);
return x_84;
}
}
}
else
{
uint8_t x_86;
uint8_t x_85;
lean_dec(x_57);
lean_dec(x_5);
lean_dec(x_4);
x_86 = !lean_is_exclusive(x_51);
if (x_86 == 0)
x_85 = !lean_is_exclusive(x_61);
if (x_85 == 0)
{
return x_51;
return x_61;
}
else
{
lean_object* x_87; lean_object* x_88; lean_object* x_89;
x_87 = lean_ctor_get(x_51, 0);
x_88 = lean_ctor_get(x_51, 1);
lean_inc(x_88);
lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_86 = lean_ctor_get(x_61, 0);
x_87 = lean_ctor_get(x_61, 1);
lean_inc(x_87);
lean_dec(x_51);
x_89 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_89, 0, x_87);
lean_ctor_set(x_89, 1, x_88);
return x_89;
lean_inc(x_86);
lean_dec(x_61);
x_88 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_88, 0, x_86);
lean_ctor_set(x_88, 1, x_87);
return x_88;
}
}
}
else
{
uint8_t x_90;
lean_dec(x_42);
uint8_t x_89;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_90 = !lean_is_exclusive(x_45);
if (x_90 == 0)
x_89 = !lean_is_exclusive(x_54);
if (x_89 == 0)
{
return x_45;
return x_54;
}
else
{
lean_object* x_91; lean_object* x_92; lean_object* x_93;
x_91 = lean_ctor_get(x_45, 0);
x_92 = lean_ctor_get(x_45, 1);
lean_inc(x_92);
lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_90 = lean_ctor_get(x_54, 0);
x_91 = lean_ctor_get(x_54, 1);
lean_inc(x_91);
lean_inc(x_90);
lean_dec(x_54);
x_92 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_92, 0, x_90);
lean_ctor_set(x_92, 1, x_91);
return x_92;
}
}
}
else
{
uint8_t x_93;
lean_dec(x_45);
x_93 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_93, 0, x_91);
lean_ctor_set(x_93, 1, x_92);
return x_93;
}
}
}
}
else
{
lean_object* x_110;
lean_dec(x_41);
lean_dec(x_40);
lean_dec(x_4);
lean_dec(x_2);
x_110 = lean_box(0);
x_30 = x_110;
goto block_39;
}
}
}
}
}
}
else
{
uint8_t x_116;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_116 = !lean_is_exclusive(x_10);
if (x_116 == 0)
x_93 = !lean_is_exclusive(x_48);
if (x_93 == 0)
{
return x_48;
}
else
{
lean_object* x_94; lean_object* x_95; lean_object* x_96;
x_94 = lean_ctor_get(x_48, 0);
x_95 = lean_ctor_get(x_48, 1);
lean_inc(x_95);
lean_inc(x_94);
lean_dec(x_48);
x_96 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_96, 0, x_94);
lean_ctor_set(x_96, 1, x_95);
return x_96;
}
}
}
}
else
{
lean_object* x_113;
lean_dec(x_33);
lean_dec(x_31);
lean_dec(x_4);
lean_dec(x_2);
x_113 = lean_box(0);
x_35 = x_113;
goto block_44;
}
block_44:
{
lean_object* x_36; lean_object* x_37;
lean_dec(x_35);
x_36 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_36, 0, x_13);
x_37 = l_Lean_indentExpr(x_36);
if (x_29 == 0)
{
lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_38 = l_Lean_Meta_substCore___lambda__3___closed__12;
x_39 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_37);
x_40 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_39, x_5, x_34);
lean_dec(x_5);
return x_40;
}
else
{
lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_41 = l_Lean_Meta_substCore___lambda__3___closed__16;
x_42 = lean_alloc_ctor(9, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_37);
x_43 = l_Lean_Meta_throwTacticEx___rarg(x_7, x_1, x_42, x_5, x_34);
lean_dec(x_5);
return x_43;
}
}
}
else
{
uint8_t x_114;
lean_dec(x_31);
lean_dec(x_13);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_114 = !lean_is_exclusive(x_32);
if (x_114 == 0)
{
return x_32;
}
else
{
lean_object* x_115; lean_object* x_116; lean_object* x_117;
x_115 = lean_ctor_get(x_32, 0);
x_116 = lean_ctor_get(x_32, 1);
lean_inc(x_116);
lean_inc(x_115);
lean_dec(x_32);
x_117 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_117, 0, x_115);
lean_ctor_set(x_117, 1, x_116);
return x_117;
}
}
}
}
}
}
}
else
{
uint8_t x_123;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_123 = !lean_is_exclusive(x_10);
if (x_123 == 0)
{
return x_10;
}
else
{
lean_object* x_117; lean_object* x_118; lean_object* x_119;
x_117 = lean_ctor_get(x_10, 0);
x_118 = lean_ctor_get(x_10, 1);
lean_inc(x_118);
lean_inc(x_117);
lean_object* x_124; lean_object* x_125; lean_object* x_126;
x_124 = lean_ctor_get(x_10, 0);
x_125 = lean_ctor_get(x_10, 1);
lean_inc(x_125);
lean_inc(x_124);
lean_dec(x_10);
x_119 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_119, 0, x_117);
lean_ctor_set(x_119, 1, x_118);
return x_119;
x_126 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_126, 0, x_124);
lean_ctor_set(x_126, 1, x_125);
return x_126;
}
}
}
else
{
uint8_t x_120;
uint8_t x_127;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_120 = !lean_is_exclusive(x_8);
if (x_120 == 0)
x_127 = !lean_is_exclusive(x_8);
if (x_127 == 0)
{
return x_8;
}
else
{
lean_object* x_121; lean_object* x_122; lean_object* x_123;
x_121 = lean_ctor_get(x_8, 0);
x_122 = lean_ctor_get(x_8, 1);
lean_inc(x_122);
lean_inc(x_121);
lean_object* x_128; lean_object* x_129; lean_object* x_130;
x_128 = lean_ctor_get(x_8, 0);
x_129 = lean_ctor_get(x_8, 1);
lean_inc(x_129);
lean_inc(x_128);
lean_dec(x_8);
x_123 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_123, 0, x_121);
lean_ctor_set(x_123, 1, x_122);
return x_123;
x_130 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_130, 0, x_128);
lean_ctor_set(x_130, 1, x_129);
return x_130;
}
}
}

View file

@ -9538,7 +9538,7 @@ return x_247;
block_223:
{
uint8_t x_198;
x_198 = l_Lean_Expr_hasMVar(x_196);
x_198 = l_Lean_Expr_hasExprMVar(x_196);
if (x_198 == 0)
{
lean_object* x_199; lean_object* x_200; uint8_t x_201;