How bad can bugs be?
REFER TO NOTES FOR EXAMPELS
What can we do about bugs?
REFER TO NOTES FOR THE EXAMPLE
What are formal methods?
Formal methods are a collection of methods by which we can take a computer programs and a set of properties that we know should hold of it and obtain strong guarantees that the program satisfies those properties.
What is formal verification?
All software is really very complicated mathematical functions.
What is the formal verification spectrum?
Formal methods exists broadly on the following spectrum.
- 1. Testing – no property, no proof
○ Not property, not proof, just random test case or values
- 2. Property-based testing – property but no proof
○ Write down your property you want to hold, computer will generate will generate the tests, but no proofs (might find bugs in manual testing)
- 3. Model checking – property and unknown proof
○ Write down a property (what you want your program to hold) and the computer will automatically go away and try to find that proof that satisfies that property, but it wont tell you the proof (tell you yes or no and trust the computer that it works)
- 4. Interactive Theorem Provers – property and known proof
What are the steps to property based testing?
x.What is Property-based testing?
Key idea:
- You write down the property.
- The computer generates test cases automatically
What are the pros and cons of property based testing?
What are Model-checking tools?
Key idea:
- You write down the property
- The computer proves it automatically
How does model checking work?
Procedure for a domain-specific tool:
- 1. User: writes down their property in a high-level language.
- 2. Tool: compiles down the property to a set of SMTLIB queries.
- 3. Tool: calls an SMT solver to answer the queries.
- 4. Tool: converts any counter-example found back into a form understandable by the user.
What are the pros and cons of model-checking?
What is interactive theorem provers?
Key idea:
- You provide the proof.
- The computer checks it.
What is the problem and solution to interactive theorem provers?
Problem: Standard programming languages not designed to write proofs!
Solution: Custom program languages called theorem provers in which you can write both proofs
What are the pros and cons of interactive theorem provers?
Advice on using formal methods
REFER TO NOTES
What are the limitations of formal methods?
How to Uses of LLMs in Formal method?
What not to do:
- Ask the LLM “Is this code correct?”
Hot research fields:
- Using LLMs to generate formal properties from human text.
- Automatic program repair based on formal properties.
- Using LLMs as generating strategies in property-based testing.
What should the LLM do?
When you ask an LLM to “generate code that does X”, the LLM should:
1. Translate X into a formal specification.
2. Generate code that does X.
3. Generate a proof that the code satisfies the specification.
4. Give the proof to an Interactive Theorem Prover to check.
5. (Optional but recommended!) The user checks that the specification means X.