8000 Something is quadratic in with-type checking · Issue #7975 · agda/agda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Something is quadratic in with-type checking #7975
Open
@andreasabel

Description

@andreasabel

We seem to be spending a lot of time when checking the well-formedness of the withFunType, the type of the generated with-function:

-- Andreas, 2013-10-21
-- Check generated type directly in internal syntax.
setCurrentRange cs $
traceCall NoHighlighting $ -- To avoid flicker.
traceCall (CheckWithFunctionType withFunType) $
-- Jesper, 2024-07-10, issue $6841:
-- Having an ill-typed type can lead to problems in the
-- coverage checker, so we ensure there are no constraints here.
noConstraints $ checkType withFunType

Testcase seems to go up in time quadratic in n:

open import Agda.Builtin.Nat
open import Agda.Builtin.Equality

T : (n : Nat) (A B : Set)  Set
T zero    A B = B
T (suc n) A B = A  T n A B

t : {A B : Set} (n : Nat) (b : B)  T n A B
t zero    b = b
t (suc n) b = λ _  t n b

n = 3000

k : {B : Set} (b : B)  T n Nat B
k b = t n b

thm : {A B : Set} (a b : B) (eq : a ≡ b)  k a ≡ k b
thm a b eq rewrite eq = refl

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceSlow type checking, interaction, compilation or execution of Agda programswithProblems with the "with" abstraction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0