chore: update stage0
This commit is contained in:
parent
479da7b914
commit
163cbbfe21
4 changed files with 796 additions and 593 deletions
4
stage0/src/Lean/Elab/BuiltinNotation.lean
generated
4
stage0/src/Lean/Elab/BuiltinNotation.lean
generated
|
|
@ -318,4 +318,8 @@ private def elabCDot (stx : Syntax) (expectedType? : Option Expr) : TermElabM Ex
|
|||
discard <| mkInstMVar stWorld
|
||||
mkAppM `StateRefT' #[ω, σ, m]
|
||||
|
||||
@[builtinTermElab noindex] def elabNoindex : TermElab := fun stx expectedType? => do
|
||||
let e ← elabTerm stx[1] expectedType?
|
||||
return DiscrTree.mkNoindexAnnotation e
|
||||
|
||||
end Lean.Elab.Term
|
||||
|
|
|
|||
60
stage0/src/Lean/Meta/DiscrTree.lean
generated
60
stage0/src/Lean/Meta/DiscrTree.lean
generated
|
|
@ -175,33 +175,43 @@ private partial def whnfEta (e : Expr) : MetaM Expr := do
|
|||
private def shouldAddAsStar (constName : Name) : Bool :=
|
||||
constName == `Nat.zero || constName == `Nat.succ
|
||||
|
||||
def mkNoindexAnnotation (e : Expr) : Expr :=
|
||||
mkAnnotation `noindex e
|
||||
|
||||
def hasNoindexAnnotation (e : Expr) : Bool :=
|
||||
annotation? `noindex e |>.isSome
|
||||
|
||||
private def pushArgs (todo : Array Expr) (e : Expr) : MetaM (Key × Array Expr) := do
|
||||
let e ← whnfEta e
|
||||
let fn := e.getAppFn
|
||||
let push (k : Key) (nargs : Nat) : MetaM (Key × Array Expr) := do
|
||||
let info ← getFunInfoNArgs fn nargs
|
||||
let todo ← pushArgsAux info.paramInfo (nargs-1) e todo
|
||||
pure (k, todo)
|
||||
match fn with
|
||||
| Expr.lit v _ => pure (Key.lit v, todo)
|
||||
| Expr.const c _ _ =>
|
||||
if shouldAddAsStar c then
|
||||
pure (Key.star, todo)
|
||||
else
|
||||
if hasNoindexAnnotation e then
|
||||
return (Key.star, todo)
|
||||
else
|
||||
let e ← whnfEta e
|
||||
let fn := e.getAppFn
|
||||
let push (k : Key) (nargs : Nat) : MetaM (Key × Array Expr) := do
|
||||
let info ← getFunInfoNArgs fn nargs
|
||||
let todo ← pushArgsAux info.paramInfo (nargs-1) e todo
|
||||
return (k, todo)
|
||||
match fn with
|
||||
| Expr.lit v _ => return (Key.lit v, todo)
|
||||
| Expr.const c _ _ =>
|
||||
if shouldAddAsStar c then
|
||||
return (Key.star, todo)
|
||||
else
|
||||
let nargs := e.getAppNumArgs
|
||||
push (Key.const c nargs) nargs
|
||||
| Expr.fvar fvarId _ =>
|
||||
let nargs := e.getAppNumArgs
|
||||
push (Key.const c nargs) nargs
|
||||
| Expr.fvar fvarId _ =>
|
||||
let nargs := e.getAppNumArgs
|
||||
push (Key.fvar fvarId nargs) nargs
|
||||
| Expr.mvar mvarId _ =>
|
||||
if mvarId == tmpMVarId then
|
||||
-- We use `tmp to mark implicit arguments and proofs
|
||||
pure (Key.star, todo)
|
||||
else if (← isReadOnlyOrSyntheticOpaqueExprMVar mvarId) then
|
||||
pure (Key.other, todo)
|
||||
else
|
||||
pure (Key.star, todo)
|
||||
| _ => pure (Key.other, todo)
|
||||
push (Key.fvar fvarId nargs) nargs
|
||||
| Expr.mvar mvarId _ =>
|
||||
if mvarId == tmpMVarId then
|
||||
-- We use `tmp to mark implicit arguments and proofs
|
||||
return (Key.star, todo)
|
||||
else if (← isReadOnlyOrSyntheticOpaqueExprMVar mvarId) then
|
||||
return (Key.other, todo)
|
||||
else
|
||||
return (Key.star, todo)
|
||||
| _ =>
|
||||
return (Key.other, todo)
|
||||
|
||||
partial def mkPathAux (todo : Array Expr) (keys : Array Key) : MetaM (Array Key) := do
|
||||
if todo.isEmpty then
|
||||
|
|
|
|||
98
stage0/stdlib/Lean/Elab/BuiltinNotation.c
generated
98
stage0/stdlib/Lean/Elab/BuiltinNotation.c
generated
|
|
@ -92,6 +92,7 @@ lean_object* l_Lean_Meta_mkDecide___at_Lean_Elab_Term_elabNativeDecide___spec__1
|
|||
uint8_t lean_name_eq(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabNativeDecide___rarg___closed__1;
|
||||
extern lean_object* l_myMacro____x40_Init_Data_ToString_Macro___hyg_23____closed__7;
|
||||
lean_object* l___regBuiltin_Lean_Elab_Term_elabNoindex(lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabNativeRefl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_instReprBool___closed__1;
|
||||
lean_object* l_Lean_Elab_Term_expandHave___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
|
|
@ -141,6 +142,7 @@ lean_object* l_Lean_Elab_Term_elabNativeRefl___closed__2;
|
|||
lean_object* l___private_Lean_Meta_AppBuilder_0__Lean_Meta_mkEqReflImp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_Lean_Parser_Term_tupleTail___elambda__1___closed__2;
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabParserMacroAux___closed__35;
|
||||
extern lean_object* l_Lean_Parser_Term_noindex___elambda__1___closed__2;
|
||||
lean_object* l_Lean_KeyedDeclsAttribute_addBuiltin___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_getMainModule___rarg(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabAnonymousCtor___closed__6;
|
||||
|
|
@ -169,8 +171,10 @@ lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_getPropToDe
|
|||
lean_object* l_Lean_Elab_Term_mkPairs_loop___closed__4;
|
||||
lean_object* l_Lean_Elab_Term_elabParen___closed__2;
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabParserMacroAux___closed__7;
|
||||
lean_object* l_Lean_Meta_DiscrTree_mkNoindexAnnotation(lean_object*);
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabClosedTerm___lambda__1___closed__1;
|
||||
lean_object* l_Lean_Elab_Term_elabParen___closed__1;
|
||||
lean_object* l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1;
|
||||
lean_object* l_Lean_MonadRef_mkInfoFromRefPos___at___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_expandCDot___spec__2(lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_Lean_Meta_mkDecideProof___rarg___lambda__1___closed__2;
|
||||
lean_object* l___regBuiltin_Lean_Elab_Term_elabTParserMacro(lean_object*);
|
||||
|
|
@ -193,6 +197,7 @@ extern lean_object* l___private_Init_Meta_0__Lean_quoteOption___rarg___closed__6
|
|||
lean_object* l_Lean_Elab_Term_tryPostponeIfNoneOrMVar(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabPanic_match__1___rarg(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabParserMacroAux___closed__20;
|
||||
lean_object* l_Lean_Elab_Term_elabNoindex___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_Lean_Parser_Term_emptyC___elambda__1___closed__2;
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabTParserMacroAux___closed__3;
|
||||
lean_object* l___private_Lean_Elab_BuiltinNotation_0__Lean_Elab_Term_elabParserMacroAux___closed__10;
|
||||
|
|
@ -262,6 +267,7 @@ lean_object* l_Lean_Elab_Term_elabTParserMacro___closed__1;
|
|||
lean_object* l___regBuiltin_Lean_Elab_Term_expandSuffices(lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabNativeRefl___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l___regBuiltin_Lean_Elab_Term_elabDecide(lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabNoindex(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabPanic___closed__5;
|
||||
lean_object* l_Lean_Meta_mkEqRefl___at_Lean_Elab_Term_elabNativeRefl___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_Elab_Term_elabSubst_match__2(lean_object*);
|
||||
|
|
@ -15136,6 +15142,93 @@ x_5 = l_Lean_KeyedDeclsAttribute_addBuiltin___rarg(x_2, x_3, x_4, x_1);
|
|||
return x_5;
|
||||
}
|
||||
}
|
||||
lean_object* l_Lean_Elab_Term_elabNoindex(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13;
|
||||
x_10 = lean_unsigned_to_nat(1u);
|
||||
x_11 = l_Lean_Syntax_getArg(x_1, x_10);
|
||||
x_12 = 1;
|
||||
x_13 = l_Lean_Elab_Term_elabTerm(x_11, x_2, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
|
||||
if (lean_obj_tag(x_13) == 0)
|
||||
{
|
||||
uint8_t x_14;
|
||||
x_14 = !lean_is_exclusive(x_13);
|
||||
if (x_14 == 0)
|
||||
{
|
||||
lean_object* x_15; lean_object* x_16;
|
||||
x_15 = lean_ctor_get(x_13, 0);
|
||||
x_16 = l_Lean_Meta_DiscrTree_mkNoindexAnnotation(x_15);
|
||||
lean_ctor_set(x_13, 0, x_16);
|
||||
return x_13;
|
||||
}
|
||||
else
|
||||
{
|
||||
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
|
||||
x_17 = lean_ctor_get(x_13, 0);
|
||||
x_18 = lean_ctor_get(x_13, 1);
|
||||
lean_inc(x_18);
|
||||
lean_inc(x_17);
|
||||
lean_dec(x_13);
|
||||
x_19 = l_Lean_Meta_DiscrTree_mkNoindexAnnotation(x_17);
|
||||
x_20 = lean_alloc_ctor(0, 2, 0);
|
||||
lean_ctor_set(x_20, 0, x_19);
|
||||
lean_ctor_set(x_20, 1, x_18);
|
||||
return x_20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t x_21;
|
||||
x_21 = !lean_is_exclusive(x_13);
|
||||
if (x_21 == 0)
|
||||
{
|
||||
return x_13;
|
||||
}
|
||||
else
|
||||
{
|
||||
lean_object* x_22; lean_object* x_23; lean_object* x_24;
|
||||
x_22 = lean_ctor_get(x_13, 0);
|
||||
x_23 = lean_ctor_get(x_13, 1);
|
||||
lean_inc(x_23);
|
||||
lean_inc(x_22);
|
||||
lean_dec(x_13);
|
||||
x_24 = lean_alloc_ctor(1, 2, 0);
|
||||
lean_ctor_set(x_24, 0, x_22);
|
||||
lean_ctor_set(x_24, 1, x_23);
|
||||
return x_24;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lean_object* l_Lean_Elab_Term_elabNoindex___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_10;
|
||||
x_10 = l_Lean_Elab_Term_elabNoindex(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
|
||||
lean_dec(x_1);
|
||||
return x_10;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = lean_alloc_closure((void*)(l_Lean_Elab_Term_elabNoindex___boxed), 9, 0);
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
lean_object* l___regBuiltin_Lean_Elab_Term_elabNoindex(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
|
||||
x_2 = l_Lean_Elab_Term_termElabAttribute;
|
||||
x_3 = l_Lean_Parser_Term_noindex___elambda__1___closed__2;
|
||||
x_4 = l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1;
|
||||
x_5 = l_Lean_KeyedDeclsAttribute_addBuiltin___rarg(x_2, x_3, x_4, x_1);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
lean_object* initialize_Init(lean_object*);
|
||||
lean_object* initialize_Init_Data_ToString(lean_object*);
|
||||
lean_object* initialize_Lean_Compiler_BorrowedAnnotation(lean_object*);
|
||||
|
|
@ -15566,6 +15659,11 @@ lean_mark_persistent(l___regBuiltin_Lean_Elab_Term_elabStateRefT___closed__1);
|
|||
res = l___regBuiltin_Lean_Elab_Term_elabStateRefT(lean_io_mk_world());
|
||||
if (lean_io_result_is_error(res)) return res;
|
||||
lean_dec_ref(res);
|
||||
l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1 = _init_l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1();
|
||||
lean_mark_persistent(l___regBuiltin_Lean_Elab_Term_elabNoindex___closed__1);
|
||||
res = l___regBuiltin_Lean_Elab_Term_elabNoindex(lean_io_mk_world());
|
||||
if (lean_io_result_is_error(res)) return res;
|
||||
lean_dec_ref(res);
|
||||
return lean_io_result_mk_ok(lean_box(0));
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
1227
stage0/stdlib/Lean/Meta/DiscrTree.c
generated
1227
stage0/stdlib/Lean/Meta/DiscrTree.c
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue