@@ -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
@@ -612,6 +612,9 @@ impl Visitor for Discharge {
612612 }
613613
614614 let bs = self . sol . bool_sort ( ) ;
615+
616+ let mut interned_props = HashSet :: new ( ) ;
617+
615618 // Declare all expressions
616619 for ( idx, expr) in data
617620 . comp
@@ -626,6 +629,9 @@ impl Visitor for Discharge {
626629 . map ( |i| ( i, data. comp . get ( i) ) ) ;
627630
628631 for ( pidx, prop) in relevant_props {
632+ // Save the proposition in the interned_props set
633+ interned_props. insert ( pidx) ;
634+
629635 let assign = self . prop_to_sexp ( prop) ;
630636 let sexp = self
631637 . sol
@@ -679,6 +685,8 @@ impl Visitor for Discharge {
679685 . props ( )
680686 . iter ( )
681687 . filter ( |( idx, _) | idx. valid ( & data. comp ) )
688+ // Filter out propositions that are already defined in expressions
689+ . filter ( |( idx, _) | !interned_props. contains ( idx) )
682690 {
683691 // Define assertion equating the proposition to its assignment
684692 let assign = self . prop_to_sexp ( prop) ;
0 commit comments