logo

Axioms for the theory of proveit.logic.equality

In [1]:
import proveit
# Prepare this notebook for defining the axioms of a theory:
%axioms_notebook # Keep this at the top following 'import proveit'.
from proveit.logic import Equals, NotEquals, Not, Forall, Implies, And, in_bool
from proveit import f, x, y, z, fx, fy
%begin axioms
Defining axioms for theory 'proveit.logic.equality'
Subsequent end-of-cell assignments will define axioms
%end_axioms will finalize the definitions

By definition, two expressions are either equal or not (though one may not always be able to know which it is):

In [2]:
equality_in_bool = Forall((x, y), in_bool(Equals(x, y)))
equality_in_bool:

Equality is transitive (two things equal to the same thing must be equal to each other):

In [3]:
equals_transitivity = Forall((x, y, z), Equals(x, z), conditions=[Equals(x, y), Equals(y, z)])
equals_transitivity:

Equality is reflexive (everything is equal to itself):

In [4]:
equals_reflexivity = Forall(x, Equals(x, x))
equals_reflexivity:

Equality is symmetric (it is a mutual relationship):

In [5]:
equals_symmetry = Forall((x, y), Equals(Equals(y, x), Equals(x, y)))
equals_symmetry:

$\neq$ is defined as the negation of $=$:

In [6]:
not_equals_def = Forall((x, y), Equals(NotEquals(x, y), Not(Equals(x, y))))
not_equals_def:

When two things are equal, one may be substituted the other within any expression:

In [7]:
substitution = Forall((f, x, y), Equals(fx, fy), conditions=Equals(x, y))
substitution:

Also see the proveit.core_expr_types.operation.operands_substitution and proveit.core_expr_types.lambda_maps.lambda_substitution axioms. Also note that while it would seem that proveit.logic.equality.substitution could be derived from proveit.core_expr_types.operation.operands_substitution, that derivation would require proveit.logic.equality.substitution (circularly) to be able to prove that $\{x = y\} \vdash (x) = (y).$

In [8]:
%end axioms
These axioms may now be imported from the theory package: proveit.logic.equality