Use correct symbol for incomplete addition

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
str4d 2021-08-12 21:33:19 +01:00 committed by Jack Grigg
parent 459e68b71e
commit 4e33fe7aec
1 changed files with 16 additions and 16 deletions

View File

@ -27,16 +27,16 @@ impl Add for IncompletePoint {
#[allow(clippy::suspicious_arithmetic_impl)]
fn add(self, rhs: Self) -> Self::Output {
// ⊥ ⊥ = ⊥
// ⊥ P = ⊥
// ⊥ ⊥ = ⊥
// ⊥ P = ⊥
IncompletePoint(self.0.and_then(|p| {
// P ⊥ = ⊥
// P ⊥ = ⊥
rhs.0.and_then(|q| {
// 0 0 = ⊥
// 0 P = ⊥
// P 0 = ⊥
// (x, y) (x', y') = ⊥ if x == x'
// (x, y) (x', y') = (x, y) + (x', y') if x != x'
// 0 0 = ⊥
// 0 P = ⊥
// P 0 = ⊥
// (x, y) (x', y') = ⊥ if x == x'
// (x, y) (x', y') = (x, y) + (x', y') if x != x'
CtOption::new(
p + q,
!(p.is_identity() | q.is_identity() | p.ct_eq(&q) | p.ct_eq(&-q)),
@ -60,17 +60,17 @@ impl Add<pallas::Affine> for IncompletePoint {
/// Specialisation of incomplete addition for mixed addition.
#[allow(clippy::suspicious_arithmetic_impl)]
fn add(self, rhs: pallas::Affine) -> Self::Output {
// ⊥ ⊥ = ⊥
// ⊥ P = ⊥
// ⊥ ⊥ = ⊥
// ⊥ P = ⊥
IncompletePoint(self.0.and_then(|p| {
// P ⊥ = ⊥ is satisfied by definition.
// P ⊥ = ⊥ is satisfied by definition.
let q = rhs.to_curve();
// 0 0 = ⊥
// 0 P = ⊥
// P 0 = ⊥
// (x, y) (x', y') = ⊥ if x == x'
// (x, y) (x', y') = (x, y) + (x', y') if x != x'
// 0 0 = ⊥
// 0 P = ⊥
// P 0 = ⊥
// (x, y) (x', y') = ⊥ if x == x'
// (x, y) (x', y') = (x, y) + (x', y') if x != x'
CtOption::new(
// Use mixed addition for efficiency.
p + rhs,