Playing with Time and Space in Circuits and Programs

56
Playing with Time and Space in Circuits and Programs Gérard Berry Collège de France Chaire Algorithmes, machines et langages PPS , 24 /0

description

Playing with Time and Space in Circuits and Programs. Gérard Berry Collège de France Chaire Algorithmes, machines et langages. PPS, 24/04/2013. Agenda. 2-adic numbers and space / time exchange in synchronous circuits Never determinize non-deterministic automata ! - PowerPoint PPT Presentation

Transcript of Playing with Time and Space in Circuits and Programs

Syntaxe, smantique, calculabilit

Playing with Time and Spacein Circuits and ProgramsGrard BerryCollge de FranceChaire Algorithmes, machines et langages PPS, 24/04/2013

125/04/2013 2G. Berry, PPS, Agenda2-adic numbers and space / time exchange in synchronous circuitsNever determinize non-deterministic automata !Use hierarchical automata for another exponential gain in space and timing optimization25/04/2013 3G. Berry, PPS, Agenda2-adic numbers and space / time exchange in synchronous circuitsNever determinize non-deterministic automata !Use hierarchical automata for another exponential gain in space and timing optimization25/04/2013 4G. Berry, PPS, Source of the 2-adic PartJ. Vuillemin.On circuits and numbers, IEEE Trans. on Computers, 43:8:868-79, 1994

25/04/2013 5G. Berry, PPS, 2-adic Numbers (Hensel, ~1900)R is a completion de Q. Is it the only one ? No : p-adic numbers for p prime infinite numbers written low-order bits first2-adic numbers unify computable arithmeticwith Boolean logicBeautiful, but physical ? cf. Matire Pense, p. 32 Alain Connes / JP ChangeuxJean Vuillemin : 2-adiques integers are the right modelJean Vuillemin : of arithmetic digital circuits Jean Vuillemin : Let us create their physics!

25/04/2013 6G. Berry, PPS, 2 Z : the Ring of 2-adic Numbersx 2 x0 x1 x2 low-order bits firstoperations and from left to rightx 2101010... 2 (10)x 1 4xx 1/3x 2100000... 2001010... 0 200000... 2 (0)1 210000... 21(0) 2 201000... 201(0) 1 211111... 2 (1)2 201111... 2 0(1) y 2010101... 2 (01)y 2 xy 2/3or x y 125/04/2013 7G. Berry, PPS, 2 Z : the Ring of 2-adic Numbers1 / 2 does not existbecause x0x0 cannot have value 1 p / q exists for all integer p, q iff q est odd(cf. Euclide)No order compatible with the operations1 0 125/04/2013 8G. Berry, PPS, 2 Z as a Boolean Algebra2-adic x seen as the set { i | xi 1 } example: 1/3 2101010... { i | i even }pointwise Boolean operations x y x y x (x y)n x n yn etc.2100011... 2011100... 2111111... x x 1Fundamental arithmetico-logical equality :25/04/2013 9G. Berry, PPS, Cantor Metric Spaced(x,x) 0d(x,y) 2n n minimal s.t. xn ynLemma : 2 Z is ultrametric : d(x,z) max (d(x,y), d(y,z))Example : d (201111..., 201101... 1/8)xyzd(x,z) min (d(x,y), d(y,z))925/04/2013 10G. Berry, PPS, Cantor Metric SpaceCompact very different from reals !ex.: open set for 210010 Open set basis : finite prefixes x0 x1...xn { 2 x0 x1...xn y0 y1...yn... | y 2 Z }110001025/04/2013 11G. Berry, PPS, Continuous functionsLemma : f : 2 Z 2 Z continuous iff f(x)n depends on a finite number of xm2 x0 x1......xm... 2 y0 y1...yn... Continuity preservation of information finiteness25/04/2013 12G. Berry, PPS, Synchronous Functionsxf(x)x0 x1...xn...0 x0 x1...xn...

25/04/2013 13G. Berry, PPS, Synchronous and Contracting FunctionsTheorem : f : 2 Z 2 Z is synchronous iff f(x)n only depends on x0x1...xn, i.e., iff f is contracting x,y. d(f(x),f(y)) d(x,y)Definition : f : 2 Z 2 Z synchronous iff computable by a synchronous circuit (with finite or infinite memory)Preuve : only if trivial, Preuve : for if see SDD construction later on xf(x)25/04/2013 14G. Berry, PPS, Moore Circuits and Strict ContractionA function f : 2 Z 2 Z is strictly contracting iff f(x)n only depends on x0x1...xn1 x,y. d(f(x),f(y)) d(x,y)A Moore synchronous circuit is such that any wire between an input and an output traverses a registerTheorem : a function is computable by a Moore circuit if and only if it is contractingMooreCircuit25/04/2013 15G. Berry, PPS, Feedbacks in Moore Circuits are LegalMooreCircuitf(x)x25/04/2013 16G. Berry, PPS, Feedbacks in Moore Circuits are Legal x,y. d(f(x),f(y)) d(x,y)Lipschitz x,y. d(f(x),f(y)) 0,6 d(x,y)Banach theorem: any Lipschitzian function over a compact set has a unique fixpointMooreCircuitf(x) xf(x)25/04/2013 17G. Berry, PPS, Full Adderabcsrs a xor b xor cr (a and b) or (b and c) or (c and a)++abscrxororandandandbitsEinsten et lpaisseur de linstant.Passer du continu au discret et du non-dterminisme au dtermininme

1725/04/2013 18G. Berry, PPS, Addition in Space++a0b0s0++1a1b1sr1++2a2b2s2r3rr = 00s a bbut within infinite time!continuity:cut at n bits for n output bitss2n1 a2n b2nx2n x mod 2n

25/04/2013 19G. Berry, PPS, Full Adderabcsrs a xor b xor cr (a and b) or (b and c) or (c and a)++abscrxororandandandbitsa b c s 2 r Einsten et lpaisseur de linstant.Passer du continu au discret et du non-dterminisme au dtermininme

1925/04/2013 20G. Berry, PPS, Basic 2-adic Operators++abscrx2 xa b c s 2 r x1 2 x2 x0 x1...xn...2 0 x0 x1...xn...2 x0 x1...xn...2 1 x0 x1...xn...25/04/2013 21G. Berry, PPS, Addition and Subtraction Over Time++absr2rtick ! a b 2 r s 2 r s a bsame equationas over space!a b 1 2 r s 2 r b 1 bs a b12 r++absrb b 1a b s

25/04/2013 22G. Berry, PPS, Mixed Space / Time Additionro

++aebe

se

2ro

tick ! s a bstill the sameequation !++ao

bo

so

re

a ae ao

b be bo

s se so

x y 2 x0 y0 x1 y1...

Same source codefor any space / time tradeoff25/04/2013 23G. Berry, PPS, Stereo Addition++absrstereoadderAlternates 2 additions over time (even / odd bits)stereo left / right channelsse so (ae be) (ao bo)

25/04/2013 24G. Berry, PPS, Addition and Subtraction Over Time++abstick ! ++absabsabs25/04/2013 25G. Berry, PPS, Multiplication and division by a constantx3 x_xy x / 3proof : y x 2 ydivision onlyby odd integers!proof : x 2 x 3 x25/04/2013 26G. Berry, PPS, Quasi-inversey 1 2 x y 1 / (12 x)xy 2 x y 1y 1 2 x yy 1 / (12 x)?contracting synchronousbut infinite memory(cf. SDD construction) 25/04/2013 27G. Berry, PPS, Quasi Square Rooty 1 4 zz x 2 z 2y 2 1 8 z 16 z 2y 1 8 xxzyy 2 1 8 x 16 z 2 16 z 2... but tells us nothingabout bit transformations!

25/04/2013 28G. Berry, PPS, Spatio-Temporal Decomposition of f Synchronousf 0 0-predictor : f 0w = f (w0) for any word wf 0 first bit output by f for inputs 0...f 1 ... 1...f 1 1-predictor : f 1w = f (w1)f w last bit output by f for the finite word wf u u-predictor : f uw = f (wu) for any words w, u

25/04/2013 29G. Berry, PPS, Automaton of x 3 x+x3 x001001110 / 01 / 10 / 11 / 10 / 10 / 01 / 01 / 00 /1 / 10 / 00 /25/04/2013 30G. Berry, PPS, Predictor 0 of x 3 x+x3 x001001110 / 01 / 10 / 11 / 10 / 10 / 01 / 01 / 0001001111 /0 /1 /0 /1 /1 /0 /01 / 00 / 11 / 01 / 00 / 025/04/2013 31G. Berry, PPS, SDD Decomposition Stepf(x) = mux(x, f 1 2 f 1(x), f 0 2 f 0(x))x10f 1f 0f (x)f 1f 025/04/2013 32G. Berry, PPS, SDD Space/Time Normal Form of fTruth-table in space and timeultra-fast : critical path one muxHalf of the bits disappear at each cycle10f11f10x10f01f00xf 01f 00

f 11f 10

f 1f 0x10f1f0f (x)............25/04/2013 33G. Berry, PPS, Shared SDD of f with Finite Memory10f11f10x10f01f00xf 01f 00

f 11f 10

f 1f 0x10f1f0f (x)............

f finite memory finitely many distinct predictors f uf with n registers SDD(f ) may have22 registersn25/04/2013 34G. Berry, PPS, From continuous functions to circuitsf continuous but not synchronous: over space : trivial if infinite spaceover time : expand the time2-adic number : < value, validity >0 0 1 0 1 1 0 1 1 1 0 0 ...0 1 1 0 0 1 1 0 0 1 1 0 ... 0 1 1 0 1 Theorem : every continuous function can berealized by a synchronous circuit with validity25/04/2013 35G. Berry, PPS, Trace of a Synchronous FunctionTr(f) 2 f0 f1 f00 f01 f10 f11 f000 f001 ... f0 2 f1 4 (Tr(f 0) Tr(f1 ))Power series over Z/2Z : S(f) = n Tr(f)n znTheorem : f : 2 Z 2 Z synchronous has finite memory iff S(f) is algebraic over Z/2ZApplication of a trace Tr(f) to an argument x is continuous calculus ?Theorem (Van der Porten) : if f has finite memory, them the real number 0, f0 f1 f00 f01 f10 f11 f000 f001 ...is either rational or transcendantal25/04/2013 36G. Berry, PPS, From Synchronous Traces to Transcendental NumbersAutomatic Sequences: Theory, Applications, GeneralizationsJean-Paul Allouche et Jeffrey ShallitCambridge University Press (21 juillet 2003)

Almost any finite automaton generates a transcendental number!2-adic numbers are the good model of arithmetic synchronous circuits (only?)the 2-adic metric, continuity, and synchronism are fundamental notions to explore further The structure of the predictor space is largely unknownThe relation between continuous functions and validity-circuits remains to be studied (calculus?)25/04/2013 37G. Berry, PPS, Conclusion

Thanks to Jean Vuillemin25/04/2013 38G. Berry, PPS, Agenda2-adic numbers and space / time exchange in synchronous circuitsNever determinize non-deterministic automata !Use hierarchical automata for another exponential gain in space and timing optimization25/04/2013 39G. Berry, PPS, From Deterministic Automata to Circuits(ab+b)*bae1e2e3e0abbabb

r0r2r1r3abbbabok1-hot encoding(only one ri to 1)size explosion!

25/04/2013 40G. Berry, PPS, The Non-Deterministic Case(ab+b)*bano size explosion much better!

bbbaaoks0s1s2s3abbab25/04/2013 41G. Berry, PPS, Electrical Subset Construction

bbbaaokas0s1s2s3abbab(ab+b)*ba25/04/2013 42G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

bbbaaokatick!25/04/2013 43G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

bbbaaokab25/04/2013 44G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

bbbaaokabtick!25/04/2013 45G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

abbbbbaaok25/04/2013 46G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab

abbbbbaaoktick!25/04/2013 47G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

abbabbbaaok25/04/2013 48G. Berry, PPS, Electrical Subset Constructions0s1s2s3abbab(ab+b)*ba

abbabbbaaoktick!25/04/2013 49G. Berry, PPS, Esterel v7 implementationmodule Autom :input a, b ;output ok; local {r0, r1, r2, r3} : reg;refine r0 : init true;sustain { next r0