mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
e1bf6289c7
Working towards a full e-graph implementation as described by the [egg paper](https://arxiv.org/pdf/2004.03082). The type system has a couple of places where e-graphs would've been useful and solved some classes of problems trivially. For example: 1. Normalization and simplification cannot handle cyclic types due to the nature of their implementation. 2. Normalization can't tell when two tables or functions are equivalent, but simplification theoretically can albeit not implemented. 3. Normalization requires deep normalization for inhabitance check, whereas simplification would've returned the `never` type itself indicating uninhabited. 4. Simplification requires constraint ordering to have perfect timing to simplify. 5. Adding a rewrite rule requires implementing it twice, once in simplification and once again in normalization with completely different code design making it hard to verify that their behavior is materially equivalent. 6. In cases where we must cache for performance, two different types that are isomorphic have different cache entries resulting in cache misses. 7. Type family reduction can handle cyclic type families, but only if the cycle is not obscured by a different type family instance. (`t1 where t1 = union<number, add<t1, number>>` is irreducible) I think we're getting the point! --- Currently the implementation is missing a few features that makes e-graphs actually useful. Those will be coming in a future PR. 1. Pattern matching, 6. Applying rewrites, 7. Rewrite until saturation, and 8. Extracting the best e-node according to some cost function. |
||
---|---|---|
.. | ||
Anyification.h | ||
ApplyTypeFunction.h | ||
AstJsonEncoder.h | ||
AstQuery.h | ||
Autocomplete.h | ||
BuiltinDefinitions.h | ||
Cancellation.h | ||
Clone.h | ||
Constraint.h | ||
ConstraintGenerator.h | ||
ConstraintSolver.h | ||
ControlFlow.h | ||
DataFlowGraph.h | ||
DcrLogger.h | ||
Def.h | ||
Differ.h | ||
Documentation.h | ||
Error.h | ||
FileResolver.h | ||
Frontend.h | ||
Generalization.h | ||
GlobalTypes.h | ||
InsertionOrderedMap.h | ||
Instantiation2.h | ||
Instantiation.h | ||
IostreamHelpers.h | ||
JsonEmitter.h | ||
Linter.h | ||
LValue.h | ||
Metamethods.h | ||
Module.h | ||
ModuleResolver.h | ||
NonStrictTypeChecker.h | ||
Normalize.h | ||
NotNull.h | ||
OverloadResolution.h | ||
Predicate.h | ||
Quantify.h | ||
RecursionCounter.h | ||
Refinement.h | ||
RequireTracer.h | ||
Scope.h | ||
Set.h | ||
Simplify.h | ||
Substitution.h | ||
Subtyping.h | ||
Symbol.h | ||
TableLiteralInference.h | ||
ToDot.h | ||
TopoSortStatements.h | ||
ToString.h | ||
Transpiler.h | ||
TxnLog.h | ||
Type.h | ||
TypeArena.h | ||
TypeAttach.h | ||
TypeChecker2.h | ||
TypeCheckLimits.h | ||
TypedAllocator.h | ||
TypeFunction.h | ||
TypeFunctionReductionGuesser.h | ||
TypeFwd.h | ||
TypeInfer.h | ||
TypeOrPack.h | ||
TypePack.h | ||
TypePairHash.h | ||
TypePath.h | ||
TypeUtils.h | ||
Unifiable.h | ||
Unifier2.h | ||
Unifier.h | ||
UnifierSharedState.h | ||
VisitType.h |