Sub topic 1
How copyright applies to software
Before you can ask who owns AI-assisted code, you need a clear picture of what copyright protects in ordinary software. This chapter covers the basics that the rest of the tutorial builds on: what is protected, what is not, who owns it by default, and how licenses fit in. Later chapters add the question of human authorship and what AI changes.
This is general education, not legal advice. Copyright law differs by country and changes over time.
Prerequisites
This chapter assumes you have:
- Basic familiarity with using an AI coding assistant.
- Working knowledge of Git and code review.
- A general awareness of what open-source licenses are. You do not need to know any license in detail.
You do not need any legal background. Terms are defined as they appear.
What copyright is
Copyright is a legal right that gives the author of an original work control over certain uses of that work, such as copying it, changing it, and distributing it. It applies to creative works in general: books, music, photographs, and software.
Three properties matter for developers.
- It is automatic. Under the Berne Convention, an international treaty that most countries have joined, protection starts when the work is created. You do not need to register it or add a notice. A file you wrote this morning is already protected.
- It requires originality. The work must come from the author's own creative choices, not be copied from elsewhere. The bar is low. It is not a test of quality or novelty.
- It protects expression, not ideas. This is the most important rule for code, and the next section covers it.
Software as a literary work
Most legal systems treat software as a kind of literary work. The reasoning is that source code is written text made of human choices, much like a book.
- In the United States, the Copyright Act defines a computer program as a set of statements or instructions used directly or indirectly in a computer to bring about a result, and protects programs as literary works.
- In the United Kingdom, the Copyright, Designs and Patents Act 1988 lists computer programs as literary works.
- In the European Union, the Software Directive (2009/24/EC) requires member states to protect programs as literary works under the Berne Convention.
Protection covers both source code and object code (the compiled form), because the compiled form is a translation of the same work. It also covers preparatory design material that leads to a program, in some systems. It does not matter which language the code is in.
Idea versus expression
Copyright protects the specific way something is written, not the underlying idea, method, or function. In US law this appears in 17 U.S.C. § 102(b), which excludes any "idea, procedure, process, system, method of operation, concept, principle, or discovery" from protection. Other systems reach the same result by different routes.
For code, this means that nobody can own the idea of sorting a list, retrying a failed HTTP request, or clamping a number to a range. They can own a particular text that implements the idea.
The following two functions do the same thing. They are two different expressions of one idea.
def clamp_a(value: float, low: float, high: float) -> float:
return max(low, min(value, high))
def clamp_b(value: float, low: float, high: float) -> float:
if value < low:
return low
if value > high:
return high
return value
if __name__ == "__main__":
for v in (-5.0, 0.5, 9.0):
assert clamp_a(v, 0.0, 1.0) == clamp_b(v, 0.0, 1.0)
print("Both implementations agree.")Writing clamp_b after reading clamp_a does not copy anyone's expression, as long as you did not reproduce the text. Both functions are also so short and so constrained by the task that the legal protection for either is thin.
Limits that narrow protection
Courts and legislators have developed several doctrines that remove parts of a program from protection even when the program as a whole is protected.
- Merger. When there is only one practical way, or very few ways, to express an idea, the idea and the expression merge, and the expression is not protected. Otherwise copyright would give control over the idea.
- Scènes à faire. Elements dictated by the task, standard practice, or the programming environment are not protected. Examples are a standard loop structure and the boilerplate a framework requires.
- Functional constraints. Choices forced by hardware, compatibility needs, or efficiency do not count as creative expression. In the EU, the Court of Justice held in SAS Institute v World Programming (2012) that the functionality of a program, its programming language, and its data file formats are not protected by copyright.
- Small fragments. Very short snippets often lack enough originality to be protected on their own. There is no fixed line, such as a number of lines. The question is whether the fragment contains the author's own creative choices.
Real cases are not clear-cut. In Google v. Oracle (2021), the US Supreme Court did not settle whether the declaring code of an API can be copyrighted. It assumed that it could and held that Google's copying of about 11,500 lines of Java API declarations was fair use. Fair use is a US defense that allows some copying without permission, judged case by case. The decision did not give general permission to copy APIs.
What is and is not protected
| Element | Usually protected? | Notes |
|---|---|---|
| Source code text | Yes, if original | Includes comments and identifiers chosen by the author |
| Compiled binaries | Yes | Treated as a form of the same work |
| Algorithms and methods | No | May be patentable in some countries, which is a separate system |
| Program behavior and features | Generally no | Functionality is not expression |
| Programming languages and file formats | Generally no | Per the EU position above |
| Short, obvious snippets | Often no | Little room for creative choice |
| Structure, sequence, and organization of a large codebase | Sometimes | Protection is thin and depends on the system |
| Documentation and UI text | Yes, if original | Protected as ordinary writing |
Related rights that are not copyright
Developers often mix copyright up with other forms of protection. They are separate systems with separate rules.
- Patents protect inventions, including some technical methods, and require an application and examination. A patent can cover an idea that copyright cannot.
- Trade secrets protect information kept confidential that has commercial value. Publishing the code can destroy that protection, while copyright survives publication.
- Trademarks protect names and logos used to identify products.
- Contracts such as a license, a terms-of-service agreement, or a non-disclosure agreement create obligations between parties. They can add limits that copyright alone does not.
Exclusive rights and infringement
The owner of a copyright has the exclusive right to do, or to authorize others to do, several things. The main ones for software are:
- Reproduce the work, including copying files, forking a repository, or pasting code.
- Prepare derivative works, which are new works based on an existing one, such as a modified version or a port to another language.
- Distribute copies to the public.
- Publicly perform or display the work, which matters less for typical software.
Infringement happens when someone does one of these acts without permission and no exception applies. Courts generally look for two things: that the defendant had access to the original or copied it, and that the result is substantially similar in protected expression. Independent creation is a defense, because copyright does not stop two people from writing similar code on their own. This will matter later when we discuss code that an AI tool produces that looks like existing code.
Ownership by default
The default owner of a copyright is the author, meaning the person who created the work. Two common exceptions change this.
- Employment. In the US, code written by an employee within the scope of employment is a "work made for hire", and the employer is treated as the author. The UK and many other countries give the employer first ownership in similar situations, though the details vary.
- Written assignment. The owner can transfer ownership to someone else in a signed written document. This is common in contractor agreements.
Independent contractors are different in many countries. Without a written agreement, a contractor often keeps the copyright in what they wrote, even if the client paid for it. Chapter 9 of this tutorial covers these arrangements in more detail as they apply to AI-assisted work.
Co-authors who contribute to one project can become joint owners of the combined work, which complicates licensing without everyone's agreement. This is one reason open-source projects often ask contributors to sign a contributor agreement or certify their contributions.
Duration and formalities
In the US, the EU, and the UK, copyright generally lasts for the life of the author plus 70 years. Works made for hire in the US last 95 years from publication or 120 years from creation, whichever ends first. The Berne minimum is life plus 50 years, so some countries use shorter terms. For practical purposes, any code you will encounter today is still protected.
Registration is not required for protection, but it can matter. In the US, a copyright owner usually must register a work before suing for infringement, and timely registration affects the damages available. A copyright notice such as "Copyright (c) 2026 Example Corp." is not required, but it is good practice because it states who claims ownership.
Licenses are permission
Because copyright is automatic and strong by default, you may not copy, change, or redistribute code that you did not write unless you have permission. A license is that permission. It is a grant from the copyright owner that sets out what you may do and on what conditions.
Code with no license is not free to use. It is the opposite: all rights are reserved by default. Public visibility on a hosting site does not grant any rights beyond what the site's terms provide.
A file can state its license in a short header. The SPDX identifier is a standard, machine-readable way to do this.
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Example Corp.
def clamp(value: float, low: float, high: float) -> float:
return max(low, min(value, high))The first line names the license under which the project distributes the file. The second line states who holds the copyright. Later chapters return to this header when discussing provenance records and automated checks.
Why this matters for AI-assisted code
Each point above becomes a question when an AI assistant writes part of the code.
- If copyright requires an author, who is the author of generated text?
- If copyright protects expression, can a model's output reproduce someone else's expression?
- If licenses attach conditions to copying, do those conditions follow generated code that matches licensed code?
- If employers own what employees write, does that include what employees get from a tool?
The following chapters take these in order, starting with why human authorship matters.
Exercise
A teammate says, "Our retry-with-backoff logic is an original idea, so nobody else can write one like it, and anyone who writes similar logic is infringing." Explain what is wrong with this claim, and name one thing copyright might protect about the logic.
Show answer
Copyright does not protect ideas, methods, or functionality, so it cannot stop others from implementing retry with exponential backoff. Independent creation is also not infringement. Copyright can protect the specific written expression, meaning the actual source text, comments, and structure, if the choices in it are original. Anyone who copies that text without permission could infringe, but someone who writes their own implementation of the same idea does not.
Exercise
A freelancer writes a module for your company under a verbal agreement and is paid in full. No written contract exists. Who most likely owns the copyright by default in many countries, and what document would change that?
Show answer
In many countries the freelancer, as the author and an independent contractor, keeps the copyright, because the work-made-for-hire rules for employees do not apply. A signed written assignment (or a contract with an ownership clause or an exclusive license) would transfer ownership or grant the rights the company needs.