auslander 0.10.0

Computational representation theory of finite-dimensional bound quiver algebras
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
use super::cache::HomotopyBlockBuilder;
use super::locality::{local_residue, residue_of};
use super::*;
use crate::homotopy::{HomSpaceMemo, same_complex_data};

fn hom_range(
    source: &BoundedComplex,
    target: &BoundedComplex,
) -> Result<DegreeRange, TiltingComplexError> {
    let lower = source
        .lower()
        .checked_sub(target.upper())
        .ok_or(TiltingComplexError::DegreeOverflow)?;
    let upper = source
        .upper()
        .checked_sub(target.lower())
        .ok_or(TiltingComplexError::DegreeOverflow)?;
    DegreeRange::new(lower, upper).map_err(|_| TiltingComplexError::DegreeOverflow)
}

pub(super) fn quotient(
    source: &ProjectiveComplex,
    target: &ProjectiveComplex,
    degree: i32,
    homs: &mut HomSpaceMemo,
) -> Result<HomotopyHomQuotient, TiltingComplexError> {
    HomotopyHom::new_in(source.complex(), target.complex(), degree, homs)?
        .into_quotient(homs)
        .map_err(Into::into)
}

pub(super) fn basis_representative(space: &HomotopyHomQuotient, index: usize) -> ChainMap {
    let field = space.source().terms()[0].field();
    let mut coordinates = vec![field.zero(); space.dim()];
    coordinates[index] = field.one();
    space.representative(&coordinates)
}

enum RepeatedSummandCheck {
    Distinct,
    Repeated { first: usize, second: usize },
    Cut,
}

/// Two summands with local endomorphism rings are isomorphic exactly when
/// some composite `T_i → T_j → T_i` is a unit, that is, lies outside the
/// radical. The radical is a subspace, so basis composites suffice.
pub(super) fn pair_is_repeated(
    end: &HomotopyHomQuotient,
    residue: &[Fp],
    forward: &HomotopyHomQuotient,
    backward: &HomotopyHomQuotient,
    meter: &mut WorkMeter,
) -> Result<bool, Interrupt> {
    for left in 0..forward.dim() {
        for right in 0..backward.dim() {
            meter.charge()?;
            if basis_product_is_unit(end, residue, forward, backward, left, right)? {
                return Ok(true);
            }
        }
    }
    Ok(false)
}

/// Whether summand `left_index` of `left` and summand `right_index` of
/// `right` are isomorphic in `K^b(proj A)`.
///
/// Equal complex data proves it directly. Otherwise both summands are
/// indecomposable with local endomorphism rings, and the test is
/// [`pair_is_repeated`] against the left endomorphism ring.
pub(crate) fn summands_isomorphic(
    left: &CertifiedSiltingComplex,
    left_index: usize,
    right: &CertifiedSiltingComplex,
    right_index: usize,
    meter: &mut WorkMeter,
) -> Result<bool, Interrupt> {
    let source = &left.candidate.summands[left_index];
    let target = &right.candidate.summands[right_index];
    if same_complex_data(source.complex(), target.complex()) {
        return Ok(true);
    }
    let homs = &mut HomSpaceMemo::default();
    meter.charge()?;
    let forward = quotient(source, target, 0, homs)?;
    meter.charge()?;
    let backward = quotient(target, source, 0, homs)?;
    pair_is_repeated(
        &left.degree_zero_endomorphisms[left_index],
        &left.degree_zero_residues[left_index],
        &forward,
        &backward,
        meter,
    )
}

fn basis_product_is_unit(
    end: &HomotopyHomQuotient,
    residue: &[Fp],
    forward: &HomotopyHomQuotient,
    backward: &HomotopyHomQuotient,
    left: usize,
    right: usize,
) -> Result<bool, TiltingComplexError> {
    let product =
        basis_representative(forward, left).then(&basis_representative(backward, right))?;
    let field = end.source().terms()[0].field();
    Ok(!residue_of(field, residue, &end.reduce(&product)?.0).is_zero())
}

fn repeated_pair(
    candidate: &TiltingComplexCandidate,
    end: &HomotopyHomQuotient,
    residue: &[Fp],
    first: usize,
    second: usize,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<RepeatedSummandCheck, Interrupt> {
    let keys = [(first, second, 0), (second, first, 0)];
    if blocks.blocks_needed(candidate, &keys) as u64
        > limit.saturating_sub(blocks.budget_built as u64)
    {
        return Ok(RepeatedSummandCheck::Cut);
    }
    let forward = blocks.get(candidate, first, second, 0)?;
    let backward = blocks.get(candidate, second, first, 0)?;
    if pair_is_repeated(end, residue, &forward, &backward, blocks.meter)? {
        return Ok(RepeatedSummandCheck::Repeated { first, second });
    }
    Ok(RepeatedSummandCheck::Distinct)
}

fn repeated_summand(
    candidate: &TiltingComplexCandidate,
    data: &BasicnessData,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<RepeatedSummandCheck, Interrupt> {
    let summands = data.ends.iter().zip(&data.residues).enumerate();
    for (first, (end, residue)) in summands.take(candidate.len()) {
        match repeated_for_first(candidate, end, residue, first, blocks, limit)? {
            RepeatedSummandCheck::Distinct => {}
            outcome => return Ok(outcome),
        }
    }
    Ok(RepeatedSummandCheck::Distinct)
}

fn repeated_for_first(
    candidate: &TiltingComplexCandidate,
    end: &HomotopyHomQuotient,
    residue: &[Fp],
    first: usize,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<RepeatedSummandCheck, Interrupt> {
    for second in first + 1..candidate.len() {
        match repeated_pair(candidate, end, residue, first, second, blocks, limit)? {
            RepeatedSummandCheck::Distinct => {}
            outcome => return Ok(outcome),
        }
    }
    Ok(RepeatedSummandCheck::Distinct)
}

struct BasicnessData {
    ends: Vec<HomotopyHomQuotient>,
    residues: Vec<Vec<Fp>>,
}

enum BasicnessCheck {
    Basic(BasicnessData),
    Blocked(TiltingComplexBlocker),
}

fn endomorphism_checks(
    candidate: &TiltingComplexCandidate,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<BasicnessCheck, Interrupt> {
    let mut ends = Vec::with_capacity(candidate.len());
    let mut residues = Vec::with_capacity(candidate.len());
    for (summand, _complex) in candidate.summands().iter().enumerate() {
        if !blocks.cached(candidate, summand, summand, 0) && blocks.budget_built as u64 == limit {
            return Ok(BasicnessCheck::Blocked(TiltingComplexBlocker::HomLimit {
                completed: blocks.budget_built,
                limit,
            }));
        }
        let end = blocks.get(candidate, summand, summand, 0)?;
        let Some(residue) = local_residue(&end, blocks.meter)? else {
            return Ok(BasicnessCheck::Blocked(
                TiltingComplexBlocker::EndomorphismLocality {
                    summand,
                    dimension: end.dim(),
                },
            ));
        };
        ends.push(end);
        residues.push(residue);
    }
    Ok(BasicnessCheck::Basic(BasicnessData { ends, residues }))
}

fn basicness_check(
    candidate: &TiltingComplexCandidate,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<BasicnessCheck, Interrupt> {
    use RepeatedSummandCheck::*;
    use TiltingComplexBlocker::*;
    match endomorphism_checks(candidate, blocks, limit)? {
        BasicnessCheck::Basic(data) => (|| -> Result<BasicnessCheck, Interrupt> {
            let blocker = match repeated_summand(candidate, &data, blocks, limit)? {
                Distinct => return Ok(BasicnessCheck::Basic(data)),
                Repeated { first, second } => RepeatedSummand { first, second },
                Cut => HomLimit {
                    completed: blocks.budget_built,
                    limit,
                },
            };
            Ok(BasicnessCheck::Blocked(blocker))
        })(),
        BasicnessCheck::Blocked(blocker) => Ok(BasicnessCheck::Blocked(blocker)),
    }
}

enum ShiftedHomCheck {
    Zero(Box<TiltingHomCheck>),
    Nonzero(Box<TiltingSelfOrthogonalityRejection>),
    Cut,
}

fn shifted_hom_check(
    candidate: &TiltingComplexCandidate,
    source: usize,
    target: usize,
    degree: i32,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
) -> Result<ShiftedHomCheck, Interrupt> {
    if !blocks.cached(candidate, source, target, degree) && blocks.budget_built as u64 == limit {
        return Ok(ShiftedHomCheck::Cut);
    }
    let space = blocks.get(candidate, source, target, degree)?;
    if space.dim() != 0 {
        return Ok(ShiftedHomCheck::Nonzero(Box::new(
            TiltingSelfOrthogonalityRejection {
                source,
                target,
                degree,
                representative: basis_representative(&space, 0),
                quotient: space,
            },
        )));
    }
    Ok(ShiftedHomCheck::Zero(Box::new(TiltingHomCheck {
        source,
        target,
        degree,
        quotient: space,
    })))
}

/// The zero checks and the kept negative class of one orthogonality scan.
struct Scan {
    goal: OrthogonalityGoal,
    checks: Vec<TiltingHomCheck>,
    negative: Option<Box<TiltingSelfOrthogonalityRejection>>,
}

impl Scan {
    /// Whether `degree` still needs a check. Under
    /// [`OrthogonalityGoal::Silting`], one negative class settles every
    /// negative shift.
    fn needs(&self, degree: i32) -> bool {
        degree != 0 && (degree > 0 || self.negative.is_none())
    }

    /// Keeps `rejection` when the goal allows it, else returns it.
    fn absorb(
        &mut self,
        rejection: Box<TiltingSelfOrthogonalityRejection>,
    ) -> Option<Box<TiltingSelfOrthogonalityRejection>> {
        if self.goal == OrthogonalityGoal::Silting && rejection.degree < 0 {
            self.negative = Some(rejection);
            return None;
        }
        Some(rejection)
    }
}

enum OrthogonalityCheck {
    Orthogonal(Scan),
    Nonzero(Box<TiltingSelfOrthogonalityRejection>),
    Cut { completed: usize, limit: u64 },
}

fn append_shifted_check(
    candidate: &TiltingComplexCandidate,
    (source, target, degree): (usize, usize, i32),
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
    scan: &mut Scan,
) -> Result<Option<OrthogonalityCheck>, Interrupt> {
    match shifted_hom_check(candidate, source, target, degree, blocks, limit)? {
        ShiftedHomCheck::Zero(check) => {
            scan.checks.push(*check);
            Ok(None)
        }
        ShiftedHomCheck::Nonzero(rejection) => {
            Ok(scan.absorb(rejection).map(OrthogonalityCheck::Nonzero))
        }
        ShiftedHomCheck::Cut => Ok(Some(OrthogonalityCheck::Cut {
            completed: blocks.budget_built,
            limit,
        })),
    }
}

fn shifted_range_check(
    candidate: &TiltingComplexCandidate,
    source: usize,
    target: usize,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
    scan: &mut Scan,
) -> Result<Option<OrthogonalityCheck>, Interrupt> {
    let range = hom_range(
        candidate.summands()[source].complex(),
        candidate.summands()[target].complex(),
    )?;
    for degree in range.lower()..=range.upper() {
        if !scan.needs(degree) {
            continue;
        }
        let key = (source, target, degree);
        if let Some(outcome) = append_shifted_check(candidate, key, blocks, limit, scan)? {
            return Ok(Some(outcome));
        }
    }
    Ok(None)
}

fn orthogonality_check(
    candidate: &TiltingComplexCandidate,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
    goal: OrthogonalityGoal,
) -> Result<OrthogonalityCheck, Interrupt> {
    let mut scan = Scan {
        goal,
        checks: Vec::new(),
        negative: None,
    };
    for source in 0..candidate.len() {
        for target in 0..candidate.len() {
            if let Some(outcome) =
                shifted_range_check(candidate, source, target, blocks, limit, &mut scan)?
            {
                return Ok(outcome);
            }
        }
    }
    Ok(OrthogonalityCheck::Orthogonal(scan))
}

pub(super) enum ClassificationFailure {
    Outcome(TiltingComplexResult),
    Interrupt(Interrupt),
}

impl<E: Into<Interrupt>> From<E> for ClassificationFailure {
    fn from(interrupt: E) -> Self {
        Self::Interrupt(interrupt.into())
    }
}

fn completed_orthogonality(
    candidate: &TiltingComplexCandidate,
    blocks: &mut HomotopyBlockBuilder<'_>,
    limit: u64,
    goal: OrthogonalityGoal,
) -> Result<Scan, ClassificationFailure> {
    let outcome = match orthogonality_check(candidate, blocks, limit, goal)? {
        OrthogonalityCheck::Orthogonal(scan) => return Ok(scan),
        OrthogonalityCheck::Nonzero(rejection) => TiltingComplexResult::NotTilting(rejection),
        OrthogonalityCheck::Cut { completed, limit } => {
            TiltingComplexResult::Undetermined(TiltingComplexBlocker::HomLimit { completed, limit })
        }
    };
    Err(ClassificationFailure::Outcome(outcome))
}

/// Classifies `candidate` from a cold block cache.
pub(super) fn classify_with_goal(
    candidate: TiltingComplexCandidate,
    generation: Option<ThickGenerationWitness>,
    limits: TiltingComplexLimits,
    goal: OrthogonalityGoal,
) -> Result<Box<CertifiedSiltingComplex>, ClassificationFailure> {
    let mut meter = WorkMeter::default();
    let blocks = HomotopyBlockBuilder::cold(&mut meter);
    classify_tilting_complex_inner(candidate, generation, limits, blocks, true, goal)
}

/// Checks basicness, the shifted Hom spaces that `goal` requires to vanish,
/// and thick generation.
pub(super) fn classify_tilting_complex_inner(
    candidate: TiltingComplexCandidate,
    generation: Option<ThickGenerationWitness>,
    limits: TiltingComplexLimits,
    mut blocks: HomotopyBlockBuilder<'_>,
    cold_generation_check: bool,
    goal: OrthogonalityGoal,
) -> Result<Box<CertifiedSiltingComplex>, ClassificationFailure> {
    blocks.begin_classification();
    let basicness = (|| -> Result<BasicnessData, ClassificationFailure> {
        match basicness_check(&candidate, &mut blocks, limits.max_hom_spaces)? {
            BasicnessCheck::Basic(data) => Ok(data),
            BasicnessCheck::Blocked(blocker) => Err(ClassificationFailure::Outcome(
                TiltingComplexResult::Undetermined(blocker),
            )),
        }
    })()?;
    let scan = completed_orthogonality(&candidate, &mut blocks, limits.max_hom_spaces, goal)?;
    let generation_valid = match &generation {
        None => false,
        Some(witness) if cold_generation_check => witness.verify(&candidate),
        Some(witness) => witness.verify_with_cached_blocks(&candidate, blocks.meter)?,
    };
    let Some(generation) = generation.filter(|_| generation_valid) else {
        return Err(ClassificationFailure::Outcome(
            TiltingComplexResult::Undetermined(TiltingComplexBlocker::Generation),
        ));
    };
    let (block_cache, work) = blocks.finish(&candidate);
    Ok(Box::new(CertifiedSiltingComplex {
        candidate,
        generation,
        degree_zero_endomorphisms: basicness.ends,
        degree_zero_residues: basicness.residues,
        zero_shifted_homs: scan.checks,
        negative_class: scan.negative,
        limits,
        block_cache,
        work,
    }))
}