TL DR To enter specific values into an expression in relational algebra, you must have a way to write table literals. Usually, the necessary operators do not become explicit, but, on the other hand, some notation, for example, meaning, is often used in algebra exercises.
For your case, using the simplest additional relationships (with a conditional table literal similar to SQL VALUES):
(restrict SPECIES=dog Animals) natural join TABLE{ISDOG}{<1>} union (restrict SPECIES<>dog Animals) natural join TABLE{ISDOG}{<0>}
If you need a reference to relational algebra with a general computing operator, see Chris Date EXTEND and his classic tutorial. Introduction to Database Systems, 8th Edition.
(More generally: to output a table with rows with new columns with values that are arbitrary value functions in the input rows, we must have access to the tables corresponding to the operators. Either we use a table literal, or suppose that a Boolean function and use its name as the name of the table.)
But it turns out that the relational model was designed so that:
Each operator of the algebra corresponds to a certain logical operator. NATURAL JOIN and AND
RESTRICT theta and AND theta
UNION and OR
MINUS and AND NOT
PROJECT all but C and EXISTS C
etc
Each nested algebra expression corresponds to a specific nested logical expression. Animals &
"animal named NAME is AGE years old ... and is of species SPECIES"
restrict SPECIES=dog Animals & "animal named NAME is AGE years old ... and is of species SPECIES" AND SPECIES=dog
A sentence is a statement. A predicate is a statement template. If each base table contains rows that make a true sentence from a predicate parameterized by its columns, then the query contains rows that make a true sentence from a corresponding predicate parameterized by its columns.
-- table of rows where animal named NAME is AGE years old ... and is of species SPECIES Animals -- table of rows where animal named NAME is AGE years old ... and is of species SPECIES AND if SPECIES=dog then ISDOG=1 ELSE ISDOG=0 -- ie rows where animal named NAME is AGE years old ... and is of species SPECIES AND (SPECIES=dog AND ISDOG=1 OR SPECIES<>DOG AND ISDOG=0) -- ie rows where animal named NAME is AGE years old ... and is of species SPECIES AND SPECIES=dog AND ISDOG=1 OR animal named NAME is AGE years old ... and is of species SPECIES AND SPECIES<>dog AND ISDOG=0 (restrict SPECIES=dog Animals) natural join TABLE{ISDOG}{<1>} union (restrict SPECIES<>dog Animals) natural join TABLE{ISDOG}{<0>}
Thus, you can simply use logic, exact engineering language (including software), science (including computer) and mathematics to describe the result tables.
-- table of rows where animal named NAME is AGE years old ... and is of species SPECIES AND ISDOG=(if SPECIES=dog then 1 else 0)
Thus, you can use table expressions and / or logical expressions in specifications, depending on what is more clear, based on (sub) expressions under ().
Animals natural join table of rows where if SPECIES=dog THEN ISDOG=1 ELSE ISDOG=0
(The table corresponding to this IF expression has a row for each row, and the row "dog" is the only one with 1.)
(Nb SQL ON and WHERE have this table form on the left and a predicate with functions on the right.)
An algebra expression computes strings that satisfy its corresponding logical expression.
It may not be obvious to you which equivalent relational expressions correspond to equivalent logical expressions and vice versa. But all that matters is that your customers understand the algebra and / or logic in the specification, and your programmers can write an equivalent SQL expression.
Understanding the semantics of relational algebra and SQL, see this answer and its references .
PS SQL SELECT does what a projection does, but also does other things that are not projections that are performed in algebra by renaming, joining, and / or table literals. What you want is not a projection. It is called EXTEND by Chris Date. I would advise anyone to use / reference to date algebra. Although adding RESTRICT / WHERE and EXTEND to arbitrary logical expressions (wffs and terms) raises the question of how to relate algebraically to logical expressions. This answer explains that / how you can always algebraically express logical expressions given by literal and / or operator tables.