Compile state for building the Ixon environment.
| 106 | pub struct KernelCtx { |
| 107 | /// Worker-local **canonical** kernel environment. Populated incrementally by |
| 108 | /// aux_gen's Phase 1+ (`compute_is_large_and_k`, `ingress_field_deps`, |
| 109 | /// etc.) with aux-substituted types at `resolve_lean_name_addr`-derived |
| 110 | /// addresses that may shift as alpha-collapse reassigns addresses over |
| 111 | /// the course of compilation. |
| 112 | pub kenv: ix_kernel::env::KEnv<ix_kernel::mode::Meta>, |
| 113 | /// Ids whose `ingress_aux_gen_dep` dispatch has already run against |
| 114 | /// `kenv`. The dispatch is a deterministic function of the constant's |
| 115 | /// kind, so once an id is here its kenv entry is at final fidelity and |
| 116 | /// the walkers skip re-expanding its whole reference closure (that |
| 117 | /// re-expansion was Θ(blocks × closure) when the set lived per call). |
| 118 | /// Keyed by resolved `KId` — not bare `Name` — so an address shifted |
| 119 | /// by later aux registration reads as unseen and re-ingresses under |
| 120 | /// the new id, exactly as the per-call sets healed it. Must be cleared |
| 121 | /// together with `kenv` (the entries it vouches for die with it). |
| 122 | pub aux_ingress_seen: FxHashSet<ix_kernel::id::KId<ix_kernel::mode::Meta>>, |
| 123 | } |
| 124 | |
| 125 | impl Default for KernelCtx { |
| 126 | fn default() -> Self { |
| 127 | Self::new() |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | impl KernelCtx { |
| 132 | pub fn new() -> Self { |
| 133 | KernelCtx { |
| 134 | kenv: ix_kernel::env::KEnv::new(), |
| 135 | aux_ingress_seen: FxHashSet::default(), |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /// Compile state for building the Ixon environment. |
| 141 | pub struct CompileState { |
| 142 | /// Ixon environment being built |
| 143 | pub env: IxonEnv, |
| 144 | /// Map from Lean constant name to Ixon address |
| 145 | pub name_to_addr: DashMap<Name, Address>, |
| 146 | /// Mutual block canonical class ordering, keyed by any inductive name in the |
| 147 | /// block. Each entry is the list of equivalence classes (in `sort_consts` order), |
| 148 | /// where each class is a list of names. |
| 149 | pub blocks: DashMap<Name, Vec<Vec<Name>>>, |
| 150 | /// Per-block size statistics (keyed by low-link name) |
| 151 | pub block_stats: DashMap<Name, BlockSizeStats>, |
| 152 | /// Constants that couldn't be compiled (name -> error description). |
| 153 | /// |
| 154 | /// Populated in two phases: |
| 155 | /// 1. Pre-compile grounding: `ground_consts` identifies constants unreachable |
| 156 | /// from axioms/primitives. |
| 157 | /// 2. During scheduling: per-block compile failures (e.g. `compute_is_large_and_k` |
| 158 | /// rejecting an ill-formed inductive) are recorded here instead of |
| 159 | /// aborting the scheduler, so the rest of the env still compiles and |
| 160 | /// callers can report each failure per-constant. |
| 161 | /// |
| 162 | /// `DashMap` (rather than `FxHashMap`) because scheduler workers insert |
| 163 | /// concurrently on per-block failure paths. |
| 164 | pub ungrounded: DashMap<Name, String>, |
| 165 | /// Persistent set of names compiled by aux_gen. Used for membership |
nothing calls this directly
no outgoing calls
no test coverage detected