Skip to content

feat: Allow writing holes which are solved by BRAT#59

Closed
croyzor wants to merge 40 commits intomainfrom
holes
Closed

feat: Allow writing holes which are solved by BRAT#59
croyzor wants to merge 40 commits intomainfrom
holes

Conversation

@croyzor
Copy link
Collaborator

@croyzor croyzor commented Nov 27, 2024

Closes #28 and #30

Copy link
Collaborator

@acl-cqc acl-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so

  • The number of comments suggests you've managed to break out a good sized chunk of code that is not too overwhelming :-), which is an achievement in itself - well done and thank you :-) 😁 👍
  • There's a lot of hard stuff in the nat-inversion-building that I really haven't followed through the logic - I can only say that it looks plausible. However really I would prefer to do one of
    • Add tests that cover all the cases and at least compile them down to Hugr. Then when we are able to execute them we suddenly gain a massive amount of assurance that we are actually building something sensible ;-) ;-)
    • If these functions are not covered by tests, then leave them error "TODO" here, and move the logic into another PR which can remain WIP until we do have tests (or at least, more time to think about them)
    • If the tests are only writable once we have Fork, lets leave them todo and move the code into #41 (they are quite localized - no change to APIs - so there shouldn't be much fallout from leaving them out of this PR)


(_, argUnders, [(kindOut,_)], (_ :<< _va, _)) <-
next "" Hypo (S0, Some (Zy :* S0)) aliasArgs (REx ("type",Star []) R0)
next "aliasargs" Hypo (S0, Some (Zy :* S0)) aliasArgs (REx ("type",Star []) R0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call this "kc_alias" and the other "load_alias" or something like that?


-- Both targets, we need to create the thing that they both derive from
(InEnd bigTgt, [VPar (InEnd weeTgt)]) -> do
(_, [(idTgt, _)], [(idSrc, _)], _) <- anext "numval id" Id (S0, Some (Zy :* S0))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This case has no test coverage)

-- = 2^k + 2^k * y
demandSucc (StrictMono k (Linear (VPar (ExEnd out)))) = do
y <- mkPred out
demandSucc _sm@(StrictMono _k (Linear (VPar (ExEnd _x)))) = error "Todo..." {-do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the whole of demandSucc has no test coverage

solveNumMeta (InEnd tgt) (n2PowTimes 1 half)
pure (StrictMonoFun (StrictMono 0 (Linear (VPar (toEnd halfTgt)))))
Full sm -> StrictMonoFun sm <$ demand0 (NumValue 0 (StrictMonoFun sm))
evenGro (StrictMonoFun (StrictMono n mono)) = pure (StrictMonoFun (StrictMono (n - 1) mono))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only line of evenGro that has test coverage

oddGro (StrictMonoFun (StrictMono 0 mono)) = case mono of
Linear (VPar (ExEnd out)) -> mkPred out >>= demandEven
Linear _ -> err . UnificationError $ "Can't force " ++ show n ++ " to be even"
-- TODO: Why aren't we using `out`??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of oddGro has test coverage

croyzor added a commit that referenced this pull request Dec 3, 2024
And other drive-by fixes pulled out from #59

---------

Co-authored-by: Alan Lawrence <alan.lawrence@quantinuum.com>
@croyzor
Copy link
Collaborator Author

croyzor commented Dec 18, 2024

Split into #69 and #70

@croyzor croyzor closed this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Let BRAT fill in holes

2 participants