Kripke Model
Time limit1sMemory limit128 MB
Given a Kripke model with n up to 10000 states, compute the set of states satisfying the CTL formula E(x U (AG y)) using fixed-point graph algorithms.
- Level
Medium7 of 10
- Topics
- Graph, DFS, Recursion, Implementation
- Solved
- No attempts yet
Problem
Testing and quality assurance are very time-consuming stages of the software development process. Various techniques are used to reduce the cost and time these stages consume. One such technique is software verification. Model checking is an approach to software verification based on Kripke models.
A Kripke model is a 5-tuple , where is a finite set of atomic propositions, is a finite set of states, is a set of initial states, is a transition relation, and is a truth relation. In this problem we ignore initial states, and is reflexive, so holds for every state .
A path beginning in state is an infinite sequence of states such that and for every .
Temporal logic and its subset Computation Tree Logic (CTL) describe propositions qualified in terms of time. Kripke models are often used to check properties described in CTL.
There are two kinds of CTL formulae: state formulae and path formulae, evaluated over states and paths respectively.
If , then is a state formula that holds in state iff .
If is a path formula, then and are state formulae, where and are path quantifiers:
- holds in state iff holds for every path beginning in ;
- holds in state iff there exists a path beginning in for which holds.
If and are state formulae, then and are path formulae, where and are temporal operators:
- (Globally) holds for a path iff holds in state for every ;
- (Until) holds for a path iff there exists such that holds in state and holds in every state .
To verify a property described by a state formula means to find every state in which holds. Verifying an arbitrary property is quite complex. Your task is easier: write a program that verifies the property described by the temporal-logic formula , where and are atomic propositions.
Input
The first line contains three positive integers , , and — the number of states, transitions, and atomic propositions (; ; ).
Each of the next lines describes one state. State () is described by — the number of atomic propositions that are true in this state — followed by a space-separated list of those propositions (). Atomic propositions are denoted by the first lowercase English letters.
Each of the next lines describes one transition and contains two integers and (; ) — a transition from state to state . The model also contains an implicit self-loop for every state (these are not listed in the input). No transition is listed twice.
The last line contains the property to verify, always of the form E(xU(AGy)), where x and y are atomic propositions.
Output
On the first line, print the number of states in which the verified property holds. On the following lines, print the numbers of those states in increasing order.