Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Containment between regions

Declare and verify the transitive rule of containment used by a spatial domain.

Model

The example’s contract defines transitive containment. If a yard contains a zone and that zone contains an inspection area, the rule derives the containment of the area in the yard.

module exemplos::regioes {
    type Regiao
    relation Contem {
        role externa: Regiao
        role interna: Regiao
    }
    rule ContemTransitiva using Contem(?a: Regiao, ?b: Regiao, ?c: Regiao) {
        when Contem(externa: ?a, interna: ?b)
        when Contem(externa: ?b, interna: ?c)
        derive positive Contem(externa: ?a, interna: ?c)
    }
}

Verification

Formation verifies the rule and the typed variables. The execution verification requires two admitted premises and the corresponding consequence; that layer is recorded separately in the report.

The complete source is at exemplos/03-regioes/modelo.fsl in the package. The script verificacao/verificar_exemplos.py runs the formation with the indicated binary and records the result. Formation and the execution of applications are separate gates in the report.