Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions. Use when users need to: (1) Formalize algorithms or data structures, (2) Create function specifications with contracts, (3) Generate predicates and properties for verification, (4) Translate informal requirements into formal logic, (5) Specify invariants for loops or data structures, or (6) Create formal definitions for mathematical concepts. Supports both Isabelle/HOL and Coq equally.
Install with Tessl CLI
npx tessl i github:ArabelaTso/Skills-4-SE --skill formal-spec-generator80
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
Generate formal specifications in Isabelle/HOL or Coq from informal descriptions, source code, or mathematical statements.
Identify what type of input is provided:
Ask the user which formal proof assistant to target:
If not specified, default to generating both versions.
Determine what needs to be formalized:
Use the reference files for syntax and patterns:
Generate specifications that include:
sorry in Isabelle or Admitted in Coq)Organize the generated specifications clearly:
For Isabelle/HOL:
theory TheoryName
imports Main
begin
(* Data type definitions *)
datatype ...
(* Function definitions *)
fun function_name :: "types" where
...
(* Predicates and properties *)
definition property_name :: "type" where
...
(* Correctness specifications *)
theorem theorem_name:
"specification"
sorry
endFor Coq:
Require Import List Arith.
Import ListNotations.
(* Data type definitions *)
Inductive ...
(* Function definitions *)
Fixpoint function_name ... :=
...
(* Predicates and properties *)
Definition property_name ... : Prop :=
...
(* Correctness theorems *)
Theorem theorem_name :
specification.
Proof.
Admitted.When given natural language descriptions:
Example: "A function that finds the maximum element in a non-empty list"
list nat (precondition: non-empty)natWhen given existing implementations:
When given mathematical statements:
For complete worked examples including insertion sort, binary search, and stack data structures, see examples.md.
sorry/Admittedc1fb172
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.