Skip to main content
. 2025 Jul 30;25(15):4695. doi: 10.3390/s25154695
Algorithm 1 Specification generation algorithm based on LLM
Require: Bytecode B, Application Binary Interface A, Functional Documentation D
Ensure: Formal Specification set Spec
  •   1:

    Spec

  •   2:

    SourceCodeDecompile(B)

  •   3:

    PromptConstructPrompt(SourceCode,A,D)

  •   4:

    ResponseLLM.query(Prompt)

  •   5:

    InvariantListParseResponse(Response)

  •   6:

    for all inv in InvariantList do

  •   7:

           if ValidateFormat(inv) then

  •   8:

                 SpecSpec{inv}

  •   9:

           end if

  • 10:

    end for

  • 11:

    return Spec