Zulip Chat Archive

Stream: general

Topic: issues with Qq in doc-gen


Jireh Loreaux (Aug 29 2023 at 15:25):

@Henrik Böving it seems like doc-gen has quite some trouble with Qq. Probably you already know this, and maybe it's a hard problem, but in case you don't, see for example, docs#Qq.checkTypeQ

Henrik Böving (Aug 29 2023 at 16:21):

I wasnt aware no, ill take a look when I'm home thanks!

Henrik Böving (Aug 29 2023 at 20:21):

Oh that does look bad yes

Henrik Böving (Aug 29 2023 at 20:21):

Does QQ have any sort of delaborator that doc-gen misses out on here? @Gabriel Ebner if it doesn't there isn't really much I can do about it.

Kyle Miller (Aug 29 2023 at 20:23):

It does seem to be missing Q(...) notation. Here's how that declaration pretty prints from within Lean:

Qq.checkTypeQ {u : Lean.Level} (e : Lean.Expr)
  (ty :
    let u := u;
    Q(Sort u)) :
  Lean.MetaM (Option Q(«$ty»))

Kyle Miller (Aug 29 2023 at 20:24):

versus in doc-gen:

def Qq.checkTypeQ{u : Lean.Level} (e : Lean.Expr) (ty : let u := u; Qq.Quoted (Lean.Expr.sort u)) :
    Lean.MetaM (Option (Qq.Quoted ty))

Henrik Böving (Aug 29 2023 at 20:34):

Aha! I think I have a clue. when I #print from within the file MetaM.lean in QQ itself I get

def Qq.checkTypeQ : {u : Level} 
  Expr 
    (ty :
        let u := u;
        Quoted (Expr.sort u)) 
      MetaM (Option (Quoted ty)) :=

and doc-gen does very much work from a perspective of analyzing one olean/module at a time to benefit from more fine grained parallelism. Since the delaborators are defined in a file separate from the syntax the delaboration is not available here. So you want to import the delaborator in all the files that it doesn't import to enable pretty printing I guess?

Gabriel Ebner (Aug 29 2023 at 21:50):

I think the quickest fix is to import Qq.Delab from Qq.MetaM. I've pushed that change just now, and it should hit doc-gen once mathlib upgrades.

Scott Morrison (Aug 29 2023 at 23:25):

Mathlib upgrade: #6857


Last updated: Dec 20 2023 at 11:08 UTC