Skip to content

Commit 936fb7a

Browse files
committed
Add Corrections
1 parent 6cce0a3 commit 936fb7a

File tree

18 files changed

+35
-33
lines changed

18 files changed

+35
-33
lines changed

pages/404.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nav_exclude: true
66

77
# Page Not Found
88

9-
This page you requested does not exist.
9+
The page you requested does not exist.
1010

1111
- Go back to the [homepage]({{ '/' | relative_url }})
1212
- Open [Getting Started]({{ '/getting-started/overview/' | relative_url }})

pages/command-line-interface.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ permalink: /command-line-interface/
55
description: Run the LiquidJava verifier from the command line for local checks, debugging, and CI workflows.
66
---
77

8-
# Command-Line
8+
# Command-Line Interface
99

10-
The LiquidJava verifier can be run from the command line, which the following options:
10+
The LiquidJava verifier can be run from the command line with the following options:
1111

1212
| Option | Description |
1313
| --- | --- |
14-
| `<...paths>` | Paths (file or directories) to be verified by LiquidJava |
14+
| `<...paths>` | Paths (files or directories) to be verified by LiquidJava |
1515
| `--help` | Show the help message with available options |
1616
| `--version` | Show the current version of the verifier |
1717
| `--debug` | Enable debug logging and skip expression simplification for troubleshooting |

pages/concepts/ghosts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Learn how to track logical state that helps express and verify rich
88

99
# Ghosts
1010

11-
Some protocols need more than a small set of named states. LiquidJava supports ghost variables for tracking extra state. They can be used in refinements and state refinements to express richer invariants about the object. Similarly to the states, these are functions that take the object being refined as a parameter.
11+
Some protocols need more than a small set of named states. LiquidJava supports ghost variables for tracking extra state. They can be used in refinements and state refinements to express richer invariants about an object. Like states, ghosts are functions that take the refined object as a parameter.
1212

1313
Ghosts are declared with the `@Ghost` annotation, and they can be updated with `@StateRefinement` annotations on methods.
1414

@@ -39,7 +39,7 @@ s.pop();
3939
s.pop(); // State Refinement Error
4040
```
4141

42-
In the "constructor" method, the ghost variable `size` is initialized to 0. An equality in a method postcondition is how ghost variables are updated. However, here it is not necessary, since when no postcondition is declared, it is initialized to its default value, similarly to how Java initializes fields to their default values when no explicit initializer is provided (`int --> 0`, `boolean --> false`, etc.).
42+
In the "constructor" method, the ghost variable `size` is initialized to `0`. An equality in a method postcondition is how ghost variables are updated. In this case, the explicit postcondition is optional, because if no postcondition is declared the ghost variable is initialized to its default value, similarly to how Java initializes fields with no explicit initializer (`int -> 0`, `boolean -> false`, and so on).
4343

4444
In the `push` method, we specify no precondition, since we can always push an element to the stack, but we specify a postcondition that increments the `size` by one. In this case, we tell the typechecker that the new value of `size` after calling `push` is equal to the old value of `size` plus one. This is possible using the `old` function, which takes an object instance and returns its value before the method call.
4545

pages/concepts/refinements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Learn about how to use refinements to specify constraints on variab
88

99
# Refinements
1010

11-
In LiquidJava, refinements allow you to express restrictions as logical predicates over basic types. They let you restrict the values a variable, field, parameter, or return value can have, which helps catch bugs before the program runs.
11+
In LiquidJava, refinements allow you to express restrictions as logical predicates over basic types. They let you restrict the values that a variable, field, parameter, or return value can have, which helps catch bugs before the program runs.
1212

1313
These are written as strings in the `@Refinement` annotation. The predicate must be a boolean expression that refers to the refined value either by its declared name or by `_`.
1414

@@ -35,7 +35,7 @@ public class RefinementExamples {
3535

3636
## Predicate Syntax
3737

38-
Refinement predicates use a language similar to Java, where you can write boolean expressions using comparisons, logical connectives, arithmetic operators, conditional expressions, and calls to ghosts or aliases, which is covered in later sections.
38+
Refinement predicates use a language similar to Java, where you can write boolean expressions using comparisons, logical connectives, arithmetic operators, conditional expressions, and calls to ghosts or aliases, which are covered in later sections.
3939

4040
| Form | Syntax | Example |
4141
| --- | --- | --- |

pages/diagnostics/custom-messages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Learn how to provide clearer diagnostic messages.
88

99
# Custom Messages
1010

11-
A custom message can be provided to any `@Refinement` or `@StateRefinement` annotation using the `msg` parameter. This message will be included in the diagnostic when a violation of that annotation is reported, to provide a clearer explanation of the API rule that was violated.
11+
A custom message can be provided to any `@Refinement` or `@StateRefinement` annotation using the `msg` parameter. This message will be included in the diagnostic when a violation of that annotation is reported, providing a clearer explanation of the API rule that was violated.
1212

1313
```java
1414
import liquidjava.specification.*;

pages/diagnostics/errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ An error can be caused by a refinement violation, an invalid refinement, or anot
2222
| `InvalidRefinementError` | A refinement is semantically invalid, such as a non-boolean expression |
2323
| `CustomError` | Any other error, such as providing a non-existent path to verify |
2424

25-
LiquidJava is only able to report **at most one error per method** to avoid cascading failures. If there are multiple errors in a method, the verifier will report the first one it encounters, and stop verifying the rest of the method, meaning that fixing one error can sometimes reveal another that was previously hidden.
25+
LiquidJava is only able to report **at most one error per method** to avoid cascading failures. If there are multiple errors in a method, the verifier will report the first one it encounters and stop verifying the rest of the method. This means that fixing one error can sometimes reveal another that was previously hidden.

pages/diagnostics/understanding-refinement-errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ In the example above:
4141
- `#ret² == 0` follows from the return expression `x / 2`, since integer division makes `1 / 2 == 0`
4242
- `0 > 0` is false, so the declared return refinement is violated
4343

44-
So the counterexample explains exactly why LiquidJava cannot prove that `x / 2` is always positive even when `x > 0`. To fix this error, we would need to either weaken the return expression to allow to return zero with the refinement `_ >= 0`, or strengthen the parameter refinement to require `x > 1`.
44+
So the counterexample explains exactly why LiquidJava cannot prove that `x / 2` is always positive even when `x > 0`. To fix this error, we would need to either weaken the return refinement to allow zero with `_ >= 0`, or strengthen the parameter refinement to require `x > 1`.
4545

4646
## Internal Variables
4747

4848
Names such as `#ret²` are internal variables created by LiquidJava during verification. The small superscript number is a counter used to keep those generated variables unique.
4949

5050
LiquidJava converts expressions into an internal A-normal form (ANF) before verification. Every time it creates a fresh internal variable during that process, the counter is incremented. This is why you may see names such as `#ret²` in the diagnostics. In practice, you can read `#ret²` as "the internal variable that represents this return value occurrence".
5151

52-
The following example shows how the internal variables are created during the typechecking:
52+
The following example shows how the internal variables are created in the typechecking:
5353

5454
```java
5555
int example(int x) { // x⁰

pages/examples/arraylist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: An external refinement for ArrayList that prevents out-of-bounds ac
88

99
# ArrayList
1010

11-
This example refines the `java.util.ArrayList` standard-library class without modifying its source code. A ghost variable tracks the size of the list, and method refinements to prevent out-of-bounds accesses.
11+
This example refines the `java.util.ArrayList` standard-library class without modifying its source code. A ghost variable tracks the size of the list, and a parameter refinement prevents out-of-bounds accesses.
1212

1313
```java
1414
import liquidjava.specification.*;

pages/examples/downloader.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ description: A typestate protocol for a downloader object.
1111
This example models a simple downloader object that tracks the progress of a download operation by combining typestates and ghost variables.
1212

1313
```java
14+
import liquidjava.specification.*;
15+
1416
@Ghost("int progress")
1517
@StateSet({"created", "downloading", "completed"})
1618
public class Downloader {

pages/examples/email.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Email
33
parent: Examples
44
nav_order: 5
55
permalink: /examples/email/
6-
description: A typestate protocol for a Email builder API.
6+
description: A typestate protocol for an Email builder API.
77
---
88

99
# Email
@@ -40,18 +40,18 @@ public class Email {
4040

4141
```java
4242
Email email = new Email();
43-
email.from("me");
44-
.to("bob");
45-
.to("alice");
46-
.subject("greetings");
47-
.body("hello!");
43+
email.from("me")
44+
.to("bob")
45+
.to("alice")
46+
.subject("greetings")
47+
.body("hello!")
4848
.build();
4949
```
5050

5151
```java
5252
Email email = new Email();
53-
email.from("me");
54-
.to("bob");
53+
email.from("me")
54+
.to("bob")
5555
.build(); // State Refinement Error
5656
```
5757

@@ -60,4 +60,4 @@ LiquidJava enforces the intended protocol:
6060
- The `from` must be set first
6161
- The `to` must be set at least once before setting the `body`
6262
- The `subject` is optional
63-
- The `build` is only allowed to be set after the body
63+
- The `build` method can only be called after the body is set

0 commit comments

Comments
 (0)