
    7,Jjf              	      z   d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	  ee
      j                         j                  d   Zedz  Zdd	d
dddZdg dddg dddg dddg dddg dddg dddg ddgZd&dZd'dZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d(dZd)d Zd)d!Zefd*d"Zd+d#Zd,d$Zed%k(  r e        yy)-zAConsolidate selector-merge shape evidence versus execution proof.    )annotationsN)Path)Any   outzGVM control-flow edge from source selector 0:0 into current selector 2:0z@predecessor/target-side forward bridge into current selector 2:0z\execution-like target-alias bridge, encoded merge bridge, or predecessor-to-current root refz8branch-state execution proof reaching the current readerz,strict map1_01a source coordinate or hotspot)source-current-bridge"predecessor-current-forward-bridge!execution-like-bridge-or-root-refbranch-state-execution-proofstrict-source-hotspotz(out/save_selector_set_decomposition.json)"currentEqualsPredecessorPlusSource#sourcePredecessorUnionCoversCurrentsourcePredecessorUnionExtraMaps
proofFound)pathfieldsz,out/save_selector_recomposition_lattice.json)currentroutePairOnlyCurrentSelectorexactPairUnionCountoneMapAugmentationCountz out/save_selector_merge_gap.json)sourceToCurrentBridgeHitCountcurrentToSourceBridgeHitCounttargetToCurrentBridgeHitCountselectorMergeGapOpenz*out/save_selector_merge_bridge_matrix.json)sourceToCurrentHitCountpredecessorToCurrentHitCountcurrentToPredecessorHitCount&currentToPredecessorBeforeFillHitCount$currentToPredecessorFillSiteHitCountforwardMergeBridgeHitCount encodedMergeExecutionBridgeFoundz+out/save_selector_target_alias_bridges.json)targetAliasSelectors&aliasToCurrentExecutionLikeBridgeFoundforwardHitsAddressAdjacentOnly#targetAliasExecutionExclusionStatusaliasBridgeSummaryRowsz-out/save_selector_route_root_ref_context.json)allRouteSelectorRootsTableOnly predecessorToCurrentRootRefFound(sourceTargetSplitAcrossPreviousSelectorsz=out/save_selector_predecessor_branch_state_execution_gap.json)branchStateExecutionProofFoundruntimeBranchStateSplitstrictHotspotFoundr   c                B    dj                  d | xs g D              xs dS )N,c              3  2   K   | ]  }t        |        y w)N)str).0values     H/home/exedev/hwanse/tools/summarize_save_selector_merge_execution_gap.py	<genexpr>zcsv.<locals>.<genexpr>a   s     95CJ9s   -)join)valuess    r3   csvr8   `   s     889FLb99@S@    c                ^      xs i  dj                   fdt               D              xs dS )Nr.   c              3  2   K   | ]  }| d |      yw):N )r1   keycountss     r3   r4   z$class_counts_text.<locals>.<genexpr>f   s      Esse1VC[M*Es   r5   )r6   sorted)r?   s   `r3   class_counts_textrA   d   s*    \rF88EfVnEELLr9   c                H   |j                  d      xs i }|j                  d      xs i }|j                  d      xs i }	|j                  d      xs i }
t        | j                  d      xr |j                  d            }|j                  d      xs | j                  d      xs g }|j                  d      du }t        |j                  d	      xs g       }t        |j                  d
      xs g       }|j                  d      }|j                  d      du xs( |j                  d      du xs |j                  d      du }|j                  d      dk(  xr* |j                  d      dk(  xr |j                  d      dk(  }|j                  d      dk(  xr |j                  d      dk(  }|j                  d      dk(  xr* |j                  d      dk(  xr |j                  d      dk(  }|j                  d      du }|j                  d      du }|j                  d      du }|j                  d      xs g }|j                  d      xs g }|j                  d      xs g }|j                  d      xs g }|j                  d      xs g }|j                  d       xs g }|j                  d!      xs g }|j                  d"      xs g }|j                  d#      } |j                  d$      }!|j                  d%      }"|j                  d&      }#|j                  d'      }$|j                  d(      du }%|j                  d)      du }&|xs
 |%xs |xs |}'|'xr |&}(|j                  d*      du })|(}*g }+|r|+j                  d+       |r|+j                  d,       |'s|+j                  d-       |&s|+j                  d.       |)s|+j                  d/       |+D ,cg c]  },t        j                  |,|,       }-},|j                  d0      du xs |j                  d1      d2k(  xs |' }.|.rd2nd3}/d4|rd5nd6d7| d8t        |       d9| d:d;|dk(  rd<nd=d>| d?| d@|j                  dA       d:d+|rd<nd=dB|j                  d       dC|j                  d       dD|j                  d       d:d,|rd<nd=dE|j                  d       dF|j                  d       dG| dH|# dI|$ dJ|% d:dK|rdLndMdN|j                  d       dO|j                  d       dP|j                  d       d:dQ|sdRndSdTj                  g dUt        |j                  dV             dW|j                  dX       dY|j                  dZ       d[|j                  d\       d]|j                  d^       d[|j                  d_       d`|j                  da       db|j                  dc       ddt        |       det        |       dft        |       dgt        |       dht        |       dit        |       djt        |       dk|  dl|! dm|j                  dn       do|       d:dp|r|sdqndrds| dt|j                  du       dv|j                  dw       dx| d:d.|&sd2ndydz|j                  d{       d||& d}|j                  d~       d|j                  d*       d:g}0d}1i d| j                  d      xs dd| j                  d      xs dd|	j                  d      xs | j                  d      d|	j                  d      xs | j                  d      d|
j                  d      xs | j                  d      d|
j                  d      xs | j                  d      d|j                  d      xs | j                  d      d|j                  d      xs | j                  d      d|d|j                  d      d|j                  d      d|d|d|j                  d      d|d|d|j                  dA      i d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|d|d&|#d'|$d(|%dV|j                  dV      xs g d|j                  dX      d|j                  dZ      d|j                  d\      d|j                  d^      i d|j                  d_      d|j                  da      d|j                  dc      d|d|d|d|d|d|d|j                  d      d|j                  d      d|d|j                  d      d| d$|!d%|"d|i d|d|d|dw|j                  dw      d)|&d|'d|(d|*d*|)d|+d|-dt        dt        t              d0|.d|/d|0dg dd|1iS c c},w )Nr   currentSelectorsourceSelectorpredecessorSelectorr   r   r   TcurrentExactPairUnionscurrentCoveringPairUnionsr    directMergeExecutionBridgeFoundr#   3aliasToCurrentAfterLastFillExecutionLikeBridgeFoundr   r   r   r   r   r   r   3   r   r   r'   r(   aliasesWithForwardHitsaliasesWithForwardDataHits aliasesWithAfterLastFillDataHitsdominantForwardDataAliasesr&   publicCoveredAliasSelectors publicCoveredForwardHitSelectors"addressAdjacentForwardHitSelectorspublicForwardHitCoverageStatusr%   #targetAliasExecutionExclusionDetail+forwardEncodedAnchorRawScalarCandidateCount+forwardEncodedAnchorPromotingCandidateCountr!   r*   r,   r   r	   r
   r   r   r   selectorMergeProofStatusblockedzready-for-reviewzset-recomposition-shapezmerge-shapedznot-merge-shapedz#currentEqualsPredecessorPlusSource=z; sourcePredecessorUnionExtra=z; routePairOnlyCurrent=)kindstatusdetailzexact-previous-unionabsentpresentzcurrentExactPairUnions=z; coveringPairUnions=z; globalExactPairUnions=r   zsourceToCurrent=z; currentToSource=z; matrixSourceToCurrent=zpredecessorToCurrent=z; targetToCurrent=z; forwardMergeBridge=z; encodedRaw=z; encodedPromoting=z; encodedMerge=z!current-predecessor-reverse-reusezreuse-before-fillopenzcurrentToPredecessor=z; beforeFill=z; fillSite=ztarget-alias-bridgeznon-execution-likezexecution-like zaliases=r"   z; hits=aliasToCurrentHitCountz; metadata/data=aliasToCurrentMetadataHitCount/aliasToCurrentDataHitCountz; promotingMeta/Data='aliasToCurrentPromotingMetadataHitCount#aliasToCurrentPromotingDataHitCountz; metadataOnlyExact=(aliasToCurrentPromotingExactMetadataOnlyz; afterFill=#aliasToCurrentAfterLastFillHitCountz; forwardHitAliases=; dataAliases=; afterFillDataAliases=z; dominantDataAliases=z; publicCovered=z; publicForward=; addressAdjacentForward=z; publicCoverage=z; exclusion=z; readerScene=)aliasToCurrentReaderOrSceneRecordHitCountz; executionLike=zroute-root-ref-contextz
table-onlyzexecution-refzallTableOnly=z; textRefs=anyRouteSelectorRootTextRefsz; splitPrevious=r)   z; predToCurrentRootRef=provenzfillWouldPass=%predecessorFillWouldPassCurrentReaderz!; branchStateExecutionProofFound=z; runtimeOrderGapOpen=openRuntimeOrderOrBytecodeGapz; strictHotspotFound=a  Selector 2:0 still looks like a recomposed selector list, not a proven execution step. It is the only selector containing the route pair and can be described as target-side 1:0 plus map1_01a, but exact previous unions, source/current bridges, predecessor/current forward bridges, route-root execution refs, and execution-like target-alias bridges are absent. The merge gap therefore stays open until selected-root runtime evidence, VM control-flow proof, or a strict source hotspot appears.sourcemap1_01atargetmap2_02dselectorsourceRootHexrootHexpredecessorRootHexcurrentRootHex#currentEqualsSourcePredecessorUnionr   routePairSelectorCountcurrentExactPairUnionCountcurrentCoveringPairUnionCountglobalExactPairUnionCountr   targetAliasToCurrentHitCount$targetAliasToCurrentMetadataHitCount targetAliasToCurrentDataHitCount-targetAliasToCurrentPromotingMetadataHitCount)targetAliasToCurrentPromotingDataHitCount.targetAliasToCurrentPromotingExactMetadataOnly)targetAliasToCurrentAfterLastFillHitCounttargetAliasForwardHitSelectorstargetAliasForwardDataSelectors%targetAliasAfterLastFillDataSelectors targetAliasDominantDataSelectors!targetAliasPublicCoveredSelectors+targetAliasPublicCoveredForwardHitSelectors,targetAliasPublicCoveredForwardHitAliasCount!publicCoveredForwardHitAliasCount&targetAliasForwardHitPublicSampleCountforwardHitPublicSampleCount-targetAliasAddressAdjacentForwardHitSelectors)targetAliasForwardHitsAddressAdjacentOnlyr$   )targetAliasPublicForwardHitCoverageStatustargetAliasBridgeSummaryRows,targetAliasToCurrentExecutionLikeBridgeFoundrouteRootsTableOnlyrouteRootExecutionRefFound selectorMergeExecutionProofFoundruntimeOrControlFlowProofFoundr   #failedSelectorMergeExecutionGateIdsmissingEvidenceevidenceRefsevidenceRefCountpromotionStatusevidenceremainingProofs)zMprove source-side selector 0:0 enters current selector 2:0 in VM control flowzNprove target-side predecessor/alias state reaches current 2:0 reader executionzPcapture selected-pointer runtime evidence or a real selector 2:0 savedata samplez3find a strict map1_01a source coordinate or hotspot
conclusion)getboollenappend1SELECTOR_MERGE_EXECUTION_MISSING_EVIDENCE_BY_GATEr8   r6   &SELECTOR_MERGE_EXECUTION_EVIDENCE_REFS)2set_decompositionrecomposition_lattice	merge_gapmerge_bridge_matrixtarget_alias_bridgesroute_root_ref_context&predecessor_branch_state_execution_gapr   current_selectorsource_selectorpredecessor_selector&current_equals_predecessor_plus_source%current_source_predecessor_extra_mapsroute_pair_only_currentexact_pair_union_countcovering_pair_countforward_merge_bridge_count#direct_merge_execution_bridge_foundsource_current_bridge_absent"predecessor_current_forward_absentreverse_reuse_onlyroute_roots_table_onlyroute_root_execution_ref_found#target_alias_execution_bridge_found"target_alias_forward_hit_selectors#target_alias_forward_data_selectors&target_alias_after_fill_data_selectors$target_alias_dominant_data_selectors target_alias_bridge_summary_rows%target_alias_public_covered_selectors%target_alias_public_forward_selectors/target_alias_address_adjacent_forward_selectors(target_alias_forward_hit_coverage_status'target_alias_execution_exclusion_status'target_alias_execution_exclusion_detail forward_encoded_anchor_raw_count&forward_encoded_anchor_promoting_count$encoded_merge_execution_bridge_found"branch_state_execution_proof_found$selector_merge_execution_proof_found#runtime_or_control_flow_proof_foundstrict_hotspot_foundproof_found(failed_selector_merge_execution_gate_idsgate_idmissing_evidenceselector_merge_gap_openpromotion_statusr   r   s2                                                     r3   build_summaryr   i   s3    $''	28bG{{#45;kk"239rO";;'<=C-1BC 	>KK<=.*
 	56 	  !BC	 *
 4778VW[__ -E!F!L"Mgkk*EFL"M!4!8!89U!V ABdJ 	c##$LMQUU	c##$YZ^bb ( 	56!; 	DMM9:a?	D##$=>!C ! 	 >?1D 	@MM9:a? '
 	 >?2E 	Q##$LMQSS	Q##$JKqP 
 4778XY]aa%;%?%?@b%cgk%k"*>*B*BCk*lpt*t')=)A)ABZ)[)a_a&*>*B*BC_*`*fdf'-A-E-EFh-i-omo*+?+C+CD`+a+geg(';'?'?@X'Y'_]_$,@,D,DEb,c,igi),@,D,DEg,h,nln)  !EFL" 4 0D/G/GHh/i,.B.F.FGl.m+.B.F.FGl.m+':'>'>?l'm$-@-D-D5.* 	 BCtK ) 	/223STX\\ ' 	, 	//	/)	/ /	 ) 	-S1S ( BEEFZ[_cc5K/1,#0778OP)0778\]/0778[\-0778VW0778OP @ 	:==gwO 
 	,-5 	4""#=>)K	433 
 %<yAS .(NnTf56\5] ^//23X/Y.Z [((?'@B		
 +"8A"=h9)*@)A B&&9%: ;))>)B)BCX)Y(Z\		
 ,">hI"9==1P#Q"R S##,==1P#Q"R S))<)@)@AZ)[(\^		
 9"Dh)'(;(?(?@^(_'` a##,==1P#Q"R S&&@%A B>? @$$J#K L  DEG		
 8-?)V'(;(?(?@^(_'` a1556^_` a/334Z[\^		
 *2U*[kG G( G33778NOPQ G R G,001IJKGL!G!5!9!9:Z![ \G\]G (++,HIJGK&G
 (++,UVWG
 XYG (++,QRSGT%G &:%=%=>h%i$jGkG 2556[\]G^%G &))K%L$MGNG  ##FGHGI(G ),,R(S'TGU'G (++O'P&QGR!G "%%J!K LGM!G "%%J!K LGM*G +..]*^)_G`"G  #K!K!G L!G" EE#G"F#G$  4778cde%G$f!%G& "E E'G		
6 -&<Eclix 67 82667UVW X!!7!;!;<f!g h i((F'GI			
 3'Iix 9==>efg h22T1U V'9==>]^_ `&&L&P&PQe&f%gi		
kaHF	W [#''1?Z[#''1?Z[ 	/--j9d=N=R=RSc=d[ 	,,Y7a;L;P;PQ`;a	[
 	377
CsGXG\G\]rGs[ 	266yApEVEZEZ[oEp[ 	+//
;g?P?T?TUf?g[ 	*..y9d=N=R=RSc=d[ 	-.T[ 	.w{{;`/a[ 	.w{{;`/a[ 	*+P[ 	'(?[ 	!"7";";<T"U[ 	%&<[  	()<![" 	$%:%>%>?T%U#[$ 	"#8#<#<=V#W%[& 	(7V)W'[( 	(7V)W)[* 	'(;(?(?@^(_+[, 	'(;(?(?@^(_-[. 	12E2I2IJr2s/[0 	/0C0G0GHn0o1[2 	%&@3[4 	*+N5[6 	67W7[8 	67]9[: 	+,P;[< 	 4 8 89O P VTV=[> 	'(<(@(@AY(Z?[@ 	/0D0H0HIi0jA[B 	+,@,D,DEa,bC[D 	89M9Q9Q5:
E[J 	45I5M5M16
K[P 	9:N:R:R6;
Q[V 	45I5M5M16
W[\ 	)*L][^ 	*+N_[` 	01Wa[b 	+,Pc[d 	,-Re[f 	67\g[h 	78L8P8P/9
i[n 	12F2J2J)3
o[t 	89hu[v 	45I5M5M,6
w[| 	45]}[~ 	./V[@ 	./VA[B 	'(HC[D 	78[E[F 	5G[H 	%&DI[J 	34J4N4N65
K[P 	)*LQ[R 	+,PS[T 	)*MU[V 	kW[X 	2Y[Z 	./W[[\ 	+][^ 	>_[` 	C FGa[b 	 7c[d 	+e[f 	Hg[h 	 
i[t 	ju[ [gs   hc                    g dd| d   dd| d    d| d    dd	| d
    d| d    dd| d    d| d    dd| d    d| d    dd| d    dt        | d          d| d    d| d    d| d    d| d    d| d     d| d!    d"| d#    d| d$    d%| d&    d| d'    d(| d)    d*| d+    d,| d-    d| d.    d/| d0    d1t        | d2          dt        | d3          dt        | d4          d5t        | d6          d7t        | d8          d9| d:    d;| d<    dd=| d>    d?| d@    dA| dB    dC| dD    dE| dF    dGt        | j                  dH             dIt        | j                  dJ      xs g        dK| j                  dL       dM| dN    dO| dP    dddQd| j                  dJ      xs g D cg c]  }dR| 	 c}ddSddTdU}| dV   D ]&  }|j                  dW|dX    dY|dZ    dY|d[    d\       ( |j	                  g d]       | d^   D ]  }t        |j                  d_            }t        |j                  d`            }|j                  da|j                  db       dc|j                  dd       dY|j                  de       dY|j                  df       dY|j                  dg       dY| dY| dY|j                  dh       di|j                  dj       di|j                  dk       dY|j                  dl       d\        |j	                  g dm       |j	                  dn | do   D               |j                  d       dpj                  |      S c c}w )qNz## Save Selector Merge Execution Gapr^   r   z
- route: `ro    -> rq   `z- source selector: `rD   z` root `rt   z- predecessor selector: `rE   rv   z- current selector: `rC   rw   z*- current equals predecessor plus source: r   z!- source+predecessor extra maps: r   z$- route pair only current selector: r   z- current exact pair unions: rz   z- source/current bridge hits: r    / r   z#- predecessor/current bridge hits: r   r   z3- current->predecessor before-fill/fill-site hits: r   r   z3- forward encoded-anchor raw/promoting candidates: rT   rU   z(- encoded merge execution bridge found: r!   z - target alias -> current hits: r}   z-- target alias promoting metadata/data hits: r   r   z3- target alias exact promoting hits metadata-only: r   z7- target alias forward/data/after-fill-data selectors: r   r   r   z1- target alias public-covered forward selectors: r   z3- target alias address-adjacent forward selectors: r   z+- target alias public coverage/exclusion: `r   z` / `r%   z,- target alias execution-like bridge found: r   z"- route root execution ref found: r   z&- branch-state execution proof found: r*   z(- selector merge execution proof found: r   z- proof found: r   z)- failed selector-merge execution gates: r   z- missing evidence count: r   z- evidence refs: r   z- selector merge gap open: r   z- promotion status: `r   z## Missing Evidence- z## Evidencez| kind | status | detail |z| --- | --- | --- |r   z| rX   z | rY   rZ   z |)r^   z## Target Alias Bridge Summaryr^   zq| selector | role | hits | data | after-fill data | classes | after-fill classes | trace W/R/S | current->alias |z;| --- | --- | ---: | ---: | ---: | --- | --- | --- | ---: |r   aliasToCurrentTargetClassCounts,aliasToCurrentAfterLastFillTargetClassCountsz| `rs   z` | roler_   rb   'aliasToCurrentAfterLastFillDataHitCount1aliasToCurrentPreWriterTraceCurrentWriterHitCountra   1aliasToCurrentPreWriterTraceCurrentReaderHitCount4aliasToCurrentPreWriterTraceRouteSceneRecordHitCountcurrentToAliasHitCount)r^   z## Remaining Proofsr^   c              3  &   K   | ]	  }d |   yw)r   Nr=   r1   items     r3   r4   zmarkdown.<locals>.<genexpr>  s     D2dVDs   r   
)r8   r   r   r   extendrA   r6   )summaryr   linesrowclassesafter_classess         r3   markdownr     s   ,-,
, 	, 		,
 WX&'tGH,=+>a@, w'789'/BZA[[\], $G,A$B#C8GThLiKjjkl,  (9 :;8GL\D]C^^_`, 5W=a5b4cd, ,C8Y0Z,[+\], /w7U/V.WX, (0L(M'NO, )1P)Q(RRUV]^}V~U  	A, .g6T.U-VVYZa  cA  [B  ZC  	D, >gFn>o=ppst{  }c  ud  te  	f,  >gFs>t=uux  zA  Bo  zp  yq  	r!," 37;]3^2_`#,$ +73Q+R*ST%,& 8@o8p7qqtu|  ~i  vj  uk  	l',( >gFv>w=xy),* B#gNnFoBpAqqtux  zA  Bc  zd  ve  uf  fi  jm  nu  v]  n^  j_  i`  	a+,, <CHu@v<w;xy-,. >c'JyBz>{=|}/,0 6g>i6j5kkpqx  z_  r`  qa  ab  	c1,2 7w?m7n6op3,4 -W5Q-R,ST5,6 19Y1Z0[\7,8 37;]3^2_`9,: ',/01;,< 4CDi8j4k3lm=,> %S5F)G)M2%N$OP?,@ GKK(:;<=A,B &g.D&E%FGC,D  (9 :;1=E,F 	G,H 	I,J 	K,L #*++.?"@"FB	G$Btf+	GM,N 	O,P 	Q,R 	S,T 	%U,V 	W,EZ z" Or#f+c#h-CM?"MNO	LL   56 
#CGG,M$NO)#''2`*ab#''*%&d3776?*;3swwG_?`>aadww345SAj9k8llois=/wwJKLAwwJKLAwwMNOsww/015	

 
LL01	LLD1B)CDD	LL99U? 
Hs   M;c           &     8   dj                  d | d   D              }dj                  d | d   D              }dj                  d | j                  d      xs g D              }dj                  dd	d
dddddddt        j                  | d          ddt        j                  | d          dt        j                  | d          dt        j                  t	        | d                dt        j                  t	        | d                dt        j                  t	        | d                dt        j                  t	        | d                dt        j                  t	        | d                 dt        j                  t	        | d!                d"d#| d$    d%| d&    d'| d(    d)| d*    d+| d,    d-| d.    d/| d0    d1t        j                  t        | j                  d2                   d3t        | j                  d      xs g        d4| j                  d5       d6t        j                  | d7          d"d8| d9    d:| d;    d<t        j                  | d7          d"d=t        j                  t        | d>                d?t        j                  t        | d@                dAt        j                  t        | dB                dCdDt        j                  t        | dE                dFt        j                  t        | dG                dHt        j                  t	        | dI                dJt        j                  t	        | dK                d"	dL| dM    dN| dO    dCdP| dQ    dCdRdS| dTdUdV| dWdXdYdj                  dZ | d[   D              d\d]dS| dTd^d_d`g      S )aNr   c           
   3     K   | ]R  }d t        j                  |d          dt        j                  |d          dt        j                  |d          d T yw)z<tr><td>rX   	</td><td>rY   rZ   
</td></tr>Nhtmlescaper1   r   s     r3   r4   zhtml_page.<locals>.<genexpr>  sg       	{{3v;'( ){{3x=)* +{{3x=)* +	s   AAr   c              3  N   K   | ]  }d t        j                  |       d  ywz<li>z</li>Nr   r   s     r3   r4   zhtml_page.<locals>.<genexpr>  s#     cd4;;t#4"5U;c   #%r   c              3  N   K   | ]  }d t        j                  |       d  ywr   r   r   s     r3   r4   zhtml_page.<locals>.<genexpr>  s(      ,0$t{{4 !'r   r   z<!doctype html>z<html lang="en">z<head>z  <meta charset="utf-8">z2  <title>Save Selector Merge Execution Gap</title>a    <style>body{font-family:system-ui,sans-serif;margin:24px;line-height:1.45;max-width:1200px}table{border-collapse:collapse;width:100%;margin:16px 0}td,th{border:1px solid #ddd;padding:6px 8px;text-align:left;vertical-align:top}th{background:#f5f5f5}code{white-space:nowrap}</style>z</head>z<body>z,  <h1>Save Selector Merge Execution Gap</h1>z  <p>r   z</p>z  <p><b>Route:</b> <code>ro   r   rq   z</code>; source <code>rD   z</code> root <code>rt   z</code>; predecessor <code>rE   rv   z</code>; current <code>rC   rw   z</code>.</p>z  <p><b>Proof:</b> mergeShape=r   z; exactPairUnions=rz   z; directMergeExecution=rH   z; encodedMergeExecution=r!   z; routeRootExecution=r   z; branchStateExecution=r*   z; proofFound=r   z*; failedSelectorMergeExecutionGates=<code>r   z</code>; missingEvidenceCount=z; evidenceRefs=r   z; status <code>r   z+  <p>selector merge execution proof found: r   z; selector merge gap open: r   z; promotion status: <code>zS  <p><b>target alias forward/data/after-fill-data selectors:</b> forwardHitAliases=r   rg   r   rh   r   z.</p>z  <p><b>target alias public-covered forward selectors; target alias address-adjacent forward selectors; target alias public coverage/exclusion:</b> publicForward=r   ri   r   z; coverage <code>r   z</code>; exclusion <code>r%   z7  <p><b>target alias promoting metadata/data hits:</b> r   r   r   z=  <p><b>target alias exact promoting hits metadata-only:</b> r   z  <h2>Missing Evidence</h2>z  <ul>z</ul>z  <h2>Evidence</h2>zS  <table><thead><tr><th>kind</th><th>status</th><th>detail</th></tr></thead><tbody>z</tbody></table>z&  <h2>Target Alias Bridge Summary</h2>z  <table><thead><tr><th>selector</th><th>role</th><th>hits</th><th>data</th><th>after-fill data</th><th>classes</th><th>after-fill classes</th><th>trace W/R/S</th><th>current-&gt;alias</th></tr></thead><tbody>c              3    K   | ]>  }d t        j                  t        |j                  d                   dt        j                  t        |j                  d                   d|j                  d       d|j                  d       d|j                  d       dt        j                  t	        |j                  d                   dt        j                  t	        |j                  d	                   d|j                  d
       d|j                  d       d|j                  d       d|j                  d       d A yw)z<tr><td><code>rs   z</code></td><td>r   r   r_   rb   r   r   r   r   ra   r   r   r   r   N)r   r   r0   r   rA   r   s     r3   r4   zhtml_page.<locals>.<genexpr>6  s>      ![[SWWZ-@)ABC D{{3swwv#789 :ww789 :ww;<= >wwHIJ K{{#4SWW=^5_#`ab c{{#4SWW=k5l#mno pwwRSTTU77NOPPQ77QRS Tww789 :s   EEr   z  </tbody></table>z  <h2>Remaining Proofs</h2>z</body>z</html>r^   )r6   r   r   r   r0   r8   r   )r   evidence_rowsproof_itemsmissing_itemss       r3   	html_pager     s   II  :& M ))cPaHbccKII 4;KK@Q4R4XVX M 99&@ i:DKK 567t<WX%678T[[QYIZ=[<\ ]  $C8H0I,J KL M"kk#go.F*GHI J%%)[[W=R5S1T%U$V W"kk#g6J.K*LMN O!!%S9J1K-L!M N O"kk#g6F.G*HIJ,X%&JKL M##*+G#H"I J((/0Q(R'S T))01S)T(U V&&-.J&K%L M((/0P(Q'R S%l34 5S5Z)[%\]^ _((+GKK8I,J,Pb(Q'R S  ',> ?@ A  $G4E,F GHV >=>? @,123 4W->%?@AO%%)[[W=]5^1_%`$a b#{{3w7X/Y+Z[\ ]((,C@g8h4i(j'kkpr!!%S9f1g-h!i j k**.++c'Bq:r6s*t)u v""&++c':e2f.g"h!i j##';;s7;`3a/b#c"ddp	r JJKLCFGHO
 PKLMUT *]O5)!aboap  qA  B4 `II  ##AB   !)[M'{^	
` `r9   c                    |j                  dd       |dz  j                  t        j                  | dd      dz   d	       |d
z  j                  t	        |       d	       y )NT)parentsexist_okz&save_selector_merge_execution_gap.jsonF   )ensure_asciiindentr   utf-8encoding&save_selector_merge_execution_gap.html)mkdir
write_textjsondumpsr   )r   out_dirs     r3   write_outputsr  P  se    MM$M.77CC

7q9D@ D  77CCIgDVahCir9   c                L    t        j                  | j                  d            S )Nr  r  )r
  loads	read_text)r   s    r3   	load_jsonr  Y  s    ::dnngn677r9   c                    t        j                  t              } | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  d	t        t
        d
z         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
               | j                         }t        t        |j                        t        |j                        t        |j                        t        |j                        t        |j                        t        |j                        t        |j                              }t!        ||j"                         t%        d|j"                  dz          y )N)descriptionz--set-decompositionz$save_selector_set_decomposition.json)typedefaultz--recomposition-latticez(save_selector_recomposition_lattice.jsonz--merge-gapzsave_selector_merge_gap.jsonz--merge-bridge-matrixz&save_selector_merge_bridge_matrix.jsonz--target-alias-bridgesz'save_selector_target_alias_bridges.jsonz--route-root-ref-contextz)save_selector_route_root_ref_context.jsonz(--predecessor-branch-state-execution-gapz9save_selector_predecessor_branch_state_execution_gap.jsonz	--out-dirz&wrote selector merge execution gap -> r  )argparseArgumentParser__doc__add_argumentr   OUT
parse_argsr   r  r   r   r   r   r   r   r   r  r  print)parserargsr   s      r3   mainr  ]  s   $$9F
-D#HnBno
1cLvFvw
D#@^:^_
/dCJrDrs
0tSKtEtu
2sMxGxy
2QQ  
 $<D$(()$,,-$..!$**+$++,$--.$==>G '4<<(	24<<Bj3j2k
lmr9   __main__)r7   zlist[Any] | Nonereturnr0   )r?   zdict | Noner!  r0   )r   dictr   r"  r   r"  r   r"  r   r"  r   r"  r   r"  r!  r"  )r   r"  r!  r0   )r   r"  r  r   r!  None)r   r   r!  r"  )r!  r#  )r  
__future__r   r  r   r
  pathlibr   typingr   __file__resolver   ROOTr  r   r   r8   rA   r   r   r   r  r  r  __name__r=   r9   r3   <module>r+     st   G "      H~''*
Ul gJ 	g$^K
5 1 ;
 ?
 3
 =
 >
	 @
 P
uC* &LAM
kkk k 	k
 k !k -1k 
k\	FRm` 25 j8n8 zF r9   