#### A flat reachability-based measure

```
fun yes = (print "yes"; yes)
```

### \[\neg\]

### π₯

The aim of this work is to simplify this process

`size_of_heap s`

`=`

`size_of reachabe_values s.refs {}`

```
<|s.locals|> ++ <|s.stack|> ++ <|s.global|>
```

`size_of vals refs seen`

- Precise measurements
- Handles aliasing
- Trivial to evaluate given concrete values

```
ββββ ftail [1,2,3] ββββ€ <= heap_limit
ββββ ftail [2,3] ββββ€ <= heap_limit
ββββ ftail [3] ββββ€ <= heap_limit
ββββ ftail [] ββββ€ <= heap_limit
```

```
βββ[2,...,n]βββΌβββrestββββ€
<=
βββ[1,2,...,n]βββΌβββrestββββ€
```

# π€¦

`size_of vals refs seen`

- Traversal-base measurement
- No algebraic properties over
`++`

- Relies on the well-formedness of its arguments

A flat reachability-based measure

The set of all reachable values

```
<|s.locals|> ++ <|s.stack|> ++ <|s.global|>
```

```
[
Block 71 some_tag [Number 1; Block 74 ...];
Number 57;
Word64 0xF5CA15;
Word64 0x01368E;
Word64 0xC81026;
RefPtr 45;
Block 75 some_tag [RefPtr 84; ...];
]
```

The set of all reachable values addresses

The set of all reachable addresses

`=`

```
reachable_addrs refs blocks roots =
{ y | βx. x β roots β§ RTC (next refs blocks) x y }
```

Once we have that, we measure!

# π

`flat_size_of refs blocks roots`

- Precise measurements
- Handles aliasing
- Simpler reasoning

- Proven equivalent to
`size_of`

- Published on IFL2021