@@ -9,7 +9,7 @@ use fil_ast as ast;
99use fil_ir:: { self as ir, Ctx , DisplayCtx } ;
1010use fil_utils:: GlobalPositionTable ;
1111use itertools:: Itertools ;
12- use std:: collections:: HashMap ;
12+ use std:: collections:: { HashMap , HashSet } ;
1313use std:: { fs, iter} ;
1414use term:: termcolor:: { ColorChoice , StandardStream } ;
1515
@@ -608,6 +608,9 @@ impl Visitor for Discharge {
608608 }
609609
610610 let bs = self . sol . bool_sort ( ) ;
611+
612+ let mut interned_props = HashSet :: new ( ) ;
613+
611614 // Declare all expressions
612615 for ( idx, expr) in data
613616 . comp
@@ -622,6 +625,9 @@ impl Visitor for Discharge {
622625 . map ( |i| ( i, data. comp . get ( i) ) ) ;
623626
624627 for ( pidx, prop) in relevant_props {
628+ // Save the proposition in the interned_props set
629+ interned_props. insert ( pidx) ;
630+
625631 let assign = self . prop_to_sexp ( prop) ;
626632 let sexp = self
627633 . sol
@@ -675,6 +681,8 @@ impl Visitor for Discharge {
675681 . props ( )
676682 . iter ( )
677683 . filter ( |( idx, _) | idx. valid ( & data. comp ) )
684+ // Filter out propositions that are already defined in expressions
685+ . filter ( |( idx, _) | !interned_props. contains ( idx) )
678686 {
679687 // Define assertion equating the proposition to its assignment
680688 let assign = self . prop_to_sexp ( prop) ;
0 commit comments