SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
Introduction Title
Program Derivation of Operations in Fp
Charles Southerland Dr. Anita Walker
Department of Mathematics & Computer Science
East Central University
Oklahoma Computing Consortium Conference 2011
Southerland, Walker Program Derivation of Operations in Fp
Introduction Thanks
Special Thanks
I would like to say a special thank you to:
Dr. Anita Walker for working closely with me throughout
this project, and for introducing me to abstract algebra
Dr. Bill Walker for introducing me to program derivation
Prof. Clay Carley for working with me on cryptology, which
first lead me to this particular problem
The creators of Beamer for allowing LATEX to save me from
the abyss of WYSIWYG presentation software
Southerland, Walker Program Derivation of Operations in Fp
Finite Fields Outline
Outline
1 Finite Fields
Definition
Field Order
A Well-Known Finite Field
2 Program Derivation
3 Multiplicative Inverse in Fp
Southerland, Walker Program Derivation of Operations in Fp
Finite Fields Definition
The Definition of a Field
Definition
A field is a 3-tuple of a set F and two operations (called addition
and multiplication) for which certain properties hold:
Closure of F under both operations
Associativity of both operations
Distinct identities in F for the operations
Additive inverses for all items in F
Multiplicative inverses for all but the additive identity
Commutativity of both operations
Distributivity of multiplication over addition
Southerland, Walker Program Derivation of Operations in Fp
Finite Fields Definition
The Galois Field
A finite field is a field in which the contained set has finite
cardinality (e.g., the field has a finite order).
All finite fields of the same order are isomorphic (so they are,
for all practical purposes, the same).
Another name for a finite field is a Galois field.
Generalized fields are often denoted as F, but finite fields in
particular are usually denoted either with GF, GF(q), or Fq,
where q is the order of the field.
Southerland, Walker Program Derivation of Operations in Fp
Finite Fields Field Order
The Order of a Finite Field
There exists a finite field of order q iff q = pn, where p is
prime and n ∈ N..
When n = 1, Fp is isomorphic to (Zp, ⊕, ⊗) (the integers
modulo p with modular addition and modular multiplication).
When n > 1, Fpn is isomorphic to the splitting field of
f (x) = xpn
− x over Fp.
This project focuses on fields of prime order, so I’m afraid
there will be no more discussion of Fpn .
Southerland, Walker Program Derivation of Operations in Fp
Finite Fields A Well-Known Finite Field
A Well-Known Finite Field of Prime Order: F2
Since 2 is prime, there is a finite field F2, and it has the form
(Z2, ⊕, ⊗).
The operations are defined as:
Addition
⊕ 0 1
0 0 1
1 1 0
Multiplication
⊗ 0 1
0 0 0
1 0 1
As you can see, F2 is binary with XOR as addition and AND
as multiplication.
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Outline
Outline
1 Finite Fields
2 Program Derivation
History
Dijkstra’s Guarded Command Language
Weakest Precondition Predicate Transformer
The Program Derivation Process
3 Multiplicative Inverse in Fp
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation History
The History of Program Derivation
Hoare’s 1969 paper An Axiomatic Basis for Computer
Programming effectively launched the Formal Methods
subfield of CS.
Dijkstra’s paper Guarded Commands, Nondeterminacy and
Formal Derivation of Programs introduced many of the ideas
presented in this paper.
Gries’ book The Science of Programming brings Dijkstra’s
paper to a level undergrad CS and Math majors can
understand.
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Dijkstra’s Guarded Command Language
Some Familiar Parts of Dijkstra’s Language
Variable Assignment
x := 1
Addition
x := x + y
Command Concatenation
b := b − a; x := x + y
Procedure Call
c := gcd(a, b)
Subtraction
b := b − a
Skip, then Abort
skip; abort
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Dijkstra’s Guarded Command Language
Dijkstra’s Guarded Commands
Guarded if-Block
if a > 0 → c := 2
b > 0 → c := 3; a := 5
c > 0 → c := 1
c = 6 → c := 4
fi
Guarded do-Block
do b = 0 → c := 1
a > 0 → a := a − 1
b < 4 → b := b + 1
c = 1 → a := a − 1
od
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Dijkstra’s Guarded Command Language
A Famous Example
Greatest Common Divisor
proc gcd(a, b) ≡
do a > b → a := a − b
b > a → b := b − a
od
return a.
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
The Weakest Precondition Predicate Transformer
Definition
The Weakest Precondition Predicate Transformer (wp) is
defined as follows:
wp : P × L → L
P is the set of all finite-length programs
L is the set of all statements about the state of a computer
wp(s, r) = q
q is the weakest precondition (the initial state)
s is the program to be executed (which changes the state)
r is the postcondition (the resulting state)
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
wp and Dijkstra’s Language
Skip
wp(”skip”, r) = r
Command Concatenation
wp(”b := a; x := y”, r)
= wp(”b := a”, wp(”x := y”, r))
Abort
wp(”abort”, r) = F
Variable Assignment
wp(”x := y”, r)
= defined(y) ∧ rx
y
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
wp and Dijkstra’s if-Block
Dijkstra’s if-Block
wp(”if a > 0 → c := 2
b > 0 → c := 3; a := 5
c > 0 → c := 1
c = 6 → c := 4 fi”, r)
= (a > 0 ∨ b > 0 ∨ c > 0 ∨ c = 6)
∧(a > 0 =⇒ wp(”c := 2”, r))
∧(b > 0 =⇒ wp(”c := 3; a := 5”, r))
∧(c > 0 =⇒ wp(”c := 1”, r))
∧(c = 6 =⇒ wp(”c := 4”, r))
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
wp and Dijkstra’s do-Block, Part I
Let’s call this ”DO”:
do b = 0 → c := 1
a > 0 → a := a − 1
b < 4 → b := b + 1
c = 1 → a := a − 1
od
Also, let’s call this ”IF”:
do b = 0 → c := 1
a > 0 → a := a − 1
b < 4 → b := b + 1
c = 1 → a := a − 1
od
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
wp and Dijkstra’s do-Block, Part II
We define Hn(r) for n ∈ N and r ∈ L as:
For n = 1
H1(r) = (b = 0 ∧ a ≤ 0 ∧ b ≥ 4 ∧ c = 1) ∧ r
For n > 1
Hn(r) = H1(r) ∨ wp(”IF”, Hn−1(r))
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation Weakest Precondition Predicate Transformer
wp and Dijkstra’s do-Block, Part III
Dijkstra’s Guarded do-Block
wp(”do b = 0 → c := 1
a > 0 → a := a − 1
b < 4 → b := b + 1
c = 1 → a := a − 1 od”, r)
= (∃n ∈ N)Hn(r)
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation The Program Derivation Process
Program Derivation
Program Derivation
Given a precondition q ∈ L and a postcondition r ∈ L,
derive a program s ∈ P that satisfies q = wp(s, r).
Southerland, Walker Program Derivation of Operations in Fp
Program Derivation The Program Derivation Process
Program Derivation Tips
Gather as much information as possible about the
precondition and postcondition.
Reduce the problem to previously solved ones whenever
possible.
Look for a loop invariant that gives clues on how to
implement the program.
If you are stuck, consider alternative representations of the
data.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Outline
Outline
1 Finite Fields
2 Program Derivation
3 Multiplicative Inverse in Fp
Multiplicative Inverses
The Greatest Common Divisor
Exploring Bezout’s Identity
Program to Find the Multiplicative Inverse in Fp
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Multiplicative Inverses
Multiplicative Inverses in Fields of Infinite and Finite Order
Finding multiplicative inverses in a field of infinite order is
typically not a problem.
Example
In (Q, +, ×), multiplicative inverses are reciprocals (e.g., a−1 = 1
a ).
Finding multiplicative inverses in fields of finite order can get
tricky.
Example
In (Zp, ⊕, ⊗), multiplicative inverses are found using Bezout’s
Identity (i.e., ax + py = 1), which has two unknown values.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Multiplicative Inverses
Obtaining the Multiplicative Inverse from Bezout’s Identity
Noting that a and b are coprime (since b = p, and p is prime),
gcd(a, b) = 1. So:
ax + by = gcd(a, b)
ax + by = 1
ax = by + 1
ax = py + 1
ax = 1
By the definition of multiplicative inverses, x = a−1.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp The Greatest Common Divisor
The Greatest Common Divisor
Recall the greatest common divisor program:
Greatest Common Divisor
proc gcd(a, b) ≡
do a > b → a := a − b
b > a → b := b − a
od
return a.
This implementation was discovered by exploring the property:
gcd(a, b) = gcd(a − b, b) = gcd(a, b − a)
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp The Greatest Common Divisor
The Loop Invariant of gcd
The loop invariant used in the primary loop of this program is
gcd(a, b) = gcd(A, B).
The loop will exit when a = b, which occurs when
a = b = gcd(a, b).
Since every iteration decreases the value of either a or b, the
loop will progress toward termination (the loop is bound by
(a − gcd(a, b)) + (b − gcd(a, b))).
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Exploring Bezout’s Identity
Bezout’s Identity and the gcd Property
Combining Bezout’s Identity with the gcd property, we get:
ax + by = gcd(a, b)
= gcd(a, b − a)
= au + (b − a)v
= au + bv − av
= a(u − v) + bv
So x ≡ u − v (mod b) and y ≡ v (mod a).
As gcd is commutative, we derive a corresponding result if we
explored gcd(a − b, b) instead of gcd(a, b − a).
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Exploring Bezout’s Identity
Reassigning x and y as Linear Combinations: Part I
Each time the arguments of gcd get closer to their final value, it is
shown that x is equivalent (mod b) and y is equivalent (mod a)
to a linear combination of their corresponding values from Bezout’s
Identity after a and b have been modified as described in the gcd
program.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Exploring Bezout’s Identity
Reassigning x and y as Linear Combinations: Part II
Specifically, it can be seen that x always has a positive coefficient
of following corresponding values of x and a negative coefficient of
corresponding values of y. Likewise, y always has a negative
coefficient of corresponding values of x and a positive coefficient of
corresponding values of y.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Exploring Bezout’s Identity
Reassigning x and y as Linear Combinations: Part III
Once the arguments to gcd are equal to each other (and equal to
the result of gcd), we can find the original values of x and y by
multiplying the coefficients that have been stored by the final
corresponding values of x and y. However, since we are looking for
a multiplicative inverse in Fp, we know gcd(a, p) = 1 as p is prime.
Since this will give us x = 1 by simplification after using the gcd
property one last time, we see that the y components are
inconsequential.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Exploring Bezout’s Identity
Reassigning x and y as Linear Combinations: Part IV
Finally, we see that only the x coefficients are of any consequence
to the final result. Specifically, once the gcd algorithm is complete,
since the initial (and desired) value of x can be found by
multiplying the final corresponding value of x by the proper
coefficient of x, and since the final corresponding value of x = 1,
we get that the desired value of x is equal to the coefficient of the
corresponding final value of x.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp
Finding the Loop Invariant
Based on the long-winded previous slides, we can describe a loop
invariant:
Axl + Byl = gcd(a, b)
where xl is is the linear combination that the initial value of x is
equal to, and yl is the linear combination that the initial value of y.
This loop invariant is nice, as it is fully compatible with the loop
invariant of gcd, and so it also progresses toward termination and
has a bound function that differs from that of gcd linearly.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp
A Last Look at gcd for Reference...
Greatest Common Divisor
proc gcd(a, b) ≡
do a > b → a := a − b
b > a → b := b − a
od
return a.
Southerland, Walker Program Derivation of Operations in Fp
Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp
Multiplicative Inverse Program
Multiplicative Inverse
proc multinv(a, b) ≡
xx := 1; yx := 0
do a > b → a := a − b; yx := yx + xx
b > a → b := b − a; xx := xx + yx
od
return xx .
Southerland, Walker Program Derivation of Operations in Fp
Conclusion Summary
Summary
Finite fields are very useful mathematical constructs that can
behave very differently from fields of infinite order.
Program derivation is performed by using the rules of the
weakest precondition predicate transformer to determine what
sequence of conditions (and thus what program statements)
must have occured between a given precondition and
postcondition.
While the process of deriving my multiplicative inverse
program was time-consuming and complicated, the results
were well worth the effort.
Southerland, Walker Program Derivation of Operations in Fp
Conclusion Future Work
Future Work
Program Derivation of Exponentiation in Fp
Extend scope to include Fpn
Explore factorization techniques
Finish library and create graphical front end
Southerland, Walker Program Derivation of Operations in Fp
Conclusion Contact Me
Contact Information
You can email me at charlie@stuphlabs.com if you have any
further questions or comments.
Southerland, Walker Program Derivation of Operations in Fp

Weitere ähnliche Inhalte

Was ist angesagt?

Lecture 05 Association Rules Advanced Topics
Lecture 05 Association  Rules  Advanced  TopicsLecture 05 Association  Rules  Advanced  Topics
Lecture 05 Association Rules Advanced TopicsPier Luca Lanzi
 
Sequential pattern mining
Sequential pattern miningSequential pattern mining
Sequential pattern miningkiran said
 
Monad presentation scala as a category
Monad presentation   scala as a categoryMonad presentation   scala as a category
Monad presentation scala as a categorysamthemonad
 
Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Dacong (Tony) Yan
 
Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in Rherbps10
 
Functional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold MeisingerFunctional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold MeisingerGeroldMeisinger
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!Dung Trương
 
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...Tomoki Koriyama
 

Was ist angesagt? (14)

Algorithm
AlgorithmAlgorithm
Algorithm
 
Lecture 05 Association Rules Advanced Topics
Lecture 05 Association  Rules  Advanced  TopicsLecture 05 Association  Rules  Advanced  Topics
Lecture 05 Association Rules Advanced Topics
 
Sequential pattern mining
Sequential pattern miningSequential pattern mining
Sequential pattern mining
 
Sequential Pattern Mining and GSP
Sequential Pattern Mining and GSPSequential Pattern Mining and GSP
Sequential Pattern Mining and GSP
 
Monad presentation scala as a category
Monad presentation   scala as a categoryMonad presentation   scala as a category
Monad presentation scala as a category
 
pattern mining
pattern miningpattern mining
pattern mining
 
Stack
StackStack
Stack
 
Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...
 
Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in R
 
Functional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold MeisingerFunctional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold Meisinger
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Lecture04
Lecture04Lecture04
Lecture04
 
The LabPQR Color Space
The LabPQR Color SpaceThe LabPQR Color Space
The LabPQR Color Space
 
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...
A TRAINING METHOD USING
 DNN-GUIDED LAYERWISE PRETRAINING
 FOR DEEP GAUSSIAN ...
 

Ähnlich wie Program Derivation of Operations in Finite Fields of Prime Order

lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdfAnaNeacsu5
 
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...Geoffrey Négiar
 
Subtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondSubtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondPatrick Diehl
 
Functional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersFunctional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersChris
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING karishma gupta
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Data Con LA
 
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...CodeFest
 
Distributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsDistributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsPantelis Sopasakis
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkDB Tsai
 
Alpine Spark Implementation - Technical
Alpine Spark Implementation - TechnicalAlpine Spark Implementation - Technical
Alpine Spark Implementation - Technicalalpinedatalabs
 
Yampa AFRP Introduction
Yampa AFRP IntroductionYampa AFRP Introduction
Yampa AFRP IntroductionChengHui Weng
 
2014-06-20 Multinomial Logistic Regression with Apache Spark
2014-06-20 Multinomial Logistic Regression with Apache Spark2014-06-20 Multinomial Logistic Regression with Apache Spark
2014-06-20 Multinomial Logistic Regression with Apache SparkDB Tsai
 
Regret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationRegret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationTasuku Soma
 
study Streaming Multigrid For Gradient Domain Operations On Large Images
study Streaming Multigrid For Gradient Domain Operations On Large Imagesstudy Streaming Multigrid For Gradient Domain Operations On Large Images
study Streaming Multigrid For Gradient Domain Operations On Large ImagesChiamin Hsu
 
Fractional programming (A tool for optimization)
Fractional programming (A tool for optimization)Fractional programming (A tool for optimization)
Fractional programming (A tool for optimization)VARUN KUMAR
 

Ähnlich wie Program Derivation of Operations in Finite Fields of Prime Order (20)

lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
 
Slides
SlidesSlides
Slides
 
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...
Stochastic Frank-Wolfe for Constrained Finite Sum Minimization @ Montreal Opt...
 
Subtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondSubtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff Hammond
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Functional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersFunctional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative Programmers
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
 
3. Functions II.pdf
3. Functions II.pdf3. Functions II.pdf
3. Functions II.pdf
 
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...
CodeFest 2014. Axel Rauschmayer — JavaScript’s variables: scopes, environment...
 
Distributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsDistributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUs
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache Spark
 
Alpine Spark Implementation - Technical
Alpine Spark Implementation - TechnicalAlpine Spark Implementation - Technical
Alpine Spark Implementation - Technical
 
Yampa AFRP Introduction
Yampa AFRP IntroductionYampa AFRP Introduction
Yampa AFRP Introduction
 
2014-06-20 Multinomial Logistic Regression with Apache Spark
2014-06-20 Multinomial Logistic Regression with Apache Spark2014-06-20 Multinomial Logistic Regression with Apache Spark
2014-06-20 Multinomial Logistic Regression with Apache Spark
 
Ecc2
Ecc2Ecc2
Ecc2
 
Regret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationRegret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function Maximization
 
QMC: Transition Workshop - Approximating Multivariate Functions When Function...
QMC: Transition Workshop - Approximating Multivariate Functions When Function...QMC: Transition Workshop - Approximating Multivariate Functions When Function...
QMC: Transition Workshop - Approximating Multivariate Functions When Function...
 
study Streaming Multigrid For Gradient Domain Operations On Large Images
study Streaming Multigrid For Gradient Domain Operations On Large Imagesstudy Streaming Multigrid For Gradient Domain Operations On Large Images
study Streaming Multigrid For Gradient Domain Operations On Large Images
 
Fractional programming (A tool for optimization)
Fractional programming (A tool for optimization)Fractional programming (A tool for optimization)
Fractional programming (A tool for optimization)
 

Mehr von Charles Southerland (11)

hextime (OKC LUGnuts 5C393C35)
hextime (OKC LUGnuts 5C393C35)hextime (OKC LUGnuts 5C393C35)
hextime (OKC LUGnuts 5C393C35)
 
HTTPS Sucks
HTTPS SucksHTTPS Sucks
HTTPS Sucks
 
Authentication Concepts
Authentication ConceptsAuthentication Concepts
Authentication Concepts
 
Linux Users are People, Too!
Linux Users are People, Too!Linux Users are People, Too!
Linux Users are People, Too!
 
RSA
RSARSA
RSA
 
Passwords
PasswordsPasswords
Passwords
 
Program Derivation of Matrix Operations in GF
Program Derivation of Matrix Operations in GFProgram Derivation of Matrix Operations in GF
Program Derivation of Matrix Operations in GF
 
Logs And Backups
Logs And BackupsLogs And Backups
Logs And Backups
 
C Is Not Dead Yet
C Is Not Dead YetC Is Not Dead Yet
C Is Not Dead Yet
 
All Your Password Are Belong To Us
All Your Password Are Belong To UsAll Your Password Are Belong To Us
All Your Password Are Belong To Us
 
One-Time Pad Encryption
One-Time Pad EncryptionOne-Time Pad Encryption
One-Time Pad Encryption
 

Kürzlich hochgeladen

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Kürzlich hochgeladen (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Program Derivation of Operations in Finite Fields of Prime Order

  • 1. Introduction Title Program Derivation of Operations in Fp Charles Southerland Dr. Anita Walker Department of Mathematics & Computer Science East Central University Oklahoma Computing Consortium Conference 2011 Southerland, Walker Program Derivation of Operations in Fp
  • 2. Introduction Thanks Special Thanks I would like to say a special thank you to: Dr. Anita Walker for working closely with me throughout this project, and for introducing me to abstract algebra Dr. Bill Walker for introducing me to program derivation Prof. Clay Carley for working with me on cryptology, which first lead me to this particular problem The creators of Beamer for allowing LATEX to save me from the abyss of WYSIWYG presentation software Southerland, Walker Program Derivation of Operations in Fp
  • 3. Finite Fields Outline Outline 1 Finite Fields Definition Field Order A Well-Known Finite Field 2 Program Derivation 3 Multiplicative Inverse in Fp Southerland, Walker Program Derivation of Operations in Fp
  • 4. Finite Fields Definition The Definition of a Field Definition A field is a 3-tuple of a set F and two operations (called addition and multiplication) for which certain properties hold: Closure of F under both operations Associativity of both operations Distinct identities in F for the operations Additive inverses for all items in F Multiplicative inverses for all but the additive identity Commutativity of both operations Distributivity of multiplication over addition Southerland, Walker Program Derivation of Operations in Fp
  • 5. Finite Fields Definition The Galois Field A finite field is a field in which the contained set has finite cardinality (e.g., the field has a finite order). All finite fields of the same order are isomorphic (so they are, for all practical purposes, the same). Another name for a finite field is a Galois field. Generalized fields are often denoted as F, but finite fields in particular are usually denoted either with GF, GF(q), or Fq, where q is the order of the field. Southerland, Walker Program Derivation of Operations in Fp
  • 6. Finite Fields Field Order The Order of a Finite Field There exists a finite field of order q iff q = pn, where p is prime and n ∈ N.. When n = 1, Fp is isomorphic to (Zp, ⊕, ⊗) (the integers modulo p with modular addition and modular multiplication). When n > 1, Fpn is isomorphic to the splitting field of f (x) = xpn − x over Fp. This project focuses on fields of prime order, so I’m afraid there will be no more discussion of Fpn . Southerland, Walker Program Derivation of Operations in Fp
  • 7. Finite Fields A Well-Known Finite Field A Well-Known Finite Field of Prime Order: F2 Since 2 is prime, there is a finite field F2, and it has the form (Z2, ⊕, ⊗). The operations are defined as: Addition ⊕ 0 1 0 0 1 1 1 0 Multiplication ⊗ 0 1 0 0 0 1 0 1 As you can see, F2 is binary with XOR as addition and AND as multiplication. Southerland, Walker Program Derivation of Operations in Fp
  • 8. Program Derivation Outline Outline 1 Finite Fields 2 Program Derivation History Dijkstra’s Guarded Command Language Weakest Precondition Predicate Transformer The Program Derivation Process 3 Multiplicative Inverse in Fp Southerland, Walker Program Derivation of Operations in Fp
  • 9. Program Derivation History The History of Program Derivation Hoare’s 1969 paper An Axiomatic Basis for Computer Programming effectively launched the Formal Methods subfield of CS. Dijkstra’s paper Guarded Commands, Nondeterminacy and Formal Derivation of Programs introduced many of the ideas presented in this paper. Gries’ book The Science of Programming brings Dijkstra’s paper to a level undergrad CS and Math majors can understand. Southerland, Walker Program Derivation of Operations in Fp
  • 10. Program Derivation Dijkstra’s Guarded Command Language Some Familiar Parts of Dijkstra’s Language Variable Assignment x := 1 Addition x := x + y Command Concatenation b := b − a; x := x + y Procedure Call c := gcd(a, b) Subtraction b := b − a Skip, then Abort skip; abort Southerland, Walker Program Derivation of Operations in Fp
  • 11. Program Derivation Dijkstra’s Guarded Command Language Dijkstra’s Guarded Commands Guarded if-Block if a > 0 → c := 2 b > 0 → c := 3; a := 5 c > 0 → c := 1 c = 6 → c := 4 fi Guarded do-Block do b = 0 → c := 1 a > 0 → a := a − 1 b < 4 → b := b + 1 c = 1 → a := a − 1 od Southerland, Walker Program Derivation of Operations in Fp
  • 12. Program Derivation Dijkstra’s Guarded Command Language A Famous Example Greatest Common Divisor proc gcd(a, b) ≡ do a > b → a := a − b b > a → b := b − a od return a. Southerland, Walker Program Derivation of Operations in Fp
  • 13. Program Derivation Weakest Precondition Predicate Transformer The Weakest Precondition Predicate Transformer Definition The Weakest Precondition Predicate Transformer (wp) is defined as follows: wp : P × L → L P is the set of all finite-length programs L is the set of all statements about the state of a computer wp(s, r) = q q is the weakest precondition (the initial state) s is the program to be executed (which changes the state) r is the postcondition (the resulting state) Southerland, Walker Program Derivation of Operations in Fp
  • 14. Program Derivation Weakest Precondition Predicate Transformer wp and Dijkstra’s Language Skip wp(”skip”, r) = r Command Concatenation wp(”b := a; x := y”, r) = wp(”b := a”, wp(”x := y”, r)) Abort wp(”abort”, r) = F Variable Assignment wp(”x := y”, r) = defined(y) ∧ rx y Southerland, Walker Program Derivation of Operations in Fp
  • 15. Program Derivation Weakest Precondition Predicate Transformer wp and Dijkstra’s if-Block Dijkstra’s if-Block wp(”if a > 0 → c := 2 b > 0 → c := 3; a := 5 c > 0 → c := 1 c = 6 → c := 4 fi”, r) = (a > 0 ∨ b > 0 ∨ c > 0 ∨ c = 6) ∧(a > 0 =⇒ wp(”c := 2”, r)) ∧(b > 0 =⇒ wp(”c := 3; a := 5”, r)) ∧(c > 0 =⇒ wp(”c := 1”, r)) ∧(c = 6 =⇒ wp(”c := 4”, r)) Southerland, Walker Program Derivation of Operations in Fp
  • 16. Program Derivation Weakest Precondition Predicate Transformer wp and Dijkstra’s do-Block, Part I Let’s call this ”DO”: do b = 0 → c := 1 a > 0 → a := a − 1 b < 4 → b := b + 1 c = 1 → a := a − 1 od Also, let’s call this ”IF”: do b = 0 → c := 1 a > 0 → a := a − 1 b < 4 → b := b + 1 c = 1 → a := a − 1 od Southerland, Walker Program Derivation of Operations in Fp
  • 17. Program Derivation Weakest Precondition Predicate Transformer wp and Dijkstra’s do-Block, Part II We define Hn(r) for n ∈ N and r ∈ L as: For n = 1 H1(r) = (b = 0 ∧ a ≤ 0 ∧ b ≥ 4 ∧ c = 1) ∧ r For n > 1 Hn(r) = H1(r) ∨ wp(”IF”, Hn−1(r)) Southerland, Walker Program Derivation of Operations in Fp
  • 18. Program Derivation Weakest Precondition Predicate Transformer wp and Dijkstra’s do-Block, Part III Dijkstra’s Guarded do-Block wp(”do b = 0 → c := 1 a > 0 → a := a − 1 b < 4 → b := b + 1 c = 1 → a := a − 1 od”, r) = (∃n ∈ N)Hn(r) Southerland, Walker Program Derivation of Operations in Fp
  • 19. Program Derivation The Program Derivation Process Program Derivation Program Derivation Given a precondition q ∈ L and a postcondition r ∈ L, derive a program s ∈ P that satisfies q = wp(s, r). Southerland, Walker Program Derivation of Operations in Fp
  • 20. Program Derivation The Program Derivation Process Program Derivation Tips Gather as much information as possible about the precondition and postcondition. Reduce the problem to previously solved ones whenever possible. Look for a loop invariant that gives clues on how to implement the program. If you are stuck, consider alternative representations of the data. Southerland, Walker Program Derivation of Operations in Fp
  • 21. Multiplicative Inverse in Fp Outline Outline 1 Finite Fields 2 Program Derivation 3 Multiplicative Inverse in Fp Multiplicative Inverses The Greatest Common Divisor Exploring Bezout’s Identity Program to Find the Multiplicative Inverse in Fp Southerland, Walker Program Derivation of Operations in Fp
  • 22. Multiplicative Inverse in Fp Multiplicative Inverses Multiplicative Inverses in Fields of Infinite and Finite Order Finding multiplicative inverses in a field of infinite order is typically not a problem. Example In (Q, +, ×), multiplicative inverses are reciprocals (e.g., a−1 = 1 a ). Finding multiplicative inverses in fields of finite order can get tricky. Example In (Zp, ⊕, ⊗), multiplicative inverses are found using Bezout’s Identity (i.e., ax + py = 1), which has two unknown values. Southerland, Walker Program Derivation of Operations in Fp
  • 23. Multiplicative Inverse in Fp Multiplicative Inverses Obtaining the Multiplicative Inverse from Bezout’s Identity Noting that a and b are coprime (since b = p, and p is prime), gcd(a, b) = 1. So: ax + by = gcd(a, b) ax + by = 1 ax = by + 1 ax = py + 1 ax = 1 By the definition of multiplicative inverses, x = a−1. Southerland, Walker Program Derivation of Operations in Fp
  • 24. Multiplicative Inverse in Fp The Greatest Common Divisor The Greatest Common Divisor Recall the greatest common divisor program: Greatest Common Divisor proc gcd(a, b) ≡ do a > b → a := a − b b > a → b := b − a od return a. This implementation was discovered by exploring the property: gcd(a, b) = gcd(a − b, b) = gcd(a, b − a) Southerland, Walker Program Derivation of Operations in Fp
  • 25. Multiplicative Inverse in Fp The Greatest Common Divisor The Loop Invariant of gcd The loop invariant used in the primary loop of this program is gcd(a, b) = gcd(A, B). The loop will exit when a = b, which occurs when a = b = gcd(a, b). Since every iteration decreases the value of either a or b, the loop will progress toward termination (the loop is bound by (a − gcd(a, b)) + (b − gcd(a, b))). Southerland, Walker Program Derivation of Operations in Fp
  • 26. Multiplicative Inverse in Fp Exploring Bezout’s Identity Bezout’s Identity and the gcd Property Combining Bezout’s Identity with the gcd property, we get: ax + by = gcd(a, b) = gcd(a, b − a) = au + (b − a)v = au + bv − av = a(u − v) + bv So x ≡ u − v (mod b) and y ≡ v (mod a). As gcd is commutative, we derive a corresponding result if we explored gcd(a − b, b) instead of gcd(a, b − a). Southerland, Walker Program Derivation of Operations in Fp
  • 27. Multiplicative Inverse in Fp Exploring Bezout’s Identity Reassigning x and y as Linear Combinations: Part I Each time the arguments of gcd get closer to their final value, it is shown that x is equivalent (mod b) and y is equivalent (mod a) to a linear combination of their corresponding values from Bezout’s Identity after a and b have been modified as described in the gcd program. Southerland, Walker Program Derivation of Operations in Fp
  • 28. Multiplicative Inverse in Fp Exploring Bezout’s Identity Reassigning x and y as Linear Combinations: Part II Specifically, it can be seen that x always has a positive coefficient of following corresponding values of x and a negative coefficient of corresponding values of y. Likewise, y always has a negative coefficient of corresponding values of x and a positive coefficient of corresponding values of y. Southerland, Walker Program Derivation of Operations in Fp
  • 29. Multiplicative Inverse in Fp Exploring Bezout’s Identity Reassigning x and y as Linear Combinations: Part III Once the arguments to gcd are equal to each other (and equal to the result of gcd), we can find the original values of x and y by multiplying the coefficients that have been stored by the final corresponding values of x and y. However, since we are looking for a multiplicative inverse in Fp, we know gcd(a, p) = 1 as p is prime. Since this will give us x = 1 by simplification after using the gcd property one last time, we see that the y components are inconsequential. Southerland, Walker Program Derivation of Operations in Fp
  • 30. Multiplicative Inverse in Fp Exploring Bezout’s Identity Reassigning x and y as Linear Combinations: Part IV Finally, we see that only the x coefficients are of any consequence to the final result. Specifically, once the gcd algorithm is complete, since the initial (and desired) value of x can be found by multiplying the final corresponding value of x by the proper coefficient of x, and since the final corresponding value of x = 1, we get that the desired value of x is equal to the coefficient of the corresponding final value of x. Southerland, Walker Program Derivation of Operations in Fp
  • 31. Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp Finding the Loop Invariant Based on the long-winded previous slides, we can describe a loop invariant: Axl + Byl = gcd(a, b) where xl is is the linear combination that the initial value of x is equal to, and yl is the linear combination that the initial value of y. This loop invariant is nice, as it is fully compatible with the loop invariant of gcd, and so it also progresses toward termination and has a bound function that differs from that of gcd linearly. Southerland, Walker Program Derivation of Operations in Fp
  • 32. Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp A Last Look at gcd for Reference... Greatest Common Divisor proc gcd(a, b) ≡ do a > b → a := a − b b > a → b := b − a od return a. Southerland, Walker Program Derivation of Operations in Fp
  • 33. Multiplicative Inverse in Fp Program to Find the Multiplicative Inverse in Fp Multiplicative Inverse Program Multiplicative Inverse proc multinv(a, b) ≡ xx := 1; yx := 0 do a > b → a := a − b; yx := yx + xx b > a → b := b − a; xx := xx + yx od return xx . Southerland, Walker Program Derivation of Operations in Fp
  • 34. Conclusion Summary Summary Finite fields are very useful mathematical constructs that can behave very differently from fields of infinite order. Program derivation is performed by using the rules of the weakest precondition predicate transformer to determine what sequence of conditions (and thus what program statements) must have occured between a given precondition and postcondition. While the process of deriving my multiplicative inverse program was time-consuming and complicated, the results were well worth the effort. Southerland, Walker Program Derivation of Operations in Fp
  • 35. Conclusion Future Work Future Work Program Derivation of Exponentiation in Fp Extend scope to include Fpn Explore factorization techniques Finish library and create graphical front end Southerland, Walker Program Derivation of Operations in Fp
  • 36. Conclusion Contact Me Contact Information You can email me at charlie@stuphlabs.com if you have any further questions or comments. Southerland, Walker Program Derivation of Operations in Fp