Delta -- new logic programming language and Delta-methodology for p-computable programs on Turing Complete Languages
aa r X i v : . [ c s . L O ] J u l Delta - new logic programming language. & Delta-methodology for p-computable programson Turing Complete Languages.
Andrey Nechesov
Russia, Novosibirsk, AcademgorodokSobolev institute of mathematics.Email: nechesoff@gmail.comTelegram: @nechesoffSkype: Nechesov
Annotation:
In paper describes the new logic programming language
Delta ,which have a many good properties. Delta-programs is p-computable, verifiableand can translation on other languages. Also we describe the Delta-methodologyfor constructing p-computable programs in high-level languages such as PHP,Java, JavaScript, C++, Pascal, Delphi, Python, Solidity and other. We wouldlike to especially note the use of the Delta methodology for creating
Smart Con-tracts and for
Internet of things . Keywords:
Delta, Delta language, dynamic logic, dynamic model, seman-tic programming, logic language, Delta-methodology, polynomial computability,turing complete languages, polynomial time, p-computable program, blockchain,smart contracts, cryptocurrency, Ethereum, Bitcoin, internet of things, IoT.
Introduction
In this paper introduced new logic programming language Delta for building log-ical Delta-programs based on the theory of semantic programming developed byErshov, Goncharov and Sviridenko[4][5] in the 70s-80s of the last century.In this paper we change the concept of the formula and define
D-formulas(orDelta programs) are special list-formulas. Then we define the execution of aprogram how is the process of checking truth D-formula on a dynamic model.Polynomiality is the main advantage of the Delta programs, which allows notonly to build Delta programs, but also use Delta methodology for creation pro-grams in high-level languages.Main idea our paper consider program how list-formula from another formulason dynamic models. And we created by iterations new Delta-programs use sim-ple base formulas for this. Also we entered a dynamic models how models wherewe save final values of variables when check formula on this model.1 . Semantic programming
The main idea of semantic programming is to consider the program as a for-mula on a suitable model and reduce the execution of the program to the truthchecking formula on the model. Ershov, Goncharov, Sviridenko[4] in their workssuggested using the hereditarily-finite super structure HW ( M ) . They added inbase set of model new elements - lists and add new Lisp functions and relations.We will use some of the list-functions in our article:1) nil - the empty list constant2) head - last element in non-empty list or nil otherwise.3) tail - the list retrieved from the base non-empty list by deleting the last ele-ment or nil otherwise.4) cons ( l , l ) - add list l how new last element in l conc ( l , l ) - concatenation of 2 lists: < l , l > l ∈ w - where l - element of list w l ⊆ w - where l to be the beginning of the list w and we add some next operations:8) addV alue ( l, < x, a > ) - delete any element with view < x, b > for some b from list l and add < x, a > in list l how last elements.9) addV alues ( l, < x , a >, ..., < x n , a n > ) - delete any elements with view < x i , b i > for some b i from list l and add < x i , a i > in list l how last elements.In semantic programming we can define new types of objects with ∆ p − enrichmentsand add this objects in base set.[1]. Set of this objects will be a p-computable.This helps us to extend the set of types of variables in the model, while notgoing beyond the polynomiality.In [2] we defined ∆ -boundary terms, which can extend our formulas and newformulas extension will be conservative. The boundary property will be usedvery often in our article, because the polynomiality is very closely with it. Allour new constructions will be boundary.All this methods and extensions we can use in our Delta-methodology, whichwe describe below. 2 . Delta abstract logic language and Dynamics models. When we create a program, it is very important that in the process of executingthe program code, we save our calculations. In the program code, assigning avariable a value, we store this information. Therefore, when creating a logicalprogram, it is very important to store the values of variables. Standart logicmodels not enough good do this. In this chapter we entered a new abstract logiclanquage
Delta and new type of models - Dynamics models. On this models weextended formulas with new operators and symbols, and now we can easy savecalculated variable values. Dynamic model created an initialized list of variablesand add another values of variables for new D-predicates and D-functions. Anylogical program we consider how list of < Φ , ..., Φ n > of D-formulas Φ i on ourdynamic model D ( M ) E . When we check formula Φ i on truth D ( M ) | = Φ i ,our model D ( M ) E can change own internal parameters with formula operator Γ Φ i ( E ) and can change signature σ : add new predicate or function symbols.Let M − polinomial model signature σ . Denotement:
Dynamic model: D ( M ) E = < M , E > , where E - trace list of sets of initialisation variables pairs < variable, value > (on start E = nil )with signature σ ∗ = σ on start, but can enrich another predicates and functionssymbols. Denotement:
Formula Φ( x, y ) − ∆ p -formula, if truth checking formula Φ isp-computable algorithm, from incoming variables x i = a i and this algorithmalso find values for outcoming variables y . Denotement
Boundary ∆ p -formula Φ( x, y ) it’s ∆ p -formula, , where ∃ C ∃ p ∀ x i | y i | ≤ C ∗ ( | x | + ... | x n | ) p . Denotement:
Formula Φ( x, y ) − C-p- ∆ p -formula, if truth checking formula Φ is p-computable algorithm with contant C and power of p . Denotement: M − ∆ p -model, if M - p-computable model.Let F = { Φ i } , i ∈ N - countably or finite family boundary of C-p- ∆ p -formulason C-p- ∆ p -model M . Denotement:
Family F , defined above, is boundary C-p- ∆ p -family.Let M - ∆ p -model signature σ .Let D ( M ) E -dynamic model signature σ ∗ , where on start E = nil nductively define D-Terms on dynamic model D ( M ) E with signature σ ∗ :
1) if c - constant, then c - D-term2) if x - variable, then x - D-term3) if f ∈ σ ∗ - n-th place functional symbol, then f ( t ( x ) , ..., t n ( x )) - D-term,where t i - D-terms Inductively define D-formulas on dynamic model D ( M ) E :
1) Any quantifer free formula of signature σ ∗ is D-formula2) " y := t ( x ) " - it’s D-formula( "assignment" operator ), where t − D-term .3)
COP Y operator: analoge FOR in programming languages but we requarewhat all outcoming variables y was a boundary:" COP Y (Φ( x, y ) , n ) = < Φ , ..., Φ > " copy the formula n-times Φ .for Ψ( x, y ) : < Φ , ..., Φ > ∃ C, p ∀ n ∈ N | y i | ≤ C ∗ ( | x | + ... | x n | + n ) p If operator: If (Ψ( x, y ) , Φ ( x, y ) , Φ ( x, y )) = ( Φ , D ( M ) E | = Ψ( x, y )Φ , else ∆ p − operator α : α ( x ) = Φ( x, y ) , Φ ∈ F , F − boundary ∆ p − family and α ∈ σ ∗ − special functional symbol. α ( x ) − D-formula.6) "predicate P ( x, y ) : Φ( x, y ) " is D-formula (or D-predicate ), where
P / ∈ σ ∗ and Φ( x, y ) -D-formula.7) "function f ( x ) return y : Φ( x, y ) " is D-formula ( f ( x ) is D-function ), if ( f ( x ) , y ) - D-predicate and f / ∈ σ ∗ ,.8) " return " - D-formula9) List of formulas " < Φ , ..., Φ n > " is D-formula, all Φ i - D-formulas. Inductively define truth checking D-formula on D ( M ) E and how model D ( M ) E is changed1) If Φ( x ) - quantifier free formula signature σ ∗ , then D ( M ) E | = Φ( x ) ⇔ M | = Φ( a ) < x i , a i > ∈ head ( E ) .2) Operator COP Y : D ( M ) E | = COP Y (Φ( x, y ) , z ) ⇔ D ( M ) E | = < Φ( x, y ) , ..., Φ( x, y ) > where all < x i , a i > ∈ head ( E ) and < z, n > ∈ head ( E ) , n ∈ N and for Ψ( x, y ) : < Φ( x, y ) , ..., Φ( x, y ) > we requare for all y i in Ψ is boundary from x and n .3) Operator IF : D ( M ) E | = If (Ψ , Φ , Φ ) ⇔ ( D ( M ) Γ Ψ ( E ) | = Φ , if D ( M ) E | = Ψ( x, y ) D ( M ) E | = Φ , else Γ Ψ ( E ) = cons ( tail ( E ) , addV alues ( head ( E ) , < y , b >, ..., < y k , b k > )) and all < x i , a i > ∈ head ( E ) , i ∈ [1 , ..., n ]
4) Operator α : D ( M ) E | = α ( x ) ⇔ D ( M ) E | = Φ( x, y ) where all < x i , a i > ∈ E for some a i and Φ ∈ F where F boundary-C-p- ∆ p − family
5) Let f ∈ σ − n-place functional symbol D ( M ) E | = y := f ( x ) ⇔ D ( M ) Γ ( f ( x ) ,y ) ( E ) | = true Γ ( f ( x ) ,y ) ( E ) = cons ( tail ( E ) , addV alue ( head ( E ) , < y, f ( a ) > )) and all < x i , a i > ∈ head ( E ) , i ∈ [1 , ..., n ]
6) Let f ∈ σ − n-place D-functional symbol, where ( f ( x ) , y ) - D-predicate D ( M ) E | = z := f ( x ) ⇔ D ( M ) Γ ( f ( x ) ,z ) ( E ) | = α ( a ) Γ ( f ( x ) ,z ) ( E ) = cons ( cons ( E, << z, y >> ) , << x , a >, ..., < x n , a n >> ) and all < x i , a i > ∈ head ( E ) , i ∈ [1 , ..., n ]
7) Let t , ..., t n - D-terms of signature σ ∗ , and f ∈ σ ∗ - n-place functionalsymbol. D ( M ) E | = y := f ( t ( x ) , ..., t n ( x )) ⇔ D ( M ) E | = < z := t ( x ) , ..., z n := t n ( x ) , y := f ( z , ..., z n ) > and all < x i , a i > ∈ head ( E ) for all i ∈ [1 , ..., n ] ⇔ D ( M ) Γ ( zn,tn ) ( ... Γ ( z ,t ( E ) ... ) | = y := f ( z , ..., z n ) ( z n ,t n ) ( ... Γ ( z ,t ) ( E ) ... ) = cons ( tail ( E ) , addV alues ( head ( E ) , < z , t >, ..., < z n , t n > ))
8) Let P ( x, y ) - boundary ∆ p -predicate of signature σ . D ( M ) E | = P ( x, y ) ⇔ D ( M ) Γ P ( E ) | = true Γ P ( E ) = cons ( tail ( E ) , addV alues ( head ( E ) , < y = b >, ..., < y k = b k > )) & all < x i , a i > ∈ head ( E )
9) Let P ( x, y ) - D-predicate of signature σ ∗ . D ( M ) E | = P ( x, z ) ⇔ D ( M ) Γ P ( E ) | = Φ( x, y ) Γ P ( E ) = cons ( cons ( tail ( E ) , << z , y >, ..., < z n , y n >> ) , << x , a >, ..., < x n , a n >> ) and all < x i , a i > ∈ head ( E ) , i ∈ [1 , ..., n ] D ( M ) E | = < Φ , ..., Φ n > ⇔ D ( M ) E | = Φ and D ( M ) Γ Φ1 ( E ) | = < Φ , ..., Φ n > D ( M ) E | = return ⇔ D ( M ) Γ return ( E ) | = true Γ return ( E ) = cons ( tail ( E ) , addV alue ( head ( E ) , < return, > )) D ( M ) Γ return ( E ) | = < Φ , ..., Φ n > ⇔ D ( M ) Γ return ( E ) | = < Φ , ..., Φ n > D ( M ) Γ return ( E ) | = nil ⇔ D ( M ) Γ nil (Γ return ( E )) | = true Γ nil (Γ return ( E )) = cons ( tail ( tail ( tail (Γ return ( E )))) , addV alues ( head ( tail ( tail (Γ return ( E )))) ,
3. Delta programs
When we define the concept of a D-formulas and dynamic models, we can intro-duce the concept of a delta program and describe the process of computation.Calculation of outgoing values in a delta-program and checking truth of D-formula on dynamic model is equivalent concepts.
Definition:
Delta-program it’s D-formula on dynamic model D ( M ) E Definition:
Delta-program Φ is ∆ p -program, if Φ − ∆ p − D-formula6 efinition:
Process of computation of Delta-program it’s process of truth check-ing this how D-formula on dynamic model D ( M ) E Definition:
Atomic D-formula Φ it’s formula have a next one view:1) y := f ( x ) , where f ∈ σ P ( x, y ) , where P ∈ σ return Inductively define rank r (Φ) for any D-formula on dynamic-model D ( M ) E :1) r (Φ) = 0 , if Φ - atomic formula.2) COP Y operator: r ( COP Y (Φ , n )) = r (Φ) + 1 .3) IF operator: r ( IF (Ψ , Φ , Φ )) = max { r (Φ ) , r (Φ ) } + 1 .4) α operator: r ( α ( x )) = max { r (Φ i ) } + 1 , where all Φ i ∈ F .5) Ψ : " predicate P ( x, y ) : Φ( x, y ) " , then r (Ψ) = r (Φ) + 1 .6) Ψ : " f unction f ( x ) return y : Φ( x, y ) " , then r (Ψ) = r (Φ) + 1 .7) P − D-predicate, then r ( P ( x, y )) = r ( predicate P ( x, y ) : Φ( x, y )) + 1 f − D-function, then r ( y := f ( x )) = r ( f unction f ( x ) return y : Φ( x, y )) + 1
9) if Φ , ..., Φ n - D-formulas, where max { r (Φ i )) } = k , then r ( < Φ , ..., Φ n > ) = k + 1 . Lemma 3.1 : If all Φ i − boundary ∆ p − D − formulas, then Φ = < Φ , ... Φ n > − boundary ∆ p − formula (cid:3) Induction by n : D ( M ) E | = < Φ ( x, y ) > ⇔ D ( M ) Γ Φ1 ( E ) | = true and Φ - boundary ∆ p -formula.Induction step:Let for any list of length k - < Φ , ..., Φ k +1 > boundary ∆ p -formula, then D ( M ) E | = < Φ , ... Φ k +1 > ⇔ D ( M ) Γ Φ1 ( E ) | = < Φ , ... Φ k +1 > We requare for all Φ i - boundary, then for all outcoming y for Φ we have | y j | ≤ C ∗ ( | x | + ... | x n | ) p , and by induction < Φ , ..., Φ k +1 > -boundary ∆ p for-mula, then exists R and q, what < Φ , ..., Φ k +1 > is boundary R-q- ∆ p formula.7 Theorem
Any Delta-program Φ is ∆ p -program. (cid:3) Proof by induction by formula complexity:Induction Base: r (Φ) = 0 : Then our D-formula Φ is atomic and then it’s bound-ary ∆ p -D-formulaInduction Step: Let it’s true for any Φ i with rank r (Φ i ) = k .We have a next:1) COP Y (Φ , n ) = < Φ , ..., Φ > − boundary- ∆ p − D-formula by definition2) IF (Ψ , Φ , Φ ) − boundary- ∆ p − D-formula. t ( D ( M ) E | = Ψ( x, y )) ≤ C ∗ ( | x | + ... + | x n | ) p and all | y i | ≤ C ∗ ( | x | + ... + | x n | ) p and then t ( D ( M ) Γ Ψ ( E ) | = Φ ( x )) ≤ C ∗ ( | y | + ... + | y n | ) p ≤ n ∗ C ∗ ( | x | + ... | x n | ) p t ( D ( M ) E | = Φ ( x )) ≤ C ∗ ( | x | + ... + | x n | ) p
3) Operator α : t ( D ( M ) E | = α ( x )) = t ( D ( M ) E | = Φ i ( x ) ( x, y )) + C ∗ ( | x | + ... | x n | ) p ≤ C ∗ ( | x | + ... + | x n | ) p Φ = < Φ , ..., Φ n > use Lemma 3.1 we get, what Φ − ∆ p − program.5) Ψ : " predicate P ( x, y ) : Φ( x, y ) "need check what new symbol P not in signature and Φ( x, y ) -D-formula6) Ψ : " f unction f ( x ) : return y : Φ( x, y ) "In this case same argumentation how in 5).7) P ( x, y ) , where P -D-predicate t ( D ( M ) E | = P ( x, y )) = t ( D ( M ) E | = Φ( x, y )) y := f ( x ) , where f -D-functionIn this case same argumentation how in 7). (cid:4)
4. Delta methodology in Turing Complete Languages
The process of creating a Delta programs can be transferred to Turing com-plete languages. In other words, we can talk about the Delta methodology in8uring complete languages. All operators, predicates, and functions are wasdefinable for our Delta language are the same as in most programming lan-guages such as PHP, C++, Fortran, Pascal, Solidity. All this programs willbe a p − computable. Programs using Delta-methodology we can translate onother programming language and also on law language. Delta methodology areimportant in the direction of creating smart contracts. For each smart contract,it is very important to know how long it will run and how much computingresources need to be spent for this. Today, the most popular platform for cre-ating smart contracts is Ethereum, and the most popular language is Solidity.And for executing smart contract on Ethereum need use "gas" because we donot know when the contract executing will stop. Delta-methodology for smartcontracts decide this questions.In the development of software products it is also very important to know whatdegree of polynomiality will be our program. Program will be p − computable,but the degree of polynomiality is too high. Delta-methodology allows us toestimate the degree of polynomiality in one or another implementation of thealgorithm using programs on high-level languages. References [1] Andrey Nechesov, Semantic programming: method ∆ p -enrichments and polyno-mial computable fixed points.Url: https://arxiv.org/abs/1903.08109 Date: March 19, 2019, Version: 1.0 [2] Goncharov S.S., The computability via definability in semantic modeling.Url:
Join work with D. Sviridenko and A.Nechesov. Date: May 14, 2018 [3] Goncharov S.S., Conditional Terms in Semantic Programming.In:
Sibirian Mathematical Journal, 2017, V 58, No5, P. 794-800. [4] Goncharov S.S., Sviridenko D.I., Σ -programming.In: Transl., II.Ser., Am. Math. Soc. 1989. V. 142. P. 101–121. [5] Ershov Yu. L., Goncharov S. S., Sviridenko D. I., Semantic programmingIn:
Information processing 86: Proc. IFIP 10-th World Comput. Cong. Dublin.1986. V. 10. P. 1113–1120. [6] Ershov Yu. L. "Definability and computability.". 1996[6] Ershov Yu. L. "Definability and computability.". 1996