Kripke Model
문제
Testing and quality assurance are very time-consuming stages of software development process. Different techniques are used to reduce cost and time consumed by these stages. One of such techniques is software verification. Model checking is an approach to the 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 model's states, is a set of initial states, is a transition relation, and is a truth relation. In this problem we will not take initial states into account and relation will be a reflexive relation, so will be true for all states .
A path beginning in state in the Kripke model is an infinite sequence of states such that , and for each the .
Temporal logic and its subset Computational tree logic (CTL) are used to describe propositions qualified in terms of time. Kripke models are often used to check properties, described in CTL.
There are two types of formulae in CTL: state formulae and path formulae. The values of state and path formulae are evaluated for states and paths correspondingly.
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 a state , iff holds for each path beginning in the state ;
- holds in state , iff there exists a path , beginning in the state , such that holds for .
If and are state formulae, then and are path formulae, where and are temporal operators:
- (Globally) holds for a path iff for each the formula holds in the state ;
- (Until) holds for a path if there exists such that holds for each state in the range , and holds in state ;
To verify a property described by a state formula means to find all states, holds for. Verification of an arbitrary property is a pretty complex problem. Your problem is much easier --- you are to write a program that verifies a property described by a temporal logic formula , where and are some atomic propositions.
입력
The first line of the input file contains three positive integer numbers , and --- number of states, transitions and atomic propositions (; ; ).
The following lines describe one state each. The state () is described by --- a number of atomic propositions which are true for this state and a space-separated list of these atomic propositions (). Atomic propositions are denoted by first small English letters.
Next lines describe transitions. Each of them contains two integer numbers and (; ) --- the transition from state to state . The verified Kripke model contains implicit loop transitions for each state (they are not listed in the input file). No transition is listed in the input file twice.
The last line of the input file contains the formula of the property to be verified. This formula always has the form E(xU(AGy)), where x and y are some atomic propositions.
출력
The first line of the output file must contain the number of states for which the verified property holds. The following lines must contain the numbers of these states listed in increasing order.
예제
예제 1
7 8 2 1 a 1 a 2 a b 1 b 1 b 1 a 1 a 1 2 2 3 3 4 4 5 5 3 2 6 6 7 7 6 E(aU(AGb))
5 1 2 3 4 5