A software construction technique that integrates object process modeling and specification-driven development

By using DAG decomposition and global dictionary automatic verification methods, the problem of requiring a large amount of manual correction in software code generation in existing technologies is solved, realizing automatic code generation and verification, and improving the reliability and reusability of software.

CN123114450APending Publication Date: 2026-11-17SHANGHAI FUDIAN INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611351326.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-02
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies struggle to ensure that software code strictly conforms to design specifications. In particular, complex software systems lack recursive decomposition and explicit formalization of object methods, resulting in code generation requiring extensive manual correction and exhibiting poor reusability.

Method used

A dual-perspective specification decomposition method based on directed acyclic graphs (DAGs) is adopted. Through object process modeling (OPM) and specification-driven development (SDD), functional specifications are recursively decomposed according to the graph, and automatic verification and closed-loop correction are performed using a global dictionary to generate code that conforms to the dual-perspective specification.

Benefits of technology

It enables automatic generation and verification of software code, improves code reliability and reusability, ensures consistency and consistency of all domain concepts in the global dictionary, and greatly improves software quality and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114450A_ABST
    Figure CN123114450A_ABST
Patent Text Reader

Abstract

AI-driven code generation for application deployment has become a mainstream trend in software engineering, but effective mechanisms for controlling code quality are lacking. While Specification-Driven Development (SDD) serves as a technical means for generating AI-driven code, it still suffers from issues related to the quality of specification definitions. This invention proposes ORM-SDD (Recursive Phased Specification-Driven Development Based on Object Process Modeling), a code generation technology that deeply integrates Object Process Modeling (OPM) and Specification-Driven Development (SDD). The core idea is to construct the top-level software specification as the root node of a Directed Acyclic Graph (DAG), recursively decomposing it into child nodes until atomic operations are achieved; each node simultaneously carries a dual-perspective specification of formal behavioral contracts and object ontology structure; all domain concepts and methods are stored in a global dictionary for reuse. During bottom-up code generation, each node undergoes three formal verifications: behavioral, structural, and cross-perspective verification; failure triggers closed-loop correction. This invention ensures that the generated code is strictly consistent with the specification, and that domain concepts are globally unified, traceable, and reusable, significantly improving the development efficiency and reliability of security-critical software.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to software engineering and automated code generation technology, specifically to a specification-driven development method and system that integrates Object Process Modeling (OPM) [1][2][3] and Specification-Driven Development (SDD) [7][8], recursively decomposes the specification using a directed acyclic graph, and integrates formal specifications from the dual perspectives of behavioral contracts and object ontology [4][5][6], thereby realizing automatic code generation, automatic verification and closed-loop correction. Background Technology

[0002] As software systems become increasingly complex, ensuring that software code strictly conforms to design specifications has become a core challenge. Existing technologies mainly fall into two categories: one is formal verification techniques, such as program proofs and model checking based on Hoare logic, which require manual writing and verification of formal specifications after code development. However, the specifications themselves may be inaccurate and disconnected from domain concepts. The other is Model-Driven Development (MDD), which generates code frameworks using models such as UML / SysML, but lacks formal guarantees of behavioral correctness, often requiring extensive manual correction of the generated code. Refinement-driven development (such as B-methods and Event-B), which has emerged in recent years, supports progressive refinement, but its specifications are primarily from a single behavioral perspective, lacking explicit formalization of the domain conceptual structure (objects, relationships, constraints), leading to difficulties in concept reuse and the inability to automatically utilize existing concept dictionaries during the decomposition process. Furthermore, existing technologies fail to treat objects and methods themselves as recursively decomposable specification units, limiting the granularity of reuse. Therefore, a systematic method is needed that can recursively decompose functional specifications according to diagrams, explicitly formalize object structures and behavioral contracts, and ultimately generate correct executable code by leveraging global dictionary reuse, automatic verification, and closed-loop correction. Summary of the Invention

[0003] This invention proposes the ORM-SDD (Recursive Phased Specification-Driven Development Based on Object Process Modeling) technology, aiming to provide an automatic software generation and verification method based on the dual-perspective specification decomposition of directed acyclic graphs (DAGs) to solve the above-mentioned problems.

[0004] The method of the present invention includes: Initialization phase: Obtain top-level functional requirements, create the DAG root node, and initialize a global dictionary containing basic concepts and atomic capabilities.

[0005] Recursive specification decomposition phase: Nodes are processed in a breadth-first or depth-first manner. For each node, it is determined whether it can be directly matched by atomic capabilities. If not, its object structure is refined and decomposed into multiple sub-operation nodes, defining the compositional logic between the sub-nodes. All newly defined objects, methods, and contracts are stored in the global dictionary. This phase continues until all nodes are leaf nodes (atomic capabilities).

[0006] The bottom-up implementation of the generation and formal verification phase involves generating the implementation code for each node by combining the atomic implementations of the leaf nodes in reverse topological order, and performing three formal verifications: behavioral contract verification, structural consistency verification, and cross-perspective consistency verification. If a verification fails, a closed-loop correction strategy (local code correction, refinement adjustment, specification optimization, or atomic replacement) is triggered, and the verification is repeated until it passes.

[0007] System assembly phase: Starting with the root node implementation as the entry point, assemble all the code, and output an executable system and a complete archive of specifications and proofs.

[0008] In the global object ontology dictionary, object definitions include classes, attributes, relationships, and invariant constraints, while method definitions are their behavioral contracts. Each method can correspond to a DAG node, thus enabling recursive specification-driven development of methods. Through this method, the implementation of each node is mathematically proven to satisfy its dual-perspective specification, and all domain concepts are unified and consistent within the global dictionary, greatly improving the reliability and reusability of the software. Attached Figure Description

[0009] Figure 1 Basic workflow.

[0010] Figure 2 Overall flowchart.

[0011] Figure 3 A schematic diagram of the DAG canonical decomposition, showing the layer-by-layer decomposition from the root node to the atomic capabilities.

[0012] Figure 4 : A dual-view specification structure diagram of a single node.

[0013] Figure 5 Bottom-up verification and closed-loop correction flowchart.

[0014] References Objct-Process Methodology: A Holistic Systems Paradigm By Dori D,2002 [2] Model-Based Systems Engineering with OPM and SysML By Dori D,2016 [3] ISO / PAS 19450:2015. Automation systems and integration — Object-Process Methodology. International Organization for Standardization. [4] Knowledge engineering: Principles and methods By Studer, R., Benjamins, VR, & Fensel, D 1998 [5] The Semantic Web By Berners-Lee, T., Hendler, J., & Lassila, O.2001 [6] From SHIQ and RDF to OWL: The making of a Web Ontology LanguageBy Horrocks, I., Patel-Schneider, PF, & van Harmelen, F 2003 [7] Architectural Styles and the Design of Network-based SoftwareArchitectures By Fielding, RT 2000 [8] Designing APIs with Swagger and OpenAPI. By Ponelat, J., &Rosenstock, L. 2022 Detailed Implementation

[0015] The specific implementation of this invention includes basic definitions and a description of the four steps of the ORM-SDD algorithm (see attached document). Figure 2 ), and the formal guarantees provided by algorithm-based software construction.

[0016] Basic definition

[0017] The canonical decomposition structure of SDD is a directed acyclic graph G = (N, E), where N is a finite set of nodes, where each node n ∈ N represents a functional specification unit.

[0018] E ⊆ N × N is a set of edges, where edge (n, c) ∈ E indicates that c is a refined child node of n (n is the parent and c is the child).

[0019] The root node of G is denoted as root ∈ N, and has no incoming edges; the leaf nodes have no outgoing edges.

[0020] children(n) = { c ∈ N | (n, c) ∈ E}, descendants(n) are the descendant child nodes.

[0021] Definition 2 (Object Structure Ontology and Global Dictionary) The global object / ontology dictionary Ω is a formalized domain conceptual model that includes: A set of classes (concepts) C, each class C has an attribute set attr(C) and a relation set rel(C).

[0022] A set of object properties and relational axioms (such as Cardinality, SubClassOf, Disjointness) are represented using first-order logic or descriptive logic.

[0023] A set of defined method signatures and behavior contracts (see Definition 4).

[0024] Ω is continuously enriched during the SDD process, but logical consistency must be maintained.

[0025] Definition 3 (Atomic Capability Library) AtomLib is a set of pre-validated atomic capabilities a ∈ A. Each atomic capability is bound to: a behavior contract (Pre a Post a ); Mapping to types in Ω (input / output object structures); Verified implementation Impl a Satisfying Impl a ⊨(Pre a Post a ).

[0026] Atomic capabilities include basic operations, external APIs, database primitives, etc., which act as indivisible leaf nodes in algorithms.

[0027] Definition 4 (Node Specification) For each node n ∈ N, its canonical Spec(n) is a triple (see Appendix for node representation). Figure 4 ): Spec(n) = (O n , Φ nComb n ) in: O n It is a local object structure definition, that is, the objects, properties, relations, and invariants introduced or referenced within the scope of this node. It must be compatible with the global dictionary Ω, that is, Ω ∪ O_n without logical contradiction.

[0028] Φ n It is a behavioral contract, including preconditions. n and postconditions n This describes the logical relationship between the functional inputs and outputs of this node. n and Post n The item types in O are from O n (and Ω).

[0029] Comb n It is an optional child node combiner. If n is not a leaf node, then Combine n It defines how to construct an implementation of n using the implementation of children(n). It can be a control flow expression (sequential;, parallel ||, conditional if-then-else, loop while, etc.) and is regarded as a higher-order function in formal semantics.

[0030] Leaf node Comb n If empty, its implementation is directly mapped to atomic capability calls.

[0031] For the root node, Spec(root) is the top-level specification of the entire system.

[0032] Definition 5 (Object methods as nodes) Any object method m defined in Ω has its specification itself as a DAG node n. m n m Behavioral Contract Φ nm It describes the semantics of the method and may expand into a child node graph (a refinement of the method body). m O in nm The object context in which this method operates is defined. Therefore, method reuse is equivalent to reusing the corresponding DAG subgraph.

[0033] The formalization of the algorithm consists of four steps.

[0034] Input: Top-level requirement description Req, initial global dictionary Ω_0, atomic library A.

[0035] Output: The root node of the initial DAG graph G, and the queue of nodes to be processed Q.

[0036] Create a node root, and set Spec(root) = (O root0 , Φ root0 Comb root = ?), where O root0 Only includes the top-level conceptual shell explicitly stated in the requirements, Φ root0 This is a placeholder contract (initially it can be true, true).

[0037] Add root to queue Q and initialize G = ({root}, ∅).

[0038] Step 2: Recursive decomposition (processing queue Q) When Q ≠ ∅, retrieve node n ∈ Q and execute: Step 2.1 Atomism determination If there exists a ∈ A and a substitution θ (mapping the type in the contract of n to the type of a) such that: Φ n ⊑ (Pre a Post a And O n ⊆ Ω ∪ O a 即 n 的规范可被原子能力 a 的契约所覆盖,且结构兼容,则: 标记 n 为叶节点,令 Combn = nil,Impl(n) := Impla。

[0039] 注:此时 n 的实现已验证,无需进一步分解。

[0040] 从 Q 中移除 n,继续循环。

[0041] Step 2.2 Refining and decomposing (non-atomic nodes) If n cannot match an atom, then perform domain concept extraction and operation decomposition to generate a child node set C. new (For the decomposition process, please refer to the appendix) Figure 3 (Example).

[0042] a. Object structure refinement Analyze the responsibilities of n and identify or create the required object concepts.

[0043] In Ω and O n Based on this, define local extension O n ext It includes new classes, attributes, and constraints (as described in the UML-OPM object process diagram).

[0044] On ext Check for consistency with Ω (using the ontology inference engine). If inconsistent, adjust O. n ext Or Ω.

[0045] Update O n := O n ∪ O n ext And update the global Ω synchronously (add new definitions, and ensure that Ω expands monotonically but remains consistent).

[0046] b. Operational decomposition Based on O n Given the desired behavior, design a set of suboperations M = {m1, ..., m}. k}, together they achieve Φ n .

[0047] For each m i Create a new node n i Its initial specification Spec(n) i ) = (O n i , Φ i , ?), where O n i The object context in which this sub-operation is visible is limited, Φ i For its behavioral contract.

[0048] These sub-operations will become the child nodes of n: Let children(n) = {n1, ..., n} k}

[0049] Define a combinator (Comb) for n. n Describe how to call n i and data streams. For example, Comb n = n1 ; n2 ;if (cond) n3 else n4, and give the formal mapping.

[0050] c. Update the DAG and queue n i Add to N, edge (n, n) i Add to E.

[0051] For each n i Join Q.

[0052] If m i For a given object method, then n i Associated with the definition of this method in Ω, and ensuring that Spec(n) i This is equivalent to the contract of this method.

[0053] Step 3: Bottom-up generation and verification When Q is empty, meaning all nodes have been marked and leaf nodes have been associated with atoms, process each node n according to the reverse topological order of the DAG: Step 3.1 Implement the construction If n is a leaf node: Impl(n) has been specified in step 2.1.

[0054] If n is a non-leaf node: Impl(n) = Comb_n( Impl(c_1), ..., Impl(c_k) ), Where {c_1, ..., c_k} = children(n), each Impl(c_i) has been obtained. Comb_n is translated into executable glue code (procedure calls, data transfers, etc.). Simultaneously, object structure code conforming to O_n time (class definitions, data constraints, etc.) is generated.

[0055] For node n, perform the following three verifications; only if all three pass is the node considered successfully verified.

[0056] (V1) Behavioral Contract Verification Prove that Impl(n) satisfies Φ n That is: {Pre n} Impl(n) { Post n} The proof is automated using program verification tools (Hoare logic, SMT solver). During the proof, it can be assumed that the contract Φ of each child node c_i... ci Established (i.e., Impl(c)) i ) ⊨ Φ ci ).

[0057] (V2) Structural Consistency Verification Verify that the objects and data used in Impl(n) are consistent with O n Consistent with global Ω: All object creation and modification operations must comply with O n The class invariants and multiplicity constraints defined in the code.

[0058] Verify Ω ∪ O n Consistency (ontology inference check).

[0059] For each object method m defined in Ω, its implementation node n m The contract must be with Φ nm equivalence.

[0060] (V3) Cross-perspective consistency verification Generate additional verification condition: The behavior of Impl(n) does not lead to a violation of O(n) logic. n Structural constraints. For example, a method postcondition that claims to create an association but actually violates a cardinality constraint will be detected. This can be achieved by introducing O(n) into the validation tool. n The invariants are implemented as global assertions.

[0061] Step 3.3 Correction when verification fails (closed loop) If any verification fails, a correction strategy is triggered (in order of priority): a. Local implementation correction: If the failure is caused by a glue code error, the code generated by Comb_n is corrected (e.g., by using the program synthesizer to try to generate orchestration code that satisfies Φ_n while maintaining the O_n constraint).

[0062] b. Refinement and adjustment: If the current decomposition cannot satisfy Φ_n, return to step 2.2, modify the child node partition or sub-contract, and then regenerate Impl(n) and verify it.

[0063] c. Standardization and optimization: If Φ_n is found to contradict or be unrealizable from O_n, backtrack and modify Φ_n or O_n. This may require tracing back to the parent node and even the root, but try to keep the modification local.

[0064] d. Atomic capability replacement: If the atomic capability mapped to a leaf node does not actually satisfy the subcontract, then search A again or consider further decomposing the leaf node.

[0065] After correction, repeat step 3.2 until successful (see attached workflow). Figure 5 ).

[0066] Step 4: System Assembly and Final Verification Step 4.1 Using Impl(root) as the main entry point of the program, and combining all dependent implementations, a complete executable system is generated.

[0067] Step 4.2 (optional) Perform system-level global property verification, such as activity and safety, using model detection to verify Impl(root) ⊨ Spec(root).

[0068] Step 4.3 outputs the final code, a complete specification archive, and a rich global dictionary Ω for reuse in subsequent projects.

[0069] Formal guarantee Software built based on the ORM-SDD algorithm of this invention has the following formal guarantees: 1. Refined Correctness: For any non-root node n, if all its child nodes satisfy their own contract, then Impl(n) satisfies Spec(n). This is guaranteed by combinatorial verification (V1).

[0070] 2. Structural semantic fidelity: The implementation of any operation does not violate the object structure constraints of its node, and the global ontology Ω is consistent across all nodes.

[0071] 3. Traceability: Every step of refinement from atomic capabilities to the root node is recorded in the DAG and formal proof.

[0072] 4. Reuse and modularity: Objects and methods in Ω can be referenced across DAG nodes, and methods as nodes make reuse verifiable.

[0073] 5. Algorithm Termination: The algorithm terminates if the decomposition process eventually reduces all nodes to atomic capabilities (or realizable leaf nodes) and the modified loop is bounded (e.g., by setting a maximum number of iterations). In practice, decomposition should be guided manually or heuristically to avoid endless refinement backtracking.

Claims

1. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The software functionality specification is recursively described based on a Directed Acyclic Graph (DAG). The specific process includes:

1. Initializing the DAG based on input requirements; 2. Recursively decomposing the nodes in the DAG; 3. Repeating the decomposition until all nodes are leaf nodes; 4. Generating implementation code for each node from bottom to top according to the inverse topological order of the DAG, and formally verifying the behavioral contracts, object structure consistency, and cross-perspective consistency of the nodes; 5. Using the verified implementation of the root node as the entry point, combining the implementation code of all nodes to generate a complete software system.

2. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The DAG initialization process includes: obtaining the top-level functional requirements of the software to be developed; creating the DAG root node; initializing the global object ontology dictionary; the global object ontology dictionary is used to store domain objects and their method specifications, and maintains logical consistency; A software construction technique that integrates object process modeling and specification-driven development is characterized by the following process for recursively decomposing nodes in a DAG: taking a node out of the queue; if the specification of the node can be matched by an atomic capability in the atomic capability library, then marking it as a leaf node; otherwise, refining the object structure definition for the node and decomposing it into multiple sub-operations, creating corresponding child nodes, defining the combinational logic between child nodes, and adding the child nodes to the queue.

3. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The specification of each node in its DAG includes two parts: a formal behavioral contract and an object structure definition.

4. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, Its implementation and verification steps are represented as a continuous iterative process: following the inverse topological order of the DAG, implementation code is generated for each node from bottom to top, and the behavioral contract, object structure consistency and cross-perspective consistency of the nodes are formally verified. If any verification fails, a pre-defined correction strategy is executed, and the implementation code is regenerated or the specification is adjusted until all verifications pass.

5. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The formal behavioral contract includes preconditions and postconditions, the object structure definition includes classes, attributes, relationships and invariant constraints, and the types in the behavioral contract are referenced from the object structure definition.

6. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, In the global object ontology dictionary, the definition of an object can be referenced or extended by any node in the DAG; when defining a method of an object, the method specification corresponds to a DAG node, and its decomposition and verification process is the same as that of other functional nodes.

7. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, Verification of behavioral contracts involves using program verification tools to prove that the implementation code of a node satisfies its own behavioral contract under the assumptions of its child node contracts.

8. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The consistency verification of object structure is achieved by checking the consistency between the data structure operated on by the implementation code and the node object structure definition and global dictionary through the ontology inference engine.

9. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, Cross-perspective consistency verification generates and proves that the implementation code does not violate the constraints in the object structure definition.

10. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The preset correction strategies include at least one of the following: local implementation code correction, adjustment of child node partitioning or sub-contract, modification of the behavior contract or object structure definition of the current node, and replacement of the referenced atomic capabilities.

11. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The atomic capability library contains formally verified basic numerical / logical computations, external tool calls, database read / write operations, and code library calls, with each atomic capability accompanied by a formal contract.

12. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, include: The specification editing and DAG management module is used to create and edit dual-view specifications for nodes and maintain the DAG decomposition structure; The global object ontology dictionary module is used to store and manage domain objects, relationships, constraints, and method specifications, and supports version consistency and inference checks; The Atomic Capabilities Library module provides pre-verified atomic capabilities and their contracts; The decomposition engine module is used to determine node atomicity, refine object structure and decompose operations, and generate child nodes and combinational logic; the code generation and verification module is used to generate the implementation code of each node in reverse topological order and call the program verifier and ontology inference engine to perform three formal verifications; the closed-loop correction control module is used to execute correction strategies when verification fails and trigger regeneration or reverification; the system assembly output module is used to combine all node implementations and output the final software product and verification evidence.

13. A software construction technique that integrates object-process modeling and specification-driven development, characterized in that, The global object ontology dictionary module embeds an ontology inference engine, which is used to check the consistency between the structure of newly added objects and the existing dictionary in real time.