@@ -332,7 +332,7 @@ def print_statements(
332332 code = code .replace (var_name , f"{ computation .name } ({ args_str } )" )
333333 html_parts .append (f"<code>{ code } </code>" )
334334 html_parts .append ("</p>" )
335- val = cost_stmt . validation or cost_val
335+ val = cost_val or cost_stmt . validation
336336 if val .satisfiable is not None and val .message is not None :
337337 html_parts .append (f'<p><span class="label">Satisfiable:</span> { val .satisfiable } </p>' )
338338 html_parts .append (f'<p><span class="label">Reason:</span> { val .message } </p>' )
@@ -344,7 +344,7 @@ def print_statements(
344344 ):
345345 if (param_stmt .formalization is None or param_stmt .formalization .mapping is None ) and only_formalized :
346346 continue
347- val = param_stmt . validation or param_val
347+ val = param_val or param_stmt . validation
348348 if val .holds is not None :
349349 holds_tag = "holds" if val .holds else "not-hold"
350350 else :
@@ -373,38 +373,6 @@ def print_statements(
373373 html_parts .append (f'<p><span class="label">Reason:</span> { val .message } </p>' )
374374 html_parts .append ("</div>" )
375375
376- # Structure Constraints Rendering
377- for struct_stmt , struct_val in zip (
378- statements .structure_constraints or [], validation .structure_constraints or []
379- ):
380- if struct_stmt .formalization is None and only_formalized :
381- continue
382-
383- if val .holds is not None :
384- holds_tag = "holds" if struct_val .holds else "not-hold"
385- else :
386- holds_tag = ''
387- html_parts .append (f'<div class="block { holds_tag } ">' )
388- html_parts .append (f"<h2>{ struct_stmt .type } </h2>" )
389- html_parts .append (f'<p><span class="label ">Statement:</span> { struct_stmt .text } </p>' )
390- if struct_stmt .formalization is None :
391- html_parts .append ("UNFORMALIZED" )
392- else :
393- html_parts .append ('<p><span class="label">Formalization:</span> ' )
394- func_constr = struct_stmt .formalization
395- args_str = ", " .join (
396- f"{ argname } =" + (f"'{ argvalue } '" if isinstance (argvalue , str ) else str (argvalue ))
397- for argname , argvalue in func_constr .arguments .items ()
398- )
399- func_str = f"{ func_constr .function_name } ({ args_str } ) == { func_constr .expected_result } "
400- html_parts .append (f"<code>{ func_str } </code>" )
401- html_parts .append ("</p>" )
402- val = struct_stmt .validation or struct_val
403- if val .satisfiable is not None and val .holds is not None :
404- html_parts .append (f'<p><span class="label">Satisfiable:</span> { val .satisfiable } </p>' )
405- html_parts .append (f'<p><span class="label">Holds:</span> { val .holds } </p>' )
406- html_parts .append ("</div>" )
407-
408376 # Unformalizable Statements Rendering (if applicable)
409377 if not only_formalized :
410378 for unf_stmt in statements .unformalizable_statements or []:
@@ -447,7 +415,7 @@ def print_statements(
447415 )
448416 code = code .replace (var_name , f"{ computation .name } ({ args_str } )" )
449417 print (code )
450- val = cost_stmt . validation or cost_val
418+ val = cost_val or cost_stmt . validation
451419 if val .satisfiable is not None and val .message is not None :
452420 print (f"Satisfiable: { val .satisfiable } " )
453421 print (val .message )
@@ -475,36 +443,11 @@ def print_statements(
475443 )
476444 code = code .replace (var_name , f"{ computation .name } ({ args_str } )" )
477445 print (code )
478- val = param_stmt . validation or param_val
446+ val = param_val or param_stmt . validation
479447 if val .satisfiable is not None and val .message is not None and val .holds is not None :
480448 print (f"Satisfiable: { val .satisfiable } " )
481449 print (f"Holds: { val .holds } ({ val .message } )" )
482450 print ("\n -----------------------------------\n " )
483- for struct_stmt , struct_val in zip (
484- statements .structure_constraints or [], validation .structure_constraints or []
485- ):
486- if struct_stmt .formalization is None and only_formalized :
487- continue
488- print ("Type:" , struct_stmt .type )
489- print ("Statement:" , struct_stmt .text )
490- print ("Formalization:" , end = " " )
491- if struct_stmt .formalization is None :
492- print ("UNFORMALIZED" )
493- else :
494- func_constr = struct_stmt .formalization
495- args_str = ", " .join (
496- [
497- f"{ argname } =" + (f"'{ argvalue } '" if isinstance (argvalue , str ) else str (argvalue ))
498- for argname , argvalue in func_constr .arguments .items ()
499- ]
500- )
501- func_str = f"{ func_constr .function_name } ({ args_str } ) == { func_constr .expected_result } "
502- print (func_str )
503- val = struct_stmt .validation or struct_val
504- if val .satisfiable is not None and val .holds is not None :
505- print (f"Satisfiable: { val .satisfiable } " )
506- print (f"Holds: { val .holds } " )
507- print ("\n -----------------------------------\n " )
508451 if not only_formalized :
509452 for unf_stmt in statements .unformalizable_statements or []:
510453 print ("Type:" , unf_stmt .type )
0 commit comments