lean4-htt/src/Lean/Meta
Joachim Breitner ea22ef4485
refactor: port below and brecOn construction to Lean (#4517)
This ports the `.below` and `.brecOn` constructions to lean.

I kept them in the same file, as they were in the C code, because they
are
highly coupled and the constructions are very analogous.

For validation I developed this in a separate repository at
https://github.com/nomeata/lean-constructions/tree/fad715e
and checked that all declarations found in Lean and Mathlib are
equivalent, up to

    def canon (e : Expr) : CoreM Expr := do
      Core.transform (← Core.betaReduce e) (pre := fun
        | .const n ls  => return .done (.const n (ls.map (·.normalize)))
        | .sort l => return .done (.sort l.normalize)
        | _ => return .continue)

It was not feasible to make them completely equal, because the kernel's
type inference code seem to optimize level expressions a bit less
aggressively, and beta-reduces less in inference.

The private helper functions about `PProd` can later move into their own
file, used by these constructions as well as the structural recursion
module.
2024-06-26 11:10:39 +00:00
..
ArgsPacker refactor: ArgsPacker (#3621) 2024-03-14 14:59:40 +00:00
Constructions refactor: port below and brecOn construction to Lean (#4517) 2024-06-26 11:10:39 +00:00
Match fix: IndPredBelow should not add auxiliary declarations containing sorry (#4563) 2024-06-25 20:57:32 +00:00
Tactic fix: avoid unnecessary proof steps in simp (#4567) 2024-06-26 05:48:03 +00:00
AbstractMVars.lean fix: cached results at synthInstance? (#4530) 2024-06-23 17:54:35 +00:00
AbstractNestedProofs.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
ACLt.lean fix: loose bound variables at ACLt (#3819) 2024-04-01 20:26:20 +00:00
AppBuilder.lean doc: fix docstring for Lean.Meta.mkEqOfHEq (#3921) 2024-04-16 16:33:12 +00:00
ArgsPacker.lean chore: remove the coercion from String to Name (#3589) 2024-03-21 23:46:03 +00:00
Basic.lean fix: cached results at synthInstance? (#4530) 2024-06-23 17:54:35 +00:00
Canonicalizer.lean feat: improve grind preprocessor (#4221) 2024-05-20 04:29:49 +00:00
Check.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
CheckTactic.lean chore: bool and prop lemmas for Mathlib compatibility and improved confluence (#3508) 2024-03-04 23:56:30 +00:00
Closure.lean refactor: port mk_definition_inferring_unsafe to Lean (#4498) 2024-06-19 18:26:19 +00:00
Coe.lean refactor: Offset.lean and related files (#3614) 2024-03-05 19:40:15 -08:00
CoeAttr.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
CollectFVars.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
CollectMVars.lean chore: upstream solve_by_elim (#3408) 2024-02-21 01:16:04 +00:00
CompletionName.lean refactor: constructions: modify environment in lean world (#4474) 2024-06-19 08:58:53 +00:00
CongrTheorems.lean fix: cleanup type annotations in congruence theorems (#4185) 2024-05-15 23:50:35 +00:00
Constructions.lean refactor: port below and brecOn construction to Lean (#4517) 2024-06-26 11:10:39 +00:00
CtorRecognizer.lean feat: add grind.injection (#4243) 2024-05-21 17:57:02 +00:00
DecLevel.lean chore: missing registerTraceClass (#4369) 2024-06-06 00:53:16 +00:00
Diagnostics.lean fix: type class issues with maxSynthPendingDepth := 1 (#4119) 2024-05-14 03:03:32 +00:00
DiscrTree.lean chore: fix linter errors (#4502) 2024-06-19 18:24:08 +00:00
DiscrTreeTypes.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Eqns.lean feat: propagate maxHeartbeats to kernel (#4113) 2024-05-09 17:44:19 +00:00
Eval.lean feat: propagate maxHeartbeats to kernel (#4113) 2024-05-09 17:44:19 +00:00
ExprDefEq.lean chore: remove redundant if-else in isDefEqQuickOther (#4388) 2024-06-18 23:44:29 +00:00
ExprLens.lean chore: code convention (#4009) 2024-04-28 15:49:55 +00:00
ExprTraverse.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
ForEachExpr.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
FunInfo.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
GeneralizeTelescope.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
GeneralizeVars.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
GetUnfoldableConst.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
GlobalInstances.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
IndPredBelow.lean fix: IndPredBelow should not add auxiliary declarations containing sorry (#4563) 2024-06-25 20:57:32 +00:00
Inductive.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
InferType.lean refactor: constructions: modify environment in lean world (#4474) 2024-06-19 08:58:53 +00:00
Injective.lean fix: revert "monadic generalization of FindExpr" (#4125) 2024-05-10 20:36:08 +00:00
Instances.lean feat: improve set_option diagnostics true (#4031) 2024-04-30 05:07:03 +00:00
Iterator.lean chore: address copyright inconsistencies (#3448) 2024-02-22 06:23:50 -08:00
KAbstract.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
KExprMap.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
LazyDiscrTree.lean chore: make Name.isInternalDetail public, to remove duplication downstream (#4454) 2024-06-14 01:55:52 +00:00
LevelDefEq.lean feat: universe constraint approximations (#3981) 2024-04-24 20:27:51 +00:00
LitValues.lean feat: getBitVecValue? understands BitVec.ofNatLt (#4391) 2024-06-07 17:43:08 +00:00
Match.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
MatchUtil.lean fix: regression on match expressions with builtin literals (#3521) 2024-02-27 18:49:44 +00:00
NatInstTesters.lean feat: shorten auto-generated instance names (#3089) 2024-04-13 18:08:50 +00:00
Offset.lean feat: shorten auto-generated instance names (#3089) 2024-04-13 18:08:50 +00:00
PPGoal.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
RecursorInfo.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Reduce.lean fix: fold raw Nat literals at dsimp (#3624) 2024-03-06 18:29:20 +00:00
ReduceEval.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
SizeOf.lean chore: missing registerTraceClass (#4369) 2024-06-06 00:53:16 +00:00
Structure.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
SynthInstance.lean fix: cached results at synthInstance? (#4530) 2024-06-23 17:54:35 +00:00
Tactic.lean feat: add grind_norm simp attribute for grind tactic 2024-05-14 19:52:25 +02:00
Transform.lean fix: dsimp missing theorems for literals (#4467) 2024-06-20 00:35:53 +00:00
TransparencyMode.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
UnificationHint.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
WHNF.lean fix: typo in Meta.unfoldProjInstWhenInstances? (#4139) 2024-05-12 16:45:56 +00:00