# Is Algorithm to Solve a Problem Licensed?

The keep things as simple I will use very basic example.

The problem is to aggregate 4 numbers to have 10.

One developer uses below code/algorithm (Case 0) in his program file and license it as proprietary.

``````var firstNumber = 1;
var secondNumber = 3;
var thirdNumber = 3;
var fourthNumber = 3;
var sum = firstNumber + secondNumber + thirdNumber + fourthNumber;
``````

What happens if a developer (Case 1) copies all code/algorithm and just replaces variable names?

``````var first = 1;
var second = 3;
var third = 3;
var fourth = 3;
var sum = first + second + third + fourth;
``````

Or if another developer (Case 2) again copies all code/algorithm but this time replaces the numbers itself.

``````var firstNumber = 2;
var secondNumber = 2;
var thirdNumber = 4;
var fourthNumber = 2;
var sum = firstNumber + secondNumber + thirdNumber + fourthNumber;
``````

I want to ask what licenses actually protect? Do licences protect the code listing or algorithm? If an algorithm is protected by either proprietary or open source license, does it mean no other developer can modify and use it? Are even variable names also protected and prohibited to re-use?

And most importantly who does decide whether algorithm are same or not? For example, is Case 0 and Case 1 same although the variable names are changed?

And as last question, if Case 0 would have been licensed as Open Source, would it change the evaluation process?

• This is a legal question none of us are qualified to comment on. And it's likely that even the accurate legal answers are "no one knows yet". – Ixrec Mar 15 '16 at 17:01
• I think your example may be too trivial. I think it was in the Oracle v. Google case they showed examples of code that were clear copies of licensed code but the judge wasn't impressed because the code wasn't doing anything interesting. – JimmyJames Mar 15 '16 at 17:02
• @JimmyJames: +1 for the judge for having been able to qualify code as interesting. – Tibo Mar 15 '16 at 19:15
• @Tibo Yep. I followed that one on Groklaw while it was happening, and apparently the judge learned to code because he wanted to be able to do his job properly for that case. That's a +1000 from me :D – Iker Mar 15 '16 at 19:20
• @JimmyJames I suppose you mean "original" and not "interesting". – Christophe Mar 15 '16 at 21:45

Copyright protects creative works, not ideas. An algorithm as a general problem-solving strategy is an abstract idea and not subject to copyright. A concrete code listing, no matter how elaborate or dull, is a creative work and subject to copyright and licensing. Under some circumstances, algorithms can be protected by patents (which can be licensed too), but that's a totally different and, frankly, rather disappointing story.

If you publish an algorithm, anybody is allowed to re-implement it in their own code. They are not, however, allowed to copy your code verbatim or take it and make a modification out of it without your approval. Of course, for the overly trivial example summing up four numbers, you'll have a hard time as a copyright holder to prove that what they did way copying your work and then renaming variables in order to camouflage this. But in principle, even smallest pieces of code are subject to copyright. In the end, it's the person who wants to forbid somebody else to do something who has to convince the court that their case is legit. And yes, it's a court that will ultimately decide.

• @JerryCoffin that's US law. Elsewhere typical copyright cases use to be handled by magistrate, the magistrate generally appoints an expert witness to lay down the matter of facts. – Christophe Mar 15 '16 at 21:34
• @JerryCoffin Depends on your country. I'm looking at this from a German perspective where we have no juries in civil law cases but I guess your description is correct for the US. I'll re-word my answer to “court” which I hope will be applicable more broadly. – 5gon12eder Mar 15 '16 at 21:34
• @5gon12eder expert witnesses usually have code analysis tool to find basic code thefts that are diguised through renaming of variables or functions or changing the order of declaration of functions in the code. Of course, trivial algorithms that do not have any originality are not protected by copyright. Unfortunately, it is very difficult to forecast what will be considered as original or not. Case law is sometimes full of surprises in this matter. – Christophe Mar 15 '16 at 21:43
• @Christophe I know these tools. They are frequently used in universities to detect plagiarism as well. But as you say, it takes a certain amount of code complexity for any tool to give a confident answer. In any case, it's the code listing not the algorithm that is copyrighted. – 5gon12eder Mar 16 '16 at 18:00
• yes: it's the code which is copyrightable, not the algorithm. While this is a clear principle about the freedom of ideas, it is unfortunate that in some countries, certain algorithm could be patentable (see WIPO point 4 – Christophe Mar 16 '16 at 18:15

There are different forms of intellectual property protections, and the details of what they protect vary from jurisdiction to jurisdiction. When you refer to 'license', I think what you actually means is copyright. This is the form of intellectual property protection used by open sources licenses. In the US, copyright protects the expression of ideas, but not the ideas themselves. In your example any of the variants could be protected by copyright, but not the algorithm.

However, your example is not a great one because it's trivial. Your examples are really all the same code, just the variables names have been changed. In general, taking somebody's copyrighted code and simply make cosmetic changes to it, like changing variables names, or changing 'for' loops to 'while', would be a copyright violation. However, copyright law in the US recognizes that some simple ideas (say like adding four numbers together) are trivial, and will look the same in any implementation, so they're not protected.

On the other hand, in the US, patent law can be used to protect algorithms. For example the RSA encryption algorithm is protected by multiple patents. The exact rules of which algorithms can be patented is actively being threshed out in the courts.

• I think license is the right term here. It's what the owner of the source is and is not granting to the receiver. Open source licenses often state things about not redistributing the code (w/ or w/o modification.) – JimmyJames Mar 15 '16 at 17:05
• @JimmyJames, sure but their legal right to enforce a license is based on their holding the copyright to the licensed code. – Charles E. Grant Mar 15 '16 at 17:07