chore: update stage0

This commit is contained in:
Leonardo de Moura 2020-02-09 19:26:30 -08:00
parent c3b2a1da50
commit 145c94a5cc
36 changed files with 36302 additions and 6910 deletions

View file

@ -271,14 +271,14 @@ instance [HasRepr α] [HasRepr β] : HasRepr (RBMap α β lt) :=
| [] => mkRBMap _ _ _
| ⟨k,v⟩::xs => (ofList xs).insert k v
@[inline] def findCore : RBMap α β lt → α → Option (Sigma (fun (k : α) => β))
@[inline] def findCore? : RBMap α β lt → α → Option (Sigma (fun (k : α) => β))
| ⟨t, _⟩, x => t.findCore lt x
@[inline] def find : RBMap α β lt → α → Option β
@[inline] def find? : RBMap α β lt → α → Option β
| ⟨t, _⟩, x => t.find lt x
@[inline] def findD (t : RBMap α β lt) (k : α) (v₀ : β) : β :=
(t.find k).getD v₀
(t.find? k).getD v₀
/-- (lowerBound k) retrieves the kv pair of the largest key smaller than or equal to `k`,
if it exists. -/
@ -286,7 +286,7 @@ instance [HasRepr α] [HasRepr β] : HasRepr (RBMap α β lt) :=
| ⟨t, _⟩, x => t.lowerBound lt x none
@[inline] def contains (t : RBMap α β lt) (a : α) : Bool :=
(t.find a).isSome
(t.find? a).isSome
@[inline] def fromList (l : List (α × β)) (lt : αα → Bool) : RBMap α β lt :=
l.foldl (fun r p => r.insert p.1 p.2) (mkRBMap α β lt)

View file

@ -23,7 +23,7 @@ match t.max with
| none => panic! "map is empty"
@[inline] def find! [Inhabited β] (t : RBMap α β lt) (k : α) : β :=
match t.find k with
match t.find? k with
| some b => b
| none => panic! "key is not in the map"

View file

@ -66,13 +66,13 @@ RBMap.erase t a
| [] => mkRBTree _ _
| x::xs => (ofList xs).insert x
@[inline] def find (t : RBTree α lt) (a : α) : Option α :=
match RBMap.findCore t a with
@[inline] def find? (t : RBTree α lt) (a : α) : Option α :=
match RBMap.findCore? t a with
| some ⟨a, _⟩ => some a
| none => none
@[inline] def contains (t : RBTree α lt) (a : α) : Bool :=
(t.find a).isSome
(t.find? a).isSome
def fromList (l : List α) (lt : αα → Bool) : RBTree α lt :=
l.foldl insert (mkRBTree α lt)
@ -84,7 +84,7 @@ RBMap.all t (fun a _ => p a)
RBMap.any t (fun a _ => p a)
def subset (t₁ t₂ : RBTree α lt) : Bool :=
t₁.all $ fun a => (t₂.find a).toBool
t₁.all $ fun a => (t₂.find? a).toBool
def seteq (t₁ t₂ : RBTree α lt) : Bool :=
subset t₁ t₂ && subset t₂ t₁

View file

@ -349,12 +349,12 @@ match env.getModuleIdxFor? decl with
match (attr.ext.getModuleEntries env modIdx).binSearch (decl, arbitrary _) (fun a b => Name.quickLt a.1 b.1) with
| some (_, val) => some val
| none => none
| none => (attr.ext.getState env).find decl
| none => (attr.ext.getState env).find? decl
def setParam {α : Type} (attr : ParametricAttribute α) (env : Environment) (decl : Name) (param : α) : Except String Environment :=
if (env.getModuleIdxFor? decl).isSome then
Except.error ("invalid '" ++ toString attr.attr.name ++ "'.setParam, declaration is in an imported module")
else if ((attr.ext.getState env).find decl).isSome then
else if ((attr.ext.getState env).find? decl).isSome then
Except.error ("invalid '" ++ toString attr.attr.name ++ "'.setParam, attribute has already been set")
else
Except.ok (attr.ext.addEntry env (decl, param))
@ -405,12 +405,12 @@ match env.getModuleIdxFor? decl with
match (attr.ext.getModuleEntries env modIdx).binSearch (decl, arbitrary _) (fun a b => Name.quickLt a.1 b.1) with
| some (_, val) => some val
| none => none
| none => (attr.ext.getState env).find decl
| none => (attr.ext.getState env).find? decl
def setValue {α : Type} (attrs : EnumAttributes α) (env : Environment) (decl : Name) (val : α) : Except String Environment :=
if (env.getModuleIdxFor? decl).isSome then
Except.error ("invalid '" ++ toString attrs.ext.name ++ "'.setValue, declaration is in an imported module")
else if ((attrs.ext.getState env).find decl).isSome then
else if ((attrs.ext.getState env).find? decl).isSome then
Except.error ("invalid '" ++ toString attrs.ext.name ++ "'.setValue, attribute has already been set")
else
Except.ok (attrs.ext.addEntry env (decl, val))

View file

@ -454,27 +454,27 @@ def LocalContext.addParams (ctx : LocalContext) (ps : Array Param) : LocalContex
ps.foldl LocalContext.addParam ctx
def LocalContext.isJP (ctx : LocalContext) (idx : Index) : Bool :=
match ctx.find idx with
match ctx.find? idx with
| some (LocalContextEntry.joinPoint _ _) => true
| other => false
def LocalContext.getJPBody (ctx : LocalContext) (j : JoinPointId) : Option FnBody :=
match ctx.find j.idx with
match ctx.find? j.idx with
| some (LocalContextEntry.joinPoint _ b) => some b
| other => none
def LocalContext.getJPParams (ctx : LocalContext) (j : JoinPointId) : Option (Array Param) :=
match ctx.find j.idx with
match ctx.find? j.idx with
| some (LocalContextEntry.joinPoint ys _) => some ys
| other => none
def LocalContext.isParam (ctx : LocalContext) (idx : Index) : Bool :=
match ctx.find idx with
match ctx.find? idx with
| some (LocalContextEntry.param _) => true
| other => false
def LocalContext.isLocalVar (ctx : LocalContext) (idx : Index) : Bool :=
match ctx.find idx with
match ctx.find? idx with
| some (LocalContextEntry.localVar _ _) => true
| other => false
@ -485,13 +485,13 @@ def LocalContext.eraseJoinPointDecl (ctx : LocalContext) (j : JoinPointId) : Loc
ctx.erase j.idx
def LocalContext.getType (ctx : LocalContext) (x : VarId) : Option IRType :=
match ctx.find x.idx with
match ctx.find? x.idx with
| some (LocalContextEntry.param t) => some t
| some (LocalContextEntry.localVar t _) => some t
| other => none
def LocalContext.getValue (ctx : LocalContext) (x : VarId) : Option Expr :=
match ctx.find x.idx with
match ctx.find? x.idx with
| some (LocalContextEntry.localVar _ v) => some v
| other => none
@ -503,7 +503,7 @@ class HasAlphaEqv (α : Type) :=
export HasAlphaEqv (aeqv)
def VarId.alphaEqv (ρ : IndexRenaming) (v₁ v₂ : VarId) : Bool :=
match ρ.find v₁.idx with
match ρ.find? v₁.idx with
| some v => v == v₂.idx
| none => v₁ == v₂

View file

@ -107,7 +107,7 @@ collectArray as collectArg
private def accumulate (s' : LiveVarSet) : Collector :=
fun s => s'.fold (fun s x => s.insert x) s
private def collectJP (m : JPLiveVarMap) (j : JoinPointId) : Collector :=
match m.find j with
match m.find? j with
| some xs => accumulate xs
| none => skip -- unreachable for well-formed code
private def bindVar (x : VarId) : Collector :=

View file

@ -43,7 +43,7 @@ namespace NormalizeIds
abbrev M := ReaderT IndexRenaming Id
def normIndex (x : Index) : M Index :=
fun m => match m.find x with
fun m => match m.find? x with
| some y => y
| none => x

View file

@ -36,7 +36,7 @@ def getDecl (ctx : Context) (fid : FunId) : Decl :=
| none => arbitrary _ -- unreachable if well-formed
def getVarInfo (ctx : Context) (x : VarId) : VarInfo :=
match ctx.varMap.find x with
match ctx.varMap.find? x with
| some info => info
| none => {} -- unreachable in well-formed code
@ -46,7 +46,7 @@ match ctx.localCtx.getJPParams j with
| none => #[] -- unreachable in well-formed code
def getJPLiveVars (ctx : Context) (j : JoinPointId) : LiveVarSet :=
match ctx.jpLiveVarMap.find j with
match ctx.jpLiveVarMap.find? j with
| some s => s
| none => {}
@ -65,7 +65,7 @@ FnBody.dec x 1 true info.persistent b
private def updateRefUsingCtorInfo (ctx : Context) (x : VarId) (c : CtorInfo) : Context :=
if c.isRef then ctx
else let m := ctx.varMap;
{ varMap := match m.find x with
{ varMap := match m.find? x with
| some info => m.insert x { ref := false, .. info } -- I really want a Lenses library + notation
| none => m,
.. ctx }
@ -167,7 +167,7 @@ private def isPersistent : Expr → Bool
/- We do not need to consume the projection of a variable that is not consumed -/
private def consumeExpr (m : VarMap) : Expr → Bool
| Expr.proj i x => match m.find x with
| Expr.proj i x => match m.find? x with
| some info => info.consume
| none => true
| other => true

View file

@ -148,7 +148,7 @@ def insert (m : NameMap α) (n : Name) (a : α) := RBMap.insert m n a
def contains (m : NameMap α) (n : Name) : Bool := RBMap.contains m n
@[inline] def find (m : NameMap α) (n : Name) : Option α := RBMap.find m n
@[inline] def find? (m : NameMap α) (n : Name) : Option α := RBMap.find? m n
end NameMap

View file

@ -51,7 +51,7 @@ pure $ decls.fold
def getOptionDecl (name : Name) : IO OptionDecl := do
decls ← getOptionDecls;
(some decl) ← pure (decls.find name) | throw $ IO.userError ("unknown option '" ++ toString name ++ "'");
(some decl) ← pure (decls.find? name) | throw $ IO.userError ("unknown option '" ++ toString name ++ "'");
pure decl
def getOptionDefaulValue (name : Name) : IO DataValue := do

View file

@ -7,6 +7,9 @@ prelude
import Init.Lean.Util.CollectMVars
import Init.Lean.Meta.Tactic.Assumption
import Init.Lean.Meta.Tactic.Intro
import Init.Lean.Meta.Tactic.Clear
import Init.Lean.Meta.Tactic.Revert
import Init.Lean.Meta.Tactic.Subst
import Init.Lean.Elab.Util
import Init.Lean.Elab.Term
@ -344,6 +347,27 @@ fun stx => match_syntax stx with
setGoals (g :: gs)
| _ => throwUnsupportedSyntax
def forEachVar (ref : Syntax) (hs : Array Syntax) (tac : MVarId → FVarId → MetaM MVarId) : TacticM Unit :=
hs.forM $ fun h => do
(g, gs) ← getMainGoal ref;
withMVarContext g $ do
fvar? ← liftTermElabM $ Term.isLocalTermId? h true;
match fvar? with
| none => throwError h ("unknown variable '" ++ toString h.getId ++ "'")
| some fvar => do
g ← liftMetaM ref $ tac g fvar.fvarId!;
setGoals (g :: gs)
@[builtinTactic «clear»] def evalClear : Tactic :=
fun stx => match_syntax stx with
| `(tactic| clear $hs*) => forEachVar stx hs Meta.clear
| _ => throwUnsupportedSyntax
@[builtinTactic «subst»] def evalSubst : Tactic :=
fun stx => match_syntax stx with
| `(tactic| subst $hs*) => forEachVar stx hs Meta.subst
| _ => throwUnsupportedSyntax
@[builtinTactic paren] def evalParen : Tactic :=
fun stx => evalTactic (stx.getArg 1)

View file

@ -78,7 +78,7 @@ def toMessageData : Exception → MessageData
| notInstance i ctx => mkCtx ctx $ "not a type class instance " ++ i
| appBuilder op msg args ctx => mkCtx ctx $ "application builder failure " ++ op ++ " " ++ args ++ " " ++ msg
| synthInstance inst ctx => mkCtx ctx $ "failed to synthesize" ++ indentExpr inst
| tactic tacName mvarId msg ctx => mkCtx ctx $ "tactic '" ++ tacName ++ "' failed " ++ msg ++ Format.line ++ MessageData.ofGoal mvarId
| tactic tacName mvarId msg ctx => mkCtx ctx $ "tactic '" ++ tacName ++ "' failed, " ++ msg ++ Format.line ++ MessageData.ofGoal mvarId
| bug _ _ => "internal bug" -- TODO improve
| other s => s

View file

@ -14,13 +14,13 @@ withMVarContext mvarId $ do
checkNotAssigned mvarId `clear;
lctx ← getLCtx;
unless (lctx.contains fvarId) $
throwTacticEx `clear mvarId ("unknown hypothesis '" ++ mkFVar fvarId ++ "'");
throwTacticEx `clear mvarId ("unknown variable '" ++ mkFVar fvarId ++ "'");
tag ← getMVarTag mvarId;
mctx ← getMCtx;
lctx.forM $ fun localDecl =>
unless (localDecl.fvarId == fvarId) $
when (mctx.localDeclDependsOn localDecl fvarId) $
throwTacticEx `clear mvarId ("hypothesis '" ++ localDecl.value ++ "' depends on '" ++ mkFVar fvarId ++ "'");
throwTacticEx `clear mvarId ("variable '" ++ localDecl.toExpr ++ "' depends on '" ++ mkFVar fvarId ++ "'");
mvarDecl ← getMVarDecl mvarId;
when (mctx.exprDependsOn mvarDecl.type fvarId) $
throwTacticEx `clear mvarId ("taget depends on '" ++ mkFVar fvarId ++ "'");

View file

@ -0,0 +1,49 @@
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import Init.Lean.Expr
import Init.Lean.ReplaceExpr
namespace Lean
namespace Meta
/-
Some tactics substitute hypotheses with new ones and/or terms.
We track these substitutions using `FVarSubst`.
It is just a mapping from the original FVarId (internal) name
to an expression. The new expression should be well-formed with
respect to the new goal. -/
structure FVarSubst :=
(map : NameMap Expr := {})
namespace FVarSubst
def insert (s : FVarSubst) (fvarId : FVarId) (e : Expr) : FVarSubst :=
{ map := s.map.insert fvarId e }
def contains (s : FVarSubst) (fvarId : FVarId) : Bool :=
s.map.contains fvarId
/-- Given `e`, for each `(x => v)` in `s` replace `x` with `v` in `e` -/
def apply (s : FVarSubst) (e : Expr) : Expr :=
if s.map.isEmpty then e
else if !e.hasFVar then e
else e.replace $ fun e => match e with
| Expr.fvar fvarId _ => s.map.find? fvarId
| _ => none
/--
Extend substitution `newS` by applying `newS` to entries `(x => v)` to `oldS`,
and then merging the resulting entry `(x => newS.apply v)` to `newS`.
Remark: the entries in `newS` have precedence over the ones in `oldS`. -/
def compose (newS oldS : FVarSubst) : FVarSubst :=
if newS.map.isEmpty then oldS
else if oldS.map.isEmpty then newS
else oldS.map.fold (fun m fvarId e => if m.map.contains fvarId then m else m.insert fvarId (m.apply e)) newS
end FVarSubst
end Meta
end Lean

View file

@ -57,12 +57,12 @@ withMVarContext mvarId $ do
(fvars, mvarId) ← introNCoreAux mvarId mkName n lctx #[] 0 s mvarType;
pure (fvars.map Expr.fvarId!, mvarId)
def mkAuxName (lctx : LocalContext) (defaultName : Name) : List Name → Name × List Name
| [] => (lctx.getUnusedName defaultName, [])
| n :: rest => (if n == "_" then lctx.getUnusedName defaultName else n, rest)
def mkAuxName (useUnusedNames : Bool) (lctx : LocalContext) (defaultName : Name) : List Name → Name × List Name
| [] => (if useUnusedNames then lctx.getUnusedName defaultName else defaultName, [])
| n :: rest => (if n != "_" then n else if useUnusedNames then lctx.getUnusedName defaultName else defaultName, rest)
def introN (mvarId : MVarId) (n : Nat) (givenNames : List Name := []) : MetaM (Array FVarId × MVarId) :=
introNCore mvarId n mkAuxName givenNames
def introN (mvarId : MVarId) (n : Nat) (givenNames : List Name := []) (useUnusedNames := true) : MetaM (Array FVarId × MVarId) :=
introNCore mvarId n (mkAuxName useUnusedNames) givenNames
def intro (mvarId : MVarId) (name : Name) : MetaM (FVarId × MVarId) := do
(fvarIds, mvarId) ← introN mvarId 1 [name];

View file

@ -12,11 +12,14 @@ namespace Meta
def revert (mvarId : MVarId) (fvars : Array FVarId) (preserveOrder : Bool := false) : MetaM (Array FVarId × MVarId) :=
if fvars.isEmpty then pure (fvars, mvarId)
else withMVarContext mvarId $ do
tag ← getMVarTag mvarId;
checkNotAssigned mvarId `revert;
-- Set metavariable kind to natural to make sure `elimMVarDeps` will assign it.
setMVarKind mvarId MetavarKind.natural;
e ← finally (elimMVarDeps (fvars.map mkFVar) (mkMVar mvarId) preserveOrder) (setMVarKind mvarId MetavarKind.syntheticOpaque);
pure $ e.withApp $ fun mvar args => (args.map Expr.fvarId!, mvar.mvarId!)
e.withApp $ fun mvar args => do
setMVarTag mvar.mvarId! tag;
pure (args.map Expr.fvarId!, mvar.mvarId!)
end Meta
end Lean

View file

@ -0,0 +1,127 @@
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import Init.Lean.Meta.AppBuilder
import Init.Lean.Meta.Message
import Init.Lean.Meta.Tactic.Util
import Init.Lean.Meta.Tactic.Revert
import Init.Lean.Meta.Tactic.Intro
import Init.Lean.Meta.Tactic.Clear
import Init.Lean.Meta.Tactic.FVarSubst
namespace Lean
namespace Meta
def substCore (mvarId : MVarId) (hFVarId : FVarId) (symm := false) (genFVarSubst := false) : MetaM (FVarSubst × MVarId) :=
withMVarContext mvarId $ do
tag ← getMVarTag mvarId;
checkNotAssigned mvarId `subst;
hLocalDecl ← getLocalDecl hFVarId;
match hLocalDecl.type.eq? with
| none => throwTacticEx `subst mvarId "argument must be an equality proof"
| some (α, lhs, rhs) =>
let a := if symm then rhs else lhs;
let b := if symm then lhs else rhs;
match a with
| Expr.fvar aFVarId _ => do
mctx ← getMCtx;
when (mctx.exprDependsOn b aFVarId) $
throwTacticEx `subst mvarId ("'" ++ a ++ "' occurs at" ++ indentExpr b);
aLocalDecl ← getLocalDecl aFVarId;
(vars, mvarId) ← revert mvarId #[aFVarId, hFVarId] true;
(twoVars, mvarId) ← introN mvarId 2 [] false;
let aFVarId := twoVars.get! 0;
let a := mkFVar aFVarId;
let hFVarId := twoVars.get! 1;
let h := mkFVar hFVarId;
withMVarContext mvarId $ do
mvarDecl ← getMVarDecl mvarId;
let type := mvarDecl.type;
hLocalDecl ← getLocalDecl hFVarId;
match hLocalDecl.type.eq? with
| none => unreachable!
| some (α, lhs, rhs) => do
let b := if symm then lhs else rhs;
mctx ← getMCtx;
let depElim := mctx.exprDependsOn mvarDecl.type hFVarId;
let continue (motive : Expr) (newType : Expr) : MetaM (FVarSubst × MVarId) := do {
major ← if symm then pure h else mkEqSymm h;
newMVar ← mkFreshExprSyntheticOpaqueMVar newType tag;
let minor := newMVar;
newVal ← if depElim then mkEqRec motive minor major else mkEqNDRec motive minor major;
modify $ fun s => { mctx := s.mctx.assignExpr mvarId newVal, .. s };
let mvarId := newMVar.mvarId!;
mvarId ← clear mvarId hFVarId;
mvarId ← clear mvarId aFVarId;
(newFVars, mvarId) ← introN mvarId (vars.size - 2) [] false;
fvarSubst ← pure {FVarSubst . }; -- TODO
pure (fvarSubst, mvarId)
};
if depElim then do
let newType := (type.abstract #[a]).instantiate1 b;
reflB ← mkEqRefl b;
let newType := (newType.abstract #[h]).instantiate1 reflB;
if symm then do
motive ← mkLambda #[a, h] type;
continue motive newType
else do
/- `type` depends on (h : a = b). So, we use the following trick to avoid a type incorrect motive.
1- Create a new local (hAux : b = a)
2- Create newType := type [hAux.symm / h]
`newType` is type correct because `h` and `hAux.symm` are definitionally equal by proof irrelevance.
3- Create motive by abstracting `a` and `hAux` in `newType`. -/
hAuxType ← mkEq b a;
motive ← withLocalDecl `_h hAuxType BinderInfo.default $ fun hAux => do {
hAuxSymm ← mkEqSymm hAux;
/- replace h in type with hAuxSymm -/
let newType := (type.abstract #[h]).instantiate1 hAuxSymm;
mkLambda #[a, hAux] newType
};
continue motive newType
else do
motive ← mkLambda #[a] type;
let newType := (type.abstract #[a]).instantiate1 b;
continue motive newType
| _ =>
throwTacticEx `subst mvarId $
"invalid equality proof, it is not of the form "
++ (if symm then "(t = x)" else "(x = t)")
++ indentExpr hLocalDecl.type
def subst (mvarId : MVarId) (hFVarId : FVarId) : MetaM MVarId :=
withMVarContext mvarId $ do
hLocalDecl ← getLocalDecl hFVarId;
match hLocalDecl.type.eq? with
| some (α, lhs, rhs) =>
if rhs.isFVar then
Prod.snd <$> substCore mvarId hFVarId true
else if lhs.isFVar then
Prod.snd <$> substCore mvarId hFVarId
else
throwTacticEx `subst mvarId $
"invalid equality proof, it is not of the form (x = t) or (t = x)"
++ indentExpr hLocalDecl.type
| none => do
mctx ← getMCtx;
lctx ← getLCtx;
some (fvarId, symm) ← lctx.findDeclM?
(fun localDecl => match localDecl.type.eq? with
| some (α, lhs, rhs) =>
if rhs.isFVar && rhs.fvarId! == hFVarId && !mctx.exprDependsOn lhs hFVarId then
pure $ some (localDecl.fvarId, true)
else if lhs.isFVar && lhs.fvarId! == hFVarId && !mctx.exprDependsOn rhs hFVarId then
pure $ some (localDecl.fvarId, false)
else
pure none
| _ => pure none)
| throwTacticEx `subst mvarId ("did not find equation for eliminating '" ++ mkFVar hFVarId ++ "'");
Prod.snd <$> substCore mvarId fvarId symm
@[init] private def regTraceClasses : IO Unit :=
registerTraceClass `Meta.Tactic.subst
end Meta
end Lean

View file

@ -14,6 +14,9 @@ def getMVarTag (mvarId : MVarId) : MetaM Name := do
mvarDecl ← getMVarDecl mvarId;
pure mvarDecl.userName
def setMVarTag (mvarId : MVarId) (tag : Name) : MetaM Unit := do
modify $ fun s => { mctx := s.mctx.setMVarUserName mvarId tag, .. s }
def mkFreshExprSyntheticOpaqueMVar (type : Expr) (userName : Name := Name.anonymous) : MetaM Expr :=
mkFreshExprMVar type userName MetavarKind.syntheticOpaque

View file

@ -327,6 +327,10 @@ def setMVarKind (mctx : MetavarContext) (mvarId : MVarId) (kind : MetavarKind) :
let decl := mctx.getDecl mvarId;
{ decls := mctx.decls.insert mvarId { kind := kind, .. decl }, .. mctx }
def setMVarUserName (mctx : MetavarContext) (mvarId : MVarId) (userName : Name) : MetavarContext :=
let decl := mctx.getDecl mvarId;
{ decls := mctx.decls.insert mvarId { userName := userName, .. decl }, .. mctx }
def findLevelDepth? (mctx : MetavarContext) (mvarId : MVarId) : Option Nat :=
mctx.lDepth.find? mvarId
@ -706,11 +710,11 @@ else do
throw (Exception.revertFailure mctx lctx toRevert prevDecl)
};
let newToRevert := if preserveOrder then toRevert else Array.mkEmpty toRevert.size;
let firstDeclToVisit := if preserveOrder then lctx.getFVar! toRevert.back else getLocalDeclWithSmallestIdx lctx toRevert;
let skipFirst := preserveOrder;
let firstDeclToVisit := getLocalDeclWithSmallestIdx lctx toRevert;
let initSize := newToRevert.size;
lctx.foldlFromM
(fun (newToRevert : Array Expr) decl =>
if skipFirst && decl.index == firstDeclToVisit.index then pure newToRevert
if initSize.any $ fun i => decl.fvarId == (newToRevert.get! i).fvarId! then pure newToRevert
else if toRevert.any (fun x => decl.fvarId == x.fvarId!) then
pure (newToRevert.push decl.toExpr)
else if findLocalDeclDependsOn mctx decl (fun fvarId => newToRevert.any $ fun x => x.fvarId! == fvarId) then

View file

@ -1275,7 +1275,7 @@ def TokenMap (α : Type) := RBMap Name (List α) Name.quickLt
namespace TokenMap
def insert {α : Type} (map : TokenMap α) (k : Name) (v : α) : TokenMap α :=
match map.find k with
match map.find? k with
| none => map.insert k [v]
| some vs => map.insert k (v::vs)
@ -1344,15 +1344,15 @@ match stx? with
def indexed {α : Type} (map : TokenMap α) (c : ParserContext) (s : ParserState) (leadingIdentAsSymbol : Bool) : ParserState × List α :=
let (s, stx) := peekToken c s;
let find (n : Name) : ParserState × List α :=
match map.find n with
match map.find? n with
| some as => (s, as)
| _ => (s, []);
match stx with
| some (Syntax.atom _ sym) => find (mkNameSimple sym)
| some (Syntax.ident _ _ val _) =>
if leadingIdentAsSymbol then
match map.find val with
| some as => match map.find identKind with
match map.find? val with
| some as => match map.find? identKind with
| some as' => (s, as ++ as')
| _ => (s, as)
| none => find identKind

View file

@ -43,7 +43,7 @@ match env.getModuleIdxFor? projName with
match (projectionFnInfoExt.getModuleEntries env modIdx).binSearch (projName, arbitrary _) (fun a b => Name.quickLt a.1 b.1) with
| some e => some e.2
| none => none
| none => (projectionFnInfoExt.getState env).find projName
| none => (projectionFnInfoExt.getState env).find? projName
def isProjectionFn (env : Environment) (n : Name) : Bool :=
match env.getModuleIdxFor? n with

File diff suppressed because one or more lines are too long

View file

@ -47,6 +47,7 @@ uint8_t l_RBMap_any___rarg(lean_object*, lean_object*);
lean_object* l_RBNode_mfold___main___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_fold___main___at_RBMap_size___spec__1(lean_object*, lean_object*);
lean_object* l_RBNode_fold___main(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_find_x3f(lean_object*, lean_object*);
lean_object* lean_string_append(lean_object*, lean_object*);
extern lean_object* l_String_splitAux___main___closed__1;
lean_object* l_RBNode_revFold___main___rarg(lean_object*, lean_object*, lean_object*);
@ -60,7 +61,6 @@ lean_object* l_RBMap_insert___rarg(lean_object*, lean_object*, lean_object*, lea
lean_object* l_RBNode_ins___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_contains(lean_object*, lean_object*);
lean_object* l_RBNode_insert(lean_object*, lean_object*);
lean_object* l_RBMap_find(lean_object*, lean_object*);
lean_object* l_RBNode_mfold___main___rarg___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_mkRBMap___boxed(lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_add(lean_object*, lean_object*);
@ -72,7 +72,6 @@ lean_object* l_RBNode_insert___rarg(lean_object*, lean_object*, lean_object*, le
lean_object* l_RBNode_depth___main(lean_object*, lean_object*);
lean_object* l_RBNode_del___main(lean_object*, lean_object*);
lean_object* l_List_repr___at_RBMap_HasRepr___spec__1(lean_object*, lean_object*);
lean_object* l_RBMap_findCore(lean_object*, lean_object*);
lean_object* l_RBMap_size(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_isRed___rarg___boxed(lean_object*);
lean_object* l_RBNode_appendTrees___rarg(lean_object*, lean_object*);
@ -84,8 +83,8 @@ lean_object* l_RBMap_findD___rarg___boxed(lean_object*, lean_object*, lean_objec
lean_object* l_RBMap_depth___rarg(lean_object*, lean_object*);
lean_object* l_RBNode_mfold___main(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_lowerBound___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_find___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_singleton(lean_object*, lean_object*);
lean_object* l_RBMap_findCore_x3f___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_max___rarg(lean_object*);
lean_object* l_RBNode_del___main___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_min___main(lean_object*, lean_object*);
@ -112,6 +111,7 @@ lean_object* l_RBNode_erase___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_revFold(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_appendTrees___main(lean_object*, lean_object*);
lean_object* l_RBNode_min___main___rarg(lean_object*);
lean_object* l_RBMap_findCore_x3f(lean_object*, lean_object*);
lean_object* l_RBNode_mfold___main___at_RBMap_mfor___spec__1___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_mfold___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_mfor___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
@ -181,7 +181,6 @@ lean_object* l_RBNode_isBlack(lean_object*, lean_object*);
lean_object* l_List_foldl___main___at_RBMap_fromList___spec__1(lean_object*, lean_object*);
lean_object* l_RBNode_min(lean_object*, lean_object*);
lean_object* l_RBNode_find___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_findCore___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_HasRepr___rarg___closed__1;
lean_object* l_RBNode_fold___rarg(lean_object*, lean_object*, lean_object*);
uint8_t l_RBNode_all___main___rarg(lean_object*, lean_object*);
@ -192,6 +191,7 @@ lean_object* l_RBMap_maxDepth___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_empty(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_erase(lean_object*, lean_object*);
lean_object* l_RBMap_HasRepr(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_find_x3f___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_revFold___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_repr___at_RBMap_HasRepr___spec__1___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBMap_toList___boxed(lean_object*, lean_object*, lean_object*);
@ -23535,7 +23535,7 @@ x_3 = lean_alloc_closure((void*)(l_RBMap_ofList___rarg), 2, 0);
return x_3;
}
}
lean_object* l_RBMap_findCore___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
lean_object* l_RBMap_findCore_x3f___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
@ -23543,15 +23543,15 @@ x_4 = l_RBNode_findCore___main___rarg(x_1, x_2, x_3);
return x_4;
}
}
lean_object* l_RBMap_findCore(lean_object* x_1, lean_object* x_2) {
lean_object* l_RBMap_findCore_x3f(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_RBMap_findCore___rarg), 3, 0);
x_3 = lean_alloc_closure((void*)(l_RBMap_findCore_x3f___rarg), 3, 0);
return x_3;
}
}
lean_object* l_RBMap_find___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
lean_object* l_RBMap_find_x3f___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
@ -23559,11 +23559,11 @@ x_4 = l_RBNode_find___main___rarg(x_1, lean_box(0), x_2, x_3);
return x_4;
}
}
lean_object* l_RBMap_find(lean_object* x_1, lean_object* x_2) {
lean_object* l_RBMap_find_x3f(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_RBMap_find___rarg), 3, 0);
x_3 = lean_alloc_closure((void*)(l_RBMap_find_x3f___rarg), 3, 0);
return x_3;
}
}

View file

@ -16,7 +16,6 @@ extern "C" {
lean_object* l_List_repr___rarg(lean_object*, lean_object*);
lean_object* l_RBTree_isEmpty___rarg___boxed(lean_object*);
lean_object* l_RBTree_contains(lean_object*);
lean_object* l_RBTree_find___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_ofList___rarg(lean_object*, lean_object*);
lean_object* l_rbtreeOf___rarg(lean_object*, lean_object*);
lean_object* l_RBTree_subset___rarg___boxed(lean_object*, lean_object*, lean_object*);
@ -36,6 +35,7 @@ lean_object* l_RBNode_all___main___at_RBTree_subset___spec__1___rarg___boxed(lea
lean_object* l_RBTree_all___boxed(lean_object*, lean_object*);
uint8_t l_RBTree_subset___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_depth___rarg___boxed(lean_object*, lean_object*);
lean_object* l_RBTree_find_x3f(lean_object*);
lean_object* l_RBTree_fold___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_mfold___main___at_RBTree_mfor___spec__1___rarg___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_ofList___main___rarg(lean_object*, lean_object*);
@ -73,6 +73,7 @@ uint8_t l_RBTree_contains___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_List_foldl___main___at_RBTree_fromList___spec__1(lean_object*);
lean_object* l_RBNode_revFold___main___at_RBTree_revFold___spec__1(lean_object*, lean_object*);
uint8_t l_RBTree_seteq___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_find_x3f___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_HasRepr___boxed(lean_object*, lean_object*);
lean_object* l_RBTree_any___boxed(lean_object*, lean_object*);
lean_object* l_RBTree_fromList___rarg(lean_object*, lean_object*);
@ -100,7 +101,6 @@ lean_object* l_RBNode_all___main___at_RBTree_all___spec__1___rarg___boxed(lean_o
lean_object* l_RBTree_mfor___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_mfor(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBTree_HasEmptyc(lean_object*, lean_object*);
lean_object* l_RBTree_find(lean_object*);
lean_object* l_RBTree_min___boxed(lean_object*, lean_object*);
lean_object* l_RBTree_isEmpty(lean_object*, lean_object*);
lean_object* l_RBTree_fold(lean_object*, lean_object*, lean_object*);
@ -905,7 +905,7 @@ x_2 = lean_alloc_closure((void*)(l_RBTree_ofList___rarg), 2, 0);
return x_2;
}
}
lean_object* l_RBTree_find___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
lean_object* l_RBTree_find_x3f___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
@ -946,11 +946,11 @@ return x_11;
}
}
}
lean_object* l_RBTree_find(lean_object* x_1) {
lean_object* l_RBTree_find_x3f(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_RBTree_find___rarg), 3, 0);
x_2 = lean_alloc_closure((void*)(l_RBTree_find_x3f___rarg), 3, 0);
return x_2;
}
}

View file

@ -16,12 +16,14 @@ extern "C" {
lean_object* l_Lean_Name_isAtomic___boxed(lean_object*);
lean_object* l_List_reverse___rarg(lean_object*);
extern lean_object* l_Lean_mkHole___closed__3;
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg___boxed(lean_object*, lean_object*);
extern lean_object* l_Lean_Name_toString___closed__1;
lean_object* l_Lean_stringToName;
uint8_t l_RBNode_isRed___rarg(lean_object*);
lean_object* l_Lean_Name_DecidableRel___boxed(lean_object*, lean_object*);
lean_object* l_Lean_NameSet_contains___boxed(lean_object*, lean_object*);
lean_object* l_Lean_Name_hasLtQuick;
lean_object* l_Lean_NameMap_find_x3f___rarg(lean_object*, lean_object*);
lean_object* l_Lean_NameMap_Inhabited(lean_object*);
uint8_t l_Lean_Name_lt___main(lean_object*, lean_object*);
lean_object* l_Lean_Name_replacePrefix___main___boxed(lean_object*, lean_object*, lean_object*);
@ -36,6 +38,7 @@ lean_object* l_Lean_Name_getNumParts___main___boxed(lean_object*);
lean_object* l_Lean_Name_updatePrefix(lean_object*, lean_object*);
lean_object* l_Lean_Name_isAnonymous___boxed(lean_object*);
lean_object* l_Lean_mkNameSimple(lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg(lean_object*, lean_object*);
lean_object* lean_string_append(lean_object*, lean_object*);
uint8_t l_Lean_Name_isPrefixOf(lean_object*, lean_object*);
lean_object* l_Lean_Name_lt___boxed(lean_object*, lean_object*);
@ -51,10 +54,11 @@ lean_object* l_RBNode_insert___at_Lean_NameMap_insert___spec__1(lean_object*);
lean_object* l_Lean_NameMap_insert___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Name_eqStr(lean_object*, lean_object*);
lean_object* l_Lean_NameMap_find_x3f___rarg___boxed(lean_object*, lean_object*);
lean_object* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__3___rarg(lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
lean_object* l_String_toName(lean_object*);
lean_object* l_Lean_NameMap_find___rarg(lean_object*, lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1(lean_object*);
uint8_t l_Lean_Name_quickLtAux(lean_object*, lean_object*);
lean_object* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__2(lean_object*);
lean_object* l_Lean_Name_components_x27(lean_object*);
@ -78,6 +82,7 @@ lean_object* l_Lean_Name_getNumParts(lean_object*);
lean_object* l_Lean_NameMap_HasEmptyc(lean_object*);
uint8_t l_coeDecidableEq(uint8_t);
lean_object* l_Lean_Name_isInternal___main___boxed(lean_object*);
lean_object* l_Lean_NameMap_find_x3f(lean_object*);
lean_object* l_RBNode_insert___at_Lean_NameSet_insert___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkNameSet;
lean_object* l_Lean_Name_quickLtAux___main___boxed(lean_object*, lean_object*);
@ -92,14 +97,12 @@ lean_object* l_Lean_Name_appendAfter(lean_object*, lean_object*);
uint8_t l_Lean_Name_lt(lean_object*, lean_object*);
lean_object* l_Lean_Name_getNumParts___boxed(lean_object*);
uint8_t l_Lean_Name_isInternal___main(lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1(lean_object*);
lean_object* l_Lean_Name_getPrefix___boxed(lean_object*);
lean_object* l_Lean_Name_components_x27___main(lean_object*);
uint8_t l_Lean_Name_isSuffixOf(lean_object*, lean_object*);
uint8_t l_Lean_Name_isAnonymous(lean_object*);
lean_object* l_RBNode_ins___main___at_Lean_NameSet_insert___spec__2(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_NameSet_Inhabited;
lean_object* l_Lean_NameMap_find(lean_object*);
lean_object* l_Lean_Name_replacePrefix___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_List_foldl___main___at_String_toName___spec__1(lean_object*, lean_object*);
uint8_t l_Lean_Name_isSuffixOf___main(lean_object*, lean_object*);
@ -117,14 +120,11 @@ lean_object* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__2___rarg(lean_
lean_object* l_Lean_Name_getRoot___main___boxed(lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_contains___spec__1___rarg(lean_object*, lean_object*);
lean_object* l_Lean_mkNameMap(lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg(lean_object*, lean_object*);
lean_object* l_Lean_Name_getRoot___boxed(lean_object*);
lean_object* l_Lean_Name_getRoot(lean_object*);
lean_object* l_Lean_NameMap_find___rarg___boxed(lean_object*, lean_object*);
lean_object* l_Lean_Name_replacePrefix(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_components(lean_object*);
lean_object* lean_name_mk_numeral(lean_object*, lean_object*);
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg___boxed(lean_object*, lean_object*);
uint8_t lean_string_dec_lt(lean_object*, lean_object*);
uint8_t lean_string_dec_eq(lean_object*, lean_object*);
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
@ -6209,7 +6209,7 @@ x_4 = lean_box(x_3);
return x_4;
}
}
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
@ -6252,45 +6252,45 @@ goto _start;
}
}
}
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1(lean_object* x_1) {
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg___boxed), 2, 0);
x_2 = lean_alloc_closure((void*)(l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
lean_object* l_Lean_NameMap_find___rarg(lean_object* x_1, lean_object* x_2) {
lean_object* l_Lean_NameMap_find_x3f___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg(x_1, x_2);
x_3 = l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg(x_1, x_2);
return x_3;
}
}
lean_object* l_Lean_NameMap_find(lean_object* x_1) {
lean_object* l_Lean_NameMap_find_x3f(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_NameMap_find___rarg___boxed), 2, 0);
x_2 = lean_alloc_closure((void*)(l_Lean_NameMap_find_x3f___rarg___boxed), 2, 0);
return x_2;
}
}
lean_object* l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
lean_object* l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg(x_1, x_2);
x_3 = l_RBNode_find___main___at_Lean_NameMap_find_x3f___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_NameMap_find___rarg___boxed(lean_object* x_1, lean_object* x_2) {
lean_object* l_Lean_NameMap_find_x3f___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_NameMap_find___rarg(x_1, x_2);
x_3 = l_Lean_NameMap_find_x3f___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;

File diff suppressed because it is too large Load diff

View file

@ -123,6 +123,7 @@ lean_object* l_Array_binSearchAux___main___at___private_Init_Lean_Meta_DiscrTree
lean_object* l_Lean_Meta_DiscrTree_mkPathAux(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Lean_Meta_DiscrTree_4__pushArgsAux___main___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_binSearchAux___main___at___private_Init_Lean_Meta_DiscrTree_15__getMatchAux___main___spec__1___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1___boxed(lean_object*);
lean_object* l___private_Init_Lean_Meta_DiscrTree_6__shouldAddAsStar___boxed(lean_object*);
lean_object* l_Lean_Meta_DiscrTree_Key_hasFormat___closed__1;
lean_object* l_PersistentHashMap_findAtAux___main___at_Lean_Meta_DiscrTree_insertCore___spec__3(lean_object*);
@ -179,6 +180,7 @@ lean_object* l___private_Init_Lean_Meta_DiscrTree_6__shouldAddAsStar___closed__6
lean_object* l_Lean_Meta_DiscrTree_format___rarg(lean_object*, lean_object*);
lean_object* l_PersistentHashMap_findAtAux___main___at_Lean_Meta_DiscrTree_getUnify___spec__3___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_PersistentHashMap_findAtAux___main___at_Lean_Meta_DiscrTree_getUnify___spec__3___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(lean_object*);
lean_object* l_PersistentHashMap_insertAtCollisionNodeAux___main___at_Lean_Meta_DiscrTree_insertCore___spec__10___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_binInsertM___at___private_Init_Lean_Meta_DiscrTree_11__insertAux___main___spec__1___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_DiscrTree_mkPath___closed__1;
@ -254,6 +256,7 @@ lean_object* l_Array_iterateMAux___main___at_Lean_Meta_DiscrTree_format___spec__
lean_object* l___private_Init_Lean_Meta_DiscrTree_11__insertAux___main___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_binInsertM___at___private_Init_Lean_Meta_DiscrTree_11__insertAux___main___spec__1(lean_object*);
lean_object* l_Array_toList___rarg(lean_object*);
extern lean_object* l_Lean_Expr_Inhabited;
lean_object* l___private_Init_Lean_Meta_DiscrTree_17__getUnifyAux(lean_object*);
lean_object* lean_array_pop(lean_object*);
lean_object* l_Lean_Meta_DiscrTree_Trie_format___main___rarg(lean_object*, lean_object*);
@ -300,7 +303,6 @@ lean_object* l_Array_binSearchAux___main___at___private_Init_Lean_Meta_DiscrTree
lean_object* l_PersistentHashMap_findAtAux___main___at_Lean_Meta_DiscrTree_insertCore___spec__3___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_PersistentHashMap_findAux___main___at_Lean_Meta_DiscrTree_getUnify___spec__2(lean_object*);
lean_object* l_Array_back___at___private_Init_Lean_Meta_DiscrTree_11__insertAux___main___spec__2___rarg___closed__1;
lean_object* l_Array_back___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50(lean_object*);
uint8_t l_Lean_Literal_lt(lean_object*, lean_object*);
lean_object* l___private_Init_Lean_Meta_DiscrTree_11__insertAux___main(lean_object*);
lean_object* l_PersistentHashMap_foldlM___at_Lean_Meta_DiscrTree_getUnify___spec__4___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
@ -2137,6 +2139,20 @@ return x_186;
}
}
}
lean_object* l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_2 = lean_array_get_size(x_1);
x_3 = lean_unsigned_to_nat(1u);
x_4 = lean_nat_sub(x_2, x_3);
lean_dec(x_2);
x_5 = l_Lean_Expr_Inhabited;
x_6 = lean_array_get(x_5, x_1, x_4);
lean_dec(x_4);
return x_6;
}
}
lean_object* l_Lean_Meta_DiscrTree_mkPathAux___main(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
@ -2145,7 +2161,7 @@ x_5 = l_Array_isEmpty___rarg(x_1);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = l_Array_back___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50(x_1);
x_6 = l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(x_1);
x_7 = lean_array_pop(x_1);
lean_inc(x_3);
x_8 = l___private_Init_Lean_Meta_DiscrTree_7__pushArgs(x_7, x_6, x_3, x_4);
@ -2205,6 +2221,15 @@ return x_19;
}
}
}
lean_object* l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* l_Lean_Meta_DiscrTree_mkPathAux(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
@ -6229,7 +6254,7 @@ x_9 = l_Array_isEmpty___rarg(x_7);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15; lean_object* x_16;
x_10 = l_Array_back___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50(x_1);
x_10 = l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(x_1);
x_11 = lean_array_pop(x_1);
x_12 = l_Array_back___at___private_Init_Lean_Meta_DiscrTree_11__insertAux___main___spec__2___rarg___closed__2;
x_13 = lean_unsigned_to_nat(0u);
@ -9516,7 +9541,7 @@ x_18 = l_Array_isEmpty___rarg(x_16);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; uint8_t x_21; lean_object* x_22;
x_19 = l_Array_back___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50(x_2);
x_19 = l_Array_back___at_Lean_Meta_DiscrTree_mkPathAux___main___spec__1(x_2);
x_20 = lean_array_pop(x_2);
x_21 = 0;
lean_inc(x_5);

View file

@ -1380,7 +1380,7 @@ lean_object* _init_l_Lean_Meta_Exception_toMessageData___closed__49() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("' failed ");
x_1 = lean_mk_string("' failed, ");
return x_1;
}
}

View file

@ -288,7 +288,6 @@ lean_object* l___private_Init_Lean_Util_Trace_5__checkTraceOptionM___at_Lean_Met
lean_object* l_Lean_Meta_SynthInstance_Waiter_isRoot___boxed(lean_object*);
uint8_t l_AssocList_contains___main___at_Lean_Meta_SynthInstance_MkTableKey_normLevel___main___spec__4(lean_object*, lean_object*);
lean_object* lean_panic_fn(lean_object*, lean_object*);
extern lean_object* l_Nat_forMAux___main___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__51___closed__1;
lean_object* l_Lean_MetavarContext_incDepth(lean_object*);
uint8_t l_Lean_TagAttribute_hasTag(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_SynthInstance_getResult___boxed(lean_object*);
@ -350,6 +349,7 @@ extern lean_object* l_Lean_mkOptionalNode___closed__2;
lean_object* l_Lean_Meta_SynthInstance_liftMeta___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_SynthInstance_MkTableKey_normLevel___main(lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_Meta_isClassQuick___main___closed__1;
extern lean_object* l_Nat_forMAux___main___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50___closed__1;
lean_object* l_Lean_Meta_SynthInstance_consume(lean_object*, lean_object*, lean_object*);
lean_object* l_unsafeCast(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_iterateMAux___main___at_Lean_mkAppN___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
@ -398,7 +398,7 @@ lean_object* l_Lean_Meta_SynthInstance_mkInferTCGoalsLRAttr___lambda__1(lean_obj
_start:
{
lean_object* x_3;
x_3 = l_Nat_forMAux___main___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__51___closed__1;
x_3 = l_Nat_forMAux___main___at___private_Init_Lean_MetavarContext_10__collectDeps___spec__50___closed__1;
return x_3;
}
}

View file

@ -34,7 +34,6 @@ lean_object* lean_nat_add(lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_Meta_clear___spec__13___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_Meta_clear___spec__5___closed__8;
lean_object* l_Array_forMAux___main___at_Lean_Meta_clear___spec__5___closed__4;
lean_object* l_Lean_LocalDecl_value(lean_object*);
lean_object* lean_array_fget(lean_object*, lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
lean_object* l_Lean_Meta_clear___closed__1;
@ -52,6 +51,7 @@ lean_object* lean_name_mk_string(lean_object*, lean_object*);
lean_object* l_PersistentArray_forMAux___main___at_Lean_Meta_clear___spec__10___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_MetavarContext_assignExpr(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_MetavarContext_localDeclDependsOn(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_LocalDecl_toExpr(lean_object*);
lean_object* l_Lean_LocalContext_forM___at_Lean_Meta_clear___spec__8___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkFVar(lean_object*);
lean_object* l_Lean_LocalDecl_fvarId(lean_object*);
@ -165,7 +165,7 @@ lean_object* _init_l_Array_forMAux___main___at_Lean_Meta_clear___spec__5___close
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("hypothesis '");
x_1 = lean_mk_string("variable '");
return x_1;
}
}
@ -303,7 +303,7 @@ else
lean_object* x_25; lean_object* x_26; lean_object* x_27; 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; uint8_t x_37;
lean_dec(x_6);
lean_dec(x_4);
x_25 = l_Lean_LocalDecl_value(x_17);
x_25 = l_Lean_LocalDecl_toExpr(x_17);
lean_dec(x_17);
x_26 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_26, 0, x_25);
@ -447,7 +447,7 @@ else
lean_object* x_25; lean_object* x_26; lean_object* x_27; 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; uint8_t x_37;
lean_dec(x_6);
lean_dec(x_4);
x_25 = l_Lean_LocalDecl_value(x_17);
x_25 = l_Lean_LocalDecl_toExpr(x_17);
lean_dec(x_17);
x_26 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_26, 0, x_25);
@ -746,7 +746,7 @@ else
lean_object* x_25; lean_object* x_26; lean_object* x_27; 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; uint8_t x_37;
lean_dec(x_6);
lean_dec(x_4);
x_25 = l_Lean_LocalDecl_value(x_17);
x_25 = l_Lean_LocalDecl_toExpr(x_17);
lean_dec(x_17);
x_26 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_26, 0, x_25);
@ -890,7 +890,7 @@ else
lean_object* x_25; lean_object* x_26; lean_object* x_27; 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; uint8_t x_37;
lean_dec(x_6);
lean_dec(x_4);
x_25 = l_Lean_LocalDecl_value(x_17);
x_25 = l_Lean_LocalDecl_toExpr(x_17);
lean_dec(x_17);
x_26 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_26, 0, x_25);
@ -1141,7 +1141,7 @@ lean_object* _init_l_Lean_Meta_clear___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("unknown hypothesis '");
x_1 = lean_mk_string("unknown variable '");
return x_1;
}
}

View file

@ -0,0 +1,838 @@
// Lean compiler output
// Module: Init.Lean.Meta.Tactic.FVarSubst
// Imports: Init.Lean.Expr Init.Lean.ReplaceExpr
#include "runtime/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_object* lean_expr_update_forall(lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1___boxed(lean_object*, lean_object*);
lean_object* l_Lean_Meta_FVarSubst_apply___boxed(lean_object*, lean_object*);
lean_object* l_unreachable_x21___rarg(lean_object*);
uint8_t l_USize_decEq(size_t, size_t);
lean_object* lean_array_uget(lean_object*, size_t);
lean_object* lean_expr_update_mdata(lean_object*, lean_object*);
uint8_t l_Lean_Name_quickLt(lean_object*, lean_object*);
lean_object* l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(lean_object*, size_t, lean_object*, lean_object*);
lean_object* lean_array_uset(lean_object*, size_t, lean_object*);
lean_object* l_RBNode_fold___main___at_Lean_Meta_FVarSubst_compose___spec__1(lean_object*, lean_object*);
uint8_t l_Lean_NameMap_contains___rarg(lean_object*, lean_object*);
lean_object* l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_FVarSubst_apply(lean_object*, lean_object*);
lean_object* l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1(lean_object*, lean_object*);
extern lean_object* l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___closed__2;
uint8_t l_Lean_Meta_FVarSubst_contains(lean_object*, lean_object*);
lean_object* lean_expr_update_let(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_Data_binderInfo(uint64_t);
lean_object* l_Lean_Meta_FVarSubst_contains___boxed(lean_object*, lean_object*);
lean_object* lean_expr_update_proj(lean_object*, lean_object*);
size_t l_USize_mod(size_t, size_t);
size_t lean_ptr_addr(lean_object*);
lean_object* l_Lean_Meta_FVarSubst_insert(lean_object*, lean_object*, lean_object*);
lean_object* lean_expr_update_lambda(lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_Meta_FVarSubst_compose(lean_object*, lean_object*);
lean_object* lean_expr_update_app(lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_hasFVar(lean_object*);
extern lean_object* l_Lean_Expr_ReplaceImpl_initCache;
lean_object* l_Lean_Meta_FVarSubst_insert(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(x_1, x_2, x_3);
return x_4;
}
}
uint8_t l_Lean_Meta_FVarSubst_contains(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3;
x_3 = l_Lean_NameMap_contains___rarg(x_1, x_2);
return x_3;
}
}
lean_object* l_Lean_Meta_FVarSubst_contains___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_Meta_FVarSubst_contains(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
lean_object* l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickLt(x_2, x_5);
if (x_8 == 0)
{
uint8_t x_9;
x_9 = l_Lean_Name_quickLt(x_5, x_2);
if (x_9 == 0)
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
else
{
x_1 = x_7;
goto _start;
}
}
else
{
x_1 = x_4;
goto _start;
}
}
}
}
lean_object* l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(lean_object* x_1, size_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7; lean_object* x_207; lean_object* x_224; lean_object* x_225; uint8_t x_226;
x_5 = lean_ptr_addr(x_3);
x_6 = x_2 == 0 ? 0 : x_5 % x_2;
x_224 = lean_ctor_get(x_4, 1);
lean_inc(x_224);
x_225 = lean_array_uget(x_224, x_6);
lean_dec(x_224);
x_226 = lean_unbox(x_225);
lean_dec(x_225);
if (x_226 == 0)
{
lean_object* x_227;
x_227 = lean_box(0);
x_207 = x_227;
goto block_223;
}
else
{
lean_object* x_228; lean_object* x_229; size_t x_230; uint8_t x_231;
x_228 = lean_ctor_get(x_4, 0);
lean_inc(x_228);
x_229 = lean_array_uget(x_228, x_6);
lean_dec(x_228);
x_230 = lean_ptr_addr(x_229);
lean_dec(x_229);
x_231 = x_230 == x_5;
if (x_231 == 0)
{
lean_object* x_232;
x_232 = lean_box(0);
x_207 = x_232;
goto block_223;
}
else
{
lean_object* x_233; lean_object* x_234; lean_object* x_235;
lean_dec(x_3);
x_233 = lean_ctor_get(x_4, 2);
lean_inc(x_233);
x_234 = lean_array_uget(x_233, x_6);
lean_dec(x_233);
x_235 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_235, 0, x_234);
lean_ctor_set(x_235, 1, x_4);
return x_235;
}
}
block_206:
{
lean_dec(x_7);
switch (lean_obj_tag(x_3)) {
case 5:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_8 = lean_ctor_get(x_3, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
x_10 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_8, x_4);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_9, x_12);
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; 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;
x_15 = lean_ctor_get(x_13, 0);
x_16 = lean_ctor_get(x_13, 1);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
lean_inc(x_3);
x_18 = lean_array_uset(x_17, x_6, x_3);
x_19 = lean_ctor_get(x_16, 1);
lean_inc(x_19);
x_20 = 1;
x_21 = lean_box(x_20);
x_22 = lean_array_uset(x_19, x_6, x_21);
x_23 = lean_ctor_get(x_16, 2);
lean_inc(x_23);
lean_dec(x_16);
x_24 = lean_expr_update_app(x_3, x_11, x_15);
lean_inc(x_24);
x_25 = lean_array_uset(x_23, x_6, x_24);
x_26 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_26, 0, x_18);
lean_ctor_set(x_26, 1, x_22);
lean_ctor_set(x_26, 2, x_25);
lean_ctor_set(x_13, 1, x_26);
lean_ctor_set(x_13, 0, x_24);
return x_13;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t 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;
x_27 = lean_ctor_get(x_13, 0);
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_13);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
lean_inc(x_3);
x_30 = lean_array_uset(x_29, x_6, x_3);
x_31 = lean_ctor_get(x_28, 1);
lean_inc(x_31);
x_32 = 1;
x_33 = lean_box(x_32);
x_34 = lean_array_uset(x_31, x_6, x_33);
x_35 = lean_ctor_get(x_28, 2);
lean_inc(x_35);
lean_dec(x_28);
x_36 = lean_expr_update_app(x_3, x_11, x_27);
lean_inc(x_36);
x_37 = lean_array_uset(x_35, x_6, x_36);
x_38 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_38, 0, x_30);
lean_ctor_set(x_38, 1, x_34);
lean_ctor_set(x_38, 2, x_37);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_36);
lean_ctor_set(x_39, 1, x_38);
return x_39;
}
}
case 6:
{
lean_object* x_40; lean_object* x_41; uint64_t x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; uint8_t x_47;
x_40 = lean_ctor_get(x_3, 1);
lean_inc(x_40);
x_41 = lean_ctor_get(x_3, 2);
lean_inc(x_41);
x_42 = lean_ctor_get_uint64(x_3, sizeof(void*)*3);
x_43 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_40, x_4);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_41, x_45);
x_47 = !lean_is_exclusive(x_46);
if (x_47 == 0)
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; uint8_t x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; uint8_t x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60;
x_48 = lean_ctor_get(x_46, 0);
x_49 = lean_ctor_get(x_46, 1);
x_50 = lean_ctor_get(x_49, 0);
lean_inc(x_50);
lean_inc(x_3);
x_51 = lean_array_uset(x_50, x_6, x_3);
x_52 = lean_ctor_get(x_49, 1);
lean_inc(x_52);
x_53 = 1;
x_54 = lean_box(x_53);
x_55 = lean_array_uset(x_52, x_6, x_54);
x_56 = lean_ctor_get(x_49, 2);
lean_inc(x_56);
lean_dec(x_49);
x_57 = (uint8_t)((x_42 << 24) >> 61);
x_58 = lean_expr_update_lambda(x_3, x_57, x_44, x_48);
lean_inc(x_58);
x_59 = lean_array_uset(x_56, x_6, x_58);
x_60 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_60, 0, x_51);
lean_ctor_set(x_60, 1, x_55);
lean_ctor_set(x_60, 2, x_59);
lean_ctor_set(x_46, 1, x_60);
lean_ctor_set(x_46, 0, x_58);
return x_46;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; uint8_t x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; uint8_t x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74;
x_61 = lean_ctor_get(x_46, 0);
x_62 = lean_ctor_get(x_46, 1);
lean_inc(x_62);
lean_inc(x_61);
lean_dec(x_46);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
lean_inc(x_3);
x_64 = lean_array_uset(x_63, x_6, x_3);
x_65 = lean_ctor_get(x_62, 1);
lean_inc(x_65);
x_66 = 1;
x_67 = lean_box(x_66);
x_68 = lean_array_uset(x_65, x_6, x_67);
x_69 = lean_ctor_get(x_62, 2);
lean_inc(x_69);
lean_dec(x_62);
x_70 = (uint8_t)((x_42 << 24) >> 61);
x_71 = lean_expr_update_lambda(x_3, x_70, x_44, x_61);
lean_inc(x_71);
x_72 = lean_array_uset(x_69, x_6, x_71);
x_73 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_73, 0, x_64);
lean_ctor_set(x_73, 1, x_68);
lean_ctor_set(x_73, 2, x_72);
x_74 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_74, 0, x_71);
lean_ctor_set(x_74, 1, x_73);
return x_74;
}
}
case 7:
{
lean_object* x_75; lean_object* x_76; uint64_t x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; uint8_t x_82;
x_75 = lean_ctor_get(x_3, 1);
lean_inc(x_75);
x_76 = lean_ctor_get(x_3, 2);
lean_inc(x_76);
x_77 = lean_ctor_get_uint64(x_3, sizeof(void*)*3);
x_78 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_75, x_4);
x_79 = lean_ctor_get(x_78, 0);
lean_inc(x_79);
x_80 = lean_ctor_get(x_78, 1);
lean_inc(x_80);
lean_dec(x_78);
x_81 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_76, x_80);
x_82 = !lean_is_exclusive(x_81);
if (x_82 == 0)
{
lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; uint8_t x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; uint8_t x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95;
x_83 = lean_ctor_get(x_81, 0);
x_84 = lean_ctor_get(x_81, 1);
x_85 = lean_ctor_get(x_84, 0);
lean_inc(x_85);
lean_inc(x_3);
x_86 = lean_array_uset(x_85, x_6, x_3);
x_87 = lean_ctor_get(x_84, 1);
lean_inc(x_87);
x_88 = 1;
x_89 = lean_box(x_88);
x_90 = lean_array_uset(x_87, x_6, x_89);
x_91 = lean_ctor_get(x_84, 2);
lean_inc(x_91);
lean_dec(x_84);
x_92 = (uint8_t)((x_77 << 24) >> 61);
x_93 = lean_expr_update_forall(x_3, x_92, x_79, x_83);
lean_inc(x_93);
x_94 = lean_array_uset(x_91, x_6, x_93);
x_95 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_95, 0, x_86);
lean_ctor_set(x_95, 1, x_90);
lean_ctor_set(x_95, 2, x_94);
lean_ctor_set(x_81, 1, x_95);
lean_ctor_set(x_81, 0, x_93);
return x_81;
}
else
{
lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; uint8_t x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; uint8_t x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109;
x_96 = lean_ctor_get(x_81, 0);
x_97 = lean_ctor_get(x_81, 1);
lean_inc(x_97);
lean_inc(x_96);
lean_dec(x_81);
x_98 = lean_ctor_get(x_97, 0);
lean_inc(x_98);
lean_inc(x_3);
x_99 = lean_array_uset(x_98, x_6, x_3);
x_100 = lean_ctor_get(x_97, 1);
lean_inc(x_100);
x_101 = 1;
x_102 = lean_box(x_101);
x_103 = lean_array_uset(x_100, x_6, x_102);
x_104 = lean_ctor_get(x_97, 2);
lean_inc(x_104);
lean_dec(x_97);
x_105 = (uint8_t)((x_77 << 24) >> 61);
x_106 = lean_expr_update_forall(x_3, x_105, x_79, x_96);
lean_inc(x_106);
x_107 = lean_array_uset(x_104, x_6, x_106);
x_108 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_108, 0, x_99);
lean_ctor_set(x_108, 1, x_103);
lean_ctor_set(x_108, 2, x_107);
x_109 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_109, 0, x_106);
lean_ctor_set(x_109, 1, x_108);
return x_109;
}
}
case 8:
{
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_119; uint8_t x_120;
x_110 = lean_ctor_get(x_3, 1);
lean_inc(x_110);
x_111 = lean_ctor_get(x_3, 2);
lean_inc(x_111);
x_112 = lean_ctor_get(x_3, 3);
lean_inc(x_112);
x_113 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_110, x_4);
x_114 = lean_ctor_get(x_113, 0);
lean_inc(x_114);
x_115 = lean_ctor_get(x_113, 1);
lean_inc(x_115);
lean_dec(x_113);
x_116 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_111, x_115);
x_117 = lean_ctor_get(x_116, 0);
lean_inc(x_117);
x_118 = lean_ctor_get(x_116, 1);
lean_inc(x_118);
lean_dec(x_116);
x_119 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_112, x_118);
x_120 = !lean_is_exclusive(x_119);
if (x_120 == 0)
{
lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; uint8_t x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; lean_object* x_132;
x_121 = lean_ctor_get(x_119, 0);
x_122 = lean_ctor_get(x_119, 1);
x_123 = lean_ctor_get(x_122, 0);
lean_inc(x_123);
lean_inc(x_3);
x_124 = lean_array_uset(x_123, x_6, x_3);
x_125 = lean_ctor_get(x_122, 1);
lean_inc(x_125);
x_126 = 1;
x_127 = lean_box(x_126);
x_128 = lean_array_uset(x_125, x_6, x_127);
x_129 = lean_ctor_get(x_122, 2);
lean_inc(x_129);
lean_dec(x_122);
x_130 = lean_expr_update_let(x_3, x_114, x_117, x_121);
lean_inc(x_130);
x_131 = lean_array_uset(x_129, x_6, x_130);
x_132 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_132, 0, x_124);
lean_ctor_set(x_132, 1, x_128);
lean_ctor_set(x_132, 2, x_131);
lean_ctor_set(x_119, 1, x_132);
lean_ctor_set(x_119, 0, x_130);
return x_119;
}
else
{
lean_object* x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137; uint8_t x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145;
x_133 = lean_ctor_get(x_119, 0);
x_134 = lean_ctor_get(x_119, 1);
lean_inc(x_134);
lean_inc(x_133);
lean_dec(x_119);
x_135 = lean_ctor_get(x_134, 0);
lean_inc(x_135);
lean_inc(x_3);
x_136 = lean_array_uset(x_135, x_6, x_3);
x_137 = lean_ctor_get(x_134, 1);
lean_inc(x_137);
x_138 = 1;
x_139 = lean_box(x_138);
x_140 = lean_array_uset(x_137, x_6, x_139);
x_141 = lean_ctor_get(x_134, 2);
lean_inc(x_141);
lean_dec(x_134);
x_142 = lean_expr_update_let(x_3, x_114, x_117, x_133);
lean_inc(x_142);
x_143 = lean_array_uset(x_141, x_6, x_142);
x_144 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_144, 0, x_136);
lean_ctor_set(x_144, 1, x_140);
lean_ctor_set(x_144, 2, x_143);
x_145 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_145, 0, x_142);
lean_ctor_set(x_145, 1, x_144);
return x_145;
}
}
case 10:
{
lean_object* x_146; lean_object* x_147; uint8_t x_148;
x_146 = lean_ctor_get(x_3, 1);
lean_inc(x_146);
x_147 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_146, x_4);
x_148 = !lean_is_exclusive(x_147);
if (x_148 == 0)
{
lean_object* x_149; lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; uint8_t x_154; lean_object* x_155; lean_object* x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159; lean_object* x_160;
x_149 = lean_ctor_get(x_147, 0);
x_150 = lean_ctor_get(x_147, 1);
x_151 = lean_ctor_get(x_150, 0);
lean_inc(x_151);
lean_inc(x_3);
x_152 = lean_array_uset(x_151, x_6, x_3);
x_153 = lean_ctor_get(x_150, 1);
lean_inc(x_153);
x_154 = 1;
x_155 = lean_box(x_154);
x_156 = lean_array_uset(x_153, x_6, x_155);
x_157 = lean_ctor_get(x_150, 2);
lean_inc(x_157);
lean_dec(x_150);
x_158 = lean_expr_update_mdata(x_3, x_149);
lean_inc(x_158);
x_159 = lean_array_uset(x_157, x_6, x_158);
x_160 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_160, 0, x_152);
lean_ctor_set(x_160, 1, x_156);
lean_ctor_set(x_160, 2, x_159);
lean_ctor_set(x_147, 1, x_160);
lean_ctor_set(x_147, 0, x_158);
return x_147;
}
else
{
lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165; uint8_t x_166; lean_object* x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170; lean_object* x_171; lean_object* x_172; lean_object* x_173;
x_161 = lean_ctor_get(x_147, 0);
x_162 = lean_ctor_get(x_147, 1);
lean_inc(x_162);
lean_inc(x_161);
lean_dec(x_147);
x_163 = lean_ctor_get(x_162, 0);
lean_inc(x_163);
lean_inc(x_3);
x_164 = lean_array_uset(x_163, x_6, x_3);
x_165 = lean_ctor_get(x_162, 1);
lean_inc(x_165);
x_166 = 1;
x_167 = lean_box(x_166);
x_168 = lean_array_uset(x_165, x_6, x_167);
x_169 = lean_ctor_get(x_162, 2);
lean_inc(x_169);
lean_dec(x_162);
x_170 = lean_expr_update_mdata(x_3, x_161);
lean_inc(x_170);
x_171 = lean_array_uset(x_169, x_6, x_170);
x_172 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_172, 0, x_164);
lean_ctor_set(x_172, 1, x_168);
lean_ctor_set(x_172, 2, x_171);
x_173 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_173, 0, x_170);
lean_ctor_set(x_173, 1, x_172);
return x_173;
}
}
case 11:
{
lean_object* x_174; lean_object* x_175; uint8_t x_176;
x_174 = lean_ctor_get(x_3, 2);
lean_inc(x_174);
x_175 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_2, x_174, x_4);
x_176 = !lean_is_exclusive(x_175);
if (x_176 == 0)
{
lean_object* x_177; lean_object* x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; uint8_t x_182; lean_object* x_183; lean_object* x_184; lean_object* x_185; lean_object* x_186; lean_object* x_187; lean_object* x_188;
x_177 = lean_ctor_get(x_175, 0);
x_178 = lean_ctor_get(x_175, 1);
x_179 = lean_ctor_get(x_178, 0);
lean_inc(x_179);
lean_inc(x_3);
x_180 = lean_array_uset(x_179, x_6, x_3);
x_181 = lean_ctor_get(x_178, 1);
lean_inc(x_181);
x_182 = 1;
x_183 = lean_box(x_182);
x_184 = lean_array_uset(x_181, x_6, x_183);
x_185 = lean_ctor_get(x_178, 2);
lean_inc(x_185);
lean_dec(x_178);
x_186 = lean_expr_update_proj(x_3, x_177);
lean_inc(x_186);
x_187 = lean_array_uset(x_185, x_6, x_186);
x_188 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_188, 0, x_180);
lean_ctor_set(x_188, 1, x_184);
lean_ctor_set(x_188, 2, x_187);
lean_ctor_set(x_175, 1, x_188);
lean_ctor_set(x_175, 0, x_186);
return x_175;
}
else
{
lean_object* x_189; lean_object* x_190; lean_object* x_191; lean_object* x_192; lean_object* x_193; uint8_t x_194; lean_object* x_195; lean_object* x_196; lean_object* x_197; lean_object* x_198; lean_object* x_199; lean_object* x_200; lean_object* x_201;
x_189 = lean_ctor_get(x_175, 0);
x_190 = lean_ctor_get(x_175, 1);
lean_inc(x_190);
lean_inc(x_189);
lean_dec(x_175);
x_191 = lean_ctor_get(x_190, 0);
lean_inc(x_191);
lean_inc(x_3);
x_192 = lean_array_uset(x_191, x_6, x_3);
x_193 = lean_ctor_get(x_190, 1);
lean_inc(x_193);
x_194 = 1;
x_195 = lean_box(x_194);
x_196 = lean_array_uset(x_193, x_6, x_195);
x_197 = lean_ctor_get(x_190, 2);
lean_inc(x_197);
lean_dec(x_190);
x_198 = lean_expr_update_proj(x_3, x_189);
lean_inc(x_198);
x_199 = lean_array_uset(x_197, x_6, x_198);
x_200 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_200, 0, x_192);
lean_ctor_set(x_200, 1, x_196);
lean_ctor_set(x_200, 2, x_199);
x_201 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_201, 0, x_198);
lean_ctor_set(x_201, 1, x_200);
return x_201;
}
}
case 12:
{
lean_object* x_202; lean_object* x_203; lean_object* x_204;
lean_dec(x_3);
x_202 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___closed__2;
x_203 = l_unreachable_x21___rarg(x_202);
x_204 = lean_apply_1(x_203, x_4);
return x_204;
}
default:
{
lean_object* x_205;
x_205 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_205, 0, x_3);
lean_ctor_set(x_205, 1, x_4);
return x_205;
}
}
}
block_223:
{
lean_dec(x_207);
if (lean_obj_tag(x_3) == 1)
{
lean_object* x_208; lean_object* x_209;
x_208 = lean_ctor_get(x_3, 0);
lean_inc(x_208);
x_209 = l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1(x_1, x_208);
lean_dec(x_208);
if (lean_obj_tag(x_209) == 0)
{
lean_object* x_210;
x_210 = lean_box(0);
x_7 = x_210;
goto block_206;
}
else
{
lean_object* x_211; lean_object* x_212; lean_object* x_213; lean_object* x_214; uint8_t x_215; lean_object* x_216; lean_object* x_217; lean_object* x_218; lean_object* x_219; lean_object* x_220; lean_object* x_221;
x_211 = lean_ctor_get(x_209, 0);
lean_inc(x_211);
lean_dec(x_209);
x_212 = lean_ctor_get(x_4, 0);
lean_inc(x_212);
x_213 = lean_array_uset(x_212, x_6, x_3);
x_214 = lean_ctor_get(x_4, 1);
lean_inc(x_214);
x_215 = 1;
x_216 = lean_box(x_215);
x_217 = lean_array_uset(x_214, x_6, x_216);
x_218 = lean_ctor_get(x_4, 2);
lean_inc(x_218);
lean_dec(x_4);
lean_inc(x_211);
x_219 = lean_array_uset(x_218, x_6, x_211);
x_220 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_220, 0, x_213);
lean_ctor_set(x_220, 1, x_217);
lean_ctor_set(x_220, 2, x_219);
x_221 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_221, 0, x_211);
lean_ctor_set(x_221, 1, x_220);
return x_221;
}
}
else
{
lean_object* x_222;
x_222 = lean_box(0);
x_7 = x_222;
goto block_206;
}
}
}
}
lean_object* l_Lean_Meta_FVarSubst_apply(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
return x_2;
}
else
{
uint8_t x_3;
x_3 = l_Lean_Expr_hasFVar(x_2);
if (x_3 == 0)
{
return x_2;
}
else
{
size_t x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_4 = 8192;
x_5 = l_Lean_Expr_ReplaceImpl_initCache;
x_6 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_4, x_2, x_5);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
lean_dec(x_6);
return x_7;
}
}
}
}
lean_object* l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_RBNode_find___main___at_Lean_Meta_FVarSubst_apply___spec__1(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = l_Lean_Expr_ReplaceImpl_replaceUnsafeM___main___at_Lean_Meta_FVarSubst_apply___spec__2(x_1, x_5, x_3, x_4);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_Meta_FVarSubst_apply___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_FVarSubst_apply(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_RBNode_fold___main___at_Lean_Meta_FVarSubst_compose___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
x_5 = lean_ctor_get(x_2, 2);
lean_inc(x_5);
x_6 = lean_ctor_get(x_2, 3);
lean_inc(x_6);
lean_dec(x_2);
x_7 = l_RBNode_fold___main___at_Lean_Meta_FVarSubst_compose___spec__1(x_1, x_3);
x_8 = l_Lean_NameMap_contains___rarg(x_7, x_4);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = l_Lean_Meta_FVarSubst_apply(x_7, x_5);
x_10 = l_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(x_7, x_4, x_9);
x_1 = x_10;
x_2 = x_6;
goto _start;
}
else
{
lean_dec(x_5);
lean_dec(x_4);
x_1 = x_7;
x_2 = x_6;
goto _start;
}
}
}
}
lean_object* l_Lean_Meta_FVarSubst_compose(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
return x_2;
}
else
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3;
x_3 = l_RBNode_fold___main___at_Lean_Meta_FVarSubst_compose___spec__1(x_1, x_2);
return x_3;
}
}
}
}
lean_object* initialize_Init_Lean_Expr(lean_object*);
lean_object* initialize_Init_Lean_ReplaceExpr(lean_object*);
static bool _G_initialized = false;
lean_object* initialize_Init_Lean_Meta_Tactic_FVarSubst(lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_mk_io_result(lean_box(0));
_G_initialized = true;
res = initialize_Init_Lean_Expr(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_ReplaceExpr(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
return lean_mk_io_result(lean_box(0));
}
#ifdef __cplusplus
}
#endif

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

@ -13,6 +13,7 @@
#ifdef __cplusplus
extern "C" {
#endif
lean_object* l_Lean_Meta_setMVarTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_registerTraceClass(lean_object*, lean_object*);
lean_object* l_Lean_Meta_throwTacticEx(lean_object*);
lean_object* l_Lean_Meta_checkNotAssigned___closed__3;
@ -20,6 +21,7 @@ extern lean_object* l___private_Init_Lean_Meta_Basic_10__regTraceClasses___close
lean_object* l_Lean_Meta_checkNotAssigned___closed__1;
lean_object* l_Lean_Meta_getMVarTag(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_checkNotAssigned___closed__2;
lean_object* l_Lean_MetavarContext_setMVarUserName(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_throwTacticEx___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_checkNotAssigned___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_ppGoal(lean_object*, lean_object*, lean_object*);
@ -37,6 +39,7 @@ lean_object* l___private_Init_Lean_Meta_Tactic_Util_1__regTraceClasses___closed_
lean_object* l___private_Init_Lean_Meta_Tactic_Util_1__regTraceClasses___closed__2;
lean_object* l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_getMVarTag___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_setMVarTag(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_getMVarTag(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
@ -106,6 +109,64 @@ lean_dec(x_2);
return x_4;
}
}
lean_object* l_Lean_Meta_setMVarTag(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_4, 1);
x_7 = l_Lean_MetavarContext_setMVarUserName(x_6, x_1, x_2);
lean_ctor_set(x_4, 1, x_7);
x_8 = lean_box(0);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_4);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_10 = lean_ctor_get(x_4, 0);
x_11 = lean_ctor_get(x_4, 1);
x_12 = lean_ctor_get(x_4, 2);
x_13 = lean_ctor_get(x_4, 3);
x_14 = lean_ctor_get(x_4, 4);
x_15 = lean_ctor_get(x_4, 5);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_4);
x_16 = l_Lean_MetavarContext_setMVarUserName(x_11, x_1, x_2);
x_17 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_17, 0, x_10);
lean_ctor_set(x_17, 1, x_16);
lean_ctor_set(x_17, 2, x_12);
lean_ctor_set(x_17, 3, x_13);
lean_ctor_set(x_17, 4, x_14);
lean_ctor_set(x_17, 5, x_15);
x_18 = lean_box(0);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_17);
return x_19;
}
}
}
lean_object* l_Lean_Meta_setMVarTag___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_setMVarTag(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{

File diff suppressed because it is too large Load diff