I wrote a toy SAT solver in J, and tried getting ChatGPT4 to make the same thing. It worked eventually, but took quite a lot of feedback to make it sensible.
The initial version looked plausible right off the bat, but there were lots of bugs and hallucinations going on... On Mon, May 8, 2023 at 11:01 PM Thomas McGuire <tmcguir...@gmail.com> wrote: > It seems to prefer 3 : 0 explcit definition over {{}}. When I force it to > {{}} it doesn’t seem to use x and y parameters. > That is likely because the code base favors the original explicit > definition. > > As to the matrix multiplication: > It doesn’t seem to have any concept of J matrix multiplication. Coplilot’s > suggestion is as follows: > NB. multiply 2 matrices > mp =: 3 : 0 > x=.x > y=.y > (x # y) #~ 1 0 2 > ) > > It didn’t do very well with that. When I try to give it a hint: > NB. multiply 2 matrices with +/ . * instead of #~ > mp1 =: 3 : 0 > x=.x > y=.y > +/ . * x # y > ) > > It shoves it in there but it clearly doesn’t have an understanding of what > it means. I can direct it a bit but it doesn’t seem to have a clear > understanding that J can have dydactic function calls. It also doesn’t > understand J’s for loop implementation. Here are some trials at getting > copilot to use matrix multiply: > NB. multiply 2 matrices with a loop > mp2 =: 3 : 0 > x=.x > y=.y > n=. #x > z=. 0 > for_i. n do. > z=. z +/ (x i.~ i){.y > end. > z > ) > > NB. matrix multiply 2 matrices with J matrix multiply +/ . * operation > without using # or #~ > mp3 =: 3 : 0 > x=.x > y=.y > n=. #x > z=. 0 > for_i. n do. > z=. z +/ (x i.~ i){.y > end. > z > ) > > NB. J matrix multiply > mp4 =: +/ . * > > NB. multiply 2 matrices with mp4 function > mp5 =: 3 : 0 > x=.x > y=.y > mp4 x # y > ) > > So as another try I create an original style explicit definition of matrix > multiply: > NB. matrix multiply function > mp6 =: 4 : 0 > x +/ . * y > ) > > NB. use mp6 to multiply 2 matrices > mp7 =: 3 : 0 > x=.x > y=.y > (x mp6 y) #~ 1 0 2 > ) > > It clearly doesn’t understand the reserved function parameters x and y. It > has a hangup on using # and #~ even though it uses # in its > correct context at times. i got it to under stand how to insert a matrix > multiply. But now looking over the code examples it doesn’t really > understand the nuances of explicit definition 3 : 0 or 4 : 0 > > I was hoping someone on the list had some experience with generative AI or > even copilot specifically to see if there is a way to improve Copilot’s > understanding of J. Perhaps it is too much for the current crop of AI > engines available to the public? > > Thanks for taking a look Raul. > > > > On May 8, 2023, at 7:17 PM, Raul Miller <rauldmil...@gmail.com> wrote: > > > > I guess one question is: does the mechanism understand J token formation? > > > > For example, can you determine if it understands the difference > > between +/ .* and +/.* ? > > > > If so, can it recognize that + /. * is the same as +/.* ? > > > > And, if so, does it recognize that {{ and { { are different while [[ > > and [ [ are the same? > > > > These word formation issues could give rather strong hints about its > > ability (or limitations on ability) to "reason about" programs. > > > > Thanks, > > > > -- > > Raul > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm