Refactored first_origination code.
This commit is contained in:
		
							parent
							
								
									49e34e5167
								
							
						
					
					
						commit
						5608b29dc0
					
				| @ -516,21 +516,13 @@ unique_origination () | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| //! Prune invalid state w.r.t. <=C minimal requirement
 | //! Check for first-origination points
 | ||||||
| /**
 | /**
 | ||||||
|  * Intuition says this can be done a lot more efficient. Luckily this is the prototype. |  | ||||||
|  * |  | ||||||
|  *@returns True, if it's okay. If false, it needs to be pruned. |  *@returns True, if it's okay. If false, it needs to be pruned. | ||||||
|  */ |  */ | ||||||
| int | int | ||||||
| bindings_c_minimal () | first_origination () | ||||||
| { | { | ||||||
|   if (!unique_origination ()) |  | ||||||
|     { |  | ||||||
|       return false; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|   { |  | ||||||
|   List bl; |   List bl; | ||||||
| 
 | 
 | ||||||
|   // For all goals
 |   // For all goals
 | ||||||
| @ -567,8 +559,7 @@ bindings_c_minimal () | |||||||
| 			  if (switches.intruder) | 			  if (switches.intruder) | ||||||
| 			    { | 			    { | ||||||
| 			      // intruder: interm bindings should cater for the first occurrence
 | 			      // intruder: interm bindings should cater for the first occurrence
 | ||||||
| 				occursthere = | 			      occursthere = termInTerm (rd->message, b->term); | ||||||
| 				  termInTerm (rd->message, b->term); |  | ||||||
| 			    } | 			    } | ||||||
| 			  else | 			  else | ||||||
| 			    { | 			    { | ||||||
| @ -611,10 +602,21 @@ bindings_c_minimal () | |||||||
| 	} | 	} | ||||||
|       bl = bl->next; |       bl = bl->next; | ||||||
|     } |     } | ||||||
|   } |  | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | //! Determine if pattern is redundant or not
 | ||||||
|  | /**
 | ||||||
|  |  * Intuition says this can be done a lot more efficient. Luckily this is the prototype. | ||||||
|  |  * | ||||||
|  |  *@returns True, if it's okay. If false, it needs to be pruned. | ||||||
|  |  */ | ||||||
|  | int | ||||||
|  | non_redundant () | ||||||
|  | { | ||||||
|  |   return (unique_origination () && first_origination ()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| //! Count the number of bindings that are done.
 | //! Count the number of bindings that are done.
 | ||||||
| int | int | ||||||
| countBindingsDone () | countBindingsDone () | ||||||
|  | |||||||
| @ -70,7 +70,7 @@ int iterate_bindings (int (*func) (Binding b)); | |||||||
| int iterate_preceding_bindings (const int run, const int ev, | int iterate_preceding_bindings (const int run, const int ev, | ||||||
| 				int (*func) (Binding b)); | 				int (*func) (Binding b)); | ||||||
| 
 | 
 | ||||||
| int bindings_c_minimal (); | int non_redundant (); | ||||||
| int countBindingsDone (); | int countBindingsDone (); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -355,7 +355,7 @@ so technically this is a bug. Don't use. | |||||||
| 
 | 
 | ||||||
|   // Check for c-minimality
 |   // Check for c-minimality
 | ||||||
|   { |   { | ||||||
|     if (!bindings_c_minimal ()) |     if (!non_redundant ()) | ||||||
|       { |       { | ||||||
| 	if (switches.output == PROOF) | 	if (switches.output == PROOF) | ||||||
| 	  { | 	  { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user