Created
December 17, 2024 14:26
-
-
Save plt-amy/fe2a242891d730463d498e2bae1b4ec0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 681d6cab3a00f0a224b6a86af8e0765a27440fa4 Mon Sep 17 00:00:00 2001 | |
| From: =?UTF-8?q?Am=C3=A9lia=20Liao?= <me@amelia.how> | |
| Date: Tue, 17 Dec 2024 11:26:35 -0300 | |
| Subject: [PATCH] speed up product solver | |
| --- | |
| src/Cat/Diagram/Product/Solver.lagda.md | 42 ++++++++++++++++++++++--- | |
| 1 file changed, 38 insertions(+), 4 deletions(-) | |
| diff --git a/src/Cat/Diagram/Product/Solver.lagda.md b/src/Cat/Diagram/Product/Solver.lagda.md | |
| index a78c33fba..a5540774d 100644 | |
| --- a/src/Cat/Diagram/Product/Solver.lagda.md | |
| +++ b/src/Cat/Diagram/Product/Solver.lagda.md | |
| @@ -510,12 +510,46 @@ macro | |
| β (π : Precategory o β) (cartesian : β X Y β Product π X Y) | |
| β Term β Term β TC β€ | |
| products-simpl! = Reflection.simpl-macro | |
| +``` | |
| + | |
| +<!-- | |
| +```agda | |
| +module _ {o β} (C : Precategory o β) (cart : β X Y β Product C X Y) {x y : β C β} {h1 h2 : C .Precategory.Hom x y} where | |
| + open Reflection | |
| - products! : β {o β} | |
| - β (π : Precategory o β) (cartesian : β X Y β Product π X Y) | |
| - β Term β TC β€ | |
| - products! = Reflection.solve-macro | |
| + private | |
| + products-worker : Term β TC β€ | |
| + products-worker goal = withReconstructed true $ withNormalisation true do | |
| + `h1 β wait-for-type =<< quoteTC h1 | |
| + `h2 β quoteTC h2 | |
| + `x β quoteTC x | |
| + `y β quoteTC y | |
| + | |
| + βcartβ β quoteTC cart | |
| + | |
| + let | |
| + βxβ = build-obj-expr `x | |
| + βyβ = build-obj-expr `y | |
| + βlhsβ = build-hom-expr `h1 | |
| + βrhsβ = build-hom-expr `h2 | |
| + | |
| + unify goal (Reflection.βsolveβ unknown βcartβ βxβ βyβ βlhsβ βrhsβ) <|> do | |
| + βcatβ β quoteTC C | |
| + vlhs β normalise (βnfβ βcatβ βcartβ βxβ βyβ βlhsβ) | |
| + vrhs β normalise (βnfβ βcatβ βcartβ βxβ βyβ βrhsβ) | |
| + typeError | |
| + [ "Could not equate the following expressions:\n " | |
| + , termErr `h1 , "\nAnd\n " , termErr `h2 | |
| + , "\nReflected expressions\n " | |
| + , termErr βlhsβ , "\nAnd\n " , termErr βrhsβ | |
| + , strErr "\nComputed normal forms\n " | |
| + , termErr vlhs , strErr "\nAnd\n " , termErr vrhs | |
| + ] | |
| + | |
| + products! : {@(tactic products-worker) p : h1 β‘ h2} β h1 β‘ h2 | |
| + products! {p = p} = p | |
| ``` | |
| +--> | |
| # Demo | |
| -- | |
| 2.42.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment