-
Notifications
You must be signed in to change notification settings - Fork 113
/
constructors.jl
617 lines (494 loc) · 31.2 KB
/
constructors.jl
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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
#######################################################
# 1. User interface for literature models
#######################################################
@doc raw"""
literature_model(; doi::String="", arxiv_id::String="", version::String="", equation::String="", model_parameters::Dict{String,<:Any} = Dict{String,Any}(), base_space::FTheorySpace = affine_space(NormalToricVariety, 0), model_sections::Dict{String, <:Any} = Dict{String,Any}(), defining_classes::Dict{String, <:Any} = Dict{String,Any}(), completeness_check::Bool = true)
Many models have been created in the F-theory literature.
A significant number of them have even been given specific
names, for instance the "U(1)-restricted SU(5)-GUT model".
This method has access to a database, from which it can
look up such literature models.
Currently, you can provide
any combination of the following optional arguments
to the method `literature_model`:
* `doi`: A string representing the DOI of the publication that
introduced the model in question.
* `equation`: A string representing the number of the equation that introduced
the model in question.
For papers, that were posted on the arXiv, we can instead of the `doi` also
provide the following:
* `arxiv_id`: A string that represents the arXiv identifier of the paper that
introduced the model in question.
* `version`: A string representing the version of the arXiv upload.
The method `literature_model` attempts to find a model in our database
for which the provided data matches the information in our record. If no such
model can be found, or multiple models exist with information matching the
provided information, then an error is raised.
Some literature models require additional parameters to specified to single out
a model from a family of models. Such models can be provided using the optional
argument `model_parameters`, which should be a dictionary such as `Dict("k" => 5)`.
```jldoctest
julia> t = literature_model(arxiv_id = "1109.3454", equation = "3.1")
Assuming that the first row of the given grading is the grading under Kbar
Global Tate model over a not fully specified base -- SU(5)xU(1) restricted Tate model based on arXiv paper 1109.3454 Eq. (3.1)
julia> v = ambient_space(t)
A family of spaces of dimension d = 5
julia> coordinate_ring(v)
Multivariate polynomial ring in 8 variables w, a1, a21, a32, ..., z
over rational field
```
It is also possible to construct a literature model over a particular base.
Currently, this feature is only supported for toric base spaces.
```jldoctest
julia> B3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> w = torusinvariant_prime_divisors(B3)[1]
Torus-invariant, prime divisor on a normal toric variety
julia> t2 = literature_model(arxiv_id = "1109.3454", equation = "3.1", base_space = B3, defining_classes = Dict("w" => w), completeness_check = false)
Construction over concrete base may lead to singularity enhancement. Consider computing singular_loci. However, this may take time!
Global Tate model over a concrete base -- SU(5)xU(1) restricted Tate model based on arXiv paper 1109.3454 Eq. (3.1)
julia> length(singular_loci(t2))
2
```
Of course, this is also possible for Weierstrass models.
```jldoctest
julia> B2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> b = torusinvariant_prime_divisors(B2)[1]
Torus-invariant, prime divisor on a normal toric variety
julia> w = literature_model(arxiv_id = "1208.2695", equation = "B.19", base_space = B2, defining_classes = Dict("b" => b), completeness_check = false)
Construction over concrete base may lead to singularity enhancement. Consider computing singular_loci. However, this may take time!
Weierstrass model over a concrete base -- U(1) Weierstrass model based on arXiv paper 1208.2695 Eq. (B.19)
julia> length(singular_loci(w))
1
```
For convenience, we also support a simplified constructor. Instead of the meta data of the article,
this constructor accepts an integer, which specifies the position of this model in our database.
```jldoctest
julia> B2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> b = torusinvariant_prime_divisors(B2)[1]
Torus-invariant, prime divisor on a normal toric variety
julia> w = literature_model(3, base_space = B2, defining_classes = Dict("b" => b), completeness_check = false)
Construction over concrete base may lead to singularity enhancement. Consider computing singular_loci. However, this may take time!
Weierstrass model over a concrete base -- U(1) Weierstrass model based on arXiv paper 1208.2695 Eq. (B.19)
julia> length(singular_loci(w))
1
```
Similarly, also hypersurface models are supported:
```jldoctest
julia> h = literature_model(arxiv_id = "1208.2695", equation = "B.5")
Assuming that the first row of the given grading is the grading under Kbar
Hypersurface model over a not fully specified base
julia> explicit_model_sections(h)
Dict{String, MPolyRingElem} with 5 entries:
"c2" => c2
"c1" => c1
"c3" => c3
"b" => b
"c0" => c0
julia> B2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> b = torusinvariant_prime_divisors(B2)[1]
Torus-invariant, prime divisor on a normal toric variety
julia> h2 = literature_model(arxiv_id = "1208.2695", equation = "B.5", base_space = B2, defining_classes = Dict("b" => b))
Construction over concrete base may lead to singularity enhancement. Consider computing singular_loci. However, this may take time!
Hypersurface model over a concrete base
julia> hypersurface_equation_parametrization(h2)
b*w*v^2 - c0*u^4 - c1*u^3*v - c2*u^2*v^2 - c3*u*v^3 + w^2
```
"""
function literature_model(; doi::String="", arxiv_id::String="", version::String="", equation::String="", type::String="", model_parameters::Dict{String,<:Any} = Dict{String,Any}(), base_space::FTheorySpace = affine_space(NormalToricVariety, 0), model_sections::Dict{String, <:Any} = Dict{String,Any}(), defining_classes::Dict{String, <:Any} = Dict{String,Any}(), completeness_check::Bool = true)
model_dict = _find_model(doi, arxiv_id, version, equation, type)
return literature_model(model_dict; model_parameters = model_parameters, base_space = base_space, model_sections = model_sections, defining_classes = defining_classes, completeness_check = completeness_check)
end
function literature_model(k::Int; model_parameters::Dict{String,<:Any} = Dict{String,Any}(), base_space::FTheorySpace = affine_space(NormalToricVariety, 0), model_sections::Dict{String, <:Any} = Dict{String,Any}(), defining_classes::Dict{String, <:Any} = Dict{String,Any}(), completeness_check::Bool = true)
model_dict = _find_model(k)
return literature_model(model_dict; model_parameters = model_parameters, base_space = base_space, model_sections = model_sections, defining_classes = defining_classes, completeness_check = completeness_check)
end
function literature_model(model_dict::Dict{String, Any}; model_parameters::Dict{String,<:Any} = Dict{String,Any}(), base_space::FTheorySpace = affine_space(NormalToricVariety, 0), model_sections::Dict{String, <:Any} = Dict{String, Any}(), defining_classes::Dict{String, <:Any} = Dict{String, Any}(), completeness_check::Bool = true)
# (1) Deal with model parameters
if haskey(model_dict, "model_parameters")
needed_model_parameters = string.(model_dict["model_parameters"])
# Make sure the user has provided values for all the model parameters
for param in needed_model_parameters
@req (param in keys(model_parameters)) "Some model parameters not provided; the given model requires these parameters:\n $(join(needed_model_parameters, "\n "))"
end
# Function to map a function of strings over arbitrarily nested Vectors of strings
nested_string_map(f, s::String) = f(s)
nested_string_map(f, v::Vector) = map(x -> nested_string_map(f, x), v)
nested_string_map(f, a::Any) = a
for (key, val) in model_parameters
map!(x -> nested_string_map(s -> replace(s, key => string(val)), x), values(model_dict["model_data"]))
map!(x -> nested_string_map(s -> replace(s, key => string(val)), x), values(model_dict["model_descriptors"]))
map!(x -> nested_string_map(s -> replace(s, r"\(([^(),]+)\)" => dim -> string("(", Oscar.eval_poly(string.(match(r"\(([^(),]+)\)", dim).captures[1]), ZZ),")")), x), values(model_dict["model_descriptors"]))
end
end
# (2) The QSM need special treatment...
if model_dict["arxiv_data"]["id"] == "1903.00009"
# Read in the QSM-model form the database
model_dict["literature_identifier"] = "1903.00009"
k = model_parameters["k"]
qsmd_path = artifact"QSMDB"
qsm_model = load(joinpath(qsmd_path, "$k.mrdi"))
# Create the hypersurface model and set meta data attributes
model = qsm_model.hs_model
_set_all_attributes(model, model_dict, model_parameters)
# Set specialized attributes regarding the polytope
set_attribute!(model, :vertices, qsm_model.vertices)
set_attribute!(model, :poly_index, qsm_model.poly_index)
set_attribute!(model, :triang_quick, qsm_model.triang_quick)
set_attribute!(model, :max_lattice_pts_in_facet, qsm_model.max_lattice_pts_in_facet)
set_attribute!(model, :estimated_number_of_triangulations, qsm_model.estimated_number_of_triangulations)
# Set specialized attributes regarding the general geometry of the base space
set_attribute!(model, :Kbar3, qsm_model.Kbar3)
set_attribute!(model, :h11, qsm_model.h11)
set_attribute!(model, :h12, qsm_model.h12)
set_attribute!(model, :h13, qsm_model.h13)
set_attribute!(model, :h22, qsm_model.h22)
# Set specialized attributes regarding the root bundle counting
set_attribute!(model, :genus_ci, qsm_model.genus_ci)
set_attribute!(model, :degree_of_Kbar_of_tv_restricted_to_ci, qsm_model.degree_of_Kbar_of_tv_restricted_to_ci)
set_attribute!(model, :intersection_number_among_ci_cj, qsm_model.intersection_number_among_ci_cj)
set_attribute!(model, :index_facet_interior_divisors, qsm_model.index_facet_interior_divisors)
set_attribute!(model, :intersection_number_among_nontrivial_ci_cj, qsm_model.intersection_number_among_nontrivial_ci_cj)
set_attribute!(model, :dual_graph, qsm_model.dual_graph)
set_attribute!(model, :components_of_dual_graph, qsm_model.components_of_dual_graph)
set_attribute!(model, :degree_of_Kbar_of_tv_restricted_to_components_of_dual_graph, qsm_model.degree_of_Kbar_of_tv_restricted_to_components_of_dual_graph)
set_attribute!(model, :genus_of_components_of_dual_graph, qsm_model.genus_of_components_of_dual_graph)
set_attribute!(model, :simplified_dual_graph, qsm_model.simplified_dual_graph)
set_attribute!(model, :components_of_simplified_dual_graph, qsm_model.components_of_simplified_dual_graph)
set_attribute!(model, :degree_of_Kbar_of_tv_restricted_to_components_of_simplified_dual_graph, qsm_model.degree_of_Kbar_of_tv_restricted_to_components_of_simplified_dual_graph)
set_attribute!(model, :genus_of_components_of_simplified_dual_graph, qsm_model.genus_of_components_of_simplified_dual_graph)
# Finally, return the QSM model
return model
end
# (3) Construct the model over concrete or arbitrary base
if dim(base_space) > 0
# Currently, support only for toric bases
@req base_space isa NormalToricVariety "Construction of literature models over concrete bases currently limited to toric bases"
# FIXME: Append model_sections to defining_classes. This might need fixing/extending in the future...
defining_classes_provided = merge(model_sections, defining_classes)
for (key, value) in defining_classes_provided
if (value isa ToricDivisor || value isa ToricDivisorClass || value isa ToricLineBundle) == false
error("Construction of literature models over concrete bases currently requires defining classes (and model sections) to be provided as toric divisor (classes) or line bundles")
end
end
@req all(k->haskey(defining_classes_provided, k), model_dict["model_data"]["defining_classes"]) "Not all defining classes are specified"
# Is the model specific for a base dimension? If so, make consistency check
if haskey(model_dict["model_data"], "base_dim")
@req dim(base_space) == Int(model_dict["model_data"]["base_dim"]) "Model requires base dimension different from dimension of provided base"
end
# Construct the model
model = _construct_literature_model_over_concrete_base(model_dict, base_space, defining_classes_provided, completeness_check)
@vprint :FTheoryModelPrinter 0 "Construction over concrete base may lead to singularity enhancement. Consider computing singular_loci. However, this may take time!\n\n"
else
model = _construct_literature_model_over_arbitrary_base(model_dict)
end
# (4) Return the model after we set all required attributes
_set_all_attributes(model, model_dict, model_parameters)
return model
end
#######################################################
# 2. Helper function to find the specified model
#######################################################
function _find_model(doi::String, arxiv_id::String, version::String, equation::String, type::String)
@req any(s -> s != "", [doi, arxiv_id, version, equation]) "No information provided; cannot perform look-up"
file_index = JSON.parsefile(joinpath(@__DIR__, "index.json"))
candidate_files = Vector{String}()
for k in 1:length(file_index)
if all([doi == "" || get(file_index[k], "journal_doi", nothing) == doi,
arxiv_id == "" || get(file_index[k], "arxiv_id", nothing) == arxiv_id,
version == "" || get(file_index[k], "arxiv_version", nothing) == version,
equation == "" || get(file_index[k], "arxiv_equation", nothing) == equation,
type == "" || get(file_index[k], "type", nothing) == type])
push!(candidate_files, string(file_index[k]["file"]))
end
end
return _process_candidates(candidate_files)
end
function _find_model(l::Int)
@req l >= 1 "Model index must be at least 1"
file_index = JSON.parsefile(joinpath(@__DIR__, "index.json"))
candidate_files = Vector{String}()
for k in 1:length(file_index)
if get(file_index[k], "model_index", nothing) == string(l)
push!(candidate_files, string(file_index[k]["file"]))
end
end
return _process_candidates(candidate_files)
end
function _process_candidates(candidate_files::Vector{String})
@req length(candidate_files) != 0 "We could not find any models matching the given model index"
@req(length(candidate_files) == 1,
begin
dicts = map(f -> JSON.parsefile(joinpath(@__DIR__, "Models/" * f)), candidate_files)
dois = map(d -> get(d["journal_data"], "doi", nothing), dicts)
ids = map(d -> get(d["arxiv_data"], "id", nothing), dicts)
versions = map(d -> get(d["arxiv_data"], "version", nothing), dicts)
equations = map(d -> get(d["arxiv_data"]["model_location"], "equation", nothing), dicts)
types = map(d -> get(d["model_descriptors"], "type", nothing), dicts)
strings = ["doi: $(dois[i]), arxiv_id: $(ids[i]), version: $(versions[i]), equation: $(equations[i]), type: $(types[i])" for i in 1:length(dicts)]
"We could not uniquely identify the model. The matched models have the following data:\n$(reduce((s1, s2) -> s1 * "\n" * s2, strings))"
end)
model_dict = JSON.parsefile(joinpath(@__DIR__, "Models/" * candidate_files[1]))
model_dict["literature_identifier"] = candidate_files[1][6:end - 5]
return model_dict
end
#######################################################
# 3. Constructing models over concrete bases
#######################################################
# Constructs literature model over concrete base
function _construct_literature_model_over_concrete_base(model_dict::Dict{String,Any}, base_space::FTheorySpace, defining_classes::Dict{String, <:Any}, completeness_check::Bool)
# Make list and dict of the defining divisor classes
defng_cls = string.(model_dict["model_data"]["defining_classes"])
defng_cls_as_divisor_classes = [anticanonical_divisor_class(base_space)]
defining_classes_of_model = Dict("Kbar" => anticanonical_divisor_class(base_space))
for k in 1:length(defng_cls)
class_candidate = defining_classes[defng_cls[k]]
if class_candidate isa ToricDivisor || class_candidate isa ToricLineBundle
class_candidate = toric_divisor_class(class_candidate)
end
push!(defng_cls_as_divisor_classes, class_candidate)
defining_classes_of_model[defng_cls[k]] = class_candidate
end
# Find divisor classes of all sections.
@req haskey(model_dict["model_data"], "model_sections") "Database does not specify model sections for given model"
sec_names = string.(model_dict["model_data"]["model_sections"])
cfs = matrix(ZZ, transpose(hcat([[eval_poly(weight, ZZ) for weight in vec] for vec in model_dict["model_data"]["classes_of_model_sections_in_basis_of_Kbar_and_defining_classes"]]...)))
cfs = vcat([[Int(k) for k in cfs[i:i,:]] for i in 1:nrows(cfs)]...)
cl_of_secs = Dict(sec_names[k] => sum(cfs[l, k] * defng_cls_as_divisor_classes[l] for l in 1:nrows(cfs)) for k in 1:length(sec_names))
# Next, generate random values for all involved sections.
model_sections = Dict{String, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}()
for (key, value) in cl_of_secs
@req is_effective(value) "Encountered a non-effective (internal) divisor class"
if model_dict["arxiv_data"]["id"] == "1109.3454" && key == "w" && dim(base_space) == 3
if torsion_free_rank(class_group(base_space)) == 1 && degree(toric_line_bundle(cl_of_secs["w"])) == 1
model_sections[key] = basis_of_global_sections(toric_line_bundle(value))[end]
else
model_sections[key] = generic_section(toric_line_bundle(value))
end
else
model_sections[key] = generic_section(toric_line_bundle(value))
end
end
# Construct the model
auxiliary_ring, _ = polynomial_ring(QQ, sec_names, cached=false)
map = hom(auxiliary_ring, cox_ring(base_space), [model_sections[k] for k in sec_names])
if model_dict["model_descriptors"]["type"] == "tate"
# Compute Tate sections
a1 = eval_poly(get(model_dict["model_data"], "a1", "0"), auxiliary_ring)
a2 = eval_poly(get(model_dict["model_data"], "a2", "0"), auxiliary_ring)
a3 = eval_poly(get(model_dict["model_data"], "a3", "0"), auxiliary_ring)
a4 = eval_poly(get(model_dict["model_data"], "a4", "0"), auxiliary_ring)
a6 = eval_poly(get(model_dict["model_data"], "a6", "0"), auxiliary_ring)
# Compute defining model sections
model_sections["a1"] = map(a1)
model_sections["a2"] = map(a2)
model_sections["a3"] = map(a3)
model_sections["a4"] = map(a4)
model_sections["a6"] = map(a6)
# Find defining_section_parametrization
defining_section_parametrization = Dict{String, MPolyRingElem}()
if !("a1" in sec_names) || (a1 != eval_poly("a1", parent(a1)))
defining_section_parametrization["a1"] = a1
end
if !("a2" in sec_names) || (a2 != eval_poly("a2", parent(a2)))
defining_section_parametrization["a2"] = a2
end
if !("a3" in sec_names) || (a3 != eval_poly("a3", parent(a3)))
defining_section_parametrization["a3"] = a3
end
if !("a4" in sec_names) || (a4 != eval_poly("a4", parent(a4)))
defining_section_parametrization["a4"] = a4
end
if !("a6" in sec_names) || (a6 != eval_poly("a6", parent(a6)))
defining_section_parametrization["a6"] = a6
end
# Create the model
model = global_tate_model(base_space, model_sections, defining_section_parametrization; completeness_check = completeness_check)
elseif model_dict["model_descriptors"]["type"] == "weierstrass"
# Compute Weierstrass sections
f = eval_poly(get(model_dict["model_data"], "f", "0"), auxiliary_ring)
g = eval_poly(get(model_dict["model_data"], "g", "0"), auxiliary_ring)
# Compute defining model sections
model_sections["f"] = map(f)
model_sections["g"] = map(g)
# Find defining_section_parametrization
defining_section_parametrization = Dict{String, MPolyRingElem}()
if !("f" in sec_names) || (f != eval_poly("f", parent(f)))
defining_section_parametrization["f"] = f
end
if !("g" in sec_names) || (g != eval_poly("g", parent(g)))
defining_section_parametrization["g"] = g
end
# Create the model
model = weierstrass_model(base_space, model_sections, defining_section_parametrization; completeness_check = completeness_check)
elseif model_dict["model_descriptors"]["type"] == "hypersurface"
# Extract fiber ambient space
rays = [[a for a in b] for b in model_dict["model_data"]["fiber_ambient_space_rays"]]
max_cones = IncidenceMatrix([[a for a in b] for b in model_dict["model_data"]["fiber_ambient_space_max_cones"]])
fas = normal_toric_variety(max_cones, rays; non_redundant = true)
fiber_amb_coordinates = string.(model_dict["model_data"]["fiber_ambient_space_coordinates"])
set_coordinate_names(fas, fiber_amb_coordinates)
# Extract the base divisor classes of the fiber coordinates
fiber_twist_matrix = transpose(matrix(ZZ, (hcat(model_dict["model_data"]["fiber_twist_matrix"]...))))
@req ncols(fiber_twist_matrix) == length(fiber_amb_coordinates) "Number of fiber coordinate names does not match number of provided fiber gradings"
@req ncols(fiber_twist_matrix) == n_rays(fas) "Number of rays does not match number of provided fiber gradings"
fiber_twist_divisor_classes = [sum([fiber_twist_matrix[l, k] * defng_cls_as_divisor_classes[l] for l in 1:nrows(fiber_twist_matrix)]) for k in 1:ncols(fiber_twist_matrix)]
# Compute the hypersurface equation and its parametrization
auxiliary_ambient_ring, _ = polynomial_ring(QQ, vcat(sec_names, fiber_amb_coordinates), cached=false)
parametrized_hypersurface_equation = eval_poly(model_dict["model_data"]["hypersurface_equation"], auxiliary_ambient_ring)
base_coordinates = string.(gens(cox_ring(base_space)))
auxiliary_ambient_ring2, _ = polynomial_ring(QQ, vcat(base_coordinates, fiber_amb_coordinates), cached=false)
images1 = [eval_poly(string(model_sections[k]), auxiliary_ambient_ring2) for k in sec_names]
images2 = [eval_poly(string(k), auxiliary_ambient_ring2) for k in fiber_amb_coordinates]
map = hom(auxiliary_ambient_ring, auxiliary_ambient_ring2, vcat(images1, images2))
hyper_equ = map(parametrized_hypersurface_equation)
# Create the model
model = hypersurface_model(base_space, fas, fiber_twist_divisor_classes, hyper_equ; completeness_check = completeness_check)
model.hypersurface_equation_parametrization = parametrized_hypersurface_equation
else
error("Model is not a Tate, Weierstrass or hypersurface model")
end
# Set important fields and return the model
model.explicit_model_sections = model_sections
model.defining_classes = defining_classes_of_model
return model
end
#######################################################
# 4. Constructing models over arbitrary bases
#######################################################
# Constructs literature model over arbitrary base
function _construct_literature_model_over_arbitrary_base(model_dict::Dict{String,Any})
# Construct auxiliary base ring
@req haskey(model_dict["model_data"], "model_sections") "No base coordinates specified for model"
vars = string.(model_dict["model_data"]["model_sections"])
auxiliary_base_ring, _ = polynomial_ring(QQ, vars, cached=false)
# Construct the grading of the base ring
@req haskey(model_dict["model_data"], "classes_of_model_sections_in_basis_of_Kbar_and_defining_classes") "Database does not specify classes_of_model_sections_in_basis_of_Kbar_and_defining_classes, but is vital for model constrution, so cannot proceed"
auxiliary_base_grading = matrix(ZZ, transpose(hcat([[eval_poly(weight, ZZ) for weight in vec] for vec in model_dict["model_data"]["classes_of_model_sections_in_basis_of_Kbar_and_defining_classes"]]...)))
auxiliary_base_grading = vcat([[Int(k) for k in auxiliary_base_grading[i:i,:]] for i in 1:nrows(auxiliary_base_grading)]...)
base_dim = get(model_dict["model_data"], "base_dim", 3)
# Construct the model
if model_dict["model_descriptors"]["type"] == "tate"
a1 = eval_poly(get(model_dict["model_data"], "a1", "0"), auxiliary_base_ring)
a2 = eval_poly(get(model_dict["model_data"], "a2", "0"), auxiliary_base_ring)
a3 = eval_poly(get(model_dict["model_data"], "a3", "0"), auxiliary_base_ring)
a4 = eval_poly(get(model_dict["model_data"], "a4", "0"), auxiliary_base_ring)
a6 = eval_poly(get(model_dict["model_data"], "a6", "0"), auxiliary_base_ring)
model = global_tate_model(auxiliary_base_ring, auxiliary_base_grading, base_dim, [a1, a2, a3, a4, a6])
elseif model_dict["model_descriptors"]["type"] == "weierstrass"
f = eval_poly(get(model_dict["model_data"], "f", "0"), auxiliary_base_ring)
g = eval_poly(get(model_dict["model_data"], "g", "0"), auxiliary_base_ring)
model = weierstrass_model(auxiliary_base_ring, auxiliary_base_grading, base_dim, f, g)
elseif model_dict["model_descriptors"]["type"] == "hypersurface"
# Extract base variable names
auxiliary_base_vars = [string(g) for g in gens(auxiliary_base_ring)]
# Extract fiber ambient space
rays = [[a for a in b] for b in model_dict["model_data"]["fiber_ambient_space_rays"]]
max_cones = IncidenceMatrix([[a for a in b] for b in model_dict["model_data"]["fiber_ambient_space_max_cones"]])
fas = normal_toric_variety(max_cones, rays; non_redundant = true)
fiber_amb_coordinates = string.(model_dict["model_data"]["fiber_ambient_space_coordinates"])
set_coordinate_names(fas, fiber_amb_coordinates)
# Extract the base divisor classes of the fiber coordinates
fiber_twist_matrix = transpose(matrix(ZZ, (hcat(model_dict["model_data"]["fiber_twist_matrix"]...))))
@req ncols(fiber_twist_matrix) == length(fiber_amb_coordinates) "Number of fiber coordinate names does not match number of provided fiber gradings"
@req ncols(fiber_twist_matrix) == n_rays(fas) "Number of rays does not match number of provided fiber gradings"
# Extract the hypersurface equation
ambient_ring, _ = polynomial_ring(QQ, vcat(auxiliary_base_vars, fiber_amb_coordinates), cached = false)
p = eval_poly(model_dict["model_data"]["hypersurface_equation"], ambient_ring)
# Create the model
model = hypersurface_model(auxiliary_base_vars, auxiliary_base_grading, base_dim, fas, fiber_twist_matrix, p)
else
@req false "Model is not a Tate, Weierstrass or hypersurface model"
end
return model
end
#######################################################
# 5. Functions for settings attributes of models
#######################################################
function _set_all_attributes(model::AbstractFTheoryModel, model_dict::Dict{String, Any}, model_parameters::Dict{String,<:Any})
set_attribute!(model, :partially_resolved, false)
set_literature_identifier(model, model_dict["literature_identifier"])
set_model_description(model, model_dict["model_descriptors"]["description"])
set_paper_authors(model, string.(model_dict["paper_metadata"]["authors"]))
set_paper_buzzwords(model, string.(model_dict["paper_metadata"]["buzzwords"]))
set_paper_description(model, model_dict["paper_metadata"]["description"])
set_paper_title(model, model_dict["paper_metadata"]["title"])
set_arxiv_doi(model, model_dict["arxiv_data"]["doi"])
set_arxiv_link(model, model_dict["arxiv_data"]["link"])
set_arxiv_id(model, model_dict["arxiv_data"]["id"])
set_arxiv_version(model, model_dict["arxiv_data"]["version"])
set_arxiv_model_equation_number(model, model_dict["arxiv_data"]["model_location"]["equation"])
set_arxiv_model_page(model, model_dict["arxiv_data"]["model_location"]["page"])
set_arxiv_model_section(model, model_dict["arxiv_data"]["model_location"]["section"])
set_journal_doi(model, model_dict["journal_data"]["doi"])
set_journal_link(model, model_dict["journal_data"]["link"])
set_journal_year(model, model_dict["journal_data"]["year"])
set_journal_volume(model, model_dict["journal_data"]["volume"])
set_journal_name(model, model_dict["journal_data"]["journal"])
if haskey(model_dict["journal_data"], "report_numbers")
set_journal_report_numbers(model, string.(model_dict["journal_data"]["report_numbers"]))
end
set_journal_pages(model, model_dict["journal_data"]["pages"])
set_journal_model_equation_number(model, model_dict["journal_data"]["model_location"]["equation"])
set_journal_model_page(model, model_dict["journal_data"]["model_location"]["page"])
set_journal_model_section(model, model_dict["journal_data"]["model_location"]["section"])
if haskey(model_dict, "related_models")
set_attribute!(model, :related_literature_models => [str[6:end - 5] for str in model_dict["related_models"]])
end
if haskey(model_dict, "associated_models")
set_attribute!(model, :associated_literature_models => [str[6:end - 5] for str in model_dict["associated_models"]])
end
if haskey(model_dict, "model_parameters")
set_attribute!(model, :model_parameters => model_parameters)
end
if haskey(model_dict["model_data"], "resolutions")
set_resolutions(model, [[[string.(c) for c in r[1]], string.(r[2])] for r in model_dict["model_data"]["resolutions"]])
end
if haskey(model_dict["model_data"], "resolution_generating_sections")
value = [[[string.(k) for k in sec] for sec in res] for res in model_dict["model_data"]["resolution_generating_sections"]]
set_resolution_generating_sections(model, value)
end
if haskey(model_dict["model_data"], "resolution_zero_sections")
set_resolution_zero_sections(model, [[string.(a) for a in b] for b in model_dict["model_data"]["resolution_zero_sections"]])
end
if haskey(model_dict["model_data"], "weighted_resolutions")
set_weighted_resolutions(model, [[[[string.(c[1]), c[2]] for c in r[1]], string.(r[2])] for r in model_dict["model_data"]["weighted_resolutions"]])
end
if haskey(model_dict["model_data"], "weighted_resolution_generating_sections")
value = [[[string.(k) for k in sec] for sec in res] for res in model_dict["model_data"]["weighted_resolution_generating_sections"]]
set_weighted_resolution_generating_sections(model, value)
end
if haskey(model_dict["model_data"], "weighted_resolution_zero_sections")
set_weighted_resolution_zero_sections(model, [[string.(a) for a in b] for b in model_dict["model_data"]["weighted_resolution_zero_sections"]])
end
if haskey(model_dict["model_data"], "zero_section")
set_zero_section(model, string.(model_dict["model_data"]["zero_section"]))
end
if haskey(model_dict["model_data"], "generating_sections")
set_generating_sections(model, map(k -> string.(k), model_dict["model_data"]["generating_sections"]))
end
if haskey(model_dict["model_data"], "torsion_sections")
set_torsion_sections(model, map(k -> string.(k), model_dict["model_data"]["torsion_sections"]))
end
if haskey(model_dict["model_descriptors"], "gauge_algebra")
set_gauge_algebra(model, string.(model_dict["model_descriptors"]["gauge_algebra"]))
end
if haskey(model_dict["model_descriptors"], "global_gauge_quotients")
set_global_gauge_quotients(model, map(k -> string.(k), model_dict["model_descriptors"]["global_gauge_quotients"]))
end
end
#######################################################
# 6. Function to display all known literature models
#######################################################
function display_all_literature_models()
file_index = JSON.parsefile(joinpath(@__DIR__, "index.json"))
sorted_dicts = sort(file_index, by = x -> parse(Int, x["model_index"]))
for dict in sorted_dicts
print("Model $(dict["model_index"]):\n")
print(dict)
print("\n\n")
end
end