@@ -2,7 +2,10 @@ use std::{collections::HashMap, fs::File, io::Read, path::Path};
22
33use serde:: Deserialize ;
44
5- use crate :: ops:: { binary:: LtlBinaryOp , unary:: LtlUnaryOp } ;
5+ use crate :: {
6+ formula:: tree:: { FormulaTree , parse_ltl_formula} ,
7+ ops:: { binary:: LtlBinaryOp , unary:: LtlUnaryOp } ,
8+ } ;
69
710use super :: cs:: CharSeq ;
811
@@ -12,6 +15,7 @@ pub struct Instance {
1215 pub atomic_propositions : Vec < String > ,
1316 pub target : Vec < bool > ,
1417 pub operators : Operators ,
18+ pub formula : Option < FormulaTree > ,
1519}
1620
1721/// Stores the [`CharSeq`] of each atomic_proposition on a given trace.
@@ -84,11 +88,18 @@ pub fn parse_traces(buf: &str) -> Instance {
8488 // Operators filtering is not implemented in current input format.
8589 let operators = Operators :: all ( ) ;
8690
91+ let formula = parsed_input
92+ . smallest_known_formula
93+ . into_iter ( )
94+ . flat_map ( |expr| parse_ltl_formula ( & expr, & parsed_input. atomic_propositions ) )
95+ . next ( ) ;
96+
8797 Instance {
8898 traces,
8999 atomic_propositions : parsed_input. atomic_propositions ,
90100 target,
91101 operators,
102+ formula,
92103 }
93104}
94105
@@ -126,6 +137,7 @@ pub struct ParsedInput {
126137 positive_traces : Vec < ParsedTrace > ,
127138 negative_traces : Vec < ParsedTrace > ,
128139 atomic_propositions : Vec < String > ,
140+ smallest_known_formula : Option < String > ,
129141 number_positive_traces : usize ,
130142 number_negative_traces : usize ,
131143 max_length_traces : usize ,
0 commit comments