A lawyer on the GPL and Fruit/Rybka

Code, algorithms, languages, construction...
hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: A lawyer on the GPL and Fruit/Rybka

Post by hyatt » Sat Mar 12, 2011 12:58 am

You can't have semantic equivalence when A uses bitboards and B uses an array of squares (mailbox). Most of a chess engine doesn't deal directly with the board representation issues, so that semantic equivalence is a straightforward measure. But for eval, you have to rely on a lesser standard, which is "functionally equivalent." If we both evaluate pawns the same way conceptually, say rank/file * some bonus, plus we determine the pawn is passed at the same point in the code, and (say) while doing that you set a flag to say we have a passed pawn on this file that is used later... If all of that is done, and it is done in the same order, even though the code is not identical (it can't be in bitboard vs mailbox
programs unless you write terribly inefficient bitboard code) then you can reasonably conclude that A was copied from B and then converted to A's board representation, or vice versa...

There are too many ways to do things, to many different orders in which those things can be done...

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: A lawyer on the GPL and Fruit/Rybka

Post by BB+ » Sat Mar 12, 2011 5:04 am

Bob has put a huge emphasis on semantic equivalence as being the gold standard for determining code copying. However, in the codes you reference here, there does not appear to be an equivalence.
I am note quite sure to what you are referring. The evaluation functions in Fruit/Rybka necessarily fall under a different standard (as noted by Bob), due to the "language" change (mailbox to bitboard). For instance, a mechanical translation (think Google) of a book to another language might fall under a "non-literal" copy -- a more spirited translation would still be a derivative work, but the translator would also retain copyright on any "original" elements of the translation. See pages 6-7 in this PDF for more. Even if one makes various changes (e.g., re-writing the ending of a novel when translating it), there can still be a "substantial similarity" test as mentioned in the PDF that Jeremy found (Section II-D, 811--15). In short, "copyright" is not always black/white, and usually any penalties for an offence would take into account the level of similitude, among other things. As the latter PDF above points out, "copyright infringement" is almost always judged on a balance of probabilities -- this would be the likely criterion for any civil action, while the ICGA seems currently more concerned with the lesser notion of "non-originality", and will likely demand a higher level of proof.

As for the specific comparisons I made in Appendix A and pages 15-16, I think these meet a fairly strong standard of code copying. The evidence is not as strong as EvaluateWinner() in Crafty 19.0/Rybka 1.6.1 (I could likely run the right compiler on the source code of Crafty and get the same ASM code as Rybka), but it is stronger than just "substantial similarity" as might be said with the the wholesale re-use of evaluation features.

In particular, if I eliminate the things that are constant and "true" in the Fruit 2.1 code (like UseEasy -- the compiler would ignore this in any event), I get the following for the 2nd half of the Fruit 2.1 code on page 17.

Code: Select all

   if (depth == 1 && LIST_SIZE(SearchRoot->list) >= 2
       && LIST_VALUE(SearchRoot->list,0) >=
          LIST_VALUE(SearchRoot->list,1) + EasyThreshold) // this is 150
    SearchRoot->easy = true;
   if (depth > 1) // UseBad is true
   { SearchRoot->bad_2 = SearchRoot->bad_1;
     SearchRoot->bad_1 = false; }
   SearchRoot->last_value = SearchBest->value;
   if (SearchInput->depth_is_limited && depth >= SearchInput->depth_limit)
    SearchRoot->flag = true;
   if (SearchInput->time_is_limited
       && SearchCurrent->time >= SearchInput->time_limit_1
       && !SearchRoot->bad_2)
    SearchRoot->flag = true;
   if (SearchInput->time_is_limited // UseEasy is true
       && SearchCurrent->time >= SearchInput->time_limit_1 * EasyRatio // 0.20
       && SearchRoot->easy)
    SearchRoot->flag = true;
   if (SearchInput->time_is_limited // UseEarly is true
       && SearchCurrent->time >= SearchInput->time_limit_1 * EarlyRatio // 0.60
       && !SearchRoot->bad_2 && !SearchRoot->change)
    SearchRoot->flag = true;
   if (SearchInfo->can_stop
       && (SearchInfo->stop || (SearchRoot->flag && !SearchInput->infinite)))
    break;
This is to be compared to my reconstruction on page 20, which I claim is a reasonable translation of the Rybka code (albeit in "Fruit" form as to the naming of variables, etc.).

Code: Select all

   if (depth == 1 && RootMoveList[1].move != MOVE_NONE &&
       RootMoveList[0].value >= RootMoveList[1].value + 150) // 409601-40962f
    easy = true;
   if (depth > 1) // 409631-409641
    {bad_2 = bad_1;
     bad_1 = false;}
   last_value = score;
   if (depth >= depth_limit) // 409647
    flag = true;
   TimeUsed = GetTickCount() - StartTime;
   if ((3*time_limit_1)/3 <= TimeUsed && !bad_2) // 409691, has mult/div by 3
    flag = true;
   if ((time_limit_1)/6 <= TimeUsed && easy) // 20% in Fruit
    flag = true;
   if ((time_limit_1)/2 <= TimeUsed && !bad_2 && !change) // 60% in Fruit
    flag = true;
   if (stop || (flag && !SearchInput->infinite))
    break;
The principal differences are:
*) Fruit checks "depth_is_limited" and "time_is_limited" flags, but Rybka lacks these -- their use can be avoided by (say) setting the max depth to 255 and the max time to some large number in the relevant cases. Similarly with "can_stop" I guess.
*) Rybka computes TimeUsed in the middle of this code segment, while Fruit does so elsewhere.
*) Rybka has integer-based arithmetic while Fruit has doubles, and the percentages are not the same.

Balanced against these 3 differences are:
*) The condition for easy move is the same -- both check (in order) whether the depth is 1, whether there is more than one move, and if so, whether its value is at least 150 worse than that of the best move
*) They both then update the "bad" flags, but only when depth exceeds 1 -- even having these bad flags is already not too common, and the common condition "depth > 1" is not necessary (so perhaps a sign of copying)
*) The score is then copied to last_value
*) The "flag" is then set to true if depth exceeds depth_limit (keeping the above "depth_is_limited" point in mind)
*) Rybka then computes TimeUsed
*) There are then 3 conditions for time usage; in each case, the semantics are the same, once the "time_is_limited" flag is peeled off (as above).
**) In particular, each first tests TimeUsed against something [it is impossible to tell "X<=Y" from "Y>=X" at the ASM level, though some compilers will favour one over the other -- the same with "X<=Y" and "not (X>Y)"], and then checks various flags (in the same order)
*) Furthermore, the checks of these 3 timing conditions occur in the same order
*) Finally, the whole "flag" based implementation here is in and of itself a "common framework" (see the footnote on page 20, basically summing up a lot of this), with the final condition again having the same semantics (X || (Y && !Z)) once "can_stop" is removed from Fruit.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: A lawyer on the GPL and Fruit/Rybka

Post by BB+ » Sat Mar 12, 2011 6:50 am

Balanced against these 3 differences are:
Duh, I forgot the final compelling indication of "code copying" -- the six variables from the "search_root_t" structure in the Fruit 2.1 code appear in the same order in the Rybka 1.0 Beta ASM (as per the C standard for a structure):

Code: Select all

struct search_root_t {
[...]                // Rybka location
   int last_value;   // 0x66c448   // int is 4 bytes
   bool bad_1;       // 0x66c44c   // bool is 1 byte
   bool bad_2;       // 0x66c44d
   bool change;      // 0x66c44e
   bool easy;        // 0x66c44f
   bool flag;        // 0x66c450
};
Conversely, the "SearchInput->infinite" variable is not part of this structure in Fruit, and appears at a "far-away" location in Rybka 1.0 Beta (0x66c32c).

alfons
Posts: 58
Joined: Thu Jun 10, 2010 3:53 pm

Re: A lawyer on the GPL and Fruit/Rybka

Post by alfons » Sat Mar 12, 2011 1:43 pm

I know that this thread is about the Fruit/Rybka issue, but I would like to point out nevertheless, that it seems that Raíjlich violated the GPL with his latest released binary (the updater thingy). This is very concrete and you don't have to do any reverse-engineering as he confessed it in the release notes.

http://rybkaforum.net/cgi-bin/rybkaforu ... ?tid=21098

He simply does not understand the GPL; possibly that's why he was referring to 'public domain snippets' in the past to describe his coding style.

cheeky hoovering in the past:
http://www.stmintz.com/ccc/index.php?id=468275

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: A lawyer on the GPL and Fruit/Rybka

Post by Jeremy Bernstein » Sat Mar 12, 2011 3:58 pm

alfons wrote:I know that this thread is about the Fruit/Rybka issue, but I would like to point out nevertheless, that it seems that Raíjlich violated the GPL with his latest released binary (the updater thingy). This is very concrete and you don't have to do any reverse-engineering as he confessed it in the release notes.

http://rybkaforum.net/cgi-bin/rybkaforu ... ?tid=21098

He simply does not understand the GPL; possibly that's why he was referring to 'public domain snippets' in the past to describe his coding style.

cheeky hoovering in the past:
http://www.stmintz.com/ccc/index.php?id=468275
Have you notified the developer of JoJoDiff (Joris Heirbaut)?

jb

alfons
Posts: 58
Joined: Thu Jun 10, 2010 3:53 pm

Re: A lawyer on the GPL and Fruit/Rybka

Post by alfons » Sat Mar 12, 2011 5:05 pm

No.
A German doing an inquiry (denouncing anonymously) on a Czech video-artist at a Belgian programmer? Thank you, but I won't have that.

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: A lawyer on the GPL and Fruit/Rybka

Post by Jeremy Bernstein » Sat Mar 12, 2011 5:23 pm

alfons wrote:No.
A German doing an inquiry (denouncing anonymously) on a Czech video-artist at a Belgian programmer? Thank you, but I won't have that.
Sounds like a matter for the Hague.

P.S. I sent him a note (Americans of Prussian-Russian-Jewish descent living in Germany are somehow exempt from the above).

alfons
Posts: 58
Joined: Thu Jun 10, 2010 3:53 pm

Re: A lawyer on the GPL and Fruit/Rybka

Post by alfons » Sat Mar 12, 2011 5:40 pm

OK then.
The anonymity would have tainted the request.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: A lawyer on the GPL and Fruit/Rybka

Post by BB+ » Mon Mar 14, 2011 3:55 am

I know that this thread is about the Fruit/Rybka issue, but I would like to point out nevertheless, that it seems that Raíjlich violated the GPL with his latest released binary (the updater thingy).
I was going to respond (eventually) in the other thread, but will do so here.

It could depend how the updater is bundled (by Nick Carlin). For instance, if all the updater does is act like a shell, and run a shell script that does "jpatch X Y Z" for each found Rybka 4 executable, then giving a pointer to the jdiff source code could suffice.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: A lawyer on the GPL and Fruit/Rybka

Post by BB+ » Mon Mar 14, 2011 7:17 am

http://en.wikisource.org/wiki/Polish_Co ... ruary_1994
Polish Copyright Law wrote:Chapter 9. Protection of Author's Economic Rights
Article 79.
1. The author may request from the person who infringed his economic rights to cease such infringement, to render the acquired benefits or to pay double or, where the infringement is culpable, triple the amount of the respective remuneration as of the time of claiming it. The author may also claim the remedy of the inflicted damage if the action of the infringing party was culpable.
2. Irrespective of the claims specified in paragraph 1, the rightholder may demand that the perpetrator of the culpable infringement committed within the framework of economic activity and undertaken either in his own name or in the name of another person, even if on other persons' account, should pay an appropriate sum to the Fund referred to in Article 111. Such sum may not be lower than twice the value of the probable benefits gained by the perpetrator as a result of the committed infringement which was culpable.
So it is possible that triple damages could apply under Polish law (though I'm not sure exactly how to parse the first sentence in #1 above), plus some contribution to a Fund for Creative Activity (Section 111). Poland seems much more serious about copyright infringement than other countries (see this for instance -- "[copyright] is the only case of civil punitive damages known in Polish law").

Post Reply