Repository navigation
Expand file tree
/
Copy pathprocess.json
More file actions
793 lines (793 loc) · 232 KB
/
Copy pathprocess.json
File metadata and controls
793 lines (793 loc) · 232 KB
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
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
{
"runs": [
{
"runId": "3d756a48-406d-4bb5-ae63-d1dc0d96141c",
"phase": "prepared",
"resultStatus": "prepared",
"turns": 0,
"workers": 4,
"tasks": [
{
"id": "initial_goal_1",
"theorem": "OAI.IsingPerceptron.variationalValue_real_of_continuous",
"objective": "Prove the frozen original target OAI.IsingPerceptron.variationalValue_real_of_continuous; use researcher findings as advisory guidance.",
"status": "pending",
"attempts": 0,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_1",
"objective": "Investigate proof routes and difficult library connections for OAI.IsingPerceptron.variationalValue_real_of_continuous. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "pending",
"attempts": 0,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_2",
"objective": "Investigate proof routes and difficult library connections for the original targets. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "pending",
"attempts": 0,
"dependencies": [],
"receiptIds": []
}
],
"lemmaRequests": [],
"events": [],
"checks": [],
"deliveries": [
{
"id": "7e849e30-2d66-4d31-ab6e-4ca98a16bb68",
"at": "2026-10-28T06:24:28.094Z",
"kind": "research",
"status": "advisory",
"taskId": "initial_goal_1",
"workerId": "researcher-1",
"role": "researcher",
"commit": "7b74425f06e5cb2b2ccc81e7561db573f97193c8",
"summary": "The target remains unproved, but the Gaussian analytic core is now Lean-checked in the scratch source generated/problem/.scratch[local file] (exit 0): the Gaussian mgf specialization, constant integral, integrability of cosh(x+sqrt(s)z), the exact identity integral cosh(x+sqrt(s)z) = cosh(x)*exp(s/2) for s>=0, and the log-cosh upper bound. The remaining reductions are: (1) the two-branch single-step bound for gaussianTransform for 0<=d<=1, with the d>0 branch using concavity of t^d and Jensen; (2) the finite List.foldr telescoping invariant giving fieldRecursion h <= 0 for every FieldStep; (3) entropy nonnegativity from the zero one-level FieldStep and isingEntropy of the zero AEEqFun path being zero; (4) uniformPattern range preservation in [-K,K], the fixed Filter.limUnder fallback lower bound, and the EReal infimum assembly. No helper has yet been committed into Submission.lean, whose final theorem still has the seed sorry. The earlier research event was rejected only for lemmaRequests validity; this corrected finding omits lemmaRequests and records replacesReceipt."
}
]
},
{
"runId": "dda473fa-7e7d-41e7-b8e9-903a12c94113",
"startedAt": "2026-10-27T13:48:19.748Z",
"finishedAt": "2026-10-27T16:28:51.109Z",
"phase": "finished",
"resultStatus": "runtime_error",
"turns": 6,
"workers": 4,
"tasks": [
{
"id": "initial_goal_1",
"theorem": "OAI.IsingPerceptron.variationalValue_real_of_continuous",
"objective": "Prove the frozen original target OAI.IsingPerceptron.variationalValue_real_of_continuous; use researcher findings as advisory guidance.",
"status": "pending",
"attempts": 1,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_1",
"objective": "Investigate proof routes and difficult library connections for OAI.IsingPerceptron.variationalValue_real_of_continuous. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "pending",
"attempts": 0,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_2",
"objective": "Investigate proof routes and difficult library connections for the original targets. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "blocked",
"attempts": 3,
"dependencies": [],
"receiptIds": []
}
],
"events": [
{
"at": "2026-10-27T13:48:19.782Z",
"kind": "baseline",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-10-27T13:50:20.117Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-10-27T14:04:20.672Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
}
],
"checks": [],
"deliveries": [
{
"id": "d243a5d6-53a0-4860-9dbf-ca271684b783",
"at": "2026-10-27T13:50:20.112Z",
"kind": "progress",
"status": "advisory",
"workerId": "solver",
"role": "lead",
"commit": "1f6a9c7ae33189c68cb49708327d25703a085ac6",
"summary": "Saved Lead draft pending integration: math_math-plan_missing_or_too_large. Inspect git show 1f6a9c7ae33189c68cb49708327d25703a085ac6:PROJECT_RELATIVE_PATH and reapply the useful declarations against the current canonical sources. This draft has no proof acceptance."
},
{
"id": "516f8f1c-9855-4f6f-8f40-0ebda422b723",
"at": "2026-10-27T14:04:20.669Z",
"kind": "failure",
"status": "failed",
"taskId": "initial_research_2",
"workerId": "researcher-2",
"role": "researcher",
"commit": "1f6a9c7ae33189c68cb49708327d25703a085ac6",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
}
]
},
{
"runId": "77fb44b8-8230-4a75-b882-04372b717f89",
"startedAt": "2026-10-28T04:43:13.757Z",
"finishedAt": "2026-10-28T07:11:38.282Z",
"phase": "finished",
"resultStatus": "limit_reached",
"turns": 9,
"workers": 4,
"tasks": [
{
"id": "initial_goal_1",
"theorem": "OAI.IsingPerceptron.variationalValue_real_of_continuous",
"objective": "Prove the frozen original target OAI.IsingPerceptron.variationalValue_real_of_continuous; use researcher findings as advisory guidance.",
"status": "pending",
"attempts": 3,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_1",
"objective": "Investigate proof routes and difficult library connections for OAI.IsingPerceptron.variationalValue_real_of_continuous. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "pending",
"attempts": 0,
"dependencies": [],
"receiptIds": []
},
{
"id": "initial_research_2",
"objective": "Investigate proof routes and difficult library connections for the original targets. Report concrete evidence and unresolved gaps; findings are advisory.",
"status": "blocked",
"attempts": 3,
"dependencies": [],
"receiptIds": []
}
],
"lemmaRequests": [],
"knowledgeApplications": [],
"events": [
{
"at": "2026-10-28T04:43:13.763Z",
"kind": "baseline",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-10-28T04:51:14.519Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
}
],
"checks": [],
"deliveries": [
{
"id": "700a900a-6224-442c-a36e-f70cf4e7b59d",
"at": "2026-10-28T04:51:14.516Z",
"kind": "failure",
"status": "failed",
"taskId": "initial_research_2",
"workerId": "researcher-2",
"role": "researcher",
"commit": "1f6a9c7ae33189c68cb49708327d25703a085ac6",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "7e849e30-2d66-4d31-ab6e-4ca98a16bb68",
"at": "2026-10-28T06:24:28.094Z",
"kind": "research",
"status": "conditional",
"taskId": "initial_goal_1",
"workerId": "researcher-1",
"role": "researcher",
"commit": "7b74425f06e5cb2b2ccc81e7561db573f97193c8",
"summary": "The target remains unproved, but the Gaussian analytic core is now Lean-checked in the scratch source generated/problem/.scratch[local file] (exit 0): the Gaussian mgf specialization, constant integral, integrability of cosh(x+sqrt(s)z), the exact identity integral cosh(x+sqrt(s)z) = cosh(x)*exp(s/2) for s>=0, and the log-cosh upper bound. The remaining reductions are: (1) the two-branch single-step bound for gaussianTransform for 0<=d<=1, with the d>0 branch using concavity of t^d and Jensen; (2) the finite List.foldr telescoping invariant giving fieldRecursion h <= 0 for every FieldStep; (3) entropy nonnegativity from the zero one-level FieldStep and isingEntropy of the zero AEEqFun path being zero; (4) uniformPattern range preservation in [-K,K], the fixed Filter.limUnder fallback lower bound, and the EReal infimum assembly. No helper has yet been committed into Submission.lean, whose final theorem still has the seed sorry. The earlier research event was rejected only for lemmaRequests validity; this corrected finding omits lemmaRequests and records replacesReceipt."
}
]
},
{
"runId": "f5737ab7-9d8d-4789-a18d-10cc5e6f7c6b",
"startedAt": "2026-11-04T17:10:00.238Z",
"finishedAt": "2026-11-04T19:46:07.240Z",
"phase": "finished",
"resultStatus": "evaluated_passed",
"turns": 54,
"workers": 4,
"tasks": [
{
"id": "gaussian-transform-bound",
"theorem": "OAI.IsingPerceptron.gaussianTransform_abs_le",
"objective": "Prove the elementary Gaussian-transform estimate: for any s, d, K and continuous U with |U x| ≤ K for all x, one has |gaussianTransform s d U x| ≤ K for all x. First handle d = 0 by integrating the pointwise bound against the probability measure gaussianReal 0 1; for d ≠ 0 bound exp(d U) between exp(-|d|K) and exp(|d|K), integrate, apply log and divide. Consumer: uniformPattern-bound, which applies this inductively along the foldr defining uniformPattern.",
"status": "integrated",
"attempts": 1,
"dependencies": [],
"proofCommit": "875a8ab34b73620cfca8f3e4d4eb869456cd5cb1",
"checkStatus": "kernel_verified",
"receiptIds": [
"lean-8a93af417b82c9296bc5e5cc"
]
},
{
"id": "uniformPattern-bound",
"theorem": "OAI.IsingPerceptron.uniformPattern_abs_le",
"objective": "Prove that every finite uniform pattern is uniformly bounded: if f is continuous and |f x| ≤ K for all x, then |uniformPattern f q n| ≤ K for every overlap path q and every n. Unfold the List.ofFn/foldr and use the gaussianTransform bound at each of the n+1 fold steps; the values supplied as transform parameters need no sign restriction for this estimate. Consumer: the lower bound -K for patternFunctional in the original goal.",
"status": "integrated",
"attempts": 1,
"dependencies": [
"gaussian-transform-bound"
],
"proofCommit": "43433e934da8036077fcc60945457981ff03d4d4",
"checkStatus": "kernel_verified",
"receiptIds": [
"lean-5f707133c77edecd3f4144d7"
]
},
{
"id": "entropy-nonneg",
"theorem": "OAI.IsingPerceptron.isingEntropy_nonneg",
"objective": "Show that isingEntropy q is nonnegative in EReal for every overlap path q. Construct the one-level FieldStep with partition cut (0,1) and value 0; verify fieldRecursion is 0 (the only transform has parameters s = 0 and d = 0, and the base is log cosh at 0) and stepFunction is identically 0. Use the supremum introduction inequality for the corresponding EReal summand. Consumer: the finite lower bound for variationalValue in the original goal.",
"status": "integrated",
"attempts": 1,
"dependencies": [],
"proofCommit": "0b5d16efe0f202b1e37c1de20e20badde7a6132c",
"checkStatus": "kernel_verified",
"receiptIds": [
"lean-f1dd86a32f66d2e03258165b"
]
},
{
"id": "goal",
"theorem": "OAI.IsingPerceptron.variationalValue_real_of_continuous",
"objective": "Prove the original finiteness theorem: for α ≥ 0 and continuous bounded f there is a real p with variationalValue α f = (p : EReal). Intended inference: combine the uniform lower bound -α K from uniformPattern-bound and entropy-nonneg with a finite upper witness supplied by field-recursion-upper and zero-path-upper, then invoke the EReal finite-infimum bridge from erreal-finite-inf. First reducer: isolate the lower-bound and upper-witness obligations inside EReal; consumer is the frozen declaration OAI.IsingPerceptron.variationalValue_real_of_continuous.",
"status": "integrated",
"attempts": 4,
"dependencies": [],
"proofCommit": "b0cf5b6cfbbbe17a8008dfcb49462d75ded342e4",
"checkStatus": "kernel_verified",
"receiptIds": [
"lean-ca2fc5c8b834be185c3da5b3"
]
},
{
"id": "field-recursion-upper",
"objective": "Resolve the central open estimate: find a real C with fieldRecursion h ≤ C for every FieldStep h, or prove directly that isingEntropy vanishes/finishes finitely at the constant-zero overlap path. Start by testing the invariant bound for k = 1 and k = 2, including large values and many small increments, and try to propagate a log cosh/Gaussian-convolution inequality through the foldr. If the uniform bound is false, produce a concrete obstruction and identify a different admissible overlap path giving a finite upper witness. Deliver exact Lean propositions and a proof outline, not only prose; consumer is the upper-bound half of goal.",
"status": "blocked",
"attempts": 4,
"dependencies": [],
"receiptIds": []
},
{
"id": "limunder-pattern",
"objective": "Determine the exact Mathlib meaning and API of Filter.limUnder atTop for real sequences. Prove or locate a reusable lemma that a sequence bounded in absolute value by K has |Filter.limUnder atTop u| ≤ K and is finite, then apply it to uniformPattern f q to obtain the uniform patternFunctional lower bound. Return exact Lean statement and proof route; consumer is the lower-bound half of goal and the consumer uniformPattern-bound.",
"status": "blocked",
"attempts": 3,
"dependencies": [],
"receiptIds": []
},
{
"id": "erreal-finite-inf",
"objective": "Establish the EReal lattice bridge needed to turn lower and upper real bounds into a real coercion: for a nonempty set of EReal values bounded below by a finite real and containing one element bounded above by a finite real, its iInf is (p : EReal) for some real p. Work out the exact coercion, bot/top, iInf and addition lemmas and the application to variationalValue α f. Return an exact Lean type and proof; consumer is goal.",
"status": "blocked",
"attempts": 5,
"dependencies": [],
"receiptIds": []
},
{
"id": "zero-path-upper",
"objective": "Construct the constant-zero OverlapPath in the frozen AEEqFun/measure notation and prove the two consequences needed above: its integral against stepFunction h is zero for every FieldStep h, and its patternFunctional is bounded above by K when |f| ≤ K. Combine with field-recursion-upper to obtain a finite upper bound for the corresponding variational summand. Return exact helper declarations and a Lean proof sketch; consumer is the upper-bound half of goal.",
"status": "blocked",
"attempts": 11,
"dependencies": [],
"receiptIds": []
},
{
"id": "capacity_14f74f105482dc829dfc7a7ed138f119c4d554e2",
"objective": "Capacity exploration (decomposition) for consumer goal: OAI.IsingPerceptron.variationalValue_real_of_continuous.\nConsumer file: Submission.lean. Use the frozen original goal declaration supplied in the mandatory problem context.\nFind an independent decomposition of this consumer into a small dependency DAG of exact typed obligations. Give the closing derivation back to the consumer and distinguish new obligations from work already in flight.\nRead the consumer and its declared inputs, including existing findings and in-flight work, before choosing an approach. Keep the original problem and consumer statement fixed. Do not repeat an existing investigation. Lean scratch experiments outside owned Lean sources are permitted. Deliver advisory findings only in RESEARCH.md; do not change owned Lean files. State the concrete result, reproducible probe commands and outcomes, remaining gaps, and how the result would be used by this exact consumer. If a new proof obligation is justified, publish precise lemmaRequests with full closed Lean types, premises and existing input dependencies in this group. Explain the application to the consumer, without assuming the unresolved consumer as a premise of its own helper. Do not claim a proposed lemma or scratch experiment is an accepted proof. If this focus yields no useful step, report that outcome with evidence and stop.",
"status": "blocked",
"attempts": 5,
"dependencies": [
"goal"
],
"receiptIds": []
},
{
"id": "capacity_e5d6ceff6fb1100881c2c54c3a93284f7c3cdaa8",
"objective": "Capacity exploration (construction) for consumer goal: OAI.IsingPerceptron.variationalValue_real_of_continuous.\nConsumer file: Submission.lean. Use the frozen original goal declaration supplied in the mandatory problem context.\nExplore a concrete construction or witness for this consumer. Give explicit definitions and a candidate argument, use small Lean scratch probes for uncertain steps, and identify the precise remaining proof obligation.\nRead the consumer and its declared inputs, including existing findings and in-flight work, before choosing an approach. Keep the original problem and consumer statement fixed. Do not repeat an existing investigation. Lean scratch experiments outside owned Lean sources are permitted. Deliver advisory findings only in RESEARCH.md; do not change owned Lean files. State the concrete result, reproducible probe commands and outcomes, remaining gaps, and how the result would be used by this exact consumer. If a new proof obligation is justified, publish precise lemmaRequests with full closed Lean types, premises and existing input dependencies in this group. Explain the application to the consumer, without assuming the unresolved consumer as a premise of its own helper. Do not claim a proposed lemma or scratch experiment is an accepted proof. If this focus yields no useful step, report that outcome with evidence and stop.",
"status": "blocked",
"attempts": 4,
"dependencies": [
"goal"
],
"receiptIds": []
}
],
"lemmaRequests": [
{
"deliveryId": "1d5aedb1-6c43-4047-be6f-64c19838b9e8",
"deliveryStatus": "conditional",
"id": "ereal-iinf-eq-coe-of-bounds",
"objective": "Prove the EReal squeeze lemma: if a real-coerced lower bound bounds every value of a family f : ι → EReal and one distinguished value is bounded above by a real coercion, then the iInf of f is the coercion of a real. First Lean step: squeeze a ≤ iInf ≤ b via le_iInf and iInf_le, exclude ⊥ and ⊤ using EReal.coe_ne_bot and EReal.coe_lt_top, then use EReal.coe_toReal. Intended consumer: the goal glue lemma variationalValue_real_of_continuous, where f q = α*patternFunctional f q + isingEntropy q and i0 is the constant-zero overlap path; remaining premises are the patternFunctional limUnder bound and the finite entropy upper bound.",
"theorem": "OAI.IsingPerceptron.ereal_iInf_eq_coe_of_bounds",
"type": "∀ {ι : Type*} (f : ι → EReal) (i0 : ι) {a b : ℝ}, (∀ i, (a : EReal) ≤ f i) → f i0 ≤ (b : EReal) → ∃ p : ℝ, (⨅ i, f i) = (p : EReal)",
"proofPath": "Submission.lean",
"dependencies": []
},
{
"deliveryId": "1d5aedb1-6c43-4047-be6f-64c19838b9e8",
"deliveryStatus": "conditional",
"id": "ereal-iinf-coe-of-bounds",
"objective": "Nonempty-family corollary of the EReal squeeze lemma: a nonempty family of EReal values bounded below by a real coercion and containing one element bounded above by a real coercion has an iInf equal to a real coercion. First Lean step: obtain the index from the existential upper bound and apply ereal_iInf_eq_coe_of_bounds. Intended consumer: goal, same instantiation at the zero overlap path; remaining premises unchanged (patternFunctional limUnder bound, finite fieldRecursion upper bound).",
"theorem": "OAI.IsingPerceptron.ereal_iInf_coe_of_bounds",
"type": "∀ {ι : Type*} [Nonempty ι] (f : ι → EReal) {a b : ℝ}, (∀ i, (a : EReal) ≤ f i) → (∃ i, f i ≤ (b : EReal)) → ∃ p : ℝ, (⨅ i, f i) = (p : EReal)",
"proofPath": "Submission.lean",
"dependencies": [
"ereal-iinf-eq-coe-of-bounds"
]
}
],
"knowledgeApplications": [],
"review": {
"status": "accepted",
"summary": "Reviewed the fixed candidate at seedCommit 833f10564c8bc1acd816da3226c6b207556bb4be. generated/problem/Submission.lean (941 lines, sha256 9ae908672b96f937d19b4b2f6b74aa1952a57184e264e1a08c9a0bc847c2775a) is byte-identical to that commit's file; all fourteen frozen source declarations (eleven def/theorem declarations and three structures) occur in the frozen order with unchanged headers and definition bodies, and the only deleted original source lines are the seed's `sorry` proof line and its following blank separator. The trusted Challenge.lean, toolchain, lakefile, lake-manifest and all frozen Library files are untouched (matching their recorded digests). Lean evidence: the host command `math.ts check-lean --workspace .../generated/problem --file Submission.lean --timeout-seconds 0` exited 0; the only messages are linter warnings (unused variables and deprecated if_pos/if_neg), with sourceDigest c13d1cd1d841f8bcc551ffbda37ad2e16087cb849fcf3c1ef4e08c6f9045bb36 and environmentDigest 3aee7d8750d45432845074e60dc52d89dbd2909560166aab8476a10af399da66. A `#print axioms` probe reports for OAI.IsingPerceptron.variationalValue_real_of_continuous, fieldRecursion_le_zero, limUnder_bounds and ereal_iInf_eq_coe_of_bounds exactly [propext, Classical.choice, Quot.sound]; there is no sorryAx. `rg` finds no sorry, admit, native_decide, unsafe, axiom, partial, implemented_by or extern in the owned file. The exact frozen target type, confirmed by `#check` and `#print`, is: forall {alpha : Real}, 0 <= alpha -> forall {f : Real -> Real}, Continuous f -> (exists K, forall x, |f x| <= K) -> exists p : Real, variationalValue alpha f = (p : EReal). Current checked argument: (1) gaussianTransform_abs_le_of_bound and foldr_gaussianTransform_abs_le carry a uniform absolute bound K through the List.foldr defining uniformPattern, giving uniformPattern_abs_le; (2) limUnder_bounds uses Tendsto.limUnder_eq for convergent real sequences and limUnder_of_not_tendsto otherwise to squeeze Filter.limUnder atTop u between min (-K) c and max K c (c := Classical.choice (inferInstance : Nonempty Real)); (3) isingEntropy_nonneg is witnessed by the explicit one-level FieldStep with zero value, whose fieldRecursion and stepFunction are both zero; (4) fold_gaussianTransform_bounds, jensen_step_pos, integral_cosh_gaussianReal and integral_le_log_integral_exp prove the fold invariant for pairs (s,d) with s >= 0 and 0 <= d <= 1 and base log(cosh x) - W/2, and sum_increments_eq telescopes the increments to W = stepAt h (levels-1), yielding fieldRecursion_le_zero; (5) zeroPath is AEEqFun.const Real 0, zeroPath_integral kills the interaction term, and isingEntropy_zeroPath_le_zero combines with isingEntropy_nonneg to give isingEntropy zeroPath = 0; (6) ereal_iInf_eq_coe_of_bounds squeezes the EReal iInf between two real coercions, excludes bot and top using EReal.coe_ne_bot and EReal.coe_lt_top, and reconstructs it with EReal.coe_toReal; (7) the final proof takes the lower bound alpha * min (-K) c…"
},
"events": [
{
"at": "2026-11-01T06:10:37.437Z",
"kind": "baseline",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:24:42.279Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:34:05.940Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:34:32.718Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:38:33.485Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:38:57.985Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:50:48.857Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:51:13.884Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T06:58:09.803Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T07:16:38.336Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T07:22:25.430Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-01T07:57:40.522Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-04T17:10:24.162Z",
"kind": "lean-check",
"taskId": "gaussian-transform-bound",
"status": "kernel_verified"
},
{
"at": "2026-11-04T17:10:24.162Z",
"kind": "lean-check",
"taskId": "uniformPattern-bound",
"status": "kernel_verified"
},
{
"at": "2026-11-04T17:10:24.162Z",
"kind": "lean-check",
"taskId": "entropy-nonneg",
"status": "kernel_verified"
},
{
"at": "2026-11-04T17:10:25.016Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-04T19:01:44.119Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
},
{
"at": "2026-11-04T19:02:14.625Z",
"kind": "lean-check",
"taskId": "goal",
"status": "kernel_verified"
},
{
"at": "2026-11-04T19:02:15.145Z",
"kind": "transition",
"status": "not-assessed",
"message": ""
}
],
"checks": [
{
"id": "check-486f623e73a7468a26a4",
"at": "2026-11-01T06:34:05.530Z",
"scope": "task",
"taskId": "gaussian-transform-bound",
"commit": "9aa3fc5cc2afd254f1d48c0feea067997f9ceef1",
"status": "kernel_verified",
"receiptIds": [
"lean-db9301b5fce1b30750357119"
],
"diagnostics": "OAI.IsingPerceptron.gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U) (hUK : ∀ (x : ℝ), |U x| ≤ K)\n (x : ℝ) : |OAI.IsingPerceptron.gaussianTransform s d U x| ≤ K\n'OAI.IsingPerceptron.gaussianTransform_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "bcd20f220fc7ccf2c21044631f77254cf053723889562f1784f2a62f2bb14837"
},
{
"id": "check-0bf3a5a34ee5ec06bf29",
"at": "2026-11-01T06:38:33.081Z",
"scope": "task",
"taskId": "entropy-nonneg",
"commit": "d29bf10396c04c9a179f3c34db06821da7f0f052",
"status": "kernel_verified",
"receiptIds": [
"lean-671955fc7068b01c2645454d"
],
"diagnostics": "OAI.IsingPerceptron.isingEntropy_nonneg (q : OAI.IsingPerceptron.OverlapPath) : 0 ≤ OAI.IsingPerceptron.isingEntropy q\n'OAI.IsingPerceptron.isingEntropy_nonneg' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "b1846c1eed10e98b82947b8d3879a3db348db104a2c29b61f75a75da1d4124a0"
},
{
"id": "check-aceb9e49a7fd7c675064",
"at": "2026-11-01T06:50:48.457Z",
"scope": "task",
"taskId": "uniformPattern-bound",
"commit": "841f52cc5d0aefb62c24d68c65f9dad0a1c02147",
"status": "kernel_verified",
"receiptIds": [
"lean-de112387c7acc84e9a4622b4"
],
"diagnostics": "OAI.IsingPerceptron.uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f) (hK : ∀ (x : ℝ), |f x| ≤ K)\n (q : OAI.IsingPerceptron.OverlapPath) (n : ℕ) : |OAI.IsingPerceptron.uniformPattern f q n| ≤ K\n'OAI.IsingPerceptron.uniformPattern_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "fd7dc5c188c4a286c2ac17dcd04843d699f4b43941c4a93170438097a93064d3"
},
{
"id": "check-123ec2c49d88aa702208",
"at": "2026-11-04T17:10:24.162Z",
"scope": "task",
"taskId": "uniformPattern-bound",
"commit": "966ef5fa80fe45864eb22b69a1d83e053a393f6a",
"status": "kernel_verified",
"receiptIds": [
"lean-5f707133c77edecd3f4144d7"
],
"diagnostics": "OAI.IsingPerceptron.gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U) (hUK : ∀ (x : ℝ), |U x| ≤ K)\n (x : ℝ) : |OAI.IsingPerceptron.gaussianTransform s d U x| ≤ K\n'OAI.IsingPerceptron.gaussianTransform_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f) (hK : ∀ (x : ℝ), |f x| ≤ K)\n (q : OAI.IsingPerceptron.OverlapPath) (n : ℕ) : |OAI.IsingPerceptron.uniformPattern f q n| ≤ K\n'OAI.IsingPerceptron.uniformPattern_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.isingEntropy_nonneg (q : OAI.IsingPerceptron.OverlapPath) : 0 ≤ OAI.IsingPerceptron.isingEntropy q\n'OAI.IsingPerceptron.isingEntropy_nonneg' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "7ee9bc6ec26cc765ad147487e2dfb5b72806ef9469a46dcadd73f5c448711e7b"
},
{
"id": "check-146f6a82d40e0b078410",
"at": "2026-11-04T17:10:24.162Z",
"scope": "task",
"taskId": "gaussian-transform-bound",
"commit": "966ef5fa80fe45864eb22b69a1d83e053a393f6a",
"status": "kernel_verified",
"receiptIds": [
"lean-8a93af417b82c9296bc5e5cc"
],
"diagnostics": "OAI.IsingPerceptron.gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U) (hUK : ∀ (x : ℝ), |U x| ≤ K)\n (x : ℝ) : |OAI.IsingPerceptron.gaussianTransform s d U x| ≤ K\n'OAI.IsingPerceptron.gaussianTransform_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f) (hK : ∀ (x : ℝ), |f x| ≤ K)\n (q : OAI.IsingPerceptron.OverlapPath) (n : ℕ) : |OAI.IsingPerceptron.uniformPattern f q n| ≤ K\n'OAI.IsingPerceptron.uniformPattern_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.isingEntropy_nonneg (q : OAI.IsingPerceptron.OverlapPath) : 0 ≤ OAI.IsingPerceptron.isingEntropy q\n'OAI.IsingPerceptron.isingEntropy_nonneg' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "7ee9bc6ec26cc765ad147487e2dfb5b72806ef9469a46dcadd73f5c448711e7b"
},
{
"id": "check-c29a295b73a0bd8dfeef",
"at": "2026-11-04T17:10:24.162Z",
"scope": "task",
"taskId": "entropy-nonneg",
"commit": "966ef5fa80fe45864eb22b69a1d83e053a393f6a",
"status": "kernel_verified",
"receiptIds": [
"lean-f1dd86a32f66d2e03258165b"
],
"diagnostics": "OAI.IsingPerceptron.gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U) (hUK : ∀ (x : ℝ), |U x| ≤ K)\n (x : ℝ) : |OAI.IsingPerceptron.gaussianTransform s d U x| ≤ K\n'OAI.IsingPerceptron.gaussianTransform_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f) (hK : ∀ (x : ℝ), |f x| ≤ K)\n (q : OAI.IsingPerceptron.OverlapPath) (n : ℕ) : |OAI.IsingPerceptron.uniformPattern f q n| ≤ K\n'OAI.IsingPerceptron.uniformPattern_abs_le' depends on axioms: [propext, Classical.choice, Quot.sound]\nOAI.IsingPerceptron.isingEntropy_nonneg (q : OAI.IsingPerceptron.OverlapPath) : 0 ≤ OAI.IsingPerceptron.isingEntropy q\n'OAI.IsingPerceptron.isingEntropy_nonneg' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "7ee9bc6ec26cc765ad147487e2dfb5b72806ef9469a46dcadd73f5c448711e7b"
},
{
"id": "check-c8c57aadabd0a3e83ab0",
"at": "2026-11-04T19:01:43.585Z",
"scope": "task",
"taskId": "goal",
"commit": "abb797bc76d7af8527fdbf262c1a704126a04aed",
"status": "kernel_verified",
"receiptIds": [
"lean-644bc47d1e74cce9aa76a61d"
],
"diagnostics": "OAI.IsingPerceptron.variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α) {f : ℝ → ℝ} (hf : Continuous f)\n (hbounded : ∃ K, ∀ (x : ℝ), |f x| ≤ K) : ∃ p, OAI.IsingPerceptron.variationalValue α f = ↑p\n'OAI.IsingPerceptron.variationalValue_real_of_continuous' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "02389bb2ba9367a1184215c4dca9441541cfd42d010e38ff618daa90755ae724"
},
{
"id": "check-571b507932a8c3b8d86e",
"at": "2026-11-04T19:02:14.625Z",
"scope": "task",
"taskId": "goal",
"commit": "e54d1b1798910f124260c1df28b998d81c817b66",
"status": "kernel_verified",
"receiptIds": [
"lean-ca2fc5c8b834be185c3da5b3"
],
"diagnostics": "OAI.IsingPerceptron.variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α) {f : ℝ → ℝ} (hf : Continuous f)\n (hbounded : ∃ K, ∀ (x : ℝ), |f x| ≤ K) : ∃ p, OAI.IsingPerceptron.variationalValue α f = ↑p\n'OAI.IsingPerceptron.variationalValue_real_of_continuous' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "ef854546279d2b9aeb0ddb5b2331d951d478065521edca3a0e9a5fe727e4000a"
},
{
"id": "check-8a55156ac7dc04afde55",
"at": "2026-11-04T19:12:02.487Z",
"scope": "original",
"commit": "833f10564c8bc1acd816da3226c6b207556bb4be",
"status": "kernel_verified",
"receiptIds": [
"lean-3cb0737a13535afd28cb4c5e"
],
"diagnostics": "OAI.IsingPerceptron.variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α) {f : ℝ → ℝ} (hf : Continuous f)\n (hbounded : ∃ K, ∀ (x : ℝ), |f x| ≤ K) : ∃ p, OAI.IsingPerceptron.variationalValue α f = ↑p\n'OAI.IsingPerceptron.variationalValue_real_of_continuous' depends on axioms: [propext, Classical.choice, Quot.sound]",
"sourceDigest": "9ae908672b96f937d19b4b2f6b74aa1952a57184e264e1a08c9a0bc847c2775a"
}
],
"deliveries": [
{
"id": "03d4df16-9244-4819-a4bb-a07e7fe50774",
"at": "2026-11-01T06:34:32.734Z",
"kind": "proof",
"status": "verified",
"taskId": "gaussian-transform-bound",
"workerId": "researcher-2",
"role": "researcher",
"commit": "875a8ab34b73620cfca8f3e4d4eb869456cd5cb1",
"summary": "Fixed declaration checked; unresolved lemma assumptions remain obligations."
},
{
"id": "04d0d758-1440-49b0-b8bb-3743721685fc",
"at": "2026-11-01T06:38:58.005Z",
"kind": "proof",
"status": "verified",
"taskId": "entropy-nonneg",
"workerId": "engineer",
"role": "engineer",
"commit": "0b5d16efe0f202b1e37c1de20e20badde7a6132c",
"summary": "Fixed declaration checked; unresolved lemma assumptions remain obligations."
},
{
"id": "1f792538-723b-45e2-a100-31270dba56f8",
"at": "2026-11-01T06:51:13.906Z",
"kind": "proof",
"status": "verified",
"taskId": "uniformPattern-bound",
"workerId": "researcher-2",
"role": "researcher",
"commit": "43433e934da8036077fcc60945457981ff03d4d4",
"summary": "Fixed declaration checked; unresolved lemma assumptions remain obligations."
},
{
"id": "ff5c9eeb-dc95-4932-b242-a8a521058114",
"at": "2026-11-01T06:58:09.756Z",
"kind": "failure",
"status": "failed",
"taskId": "field-recursion-upper",
"workerId": "engineer",
"role": "engineer",
"commit": "0479bee28d0b5f1a17adcbeab34a64efca10688b",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "1d5aedb1-6c43-4047-be6f-64c19838b9e8",
"at": "2026-11-01T07:07:04.163Z",
"kind": "research",
"status": "conditional",
"taskId": "erreal-finite-inf",
"workerId": "engineer",
"role": "engineer",
"commit": "8d295a1b63c5300f8e0e809a7876539931f09b2e",
"summary": "EReal lattice bridge for the finite infimum is established and kernel-checked in an isolated probe (advisory until integrated). Statement: for any family f : ι → EReal with a distinguished index i0 and real a,b, if a ≤ f i for all i and f i0 ≤ b, then ∃ p : ℝ, (⨅ i, f i) = (p : EReal). Proof: the infimum is squeezed between (a : EReal) and (b : EReal); if it were ⊥ then (a : EReal) = ⊥, and if it were ⊤ then (⊤ : EReal) ≤ (b : EReal); both contradict EReal.coe_ne_bot / EReal.coe_lt_top, so EReal.coe_toReal converts it back. Applied to variationalValue this needs (i) a nonempty OverlapPath (constant zero) and (ii) both a real lower bound and a real upper bound on the summand α*patternFunctional f q + isingEntropy q. The lower bound needs the limUnder bound on patternFunctional (limunder-pattern) plus the integrated isingEntropy_nonneg; the upper bound at the zero path needs zero-path-upper and the currently blocked finite bound on fieldRecursion (field-recursion-upper). No wrapper assuming that bound is claimed."
},
{
"id": "69988026-d268-4e5e-ae6c-002cf4644d74",
"at": "2026-11-01T07:16:38.289Z",
"kind": "failure",
"status": "failed",
"taskId": "limunder-pattern",
"workerId": "researcher-2",
"role": "researcher",
"commit": "76bf8f42765d22fe9aa57778477b2f8492c6d5c9",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "3c51d4e3-e848-4edf-a8b3-29a30c2713b0",
"at": "2026-11-01T07:22:25.387Z",
"kind": "failure",
"status": "failed",
"taskId": "erreal-finite-inf",
"workerId": "engineer",
"role": "engineer",
"commit": "f6f60aa3dc2d1a590202b05b08d4095770c9a89f",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "da28ccba-fc35-4015-a5a8-0ce7402b0cf4",
"at": "2026-11-01T07:57:40.428Z",
"kind": "failure",
"status": "failed",
"taskId": "zero-path-upper",
"workerId": "researcher-2",
"role": "researcher",
"commit": "58ca8cf12c896353329f146cbc6511749543b3cd",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "d0d2e971-2748-495f-9996-8c0779dc5f81",
"at": "2026-11-01T09:29:37.286Z",
"kind": "failure",
"status": "superseded",
"taskId": "capacity_14f74f105482dc829dfc7a7ed138f119c4d554e2",
"workerId": "researcher-2",
"role": "researcher",
"commit": "e4a91bf3c3ce2962b191ea3cf11e80a4a6f89235",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "17fa5f83-c3a5-45d4-a9ea-ea1ae9efe512",
"at": "2026-11-01T09:29:44.604Z",
"kind": "failure",
"status": "superseded",
"taskId": "capacity_e5d6ceff6fb1100881c2c54c3a93284f7c3cdaa8",
"workerId": "engineer",
"role": "engineer",
"commit": "ae3d53945a7501591210ac4c602a97db9de8c311",
"summary": "math_research_checkpoint_unchanged: The same checkpoint has no new saved notes, draft, or task input across repeated recoveries. Wait for new input or revise the investigation."
},
{
"id": "3d3ed27c-3258-4f4a-8ab4-07fb6837c7bb",
"at": "2026-11-04T19:02:15.188Z",
"kind": "proof",
"status": "verified",
"taskId": "goal",
"workerId": "researcher-1",
"role": "researcher",
"commit": "b0cf5b6cfbbbe17a8008dfcb49462d75ded342e4",
"summary": "Fixed declaration checked; unresolved lemma assumptions remain obligations."
},
{
"id": "e04a62eb-7a1e-4773-94e4-96b68699fc13",
"at": "2026-11-04T19:02:15.318Z",
"kind": "research",
"status": "superseded",
"taskId": "capacity_e5d6ceff6fb1100881c2c54c3a93284f7c3cdaa8",
"workerId": "engineer",
"role": "engineer",
"commit": "ae3d53945a7501591210ac4c602a97db9de8c311",
"summary": "Delivery belongs to a superseded assignment."
},
{
"id": "7d66fd03-6786-4dd9-b41e-ce08411e5ef9",
"at": "2026-11-04T19:02:15.425Z",
"kind": "research",
"status": "superseded",
"taskId": "capacity_14f74f105482dc829dfc7a7ed138f119c4d554e2",
"workerId": "researcher-2",
"role": "researcher",
"commit": "e4a91bf3c3ce2962b191ea3cf11e80a4a6f89235",
"summary": "Delivery belongs to a superseded assignment."
},
{
"id": "33b167d4-2433-4a80-ac63-a4f8b7f20c04",
"at": "2026-11-04T19:11:33.584Z",
"kind": "progress",
"status": "advisory",
"workerId": "solver",
"role": "lead",
"commit": "ed4096c4ade16a7efbed615e726ad9100deb48b9",
"summary": "Saved Lead draft pending integration: math_original_context_changed. Inspect git show ed4096c4ade16a7efbed615e726ad9100deb48b9:PROJECT_RELATIVE_PATH and reapply the useful declarations against the current canonical sources. This draft has no proof acceptance."
},
{
"id": "70a70eb4-408d-4a68-8b73-b836e38e3b66",
"at": "2026-11-04T19:46:05.901Z",
"kind": "review",
"status": "accepted",
"workerId": "researcher-1",
"role": "researcher",
"commit": "833f10564c8bc1acd816da3226c6b207556bb4be",
"summary": "Reviewed the fixed candidate at seedCommit 833f10564c8bc1acd816da3226c6b207556bb4be. generated/problem/Submission.lean (941 lines, sha256 9ae908672b96f937d19b4b2f6b74aa1952a57184e264e1a08c9a0bc847c2775a) is byte-identical to that commit's file; all fourteen frozen source declarations (eleven def/theorem declarations and three structures) occur in the frozen order with unchanged headers and definition bodies, and the only deleted original source lines are the seed's `sorry` proof line and its following blank separator. The trusted Challenge.lean, toolchain, lakefile, lake-manifest and all frozen Library files are untouched (matching their recorded digests). Lean evidence: the host command `math.ts check-lean --workspace .../generated/problem --file Submission.lean --timeout-seconds 0` exited 0; the only messages are linter warnings (unused variables and deprecated if_pos/if_neg), with sourceDigest c13d1cd1d841f8bcc551ffbda37ad2e16087cb849fcf3c1ef4e08c6f9045bb36 and environmentDigest 3aee7d8750d45432845074e60dc52d89dbd2909560166aab8476a10af399da66. A `#print axioms` probe reports for OAI.IsingPerceptron.variationalValue_real_of_continuous, fieldRecursion_le_zero, limUnder_bounds and ereal_iInf_eq_coe_of_bounds exactly [propext, Classical.choice, Quot.sound]; there is no sorryAx. `rg` finds no sorry, admit, native_decide, unsafe, axiom, partial, implemented_by or extern in the owned file. The exact frozen target type, confirmed by `#check` and `#print`, is: forall {alpha : Real}, 0 <= alpha -> forall {f : Real -> Real}, Continuous f -> (exists K, forall x, |f x| <= K) -> exists p : Real, variationalValue alpha f = (p : EReal). Current checked argument: (1) gaussianTransform_abs_le_of_bound and foldr_gaussianTransform_abs_le carry a uniform absolute bound K through the List.foldr defining uniformPattern, giving uniformPattern_abs_le; (2) limUnder_bounds uses Tendsto.limUnder_eq for convergent real sequences and limUnder_of_not_tendsto otherwise to squeeze Filter.limUnder atTop u between min (-K) c and max K c (c := Classical.choice (inferInstance : Nonempty Real)); (3) isingEntropy_nonneg is witnessed by the explicit one-level FieldStep with zero value, whose fieldRecursion and stepFunction are both zero; (4) fold_gaussianTransform_bounds, jensen_step_pos, integral_cosh_gaussianReal and integral_le_log_integral_exp prove the fold invariant for pairs (s,d) with s >= 0 and 0 <= d <= 1 and base log(cosh x) - W/2, and sum_increments_eq telescopes the increments to W = stepAt h (levels-1), yielding fieldRecursion_le_zero; (5) zeroPath is AEEqFun.const Real 0, zeroPath_integral kills the interaction term, and isingEntropy_zeroPath_le_zero combines with isingEntropy_nonneg to give isingEntropy zeroPath = 0; (6) ereal_iInf_eq_coe_of_bounds squeezes the EReal iInf between two real coercions, excludes bot and top using EReal.coe_ne_bot and EReal.coe_lt_top, and reconstructs it with EReal.coe_toReal; (7) the final proof takes the lower bound alpha * min (-K) c…"
}
]
}
],
"sources": {
"bcd20f220fc7ccf2c21044631f77254cf053723889562f1784f2a62f2bb14837": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\n \n\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "bcd20f220fc7ccf2c21044631f77254cf053723889562f1784f2a62f2bb14837"
},
"7ee9bc6ec26cc765ad147487e2dfb5b72806ef9469a46dcadd73f5c448711e7b": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\nlemma gaussianTransform_abs_le_of_bound (s d K : ℝ) {U : ℝ → ℝ}\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n have hK : 0 ≤ K := le_trans (abs_nonneg (U 0)) (hUK 0)\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1)\n · have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hmeas K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · rw [integral_non_aestronglyMeasurable hmeas]\n simpa using hK\n · simp only [gaussianTransform, hd, ite_false]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1)\n · have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤\n Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hmeas (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n · rw [integral_non_aestronglyMeasurable hmeas]\n simp only [Real.log_zero, zero_div, abs_zero]\n exact hK\nlemma foldr_gaussianTransform_abs_le (L : List (ℝ × ℝ)) (K : ℝ) {V : ℝ → ℝ}\n (hV : ∀ x, |V x| ≤ K) :\n ∀ x, |L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x| ≤ K := by\n induction L with\n | nil => simpa using hV\n | cons a L ih =>\n intro x\n simpa [List.foldr_cons] using gaussianTransform_abs_le_of_bound a.1 a.2 K ih x\ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\n \n\nlemma uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f)\n (hK : ∀ x, |f x| ≤ K) (q : OverlapPath) (n : ℕ) :\n |uniformPattern f q n| ≤ K := by\n simpa [uniformPattern] using\n foldr_gaussianTransform_abs_le\n (List.ofFn (fun i : Fin (n + 2) =>\n let k := n + 1\n let levelVal := fun j => if j < k then cellAverage q k j else 1\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)),\n (i : ℝ) / k))) K hK 0\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef isingEntropyWitnessPartition : Partition where\n levels := 1\n positive := by norm_num\n cut := fun i : Fin (1 + 1) => (i.val : ℝ)\n ordered := by\n intro i j hij\n exact Nat.cast_lt.mpr hij\n first := by simp\n last := by simp\ndef isingEntropyWitnessFieldStep : FieldStep where\n partition := isingEntropyWitnessPartition\n value := fun _ => 0\n nonneg := by intro i; rfl\n ordered := by intro i j _; rfl\nlemma stepAt_isingEntropyWitnessFieldStep (i : ℕ) :\n stepAt isingEntropyWitnessFieldStep i = 0 := by\n unfold stepAt\n split_ifs <;> rfl\nlemma stepFunction_isingEntropyWitnessFieldStep (u : ℝ) :\n stepFunction isingEntropyWitnessFieldStep u = 0 := by\n unfold stepFunction\n apply Finset.sum_eq_zero\n intro i hi\n split_ifs <;> rfl\nlemma fieldRecursion_isingEntropyWitnessFieldStep :\n fieldRecursion isingEntropyWitnessFieldStep = 0 := by\n simp [fieldRecursion, isingEntropyWitnessFieldStep, isingEntropyWitnessPartition,\n gaussianTransform, stepAt, Real.log_one]\ntheorem isingEntropy_nonneg (q : OverlapPath) : (0 : EReal) ≤ isingEntropy q := by\n unfold isingEntropy\n refine le_iSup_of_le (f := fun h : FieldStep =>\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal))\n isingEntropyWitnessFieldStep ?_\n simp [fieldRecursion_isingEntropyWitnessFieldStep,\n stepFunction_isingEntropyWitnessFieldStep]\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "7ee9bc6ec26cc765ad147487e2dfb5b72806ef9469a46dcadd73f5c448711e7b"
},
"fd7dc5c188c4a286c2ac17dcd04843d699f4b43941c4a93170438097a93064d3": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n\nlemma gaussianTransform_abs_le_of_bound (s d K : ℝ) {U : ℝ → ℝ}\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n have hK : 0 ≤ K := le_trans (abs_nonneg (U 0)) (hUK 0)\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1)\n · have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hmeas K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · rw [integral_non_aestronglyMeasurable hmeas]\n simpa using hK\n · simp only [gaussianTransform, hd, ite_false]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1)\n · have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤\n Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hmeas (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n · rw [integral_non_aestronglyMeasurable hmeas]\n simp only [Real.log_zero, zero_div, abs_zero]\n exact hK\n\nlemma foldr_gaussianTransform_abs_le (L : List (ℝ × ℝ)) (K : ℝ) {V : ℝ → ℝ}\n (hV : ∀ x, |V x| ≤ K) :\n ∀ x, |L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x| ≤ K := by\n induction L with\n | nil => simpa using hV\n | cons a L ih =>\n intro x\n simpa [List.foldr_cons] using gaussianTransform_abs_le_of_bound a.1 a.2 K ih x\n\ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\nlemma uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f)\n (hK : ∀ x, |f x| ≤ K) (q : OverlapPath) (n : ℕ) :\n |uniformPattern f q n| ≤ K := by\n simpa [uniformPattern] using\n foldr_gaussianTransform_abs_le\n (List.ofFn (fun i : Fin (n + 2) =>\n let k := n + 1\n let levelVal := fun j => if j < k then cellAverage q k j else 1\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)),\n (i : ℝ) / k))) K hK 0\n\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "fd7dc5c188c4a286c2ac17dcd04843d699f4b43941c4a93170438097a93064d3"
},
"b1846c1eed10e98b82947b8d3879a3db348db104a2c29b61f75a75da1d4124a0": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\n \n\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef isingEntropyWitnessPartition : Partition where\n levels := 1\n positive := by norm_num\n cut := fun i : Fin (1 + 1) => (i.val : ℝ)\n ordered := by\n intro i j hij\n exact Nat.cast_lt.mpr hij\n first := by simp\n last := by simp\n\ndef isingEntropyWitnessFieldStep : FieldStep where\n partition := isingEntropyWitnessPartition\n value := fun _ => 0\n nonneg := by intro i; rfl\n ordered := by intro i j _; rfl\n\nlemma stepAt_isingEntropyWitnessFieldStep (i : ℕ) :\n stepAt isingEntropyWitnessFieldStep i = 0 := by\n unfold stepAt\n split_ifs <;> rfl\n\nlemma stepFunction_isingEntropyWitnessFieldStep (u : ℝ) :\n stepFunction isingEntropyWitnessFieldStep u = 0 := by\n unfold stepFunction\n apply Finset.sum_eq_zero\n intro i hi\n split_ifs <;> rfl\n\nlemma fieldRecursion_isingEntropyWitnessFieldStep :\n fieldRecursion isingEntropyWitnessFieldStep = 0 := by\n simp [fieldRecursion, isingEntropyWitnessFieldStep, isingEntropyWitnessPartition,\n gaussianTransform, stepAt, Real.log_one]\n\ntheorem isingEntropy_nonneg (q : OverlapPath) : (0 : EReal) ≤ isingEntropy q := by\n unfold isingEntropy\n refine le_iSup_of_le (f := fun h : FieldStep =>\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal))\n isingEntropyWitnessFieldStep ?_\n simp [fieldRecursion_isingEntropyWitnessFieldStep,\n stepFunction_isingEntropyWitnessFieldStep]\n\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "b1846c1eed10e98b82947b8d3879a3db348db104a2c29b61f75a75da1d4124a0"
},
"02389bb2ba9367a1184215c4dca9441541cfd42d010e38ff618daa90755ae724": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\n \n\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nlemma integral_exp_mul_gaussianReal_one (t : ℝ) :\n ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 = Real.exp (t ^ 2 / 2) := by\n have h := congrFun (ProbabilityTheory.mgf_id_gaussianReal (μ := 0) (v := 1)) t\n simpa [ProbabilityTheory.mgf] using h\n\nlemma integrable_exp_pos_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp (Real.sqrt s * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp x * Real.exp (Real.sqrt s * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\n\nlemma integrable_exp_neg_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp ((-Real.sqrt s) * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp (-x) * Real.exp ((-Real.sqrt s) * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\n ring_nf\n\nlemma integral_exp_affine {s : ℝ} (hs : 0 ≤ s) (t x : ℝ) :\n ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1 = Real.exp x * Real.exp (t ^ 2 / 2) := by\n have h := integral_exp_mul_gaussianReal_one t\n calc ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1\n = ∫ z, Real.exp x * Real.exp (t * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [Real.exp_add]\n _ = Real.exp x * ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 := integral_const_mul _ _\n _ = Real.exp x * Real.exp (t ^ 2 / 2) := by rw [h]\n\nlemma integrable_cosh_gaussianReal (x s : ℝ) :\n Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have h3 : Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)\n + Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := h1.add h2\n have h4 := h3.const_mul ((2:ℝ)⁻¹)\n refine h4.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [Real.cosh_eq]\n ring\n\nlemma integral_cosh_gaussianReal {s : ℝ} (hs : 0 ≤ s) (x : ℝ) :\n ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := by\n have hsp : (Real.sqrt s) ^ 2 = s := Real.sq_sqrt hs\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have e1 : ∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.exp x * Real.exp (s / 2) := by\n rw [integral_exp_affine hs, hsp]\n have e2 : ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = Real.exp (-x) * Real.exp (s / 2) := by\n have h := integral_exp_mul_gaussianReal_one (-Real.sqrt s)\n calc ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = ∫ z, Real.exp (-x) * Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [← Real.exp_add]; ring_nf\n _ = Real.exp (-x) * ∫ z, Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 :=\n integral_const_mul _ _\n _ = Real.exp (-x) * Real.exp (((-Real.sqrt s)) ^ 2 / 2) := by rw [h]\n _ = Real.exp (-x) * Real.exp (s / 2) := by\n rw [show ((-Real.sqrt s)) ^ 2 = s by rw [neg_sq, hsp]]\n calc ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = ∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z))) / 2\n ∂gaussianReal 0 1 := by\n congr 1 with z\n rw [Real.cosh_eq]\n _ = (∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z)))\n ∂gaussianReal 0 1) / 2 := by rw [integral_div]\n _ = ((∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n + (∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1)) / 2 := by\n rw [integral_add h1 h2]\n _ = Real.cosh x * Real.exp (s / 2) := by\n rw [e1, e2, Real.cosh_eq]\n ring\n\nlemma exp_mul_le_cosh_rpow {d w : ℝ} (hd : 0 ≤ d) {U : ℝ → ℝ}\n (hU : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (y : ℝ) :\n Real.exp (d * U y) ≤ (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n have hcosh_pos : 0 < Real.cosh y := Real.cosh_pos y\n have h1 : d * U y ≤ d * (Real.log (Real.cosh y) - w / 2) :=\n mul_le_mul_of_nonneg_left (hU y) hd\n have h2 : Real.exp (d * U y) ≤ Real.exp (d * (Real.log (Real.cosh y) - w / 2)) :=\n Real.exp_le_exp.mpr h1\n have h3 : Real.exp (d * (Real.log (Real.cosh y) - w / 2))\n = (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n rw [Real.rpow_def_of_pos hcosh_pos]\n rw [show d * (Real.log (Real.cosh y) - w / 2)\n = Real.log (Real.cosh y) * d + (-(d * w / 2)) by ring]\n rw [Real.exp_add]\n rw [← h3]\n exact h2\n\nlemma integrable_cosh_rpow_gaussianReal {s d : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d) (gaussianReal 0 1) := by\n have hcosh := integrable_cosh_gaussianReal x s\n have hmeas : AEStronglyMeasurable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := by\n apply Continuous.aestronglyMeasurable\n fun_prop\n refine Integrable.mono hcosh hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, Real.norm_eq_abs]\n have hpos : 0 < Real.cosh (x + Real.sqrt s * z) := Real.cosh_pos _\n rw [abs_of_pos (Real.rpow_pos_of_pos hpos d), abs_of_pos hpos]\n calc (Real.cosh (x + Real.sqrt s * z)) ^ d\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ (1:ℝ) := by\n apply Real.rpow_le_rpow_of_exponent_le\n · exact Real.one_le_cosh _\n · exact hd1\n _ = Real.cosh (x + Real.sqrt s * z) := Real.rpow_one _\n\nlemma integrable_exp_mul_u_gaussianReal {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n have hbound_int : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := hcosh_rpow.mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) := by\n have h2 : Measurable fun z : ℝ => U (x + Real.sqrt s * z) :=\n hUmeas.comp (by fun_prop)\n exact (Real.measurable_exp.comp (h2.const_mul d)).aestronglyMeasurable\n refine Integrable.mono' hbound_int hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n exact exp_mul_le_cosh_rpow hd hUup _\n\nlemma integrable_cosh_mul_exp_gaussianReal {s d w : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n exact hcosh_rpow.mul_const _\n\nlemma jensen_step_pos {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 < d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n have hcosh_int : ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := integral_cosh_gaussianReal hs x\n have hcosh_int_meas : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z))\n (gaussianReal 0 1) := integrable_cosh_gaussianReal x s\n have hptw : ∀ z, Real.exp (d * U (x + Real.sqrt s * z))\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2)) :=\n fun z => exp_mul_le_cosh_rpow hd.le hUup _\n have hJensen : (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n ≥ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1 := by\n have hconcave : ConcaveOn ℝ (Set.Ici 0) (fun y : ℝ => y ^ d) :=\n Real.concaveOn_rpow hd.le hd1\n have hcont : ContinuousOn (fun y : ℝ => y ^ d) (Set.Ici 0) := by\n intro y hy\n exact (Real.continuousAt_rpow_const y d (Or.inr hd.le)).continuousWithinAt\n have hmem : ∀ᵐ z ∂gaussianReal 0 1, Real.cosh (x + Real.sqrt s * z) ∈ Set.Ici (0:ℝ) :=\n Filter.Eventually.of_forall (fun z => (Real.cosh_pos _).le)\n have hint_rpow : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := integrable_cosh_rpow_gaussianReal hs hd.le hd1 x\n simpa only [Function.comp_apply] using\n (ConcaveOn.le_map_integral hconcave hcont isClosed_Ici hmem hcosh_int_meas hint_rpow)\n have h_exp_int := integrable_exp_mul_u_gaussianReal (M := M) hs hd.le hd1 hUmeas hUup x\n have h_bound_int := integrable_cosh_mul_exp_gaussianReal hs hd.le hd1 (w := w) x\n calc ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2))\n ∂gaussianReal 0 1 := integral_mono h_exp_int h_bound_int hptw\n _ = (∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1)\n * Real.exp (-(d * w / 2)) := integral_mul_const _ _\n _ ≤ (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n * Real.exp (-(d * w / 2)) := by\n apply mul_le_mul_of_nonneg_right hJensen (Real.exp_pos _).le\n _ = (Real.cosh x * Real.exp (s / 2)) ^ d * Real.exp (-(d * w / 2)) := by rw [hcosh_int]\n _ = (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n rw [Real.mul_rpow (Real.cosh_pos x).le (Real.exp_pos (s/2)).le]\n rw [show (Real.exp (s / 2)) ^ d = Real.exp (s / 2 * d) by\n rw [Real.rpow_def_of_pos (Real.exp_pos _), Real.log_exp]]\n rw [mul_assoc, ← Real.exp_add]\n congr 2\n ring\n\nlemma integrable_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n integrable_cosh_gaussianReal x s\n have hmono : Integrable (fun z : ℝ => M + Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have := (integrable_const (μ := gaussianReal 0 1) M).add hc\n simpa [add_comm] using this\n have hmeas : AEStronglyMeasurable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n (hUmeas.comp (by fun_prop)).aestronglyMeasurable\n refine Integrable.mono' hmono hmeas (Filter.Eventually.of_forall (fun z => ?_))\n have hlog_le : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) := by\n have h1 : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) - 1 :=\n Real.log_le_sub_one_of_pos (Real.cosh_pos _)\n linarith\n have hpos : (0:ℝ) ≤ Real.cosh (x + Real.sqrt s * z) := (Real.cosh_pos _).le\n rw [Real.norm_eq_abs, abs_le]\n constructor\n · have := hUlow (x + Real.sqrt s * z); linarith\n · have := hUup (x + Real.sqrt s * z); linarith\n\nlemma integrable_exp_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)))\n (gaussianReal 0 1) := (integrable_cosh_gaussianReal x s).mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n (Real.measurable_exp.comp (hUmeas.comp (by fun_prop))).aestronglyMeasurable\n refine Integrable.mono' hc hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n simpa using exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\n\nlemma integral_le_log_integral_exp {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n ≤ Real.log (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup x\n set A : ℝ := ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 with hA\n have hApos : 0 < A := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) := integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) ≤ A := by\n rw [hA]\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n set G : ℝ → ℝ := fun z => Real.exp (U (x + Real.sqrt s * z)) with hG\n have hGint' : Integrable G (gaussianReal 0 1) := hGint\n have hpoint : ∀ z, U (x + Real.sqrt s * z) ≤ Real.log A + (G z - A) / A := by\n intro z\n have hGpos : 0 < G z := Real.exp_pos _\n have hlogG : Real.log (G z) = U (x + Real.sqrt s * z) := by simp [hG]\n have := Real.log_le_sub_one_of_pos (div_pos hGpos hApos)\n rw [Real.log_div (ne_of_gt hGpos) (ne_of_gt hApos), hlogG] at this\n have h2 : G z / A - 1 = (G z - A) / A := by field_simp\n linarith [this, h2.le, h2.ge]\n have hright_int : Integrable (fun z : ℝ => Real.log A + (G z - A) / A) (gaussianReal 0 1) := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n exact (integrable_const (Real.log A)).add h1\n have hmono := integral_mono hUint hright_int hpoint\n have hright_val : ∫ z, (Real.log A + (G z - A) / A) ∂gaussianReal 0 1 = Real.log A := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n rw [integral_add (integrable_const (Real.log A)) h1]\n have h2 : ∫ z, (G z - A) / A ∂gaussianReal 0 1 = 0 := by\n rw [integral_div]\n rw [integral_sub hGint' (integrable_const A)]\n have hGA : (∫ z, G z ∂gaussianReal 0 1) = A := by rw [hA]\n rw [hGA]\n simp\n rw [h2]\n simp\n rw [hright_val] at hmono\n simpa [hA] using hmono\n\nlemma gaussianTransform_step_upper {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 - w / 2 := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hstep := integral_le_log_integral_exp (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup x\n have hbound_int : Integrable (fun z : ℝ =>\n Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))) (gaussianReal 0 1) :=\n (integrable_cosh_gaussianReal x s).mul_const _\n have hpoint : ∀ z : ℝ, Real.exp (U (x + Real.sqrt s * z))\n ≤ Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)) := by\n intro z\n have := exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\n simpa using this\n have hA_le : (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n calc ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))\n ∂gaussianReal 0 1 := integral_mono hGint hbound_int hpoint\n _ = (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n * Real.exp (-(w / 2)) := integral_mul_const _ _\n _ = Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n rw [integral_cosh_gaussianReal hs x]\n have hApos : 0 < ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) :=\n integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1)\n ≤ ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog_le := Real.log_le_log hApos hA_le\n rw [Real.log_mul (mul_pos (Real.cosh_pos x) (Real.exp_pos (s / 2))).ne'\n (Real.exp_pos (-(w / 2))).ne',\n Real.log_mul (Real.cosh_pos x).ne' (Real.exp_pos (s / 2)).ne',\n Real.log_exp, Real.log_exp] at hlog_le\n linarith\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hJ := jensen_step_pos (M := M) hs hdpos hd1 hUmeas hUlow hUup x\n have hpos_low : 0 < Real.exp (-(d * M)) := Real.exp_pos _\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le hpos_low hle\n have hlog_le : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log ((Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2)) :=\n Real.log_le_log hIpos hJ\n rw [Real.log_mul (Real.rpow_pos_of_pos (Real.cosh_pos x) d).ne'\n (Real.exp_pos (s * d / 2 - d * w / 2)).ne',\n Real.log_rpow (Real.cosh_pos x), Real.log_exp] at hlog_le\n rw [div_le_iff₀ hdpos]\n nlinarith\n\nlemma gaussianTransform_step_lower {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hconst : Integrable (fun _ : ℝ => -M) (gaussianReal 0 1) := integrable_const _\n have := integral_mono hconst hUint (fun z => hUlow _)\n simpa using this\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog : -(d * M) ≤\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc -(d * M) = Real.log (Real.exp (-(d * M))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hle\n rw [le_div_iff₀ hdpos]\n nlinarith\n\nlemma measurable_integral_shift {s : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => U (x + Real.sqrt s * z)) := by\n apply hU.stronglyMeasurable.comp_measurable\n fun_prop\n exact (hun.integral_prod_right (ν := gaussianReal 0 1)).measurable\n\nlemma measurable_log_integral_shift {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) := by\n apply (Real.measurable_exp.comp (hU.const_mul d)).stronglyMeasurable.comp_measurable\n fun_prop\n exact ((hun.integral_prod_right (ν := gaussianReal 0 1)).measurable.log)\n\nlemma gaussianTransform_measurable {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (gaussianTransform s d U) := by\n unfold gaussianTransform\n by_cases hd : d = 0\n · simp only [if_pos hd]\n exact measurable_integral_shift hU\n · simp only [if_neg hd]\n exact (measurable_log_integral_shift (d := d) hU).div_const d\n\nlemma gaussianTransform_step_upper' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 + c := by\n have h := gaussianTransform_step_upper (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\n calc gaussianTransform s d U x\n ≤ Real.log (Real.cosh x) + s / 2 - (-2 * c) / 2 := h\n _ = Real.log (Real.cosh x) + s / 2 + c := by ring\n\nlemma gaussianTransform_step_lower' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n exact gaussianTransform_step_lower (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\n\nlemma fold_gaussianTransform_bounds (L : List (ℝ × ℝ)) (M c : ℝ)\n (hL : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1)\n (hcM : c + (L.map Prod.fst).sum / 2 ≤ M)\n {V : ℝ → ℝ} (hVmeas : Measurable V) (hVlow : ∀ x, -M ≤ V x)\n (hVup : ∀ x, V x ≤ Real.log (Real.cosh x) + c) :\n (∀ x, L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x\n ≤ Real.log (Real.cosh x) + c + (L.map Prod.fst).sum / 2) ∧\n (∀ x, -M ≤ L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x) ∧\n Measurable (L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V) := by\n induction L with\n | nil =>\n refine ⟨fun x => ?_, hVlow, hVmeas⟩\n simpa using hVup x\n | cons a L ih =>\n obtain ⟨ha1, ha2, ha3⟩ := hL a (by simp)\n have htail : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := fun p hp =>\n hL p (by simp [hp])\n have hsum : ((a :: L).map Prod.fst).sum = a.1 + (L.map Prod.fst).sum := by simp\n rw [hsum] at hcM\n have hcM' : c + (L.map Prod.fst).sum / 2 ≤ M := by linarith\n have hih := ih htail hcM'\n set W : ℝ → ℝ := L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V with hW\n have hWmeas : Measurable W := hih.2.2\n have hWlow : ∀ x, -M ≤ W x := hih.2.1\n have hWup : ∀ x, W x ≤ Real.log (Real.cosh x) + (c + (L.map Prod.fst).sum / 2) := by\n intro x\n have := hih.1 x\n linarith\n have hcM'' : c + (L.map Prod.fst).sum / 2 ≤ M := hcM'\n have hstep_up : ∀ x, gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := fun x =>\n gaussianTransform_step_upper' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_low : ∀ x, -M ≤ gaussianTransform a.1 a.2 W x := fun x =>\n gaussianTransform_step_lower' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_meas : Measurable (gaussianTransform a.1 a.2 W) :=\n gaussianTransform_measurable hWmeas\n have hfold : (a :: L).foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V\n = gaussianTransform a.1 a.2 W := by\n simp [hW]\n refine ⟨?_, ?_, ?_⟩\n · intro x\n rw [hfold, hsum]\n have := hstep_up x\n calc gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := this\n _ = Real.log (Real.cosh x) + c + (a.1 + (L.map Prod.fst).sum) / 2 := by ring\n · intro x\n rw [hfold]\n exact hstep_low x\n · rw [hfold]\n exact hstep_meas\n\nlemma stepAt_nonneg (h : FieldStep) (i : ℕ) : 0 ≤ stepAt h i := by\n unfold stepAt\n split_ifs with hi\n · exact h.nonneg _\n · exact le_refl 0\n\nlemma stepAt_mono_of_lt (h : FieldStep) {i j : ℕ} (hij : i ≤ j)\n (hj : j < h.partition.levels) : stepAt h i ≤ stepAt h j := by\n have hi : i < h.partition.levels := lt_of_le_of_lt hij hj\n have h1 : stepAt h i = h.value ⟨i, hi⟩ := by simp [stepAt, hi]\n have h2 : stepAt h j = h.value ⟨j, hj⟩ := by simp [stepAt, hj]\n rw [h1, h2]\n exact h.ordered (Fin.mk_le_mk.mpr hij)\n\nlemma cut_nonneg (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n 0 ≤ h.partition.cut i := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have h0 : (⟨0, Nat.zero_lt_succ h.partition.levels⟩ : Fin (h.partition.levels + 1)) ≤ i :=\n Fin.zero_le i\n have := hmono h0\n rwa [h.partition.first] at this\n\nlemma cut_le_one (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n h.partition.cut i ≤ 1 := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have hlast : i ≤ (⟨h.partition.levels, Nat.lt_succ_self h.partition.levels⟩ :\n Fin (h.partition.levels + 1)) := Fin.le_last i\n have := hmono hlast\n rwa [h.partition.last] at this\n\nlemma stepAt_increment_nonneg (h : FieldStep) {i : ℕ} (hi : i < h.partition.levels) :\n 0 ≤ stepAt h i - (if i = 0 then 0 else stepAt h (i - 1)) := by\n by_cases h0 : i = 0\n · have hzi : stepAt h i = stepAt h 0 := by rw [h0]\n rw [h0, if_pos rfl]\n simp only [sub_zero]\n exact stepAt_nonneg h 0\n · have hle : i - 1 ≤ i := Nat.sub_le i 1\n have hmono := stepAt_mono_of_lt h hle hi\n rw [if_neg h0]\n linarith\n\nlemma sum_increments_eq (h : FieldStep) :\n ((List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum\n = stepAt h (h.partition.levels - 1) := by\n rw [List.map_ofFn, List.sum_ofFn]\n simp only [Function.comp_apply]\n rw [Fin.sum_univ_eq_sum_range\n (fun i => stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))) h.partition.levels]\n have htel := Finset.sum_range_sub\n (fun i : ℕ => if i = 0 then (0:ℝ) else stepAt h (i - 1)) h.partition.levels\n have hterm : ∀ i ∈ Finset.range h.partition.levels,\n stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))\n = (if i + 1 = 0 then (0:ℝ) else stepAt h (i + 1 - 1))\n - (if i = 0 then 0 else stepAt h (i - 1)) := by\n intro i hi\n have : i + 1 ≠ 0 := Nat.succ_ne_zero i\n rw [if_neg this, Nat.succ_sub_one]\n rw [Finset.sum_congr rfl hterm, htel]\n have h0 : (if (0:ℕ) = 0 then (0:ℝ) else stepAt h (0 - 1)) = 0 := if_pos rfl\n rw [h0, sub_zero]\n have hk : h.partition.levels ≠ 0 := Nat.pos_iff_ne_zero.mp h.partition.positive\n rw [if_neg hk]\n\nlemma increments_mem (h : FieldStep) :\n ∀ p ∈ List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc)), 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := by\n intro p hp\n rw [List.mem_ofFn] at hp\n obtain ⟨i, rfl⟩ := hp\n exact ⟨stepAt_increment_nonneg h i.isLt,\n cut_nonneg h i.castSucc, cut_le_one h i.castSucc⟩\n\ntheorem fieldRecursion_le_zero (h : FieldStep) : fieldRecursion h ≤ 0 := by\n set k := h.partition.levels with hk\n set W := stepAt h (k - 1) with hW\n have hWnonneg : 0 ≤ W := stepAt_nonneg h (k - 1)\n have hincr := increments_mem h\n have hsum : ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum = W := by\n rw [hW]\n exact sum_increments_eq h\n have hVmeas : Measurable (fun x : ℝ => Real.log (Real.cosh x) - W / 2) := by fun_prop\n have hVlow : ∀ x, -(W / 2) ≤ Real.log (Real.cosh x) - W / 2 := by\n intro x\n have h1 : (1:ℝ) ≤ Real.cosh x := Real.one_le_cosh x\n have := Real.log_nonneg h1\n linarith\n have hVup : ∀ x, Real.log (Real.cosh x) - W / 2\n ≤ Real.log (Real.cosh x) + (-(W / 2)) := fun x => le_refl _\n have hcM : (-(W / 2)) + ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum / 2 ≤ W / 2 := by\n rw [hsum]; linarith\n have hfold := fold_gaussianTransform_bounds\n (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))) (W / 2) (-(W / 2)) hincr hcM hVmeas hVlow hVup\n have hmain : (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).foldr\n (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - W / 2) 0 ≤ 0 := by\n have h1 := hfold.1 0\n rw [hsum] at h1\n have hc : Real.log (Real.cosh (0:ℝ)) = 0 := by simp\n rw [hc] at h1\n linarith\n simpa [fieldRecursion, hk] using hmain\n\nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n\nlemma gaussianTransform_abs_le_of_bound (s d K : ℝ) {U : ℝ → ℝ}\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n have hK : 0 ≤ K := le_trans (abs_nonneg (U 0)) (hUK 0)\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1)\n · have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hmeas K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · rw [integral_non_aestronglyMeasurable hmeas]\n simpa using hK\n · simp only [gaussianTransform, hd, ite_false]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1)\n · have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤\n Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hmeas (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n · rw [integral_non_aestronglyMeasurable hmeas]\n simp only [Real.log_zero, zero_div, abs_zero]\n exact hK\n\nlemma foldr_gaussianTransform_abs_le (L : List (ℝ × ℝ)) (K : ℝ) {V : ℝ → ℝ}\n (hV : ∀ x, |V x| ≤ K) :\n ∀ x, |L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x| ≤ K := by\n induction L with\n | nil => simpa using hV\n | cons a L ih =>\n intro x\n simpa [List.foldr_cons] using gaussianTransform_abs_le_of_bound a.1 a.2 K ih x\n\nlemma uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f)\n (hK : ∀ x, |f x| ≤ K) (q : OverlapPath) (n : ℕ) :\n |uniformPattern f q n| ≤ K := by\n simpa [uniformPattern] using\n foldr_gaussianTransform_abs_le\n (List.ofFn (fun i : Fin (n + 2) =>\n let k := n + 1\n let levelVal := fun j => if j < k then cellAverage q k j else 1\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)),\n (i : ℝ) / k))) K hK 0\n\ndef isingEntropyWitnessPartition : Partition where\n levels := 1\n positive := by norm_num\n cut := fun i : Fin (1 + 1) => (i.val : ℝ)\n ordered := by\n intro i j hij\n exact Nat.cast_lt.mpr hij\n first := by simp\n last := by simp\ndef isingEntropyWitnessFieldStep : FieldStep where\n partition := isingEntropyWitnessPartition\n value := fun _ => 0\n nonneg := by intro i; rfl\n ordered := by intro i j _; rfl\nlemma stepAt_isingEntropyWitnessFieldStep (i : ℕ) :\n stepAt isingEntropyWitnessFieldStep i = 0 := by\n unfold stepAt\n split_ifs <;> rfl\nlemma stepFunction_isingEntropyWitnessFieldStep (u : ℝ) :\n stepFunction isingEntropyWitnessFieldStep u = 0 := by\n unfold stepFunction\n apply Finset.sum_eq_zero\n intro i hi\n split_ifs <;> rfl\nlemma fieldRecursion_isingEntropyWitnessFieldStep :\n fieldRecursion isingEntropyWitnessFieldStep = 0 := by\n simp [fieldRecursion, isingEntropyWitnessFieldStep, isingEntropyWitnessPartition,\n gaussianTransform, stepAt, Real.log_one]\ntheorem isingEntropy_nonneg (q : OverlapPath) : (0 : EReal) ≤ isingEntropy q := by\n unfold isingEntropy\n refine le_iSup_of_le (f := fun h : FieldStep =>\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal))\n isingEntropyWitnessFieldStep ?_\n simp [fieldRecursion_isingEntropyWitnessFieldStep,\n stepFunction_isingEntropyWitnessFieldStep]\n\ndef zeroPath : OverlapPath where\n val := AEEqFun.const ℝ (0 : ℝ)\n admissible := ⟨fun _ => 0, (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) 0).symm, by\n intro a b ha hb hab; exact le_refl 0, by\n intro u hu; exact ⟨le_refl 0, zero_le_one⟩⟩\n\nlemma stepFunction_measurable (h : FieldStep) : Measurable (stepFunction h) := by\n unfold stepFunction\n apply Finset.measurable_sum\n intro i hi\n apply Measurable.ite\n · exact (measurableSet_lt measurable_const measurable_id).inter\n (measurableSet_lt measurable_id measurable_const)\n · exact measurable_const\n · exact measurable_const\n\nlemma zeroPath_integral (h : FieldStep) :\n ∫ u, stepFunction h u * zeroPath.val u ∂pathMeasure = 0 := by\n have hzero : (zeroPath.val : ℝ → ℝ) =ᵐ[pathMeasure] Function.const ℝ (0:ℝ) := by\n simpa [zeroPath] using\n (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) (0:ℝ))\n have : (fun u => stepFunction h u * zeroPath.val u) =ᵐ[pathMeasure] (fun _ => (0:ℝ)) := by\n filter_upwards [hzero] with u hu\n simp [hu]\n rw [integral_congr_ae this]\n simp\n\nlemma isingEntropy_zeroPath_le_zero : isingEntropy zeroPath ≤ 0 := by\n unfold isingEntropy\n refine iSup_le ?_\n intro h\n rw [zeroPath_integral h]\n have := fieldRecursion_le_zero h\n simpa using (EReal.coe_le_coe_iff.mpr this :\n ((fieldRecursion h : ℝ) : EReal) ≤ (0 : EReal))\n\nlemma limUnder_bounds {u : ℕ → ℝ} {K : ℝ} (h : ∀ n, |u n| ≤ K) :\n min (-K) (Classical.choice (inferInstance : Nonempty ℝ)) ≤ Filter.limUnder atTop u ∧\n Filter.limUnder atTop u ≤ max K (Classical.choice (inferInstance : Nonempty ℝ)) := by\n by_cases hconv : ∃ x : ℝ, Tendsto u atTop (𝓝 x)\n · obtain ⟨x, hx⟩ := hconv\n have hlim : Filter.limUnder atTop u = x := hx.limUnder_eq\n rw [hlim]\n constructor\n · apply le_trans (min_le_left _ _)\n exact ge_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).1))\n · apply le_trans (le_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).2)))\n exact le_max_left _ _\n · have hlim : Filter.limUnder atTop u\n = Classical.choice (inferInstance : Nonempty ℝ) := limUnder_of_not_tendsto hconv\n rw [hlim]\n exact ⟨min_le_right _ _, le_max_right _ _⟩\n\nlemma ereal_iInf_eq_coe_of_bounds {ι : Type*} (f : ι → EReal) (i0 : ι) {a b : ℝ}\n (ha : ∀ i, (a : EReal) ≤ f i) (hb : f i0 ≤ (b : EReal)) :\n ∃ p : ℝ, (⨅ i, f i) = (p : EReal) := by\n have hle : (a : EReal) ≤ ⨅ i, f i := le_iInf ha\n have hge : (⨅ i, f i) ≤ (b : EReal) := (iInf_le f i0).trans hb\n have hne_bot : (⨅ i, f i) ≠ ⊥ := by\n intro h\n rw [h] at hle\n exact EReal.coe_ne_bot a (le_bot_iff.mp hle)\n have hne_top : (⨅ i, f i) ≠ ⊤ := by\n intro h\n rw [h] at hge\n exact absurd hge (not_le.mpr (EReal.coe_lt_top b))\n exact ⟨(⨅ i, f i).toReal, (EReal.coe_toReal hne_top hne_bot).symm⟩\ntheorem variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α)\n {f : ℝ → ℝ} (hf : Continuous f) (hbounded : ∃ K : ℝ, ∀ x, |f x| ≤ K) :\n ∃ p : ℝ, variationalValue α f = (p : EReal) := by\n obtain ⟨K, hK⟩ := hbounded\n let c : ℝ := Classical.choice (inferInstance : Nonempty ℝ)\n have hlow : ∀ q : OverlapPath,\n ((α * min (-K) c : ℝ) : EReal) ≤ (α * patternFunctional f q : ℝ) + isingEntropy q := by\n intro q\n have hpt : ∀ n : ℕ, |uniformPattern f q n| ≤ K := uniformPattern_abs_le f K hf hK q\n have hb : min (-K) c ≤ patternFunctional f q := (limUnder_bounds hpt).1\n have hmul : α * min (-K) c ≤ α * patternFunctional f q :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * min (-K) c : ℝ) : EReal) ≤ ((α * patternFunctional f q : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * min (-K) c : ℝ) : EReal)\n ≤ ((α * patternFunctional f q : ℝ) : EReal) := hcoe\n _ ≤ (α * patternFunctional f q : ℝ) + isingEntropy q :=\n le_add_of_nonneg_right (isingEntropy_nonneg q)\n have hup : ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * max K c : ℝ) : EReal) := by\n have hpt : ∀ n : ℕ, |uniformPattern f zeroPath n| ≤ K :=\n uniformPattern_abs_le f K hf hK zeroPath\n have hb : patternFunctional f zeroPath ≤ max K c := (limUnder_bounds hpt).2\n have hmul : α * patternFunctional f zeroPath ≤ α * max K c :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * patternFunctional f zeroPath : ℝ) : EReal) ≤ ((α * max K c : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * patternFunctional f zeroPath : ℝ) : EReal) + 0 :=\n add_le_add_right isingEntropy_zeroPath_le_zero _\n _ = ((α * patternFunctional f zeroPath : ℝ) : EReal) := add_zero _\n _ ≤ ((α * max K c : ℝ) : EReal) := hcoe\n have hmain := ereal_iInf_eq_coe_of_bounds\n (fun q : OverlapPath => (α * patternFunctional f q : ℝ) + isingEntropy q) zeroPath hlow hup\n simpa [variationalValue] using hmain\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "02389bb2ba9367a1184215c4dca9441541cfd42d010e38ff618daa90755ae724"
},
"ef854546279d2b9aeb0ddb5b2331d951d478065521edca3a0e9a5fe727e4000a": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n\nlemma gaussianTransform_abs_le_of_bound (s d K : ℝ) {U : ℝ → ℝ}\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n have hK : 0 ≤ K := le_trans (abs_nonneg (U 0)) (hUK 0)\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1)\n · have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hmeas K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · rw [integral_non_aestronglyMeasurable hmeas]\n simpa using hK\n · simp only [gaussianTransform, hd, ite_false]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1)\n · have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤\n Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hmeas (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n · rw [integral_non_aestronglyMeasurable hmeas]\n simp only [Real.log_zero, zero_div, abs_zero]\n exact hK\n\nlemma foldr_gaussianTransform_abs_le (L : List (ℝ × ℝ)) (K : ℝ) {V : ℝ → ℝ}\n (hV : ∀ x, |V x| ≤ K) :\n ∀ x, |L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x| ≤ K := by\n induction L with\n | nil => simpa using hV\n | cons a L ih =>\n intro x\n simpa [List.foldr_cons] using gaussianTransform_abs_le_of_bound a.1 a.2 K ih x\n\ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\nlemma uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f)\n (hK : ∀ x, |f x| ≤ K) (q : OverlapPath) (n : ℕ) :\n |uniformPattern f q n| ≤ K := by\n simpa [uniformPattern] using\n foldr_gaussianTransform_abs_le\n (List.ofFn (fun i : Fin (n + 2) =>\n let k := n + 1\n let levelVal := fun j => if j < k then cellAverage q k j else 1\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)),\n (i : ℝ) / k))) K hK 0\n\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef isingEntropyWitnessPartition : Partition where\n levels := 1\n positive := by norm_num\n cut := fun i : Fin (1 + 1) => (i.val : ℝ)\n ordered := by\n intro i j hij\n exact Nat.cast_lt.mpr hij\n first := by simp\n last := by simp\n\ndef isingEntropyWitnessFieldStep : FieldStep where\n partition := isingEntropyWitnessPartition\n value := fun _ => 0\n nonneg := by intro i; rfl\n ordered := by intro i j _; rfl\n\nlemma stepFunction_isingEntropyWitnessFieldStep (u : ℝ) :\n stepFunction isingEntropyWitnessFieldStep u = 0 := by\n unfold stepFunction\n apply Finset.sum_eq_zero\n intro i hi\n split_ifs <;> rfl\n\nlemma fieldRecursion_isingEntropyWitnessFieldStep :\n fieldRecursion isingEntropyWitnessFieldStep = 0 := by\n simp [fieldRecursion, isingEntropyWitnessFieldStep, isingEntropyWitnessPartition,\n gaussianTransform, stepAt, Real.log_one]\n\ntheorem isingEntropy_nonneg (q : OverlapPath) : (0 : EReal) ≤ isingEntropy q := by\n unfold isingEntropy\n refine le_iSup_of_le (f := fun h : FieldStep =>\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal))\n isingEntropyWitnessFieldStep ?_\n simp [fieldRecursion_isingEntropyWitnessFieldStep,\n stepFunction_isingEntropyWitnessFieldStep]\n\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nlemma integral_exp_mul_gaussianReal_one (t : ℝ) :\n ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 = Real.exp (t ^ 2 / 2) := by\n have h := congrFun (ProbabilityTheory.mgf_id_gaussianReal (μ := 0) (v := 1)) t\n simpa [ProbabilityTheory.mgf] using h\n\nlemma integrable_exp_pos_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp (Real.sqrt s * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp x * Real.exp (Real.sqrt s * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\n\nlemma integrable_exp_neg_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp ((-Real.sqrt s) * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp (-x) * Real.exp ((-Real.sqrt s) * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\n ring_nf\n\nlemma integral_exp_affine {s : ℝ} (hs : 0 ≤ s) (t x : ℝ) :\n ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1 = Real.exp x * Real.exp (t ^ 2 / 2) := by\n have h := integral_exp_mul_gaussianReal_one t\n calc ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1\n = ∫ z, Real.exp x * Real.exp (t * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [Real.exp_add]\n _ = Real.exp x * ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 := integral_const_mul _ _\n _ = Real.exp x * Real.exp (t ^ 2 / 2) := by rw [h]\n\nlemma integrable_cosh_gaussianReal (x s : ℝ) :\n Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have h3 : Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)\n + Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := h1.add h2\n have h4 := h3.const_mul ((2:ℝ)⁻¹)\n refine h4.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [Real.cosh_eq]\n ring\n\nlemma integral_cosh_gaussianReal {s : ℝ} (hs : 0 ≤ s) (x : ℝ) :\n ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := by\n have hsp : (Real.sqrt s) ^ 2 = s := Real.sq_sqrt hs\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have e1 : ∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.exp x * Real.exp (s / 2) := by\n rw [integral_exp_affine hs, hsp]\n have e2 : ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = Real.exp (-x) * Real.exp (s / 2) := by\n have h := integral_exp_mul_gaussianReal_one (-Real.sqrt s)\n calc ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = ∫ z, Real.exp (-x) * Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [← Real.exp_add]; ring_nf\n _ = Real.exp (-x) * ∫ z, Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 :=\n integral_const_mul _ _\n _ = Real.exp (-x) * Real.exp (((-Real.sqrt s)) ^ 2 / 2) := by rw [h]\n _ = Real.exp (-x) * Real.exp (s / 2) := by\n rw [show ((-Real.sqrt s)) ^ 2 = s by rw [neg_sq, hsp]]\n calc ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = ∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z))) / 2\n ∂gaussianReal 0 1 := by\n congr 1 with z\n rw [Real.cosh_eq]\n _ = (∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z)))\n ∂gaussianReal 0 1) / 2 := by rw [integral_div]\n _ = ((∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n + (∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1)) / 2 := by\n rw [integral_add h1 h2]\n _ = Real.cosh x * Real.exp (s / 2) := by\n rw [e1, e2, Real.cosh_eq]\n ring\n\nlemma exp_mul_le_cosh_rpow {d w : ℝ} (hd : 0 ≤ d) {U : ℝ → ℝ}\n (hU : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (y : ℝ) :\n Real.exp (d * U y) ≤ (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n have hcosh_pos : 0 < Real.cosh y := Real.cosh_pos y\n have h1 : d * U y ≤ d * (Real.log (Real.cosh y) - w / 2) :=\n mul_le_mul_of_nonneg_left (hU y) hd\n have h2 : Real.exp (d * U y) ≤ Real.exp (d * (Real.log (Real.cosh y) - w / 2)) :=\n Real.exp_le_exp.mpr h1\n have h3 : Real.exp (d * (Real.log (Real.cosh y) - w / 2))\n = (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n rw [Real.rpow_def_of_pos hcosh_pos]\n rw [show d * (Real.log (Real.cosh y) - w / 2)\n = Real.log (Real.cosh y) * d + (-(d * w / 2)) by ring]\n rw [Real.exp_add]\n rw [← h3]\n exact h2\n\nlemma integrable_cosh_rpow_gaussianReal {s d : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d) (gaussianReal 0 1) := by\n have hcosh := integrable_cosh_gaussianReal x s\n have hmeas : AEStronglyMeasurable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := by\n apply Continuous.aestronglyMeasurable\n fun_prop\n refine Integrable.mono hcosh hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, Real.norm_eq_abs]\n have hpos : 0 < Real.cosh (x + Real.sqrt s * z) := Real.cosh_pos _\n rw [abs_of_pos (Real.rpow_pos_of_pos hpos d), abs_of_pos hpos]\n calc (Real.cosh (x + Real.sqrt s * z)) ^ d\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ (1:ℝ) := by\n apply Real.rpow_le_rpow_of_exponent_le\n · exact Real.one_le_cosh _\n · exact hd1\n _ = Real.cosh (x + Real.sqrt s * z) := Real.rpow_one _\n\nlemma integrable_exp_mul_u_gaussianReal {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n have hbound_int : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := hcosh_rpow.mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) := by\n have h2 : Measurable fun z : ℝ => U (x + Real.sqrt s * z) :=\n hUmeas.comp (by fun_prop)\n exact (Real.measurable_exp.comp (h2.const_mul d)).aestronglyMeasurable\n refine Integrable.mono' hbound_int hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n exact exp_mul_le_cosh_rpow hd hUup _\n\nlemma integrable_cosh_mul_exp_gaussianReal {s d w : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n exact hcosh_rpow.mul_const _\n\nlemma jensen_step_pos {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 < d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n have hcosh_int : ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := integral_cosh_gaussianReal hs x\n have hcosh_int_meas : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z))\n (gaussianReal 0 1) := integrable_cosh_gaussianReal x s\n have hptw : ∀ z, Real.exp (d * U (x + Real.sqrt s * z))\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2)) :=\n fun z => exp_mul_le_cosh_rpow hd.le hUup _\n have hJensen : (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n ≥ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1 := by\n have hconcave : ConcaveOn ℝ (Set.Ici 0) (fun y : ℝ => y ^ d) :=\n Real.concaveOn_rpow hd.le hd1\n have hcont : ContinuousOn (fun y : ℝ => y ^ d) (Set.Ici 0) := by\n intro y hy\n exact (Real.continuousAt_rpow_const y d (Or.inr hd.le)).continuousWithinAt\n have hmem : ∀ᵐ z ∂gaussianReal 0 1, Real.cosh (x + Real.sqrt s * z) ∈ Set.Ici (0:ℝ) :=\n Filter.Eventually.of_forall (fun z => (Real.cosh_pos _).le)\n have hint_rpow : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := integrable_cosh_rpow_gaussianReal hs hd.le hd1 x\n simpa only [Function.comp_apply] using\n (ConcaveOn.le_map_integral hconcave hcont isClosed_Ici hmem hcosh_int_meas hint_rpow)\n have h_exp_int := integrable_exp_mul_u_gaussianReal (M := M) hs hd.le hd1 hUmeas hUup x\n have h_bound_int := integrable_cosh_mul_exp_gaussianReal hs hd.le hd1 (w := w) x\n calc ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2))\n ∂gaussianReal 0 1 := integral_mono h_exp_int h_bound_int hptw\n _ = (∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1)\n * Real.exp (-(d * w / 2)) := integral_mul_const _ _\n _ ≤ (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n * Real.exp (-(d * w / 2)) := by\n apply mul_le_mul_of_nonneg_right hJensen (Real.exp_pos _).le\n _ = (Real.cosh x * Real.exp (s / 2)) ^ d * Real.exp (-(d * w / 2)) := by rw [hcosh_int]\n _ = (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n rw [Real.mul_rpow (Real.cosh_pos x).le (Real.exp_pos (s/2)).le]\n rw [show (Real.exp (s / 2)) ^ d = Real.exp (s / 2 * d) by\n rw [Real.rpow_def_of_pos (Real.exp_pos _), Real.log_exp]]\n rw [mul_assoc, ← Real.exp_add]\n congr 2\n ring\n\nlemma integrable_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n integrable_cosh_gaussianReal x s\n have hmono : Integrable (fun z : ℝ => M + Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have := (integrable_const (μ := gaussianReal 0 1) M).add hc\n simpa [add_comm] using this\n have hmeas : AEStronglyMeasurable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n (hUmeas.comp (by fun_prop)).aestronglyMeasurable\n refine Integrable.mono' hmono hmeas (Filter.Eventually.of_forall (fun z => ?_))\n have hlog_le : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) := by\n have h1 : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) - 1 :=\n Real.log_le_sub_one_of_pos (Real.cosh_pos _)\n linarith\n have hpos : (0:ℝ) ≤ Real.cosh (x + Real.sqrt s * z) := (Real.cosh_pos _).le\n rw [Real.norm_eq_abs, abs_le]\n constructor\n · have := hUlow (x + Real.sqrt s * z); linarith\n · have := hUup (x + Real.sqrt s * z); linarith\n\nlemma integrable_exp_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)))\n (gaussianReal 0 1) := (integrable_cosh_gaussianReal x s).mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n (Real.measurable_exp.comp (hUmeas.comp (by fun_prop))).aestronglyMeasurable\n refine Integrable.mono' hc hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n simpa using exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\n\nlemma integral_le_log_integral_exp {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n ≤ Real.log (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup x\n set A : ℝ := ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 with hA\n have hApos : 0 < A := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) := integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) ≤ A := by\n rw [hA]\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n set G : ℝ → ℝ := fun z => Real.exp (U (x + Real.sqrt s * z)) with hG\n have hGint' : Integrable G (gaussianReal 0 1) := hGint\n have hpoint : ∀ z, U (x + Real.sqrt s * z) ≤ Real.log A + (G z - A) / A := by\n intro z\n have hGpos : 0 < G z := Real.exp_pos _\n have hlogG : Real.log (G z) = U (x + Real.sqrt s * z) := by simp [hG]\n have := Real.log_le_sub_one_of_pos (div_pos hGpos hApos)\n rw [Real.log_div (ne_of_gt hGpos) (ne_of_gt hApos), hlogG] at this\n have h2 : G z / A - 1 = (G z - A) / A := by field_simp\n linarith [this, h2.le, h2.ge]\n have hright_int : Integrable (fun z : ℝ => Real.log A + (G z - A) / A) (gaussianReal 0 1) := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n exact (integrable_const (Real.log A)).add h1\n have hmono := integral_mono hUint hright_int hpoint\n have hright_val : ∫ z, (Real.log A + (G z - A) / A) ∂gaussianReal 0 1 = Real.log A := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n rw [integral_add (integrable_const (Real.log A)) h1]\n have h2 : ∫ z, (G z - A) / A ∂gaussianReal 0 1 = 0 := by\n rw [integral_div]\n rw [integral_sub hGint' (integrable_const A)]\n have hGA : (∫ z, G z ∂gaussianReal 0 1) = A := by rw [hA]\n rw [hGA]\n simp\n rw [h2]\n simp\n rw [hright_val] at hmono\n simpa [hA] using hmono\n\nlemma gaussianTransform_step_upper {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 - w / 2 := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hstep := integral_le_log_integral_exp (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup x\n have hbound_int : Integrable (fun z : ℝ =>\n Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))) (gaussianReal 0 1) :=\n (integrable_cosh_gaussianReal x s).mul_const _\n have hpoint : ∀ z : ℝ, Real.exp (U (x + Real.sqrt s * z))\n ≤ Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)) := by\n intro z\n have := exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\n simpa using this\n have hA_le : (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n calc ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))\n ∂gaussianReal 0 1 := integral_mono hGint hbound_int hpoint\n _ = (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n * Real.exp (-(w / 2)) := integral_mul_const _ _\n _ = Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n rw [integral_cosh_gaussianReal hs x]\n have hApos : 0 < ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) :=\n integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1)\n ≤ ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog_le := Real.log_le_log hApos hA_le\n rw [Real.log_mul (mul_pos (Real.cosh_pos x) (Real.exp_pos (s / 2))).ne'\n (Real.exp_pos (-(w / 2))).ne',\n Real.log_mul (Real.cosh_pos x).ne' (Real.exp_pos (s / 2)).ne',\n Real.log_exp, Real.log_exp] at hlog_le\n linarith\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hJ := jensen_step_pos (M := M) hs hdpos hd1 hUmeas hUlow hUup x\n have hpos_low : 0 < Real.exp (-(d * M)) := Real.exp_pos _\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le hpos_low hle\n have hlog_le : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log ((Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2)) :=\n Real.log_le_log hIpos hJ\n rw [Real.log_mul (Real.rpow_pos_of_pos (Real.cosh_pos x) d).ne'\n (Real.exp_pos (s * d / 2 - d * w / 2)).ne',\n Real.log_rpow (Real.cosh_pos x), Real.log_exp] at hlog_le\n rw [div_le_iff₀ hdpos]\n nlinarith\n\nlemma gaussianTransform_step_lower {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hconst : Integrable (fun _ : ℝ => -M) (gaussianReal 0 1) := integrable_const _\n have := integral_mono hconst hUint (fun z => hUlow _)\n simpa using this\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog : -(d * M) ≤\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc -(d * M) = Real.log (Real.exp (-(d * M))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hle\n rw [le_div_iff₀ hdpos]\n nlinarith\n\nlemma measurable_integral_shift {s : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => U (x + Real.sqrt s * z)) := by\n apply hU.stronglyMeasurable.comp_measurable\n fun_prop\n exact (hun.integral_prod_right (ν := gaussianReal 0 1)).measurable\n\nlemma measurable_log_integral_shift {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) := by\n apply (Real.measurable_exp.comp (hU.const_mul d)).stronglyMeasurable.comp_measurable\n fun_prop\n exact ((hun.integral_prod_right (ν := gaussianReal 0 1)).measurable.log)\n\nlemma gaussianTransform_measurable {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (gaussianTransform s d U) := by\n unfold gaussianTransform\n by_cases hd : d = 0\n · simp only [if_pos hd]\n exact measurable_integral_shift hU\n · simp only [if_neg hd]\n exact (measurable_log_integral_shift (d := d) hU).div_const d\n\nlemma gaussianTransform_step_upper' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 + c := by\n have h := gaussianTransform_step_upper (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\n calc gaussianTransform s d U x\n ≤ Real.log (Real.cosh x) + s / 2 - (-2 * c) / 2 := h\n _ = Real.log (Real.cosh x) + s / 2 + c := by ring\n\nlemma gaussianTransform_step_lower' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n exact gaussianTransform_step_lower (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\n\nlemma fold_gaussianTransform_bounds (L : List (ℝ × ℝ)) (M c : ℝ)\n (hL : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1)\n (hcM : c + (L.map Prod.fst).sum / 2 ≤ M)\n {V : ℝ → ℝ} (hVmeas : Measurable V) (hVlow : ∀ x, -M ≤ V x)\n (hVup : ∀ x, V x ≤ Real.log (Real.cosh x) + c) :\n (∀ x, L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x\n ≤ Real.log (Real.cosh x) + c + (L.map Prod.fst).sum / 2) ∧\n (∀ x, -M ≤ L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x) ∧\n Measurable (L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V) := by\n induction L with\n | nil =>\n refine ⟨fun x => ?_, hVlow, hVmeas⟩\n simpa using hVup x\n | cons a L ih =>\n obtain ⟨ha1, ha2, ha3⟩ := hL a (by simp)\n have htail : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := fun p hp =>\n hL p (by simp [hp])\n have hsum : ((a :: L).map Prod.fst).sum = a.1 + (L.map Prod.fst).sum := by simp\n rw [hsum] at hcM\n have hcM' : c + (L.map Prod.fst).sum / 2 ≤ M := by linarith\n have hih := ih htail hcM'\n set W : ℝ → ℝ := L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V with hW\n have hWmeas : Measurable W := hih.2.2\n have hWlow : ∀ x, -M ≤ W x := hih.2.1\n have hWup : ∀ x, W x ≤ Real.log (Real.cosh x) + (c + (L.map Prod.fst).sum / 2) := by\n intro x\n have := hih.1 x\n linarith\n have hcM'' : c + (L.map Prod.fst).sum / 2 ≤ M := hcM'\n have hstep_up : ∀ x, gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := fun x =>\n gaussianTransform_step_upper' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_low : ∀ x, -M ≤ gaussianTransform a.1 a.2 W x := fun x =>\n gaussianTransform_step_lower' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_meas : Measurable (gaussianTransform a.1 a.2 W) :=\n gaussianTransform_measurable hWmeas\n have hfold : (a :: L).foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V\n = gaussianTransform a.1 a.2 W := by\n simp [hW]\n refine ⟨?_, ?_, ?_⟩\n · intro x\n rw [hfold, hsum]\n have := hstep_up x\n calc gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := this\n _ = Real.log (Real.cosh x) + c + (a.1 + (L.map Prod.fst).sum) / 2 := by ring\n · intro x\n rw [hfold]\n exact hstep_low x\n · rw [hfold]\n exact hstep_meas\n\nlemma stepAt_nonneg (h : FieldStep) (i : ℕ) : 0 ≤ stepAt h i := by\n unfold stepAt\n split_ifs with hi\n · exact h.nonneg _\n · exact le_refl 0\n\nlemma stepAt_mono_of_lt (h : FieldStep) {i j : ℕ} (hij : i ≤ j)\n (hj : j < h.partition.levels) : stepAt h i ≤ stepAt h j := by\n have hi : i < h.partition.levels := lt_of_le_of_lt hij hj\n have h1 : stepAt h i = h.value ⟨i, hi⟩ := by simp [stepAt, hi]\n have h2 : stepAt h j = h.value ⟨j, hj⟩ := by simp [stepAt, hj]\n rw [h1, h2]\n exact h.ordered (Fin.mk_le_mk.mpr hij)\n\nlemma cut_nonneg (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n 0 ≤ h.partition.cut i := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have h0 : (⟨0, Nat.zero_lt_succ h.partition.levels⟩ : Fin (h.partition.levels + 1)) ≤ i :=\n Fin.zero_le i\n have := hmono h0\n rwa [h.partition.first] at this\n\nlemma cut_le_one (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n h.partition.cut i ≤ 1 := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have hlast : i ≤ (⟨h.partition.levels, Nat.lt_succ_self h.partition.levels⟩ :\n Fin (h.partition.levels + 1)) := Fin.le_last i\n have := hmono hlast\n rwa [h.partition.last] at this\n\nlemma stepAt_increment_nonneg (h : FieldStep) {i : ℕ} (hi : i < h.partition.levels) :\n 0 ≤ stepAt h i - (if i = 0 then 0 else stepAt h (i - 1)) := by\n by_cases h0 : i = 0\n · have hzi : stepAt h i = stepAt h 0 := by rw [h0]\n rw [h0, if_pos rfl]\n simp only [sub_zero]\n exact stepAt_nonneg h 0\n · have hle : i - 1 ≤ i := Nat.sub_le i 1\n have hmono := stepAt_mono_of_lt h hle hi\n rw [if_neg h0]\n linarith\n\nlemma sum_increments_eq (h : FieldStep) :\n ((List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum\n = stepAt h (h.partition.levels - 1) := by\n rw [List.map_ofFn, List.sum_ofFn]\n simp only [Function.comp_apply]\n rw [Fin.sum_univ_eq_sum_range\n (fun i => stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))) h.partition.levels]\n have htel := Finset.sum_range_sub\n (fun i : ℕ => if i = 0 then (0:ℝ) else stepAt h (i - 1)) h.partition.levels\n have hterm : ∀ i ∈ Finset.range h.partition.levels,\n stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))\n = (if i + 1 = 0 then (0:ℝ) else stepAt h (i + 1 - 1))\n - (if i = 0 then 0 else stepAt h (i - 1)) := by\n intro i hi\n have : i + 1 ≠ 0 := Nat.succ_ne_zero i\n rw [if_neg this, Nat.succ_sub_one]\n rw [Finset.sum_congr rfl hterm, htel]\n have h0 : (if (0:ℕ) = 0 then (0:ℝ) else stepAt h (0 - 1)) = 0 := if_pos rfl\n rw [h0, sub_zero]\n have hk : h.partition.levels ≠ 0 := Nat.pos_iff_ne_zero.mp h.partition.positive\n rw [if_neg hk]\n\nlemma increments_mem (h : FieldStep) :\n ∀ p ∈ List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc)), 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := by\n intro p hp\n rw [List.mem_ofFn] at hp\n obtain ⟨i, rfl⟩ := hp\n exact ⟨stepAt_increment_nonneg h i.isLt,\n cut_nonneg h i.castSucc, cut_le_one h i.castSucc⟩\n\ntheorem fieldRecursion_le_zero (h : FieldStep) : fieldRecursion h ≤ 0 := by\n set k := h.partition.levels with hk\n set W := stepAt h (k - 1) with hW\n have hWnonneg : 0 ≤ W := stepAt_nonneg h (k - 1)\n have hincr := increments_mem h\n have hsum : ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum = W := by\n rw [hW]\n exact sum_increments_eq h\n have hVmeas : Measurable (fun x : ℝ => Real.log (Real.cosh x) - W / 2) := by fun_prop\n have hVlow : ∀ x, -(W / 2) ≤ Real.log (Real.cosh x) - W / 2 := by\n intro x\n have h1 : (1:ℝ) ≤ Real.cosh x := Real.one_le_cosh x\n have := Real.log_nonneg h1\n linarith\n have hVup : ∀ x, Real.log (Real.cosh x) - W / 2\n ≤ Real.log (Real.cosh x) + (-(W / 2)) := fun x => le_refl _\n have hcM : (-(W / 2)) + ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum / 2 ≤ W / 2 := by\n rw [hsum]; linarith\n have hfold := fold_gaussianTransform_bounds\n (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))) (W / 2) (-(W / 2)) hincr hcM hVmeas hVlow hVup\n have hmain : (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).foldr\n (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - W / 2) 0 ≤ 0 := by\n have h1 := hfold.1 0\n rw [hsum] at h1\n have hc : Real.log (Real.cosh (0:ℝ)) = 0 := by simp\n rw [hc] at h1\n linarith\n simpa [fieldRecursion, hk] using hmain\n\ndef zeroPath : OverlapPath where\n val := AEEqFun.const ℝ (0 : ℝ)\n admissible := ⟨fun _ => 0, (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) 0).symm, by\n intro a b ha hb hab; exact le_refl 0, by\n intro u hu; exact ⟨le_refl 0, zero_le_one⟩⟩\n\nlemma zeroPath_integral (h : FieldStep) :\n ∫ u, stepFunction h u * zeroPath.val u ∂pathMeasure = 0 := by\n have hzero : (zeroPath.val : ℝ → ℝ) =ᵐ[pathMeasure] Function.const ℝ (0:ℝ) := by\n simpa [zeroPath] using\n (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) (0:ℝ))\n have : (fun u => stepFunction h u * zeroPath.val u) =ᵐ[pathMeasure] (fun _ => (0:ℝ)) := by\n filter_upwards [hzero] with u hu\n simp [hu]\n rw [integral_congr_ae this]\n simp\n\nlemma isingEntropy_zeroPath_le_zero : isingEntropy zeroPath ≤ 0 := by\n unfold isingEntropy\n refine iSup_le ?_\n intro h\n rw [zeroPath_integral h]\n have := fieldRecursion_le_zero h\n simpa using (EReal.coe_le_coe_iff.mpr this :\n ((fieldRecursion h : ℝ) : EReal) ≤ (0 : EReal))\n\nlemma limUnder_bounds {u : ℕ → ℝ} {K : ℝ} (h : ∀ n, |u n| ≤ K) :\n min (-K) (Classical.choice (inferInstance : Nonempty ℝ)) ≤ Filter.limUnder atTop u ∧\n Filter.limUnder atTop u ≤ max K (Classical.choice (inferInstance : Nonempty ℝ)) := by\n by_cases hconv : ∃ x : ℝ, Tendsto u atTop (𝓝 x)\n · obtain ⟨x, hx⟩ := hconv\n have hlim : Filter.limUnder atTop u = x := hx.limUnder_eq\n rw [hlim]\n constructor\n · apply le_trans (min_le_left _ _)\n exact ge_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).1))\n · apply le_trans (le_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).2)))\n exact le_max_left _ _\n · have hlim : Filter.limUnder atTop u\n = Classical.choice (inferInstance : Nonempty ℝ) := limUnder_of_not_tendsto hconv\n rw [hlim]\n exact ⟨min_le_right _ _, le_max_right _ _⟩\n\nlemma ereal_iInf_eq_coe_of_bounds {ι : Type*} (f : ι → EReal) (i0 : ι) {a b : ℝ}\n (ha : ∀ i, (a : EReal) ≤ f i) (hb : f i0 ≤ (b : EReal)) :\n ∃ p : ℝ, (⨅ i, f i) = (p : EReal) := by\n have hle : (a : EReal) ≤ ⨅ i, f i := le_iInf ha\n have hge : (⨅ i, f i) ≤ (b : EReal) := (iInf_le f i0).trans hb\n have hne_bot : (⨅ i, f i) ≠ ⊥ := by\n intro h\n rw [h] at hle\n exact EReal.coe_ne_bot a (le_bot_iff.mp hle)\n have hne_top : (⨅ i, f i) ≠ ⊤ := by\n intro h\n rw [h] at hge\n exact absurd hge (not_le.mpr (EReal.coe_lt_top b))\n exact ⟨(⨅ i, f i).toReal, (EReal.coe_toReal hne_top hne_bot).symm⟩\n\ntheorem variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α)\n {f : ℝ → ℝ} (hf : Continuous f) (hbounded : ∃ K : ℝ, ∀ x, |f x| ≤ K) :\n ∃ p : ℝ, variationalValue α f = (p : EReal) := by\n obtain ⟨K, hK⟩ := hbounded\n let c : ℝ := Classical.choice (inferInstance : Nonempty ℝ)\n have hlow : ∀ q : OverlapPath,\n ((α * min (-K) c : ℝ) : EReal) ≤ (α * patternFunctional f q : ℝ) + isingEntropy q := by\n intro q\n have hpt : ∀ n : ℕ, |uniformPattern f q n| ≤ K := uniformPattern_abs_le f K hf hK q\n have hb : min (-K) c ≤ patternFunctional f q := (limUnder_bounds hpt).1\n have hmul : α * min (-K) c ≤ α * patternFunctional f q :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * min (-K) c : ℝ) : EReal) ≤ ((α * patternFunctional f q : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * min (-K) c : ℝ) : EReal)\n ≤ ((α * patternFunctional f q : ℝ) : EReal) := hcoe\n _ ≤ (α * patternFunctional f q : ℝ) + isingEntropy q :=\n le_add_of_nonneg_right (isingEntropy_nonneg q)\n have hup : ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * max K c : ℝ) : EReal) := by\n have hpt : ∀ n : ℕ, |uniformPattern f zeroPath n| ≤ K :=\n uniformPattern_abs_le f K hf hK zeroPath\n have hb : patternFunctional f zeroPath ≤ max K c := (limUnder_bounds hpt).2\n have hmul : α * patternFunctional f zeroPath ≤ α * max K c :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * patternFunctional f zeroPath : ℝ) : EReal) ≤ ((α * max K c : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * patternFunctional f zeroPath : ℝ) : EReal) + 0 :=\n add_le_add_right isingEntropy_zeroPath_le_zero _\n _ = ((α * patternFunctional f zeroPath : ℝ) : EReal) := add_zero _\n _ ≤ ((α * max K c : ℝ) : EReal) := hcoe\n have hmain := ereal_iInf_eq_coe_of_bounds\n (fun q : OverlapPath => (α * patternFunctional f q : ℝ) + isingEntropy q) zeroPath hlow hup\n simpa [variationalValue] using hmain\n\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "ef854546279d2b9aeb0ddb5b2331d951d478065521edca3a0e9a5fe727e4000a"
},
"9ae908672b96f937d19b4b2f6b74aa1952a57184e264e1a08c9a0bc847c2775a": {
"path": "Submission.lean",
"code": "import Mathlib\n\nnamespace OAI\n\nopen MeasureTheory ProbabilityTheory Filter\nopen scoped BigOperators Topology ENNReal\n\nnoncomputable section\nnamespace IsingPerceptron\n\ndef gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=\n if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)) / d\n\nstructure Partition where\n levels : ℕ\n positive : 0 < levels\n cut : Fin (levels + 1) → ℝ\n ordered : StrictMono cut\n first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0\n last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1\n\nstructure FieldStep where\n partition : Partition\n value : Fin partition.levels → ℝ\n nonneg : ∀ i, 0 ≤ value i\n ordered : Monotone value\n\n \nlemma gaussianTransform_abs_le (s d K : ℝ) {U : ℝ → ℝ} (hU : Continuous U)\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n have hcont : Continuous fun z : ℝ => U (x + Real.sqrt s * z) := by fun_prop\n have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · simp only [gaussianTransform, hd, ite_false]\n have hcont : Continuous fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)) := by\n fun_prop\n have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤ Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hcont.aestronglyMeasurable (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\nlemma gaussianTransform_abs_le_of_bound (s d K : ℝ) {U : ℝ → ℝ}\n (hUK : ∀ x, |U x| ≤ K) : ∀ x, |gaussianTransform s d U x| ≤ K := by\n have hK : 0 ≤ K := le_trans (abs_nonneg (U 0)) (hUK 0)\n intro x\n by_cases hd : d = 0\n · simp only [gaussianTransform, hd, ite_true]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1)\n · have hint : Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n Integrable.of_bound hmeas K\n (Filter.Eventually.of_forall (fun z => by\n simpa [Real.norm_eq_abs] using hUK (x + Real.sqrt s * z)))\n have h1 : ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 ≤ K := by\n calc\n _ ≤ ∫ _z : ℝ, K ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const K) (fun z => (abs_le.mp (hUK _)).2)\n _ = K := by simp\n have h2 : -K ≤ ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 := by\n calc\n -K = ∫ _z : ℝ, -K ∂gaussianReal 0 1 := by simp\n _ ≤ _ := integral_mono (integrable_const (-K)) hint\n (fun z => (abs_le.mp (hUK _)).1)\n exact abs_le.mpr ⟨h2, h1⟩\n · rw [integral_non_aestronglyMeasurable hmeas]\n simpa using hK\n · simp only [gaussianTransform, hd, ite_false]\n by_cases hmeas : AEStronglyMeasurable\n (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1)\n · have hbound : ∀ z : ℝ, |Real.exp (d * U (x + Real.sqrt s * z))| ≤\n Real.exp (|d| * K) := by\n intro z\n rw [abs_of_pos (Real.exp_pos _)]\n apply Real.exp_le_exp.mpr\n calc\n d * U (x + Real.sqrt s * z) ≤ |d * U (x + Real.sqrt s * z)| := le_abs_self _\n _ = |d| * |U (x + Real.sqrt s * z)| := abs_mul _ _\n _ ≤ |d| * K := mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n have hint : Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n Integrable.of_bound hmeas (Real.exp (|d| * K))\n (Filter.Eventually.of_forall hbound)\n have hupp : ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 ≤\n Real.exp (|d| * K) := by\n calc\n _ ≤ ∫ _z : ℝ, Real.exp (|d| * K) ∂gaussianReal 0 1 :=\n integral_mono hint (integrable_const _) (fun z => (abs_le.mp (hbound z)).2)\n _ = Real.exp (|d| * K) := by simp\n have hlow : Real.exp (-(|d| * K)) ≤\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc\n Real.exp (-(|d| * K)) = ∫ _z : ℝ, Real.exp (-(|d| * K)) ∂gaussianReal 0 1 := by simp\n _ ≤ _ := by\n apply integral_mono (integrable_const _) hint\n intro z\n apply Real.exp_le_exp.mpr\n have hz : |d * U (x + Real.sqrt s * z)| ≤ |d| * K := by\n rw [abs_mul]\n exact mul_le_mul_of_nonneg_left (hUK _) (abs_nonneg _)\n exact (abs_le.mp hz).1\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hlow\n have hlog_upper : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1) ≤ |d| * K := by\n calc\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log (Real.exp (|d| * K)) := Real.log_le_log hIpos hupp\n _ = |d| * K := Real.log_exp _\n have hlog_lower : -(|d| * K) ≤ Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc\n -(|d| * K) = Real.log (Real.exp (-(|d| * K))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hlow\n have hlogabs : |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))\n ∂gaussianReal 0 1)| ≤ |d| * K :=\n abs_le.mpr ⟨hlog_lower, hlog_upper⟩\n rw [abs_div]\n rw [div_le_iff₀ (abs_pos.mpr hd)]\n calc\n |Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)|\n ≤ |d| * K := hlogabs\n _ = K * |d| := by ring\n · rw [integral_non_aestronglyMeasurable hmeas]\n simp only [Real.log_zero, zero_div, abs_zero]\n exact hK\nlemma foldr_gaussianTransform_abs_le (L : List (ℝ × ℝ)) (K : ℝ) {V : ℝ → ℝ}\n (hV : ∀ x, |V x| ≤ K) :\n ∀ x, |L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x| ≤ K := by\n induction L with\n | nil => simpa using hV\n | cons a L ih =>\n intro x\n simpa [List.foldr_cons] using gaussianTransform_abs_le_of_bound a.1 a.2 K ih x\ndef stepAt (h : FieldStep) (i : ℕ) : ℝ :=\n if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0\n\n \n\ndef stepFunction (h : FieldStep) (u : ℝ) : ℝ :=\n ∑ i : Fin h.partition.levels,\n if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0\n\n \ndef fieldRecursion (h : FieldStep) : ℝ :=\n let k := h.partition.levels\n let increments := List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0\n\ndef pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)\n\n \nstructure OverlapPath where\n val : ℝ →ₘ[pathMeasure] ℝ\n admissible : ∃ q : ℝ → ℝ,\n (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧\n ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1\n\n \ndef cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=\n (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),\n q.val u ∂pathMeasure\n\n \n\ndef uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=\n let k := n + 1\n let levelVal := fun i => if i < k then cellAverage q k i else 1\n let increments := List.ofFn (fun i : Fin (k + 1) =>\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))\n increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0\n\n \n\nlemma uniformPattern_abs_le (f : ℝ → ℝ) (K : ℝ) (_hf : Continuous f)\n (hK : ∀ x, |f x| ≤ K) (q : OverlapPath) (n : ℕ) :\n |uniformPattern f q n| ≤ K := by\n simpa [uniformPattern] using\n foldr_gaussianTransform_abs_le\n (List.ofFn (fun i : Fin (n + 2) =>\n let k := n + 1\n let levelVal := fun j => if j < k then cellAverage q k j else 1\n (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)),\n (i : ℝ) / k))) K hK 0\ndef patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=\n Filter.limUnder atTop (uniformPattern f q)\n\n \n\ndef isingEntropy (q : OverlapPath) : EReal :=\n ⨆ h : FieldStep,\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)\n\ndef isingEntropyWitnessPartition : Partition where\n levels := 1\n positive := by norm_num\n cut := fun i : Fin (1 + 1) => (i.val : ℝ)\n ordered := by\n intro i j hij\n exact Nat.cast_lt.mpr hij\n first := by simp\n last := by simp\ndef isingEntropyWitnessFieldStep : FieldStep where\n partition := isingEntropyWitnessPartition\n value := fun _ => 0\n nonneg := by intro i; rfl\n ordered := by intro i j _; rfl\nlemma stepAt_isingEntropyWitnessFieldStep (i : ℕ) :\n stepAt isingEntropyWitnessFieldStep i = 0 := by\n unfold stepAt\n split_ifs <;> rfl\nlemma stepFunction_isingEntropyWitnessFieldStep (u : ℝ) :\n stepFunction isingEntropyWitnessFieldStep u = 0 := by\n unfold stepFunction\n apply Finset.sum_eq_zero\n intro i hi\n split_ifs <;> rfl\nlemma fieldRecursion_isingEntropyWitnessFieldStep :\n fieldRecursion isingEntropyWitnessFieldStep = 0 := by\n simp [fieldRecursion, isingEntropyWitnessFieldStep, isingEntropyWitnessPartition,\n gaussianTransform, stepAt, Real.log_one]\ntheorem isingEntropy_nonneg (q : OverlapPath) : (0 : EReal) ≤ isingEntropy q := by\n unfold isingEntropy\n refine le_iSup_of_le (f := fun h : FieldStep =>\n ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal))\n isingEntropyWitnessFieldStep ?_\n simp [fieldRecursion_isingEntropyWitnessFieldStep,\n stepFunction_isingEntropyWitnessFieldStep]\ndef variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=\n ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q\n\nlemma integral_exp_mul_gaussianReal_one (t : ℝ) :\n ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 = Real.exp (t ^ 2 / 2) := by\n have h := congrFun (ProbabilityTheory.mgf_id_gaussianReal (μ := 0) (v := 1)) t\n simpa [ProbabilityTheory.mgf] using h\nlemma integrable_exp_pos_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp (Real.sqrt s * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp x * Real.exp (Real.sqrt s * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\nlemma integrable_exp_neg_affine (x s : ℝ) :\n Integrable (fun z : ℝ => Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have h : Integrable (fun z : ℝ => Real.exp ((-Real.sqrt s) * z)) (gaussianReal 0 1) :=\n ProbabilityTheory.integrable_exp_mul_gaussianReal _\n have h2 : Integrable (fun z : ℝ => Real.exp (-x) * Real.exp ((-Real.sqrt s) * z))\n (gaussianReal 0 1) := h.const_mul _\n refine h2.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [← Real.exp_add]\n ring_nf\nlemma integral_exp_affine {s : ℝ} (hs : 0 ≤ s) (t x : ℝ) :\n ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1 = Real.exp x * Real.exp (t ^ 2 / 2) := by\n have h := integral_exp_mul_gaussianReal_one t\n calc ∫ z, Real.exp (x + t * z) ∂gaussianReal 0 1\n = ∫ z, Real.exp x * Real.exp (t * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [Real.exp_add]\n _ = Real.exp x * ∫ z, Real.exp (t * z) ∂gaussianReal 0 1 := integral_const_mul _ _\n _ = Real.exp x * Real.exp (t ^ 2 / 2) := by rw [h]\nlemma integrable_cosh_gaussianReal (x s : ℝ) :\n Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have h3 : Integrable (fun z : ℝ => Real.exp (x + Real.sqrt s * z)\n + Real.exp (-(x + Real.sqrt s * z))) (gaussianReal 0 1) := h1.add h2\n have h4 := h3.const_mul ((2:ℝ)⁻¹)\n refine h4.congr (Filter.Eventually.of_forall (fun z => ?_))\n simp only [Real.cosh_eq]\n ring\nlemma integral_cosh_gaussianReal {s : ℝ} (hs : 0 ≤ s) (x : ℝ) :\n ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := by\n have hsp : (Real.sqrt s) ^ 2 = s := Real.sq_sqrt hs\n have h1 := integrable_exp_pos_affine x s\n have h2 := integrable_exp_neg_affine x s\n have e1 : ∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.exp x * Real.exp (s / 2) := by\n rw [integral_exp_affine hs, hsp]\n have e2 : ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = Real.exp (-x) * Real.exp (s / 2) := by\n have h := integral_exp_mul_gaussianReal_one (-Real.sqrt s)\n calc ∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1\n = ∫ z, Real.exp (-x) * Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 := by\n congr 1 with z; rw [← Real.exp_add]; ring_nf\n _ = Real.exp (-x) * ∫ z, Real.exp ((-Real.sqrt s) * z) ∂gaussianReal 0 1 :=\n integral_const_mul _ _\n _ = Real.exp (-x) * Real.exp (((-Real.sqrt s)) ^ 2 / 2) := by rw [h]\n _ = Real.exp (-x) * Real.exp (s / 2) := by\n rw [show ((-Real.sqrt s)) ^ 2 = s by rw [neg_sq, hsp]]\n calc ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = ∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z))) / 2\n ∂gaussianReal 0 1 := by\n congr 1 with z\n rw [Real.cosh_eq]\n _ = (∫ z, (Real.exp (x + Real.sqrt s * z) + Real.exp (-(x + Real.sqrt s * z)))\n ∂gaussianReal 0 1) / 2 := by rw [integral_div]\n _ = ((∫ z, Real.exp (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n + (∫ z, Real.exp (-(x + Real.sqrt s * z)) ∂gaussianReal 0 1)) / 2 := by\n rw [integral_add h1 h2]\n _ = Real.cosh x * Real.exp (s / 2) := by\n rw [e1, e2, Real.cosh_eq]\n ring\nlemma exp_mul_le_cosh_rpow {d w : ℝ} (hd : 0 ≤ d) {U : ℝ → ℝ}\n (hU : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (y : ℝ) :\n Real.exp (d * U y) ≤ (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n have hcosh_pos : 0 < Real.cosh y := Real.cosh_pos y\n have h1 : d * U y ≤ d * (Real.log (Real.cosh y) - w / 2) :=\n mul_le_mul_of_nonneg_left (hU y) hd\n have h2 : Real.exp (d * U y) ≤ Real.exp (d * (Real.log (Real.cosh y) - w / 2)) :=\n Real.exp_le_exp.mpr h1\n have h3 : Real.exp (d * (Real.log (Real.cosh y) - w / 2))\n = (Real.cosh y) ^ d * Real.exp (-(d * w / 2)) := by\n rw [Real.rpow_def_of_pos hcosh_pos]\n rw [show d * (Real.log (Real.cosh y) - w / 2)\n = Real.log (Real.cosh y) * d + (-(d * w / 2)) by ring]\n rw [Real.exp_add]\n rw [← h3]\n exact h2\nlemma integrable_cosh_rpow_gaussianReal {s d : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d) (gaussianReal 0 1) := by\n have hcosh := integrable_cosh_gaussianReal x s\n have hmeas : AEStronglyMeasurable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := by\n apply Continuous.aestronglyMeasurable\n fun_prop\n refine Integrable.mono hcosh hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, Real.norm_eq_abs]\n have hpos : 0 < Real.cosh (x + Real.sqrt s * z) := Real.cosh_pos _\n rw [abs_of_pos (Real.rpow_pos_of_pos hpos d), abs_of_pos hpos]\n calc (Real.cosh (x + Real.sqrt s * z)) ^ d\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ (1:ℝ) := by\n apply Real.rpow_le_rpow_of_exponent_le\n · exact Real.one_le_cosh _\n · exact hd1\n _ = Real.cosh (x + Real.sqrt s * z) := Real.rpow_one _\nlemma integrable_exp_mul_u_gaussianReal {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n have hbound_int : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := hcosh_rpow.mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (d * U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) := by\n have h2 : Measurable fun z : ℝ => U (x + Real.sqrt s * z) :=\n hUmeas.comp (by fun_prop)\n exact (Real.measurable_exp.comp (h2.const_mul d)).aestronglyMeasurable\n refine Integrable.mono' hbound_int hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n exact exp_mul_le_cosh_rpow hd hUup _\nlemma integrable_cosh_mul_exp_gaussianReal {s d w : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n (x : ℝ) :\n Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d\n * Real.exp (-(d * w / 2))) (gaussianReal 0 1) := by\n have hcosh_rpow := integrable_cosh_rpow_gaussianReal hs hd hd1 x\n exact hcosh_rpow.mul_const _\nlemma jensen_step_pos {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 < d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (x : ℝ) :\n ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n have hcosh_int : ∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1\n = Real.cosh x * Real.exp (s / 2) := integral_cosh_gaussianReal hs x\n have hcosh_int_meas : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z))\n (gaussianReal 0 1) := integrable_cosh_gaussianReal x s\n have hptw : ∀ z, Real.exp (d * U (x + Real.sqrt s * z))\n ≤ (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2)) :=\n fun z => exp_mul_le_cosh_rpow hd.le hUup _\n have hJensen : (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n ≥ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1 := by\n have hconcave : ConcaveOn ℝ (Set.Ici 0) (fun y : ℝ => y ^ d) :=\n Real.concaveOn_rpow hd.le hd1\n have hcont : ContinuousOn (fun y : ℝ => y ^ d) (Set.Ici 0) := by\n intro y hy\n exact (Real.continuousAt_rpow_const y d (Or.inr hd.le)).continuousWithinAt\n have hmem : ∀ᵐ z ∂gaussianReal 0 1, Real.cosh (x + Real.sqrt s * z) ∈ Set.Ici (0:ℝ) :=\n Filter.Eventually.of_forall (fun z => (Real.cosh_pos _).le)\n have hint_rpow : Integrable (fun z : ℝ => (Real.cosh (x + Real.sqrt s * z)) ^ d)\n (gaussianReal 0 1) := integrable_cosh_rpow_gaussianReal hs hd.le hd1 x\n simpa only [Function.comp_apply] using\n (ConcaveOn.le_map_integral hconcave hcont isClosed_Ici hmem hcosh_int_meas hint_rpow)\n have h_exp_int := integrable_exp_mul_u_gaussianReal (M := M) hs hd.le hd1 hUmeas hUup x\n have h_bound_int := integrable_cosh_mul_exp_gaussianReal hs hd.le hd1 (w := w) x\n calc ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d * Real.exp (-(d * w / 2))\n ∂gaussianReal 0 1 := integral_mono h_exp_int h_bound_int hptw\n _ = (∫ z, (Real.cosh (x + Real.sqrt s * z)) ^ d ∂gaussianReal 0 1)\n * Real.exp (-(d * w / 2)) := integral_mul_const _ _\n _ ≤ (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1) ^ d\n * Real.exp (-(d * w / 2)) := by\n apply mul_le_mul_of_nonneg_right hJensen (Real.exp_pos _).le\n _ = (Real.cosh x * Real.exp (s / 2)) ^ d * Real.exp (-(d * w / 2)) := by rw [hcosh_int]\n _ = (Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2) := by\n rw [Real.mul_rpow (Real.cosh_pos x).le (Real.exp_pos (s/2)).le]\n rw [show (Real.exp (s / 2)) ^ d = Real.exp (s / 2 * d) by\n rw [Real.rpow_def_of_pos (Real.exp_pos _), Real.log_exp]]\n rw [mul_assoc, ← Real.exp_add]\n congr 2\n ring\nlemma integrable_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n Integrable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n integrable_cosh_gaussianReal x s\n have hmono : Integrable (fun z : ℝ => M + Real.cosh (x + Real.sqrt s * z)) (gaussianReal 0 1) := by\n have := (integrable_const (μ := gaussianReal 0 1) M).add hc\n simpa [add_comm] using this\n have hmeas : AEStronglyMeasurable (fun z : ℝ => U (x + Real.sqrt s * z)) (gaussianReal 0 1) :=\n (hUmeas.comp (by fun_prop)).aestronglyMeasurable\n refine Integrable.mono' hmono hmeas (Filter.Eventually.of_forall (fun z => ?_))\n have hlog_le : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) := by\n have h1 : Real.log (Real.cosh (x + Real.sqrt s * z)) ≤ Real.cosh (x + Real.sqrt s * z) - 1 :=\n Real.log_le_sub_one_of_pos (Real.cosh_pos _)\n linarith\n have hpos : (0:ℝ) ≤ Real.cosh (x + Real.sqrt s * z) := (Real.cosh_pos _).le\n rw [Real.norm_eq_abs, abs_le]\n constructor\n · have := hUlow (x + Real.sqrt s * z); linarith\n · have := hUup (x + Real.sqrt s * z); linarith\nlemma integrable_exp_shift_of_bounds {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2) (x : ℝ) :\n Integrable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z))) (gaussianReal 0 1) := by\n have hc : Integrable (fun z : ℝ => Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)))\n (gaussianReal 0 1) := (integrable_cosh_gaussianReal x s).mul_const _\n have hmeas : AEStronglyMeasurable (fun z : ℝ => Real.exp (U (x + Real.sqrt s * z)))\n (gaussianReal 0 1) :=\n (Real.measurable_exp.comp (hUmeas.comp (by fun_prop))).aestronglyMeasurable\n refine Integrable.mono' hc hmeas (Filter.Eventually.of_forall (fun z => ?_))\n rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)]\n simpa using exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\nlemma integral_le_log_integral_exp {s w M : ℝ} {U : ℝ → ℝ} (hUmeas : Measurable U)\n (hUlow : ∀ y, -M ≤ U y) (hUup : ∀ y, U y ≤ Real.log (Real.cosh y) - w / 2)\n (hwM : -w / 2 ≤ M) (x : ℝ) :\n ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1\n ≤ Real.log (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M) hUmeas hUlow hUup x\n set A : ℝ := ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 with hA\n have hApos : 0 < A := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) := integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) ≤ A := by\n rw [hA]\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n set G : ℝ → ℝ := fun z => Real.exp (U (x + Real.sqrt s * z)) with hG\n have hGint' : Integrable G (gaussianReal 0 1) := hGint\n have hpoint : ∀ z, U (x + Real.sqrt s * z) ≤ Real.log A + (G z - A) / A := by\n intro z\n have hGpos : 0 < G z := Real.exp_pos _\n have hlogG : Real.log (G z) = U (x + Real.sqrt s * z) := by simp [hG]\n have := Real.log_le_sub_one_of_pos (div_pos hGpos hApos)\n rw [Real.log_div (ne_of_gt hGpos) (ne_of_gt hApos), hlogG] at this\n have h2 : G z / A - 1 = (G z - A) / A := by field_simp\n linarith [this, h2.le, h2.ge]\n have hright_int : Integrable (fun z : ℝ => Real.log A + (G z - A) / A) (gaussianReal 0 1) := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n exact (integrable_const (Real.log A)).add h1\n have hmono := integral_mono hUint hright_int hpoint\n have hright_val : ∫ z, (Real.log A + (G z - A) / A) ∂gaussianReal 0 1 = Real.log A := by\n have h1 : Integrable (fun z : ℝ => (G z - A) / A) (gaussianReal 0 1) :=\n ((hGint'.sub (integrable_const A))).div_const A\n rw [integral_add (integrable_const (Real.log A)) h1]\n have h2 : ∫ z, (G z - A) / A ∂gaussianReal 0 1 = 0 := by\n rw [integral_div]\n rw [integral_sub hGint' (integrable_const A)]\n have hGA : (∫ z, G z ∂gaussianReal 0 1) = A := by rw [hA]\n rw [hGA]\n simp\n rw [h2]\n simp\n rw [hright_val] at hmono\n simpa [hA] using hmono\nlemma gaussianTransform_step_upper {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 - w / 2 := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hstep := integral_le_log_integral_exp (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hGint := integrable_exp_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup x\n have hbound_int : Integrable (fun z : ℝ =>\n Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))) (gaussianReal 0 1) :=\n (integrable_cosh_gaussianReal x s).mul_const _\n have hpoint : ∀ z : ℝ, Real.exp (U (x + Real.sqrt s * z))\n ≤ Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2)) := by\n intro z\n have := exp_mul_le_cosh_rpow (d := 1) zero_le_one hUup (x + Real.sqrt s * z)\n simpa using this\n have hA_le : (∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n calc ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1\n ≤ ∫ z, Real.cosh (x + Real.sqrt s * z) * Real.exp (-(w / 2))\n ∂gaussianReal 0 1 := integral_mono hGint hbound_int hpoint\n _ = (∫ z, Real.cosh (x + Real.sqrt s * z) ∂gaussianReal 0 1)\n * Real.exp (-(w / 2)) := integral_mul_const _ _\n _ = Real.cosh x * Real.exp (s / 2) * Real.exp (-(w / 2)) := by\n rw [integral_cosh_gaussianReal hs x]\n have hApos : 0 < ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n have hconst : Integrable (fun _ : ℝ => Real.exp (-M)) (gaussianReal 0 1) :=\n integrable_const _\n have hle : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1)\n ≤ ∫ z, Real.exp (U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n apply integral_mono hconst hGint\n intro z; exact Real.exp_le_exp.mpr (hUlow _)\n have hval : (∫ _z : ℝ, Real.exp (-M) ∂gaussianReal 0 1) = Real.exp (-M) := by simp\n rw [hval] at hle\n exact lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog_le := Real.log_le_log hApos hA_le\n rw [Real.log_mul (mul_pos (Real.cosh_pos x) (Real.exp_pos (s / 2))).ne'\n (Real.exp_pos (-(w / 2))).ne',\n Real.log_mul (Real.cosh_pos x).ne' (Real.exp_pos (s / 2)).ne',\n Real.log_exp, Real.log_exp] at hlog_le\n linarith\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hJ := jensen_step_pos (M := M) hs hdpos hd1 hUmeas hUlow hUup x\n have hpos_low : 0 < Real.exp (-(d * M)) := Real.exp_pos _\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le hpos_low hle\n have hlog_le : Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)\n ≤ Real.log ((Real.cosh x) ^ d * Real.exp (s * d / 2 - d * w / 2)) :=\n Real.log_le_log hIpos hJ\n rw [Real.log_mul (Real.rpow_pos_of_pos (Real.cosh_pos x) d).ne'\n (Real.exp_pos (s * d / 2 - d * w / 2)).ne',\n Real.log_rpow (Real.cosh_pos x), Real.log_exp] at hlog_le\n rw [div_le_iff₀ hdpos]\n nlinarith\nlemma gaussianTransform_step_lower {s d w M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) - w / 2) (hwM : -w / 2 ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n by_cases hd0 : d = 0\n · simp only [gaussianTransform, hd0, ite_true]\n have hUint := integrable_shift_of_bounds (s := s) (w := w) (M := M)\n hUmeas hUlow hUup hwM x\n have hconst : Integrable (fun _ : ℝ => -M) (gaussianReal 0 1) := integrable_const _\n have := integral_mono hconst hUint (fun z => hUlow _)\n simpa using this\n · have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0)\n simp only [gaussianTransform, hd0, ite_false]\n have hGint := integrable_exp_mul_u_gaussianReal (M := M) hs hd hd1 hUmeas hUup x\n have hconst : Integrable (fun _ : ℝ => Real.exp (-(d * M))) (gaussianReal 0 1) :=\n integrable_const _\n have hle : Real.exp (-(d * M))\n ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 := by\n calc Real.exp (-(d * M)) = ∫ _z : ℝ, Real.exp (-(d * M)) ∂gaussianReal 0 1 := by simp\n _ ≤ ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n integral_mono hconst hGint (fun z => Real.exp_le_exp.mpr (by\n have := hUlow (x + Real.sqrt s * z); nlinarith))\n have hIpos : 0 < ∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1 :=\n lt_of_lt_of_le (Real.exp_pos _) hle\n have hlog : -(d * M) ≤\n Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) := by\n calc -(d * M) = Real.log (Real.exp (-(d * M))) := by rw [Real.log_exp]\n _ ≤ Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1) :=\n Real.log_le_log (Real.exp_pos _) hle\n rw [le_div_iff₀ hdpos]\n nlinarith\nlemma measurable_integral_shift {s : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => U (x + Real.sqrt s * z)) := by\n apply hU.stronglyMeasurable.comp_measurable\n fun_prop\n exact (hun.integral_prod_right (ν := gaussianReal 0 1)).measurable\nlemma measurable_log_integral_shift {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (fun x : ℝ => Real.log\n (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) ∂gaussianReal 0 1)) := by\n have hun : StronglyMeasurable\n (Function.uncurry fun x z : ℝ => Real.exp (d * U (x + Real.sqrt s * z))) := by\n apply (Real.measurable_exp.comp (hU.const_mul d)).stronglyMeasurable.comp_measurable\n fun_prop\n exact ((hun.integral_prod_right (ν := gaussianReal 0 1)).measurable.log)\nlemma gaussianTransform_measurable {s d : ℝ} {U : ℝ → ℝ} (hU : Measurable U) :\n Measurable (gaussianTransform s d U) := by\n unfold gaussianTransform\n by_cases hd : d = 0\n · simp only [if_pos hd]\n exact measurable_integral_shift hU\n · simp only [if_neg hd]\n exact (measurable_log_integral_shift (d := d) hU).div_const d\nlemma gaussianTransform_step_upper' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n gaussianTransform s d U x ≤ Real.log (Real.cosh x) + s / 2 + c := by\n have h := gaussianTransform_step_upper (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\n calc gaussianTransform s d U x\n ≤ Real.log (Real.cosh x) + s / 2 - (-2 * c) / 2 := h\n _ = Real.log (Real.cosh x) + s / 2 + c := by ring\nlemma gaussianTransform_step_lower' {s d c M : ℝ} (hs : 0 ≤ s) (hd : 0 ≤ d) (hd1 : d ≤ 1)\n {U : ℝ → ℝ} (hUmeas : Measurable U) (hUlow : ∀ x, -M ≤ U x)\n (hUup : ∀ x, U x ≤ Real.log (Real.cosh x) + c) (hcM : c ≤ M) (x : ℝ) :\n -M ≤ gaussianTransform s d U x := by\n exact gaussianTransform_step_lower (w := -2 * c) hs hd hd1 hUmeas hUlow\n (fun y => by have := hUup y; linarith) (by linarith) x\nlemma fold_gaussianTransform_bounds (L : List (ℝ × ℝ)) (M c : ℝ)\n (hL : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1)\n (hcM : c + (L.map Prod.fst).sum / 2 ≤ M)\n {V : ℝ → ℝ} (hVmeas : Measurable V) (hVlow : ∀ x, -M ≤ V x)\n (hVup : ∀ x, V x ≤ Real.log (Real.cosh x) + c) :\n (∀ x, L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x\n ≤ Real.log (Real.cosh x) + c + (L.map Prod.fst).sum / 2) ∧\n (∀ x, -M ≤ L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V x) ∧\n Measurable (L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V) := by\n induction L with\n | nil =>\n refine ⟨fun x => ?_, hVlow, hVmeas⟩\n simpa using hVup x\n | cons a L ih =>\n obtain ⟨ha1, ha2, ha3⟩ := hL a (by simp)\n have htail : ∀ p ∈ L, 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := fun p hp =>\n hL p (by simp [hp])\n have hsum : ((a :: L).map Prod.fst).sum = a.1 + (L.map Prod.fst).sum := by simp\n rw [hsum] at hcM\n have hcM' : c + (L.map Prod.fst).sum / 2 ≤ M := by linarith\n have hih := ih htail hcM'\n set W : ℝ → ℝ := L.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V with hW\n have hWmeas : Measurable W := hih.2.2\n have hWlow : ∀ x, -M ≤ W x := hih.2.1\n have hWup : ∀ x, W x ≤ Real.log (Real.cosh x) + (c + (L.map Prod.fst).sum / 2) := by\n intro x\n have := hih.1 x\n linarith\n have hcM'' : c + (L.map Prod.fst).sum / 2 ≤ M := hcM'\n have hstep_up : ∀ x, gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := fun x =>\n gaussianTransform_step_upper' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_low : ∀ x, -M ≤ gaussianTransform a.1 a.2 W x := fun x =>\n gaussianTransform_step_lower' ha1 ha2 ha3 hWmeas hWlow hWup hcM'' x\n have hstep_meas : Measurable (gaussianTransform a.1 a.2 W) :=\n gaussianTransform_measurable hWmeas\n have hfold : (a :: L).foldr (fun sd U => gaussianTransform sd.1 sd.2 U) V\n = gaussianTransform a.1 a.2 W := by\n simp [hW]\n refine ⟨?_, ?_, ?_⟩\n · intro x\n rw [hfold, hsum]\n have := hstep_up x\n calc gaussianTransform a.1 a.2 W x\n ≤ Real.log (Real.cosh x) + a.1 / 2 + (c + (L.map Prod.fst).sum / 2) := this\n _ = Real.log (Real.cosh x) + c + (a.1 + (L.map Prod.fst).sum) / 2 := by ring\n · intro x\n rw [hfold]\n exact hstep_low x\n · rw [hfold]\n exact hstep_meas\nlemma stepAt_nonneg (h : FieldStep) (i : ℕ) : 0 ≤ stepAt h i := by\n unfold stepAt\n split_ifs with hi\n · exact h.nonneg _\n · exact le_refl 0\nlemma stepAt_mono_of_lt (h : FieldStep) {i j : ℕ} (hij : i ≤ j)\n (hj : j < h.partition.levels) : stepAt h i ≤ stepAt h j := by\n have hi : i < h.partition.levels := lt_of_le_of_lt hij hj\n have h1 : stepAt h i = h.value ⟨i, hi⟩ := by simp [stepAt, hi]\n have h2 : stepAt h j = h.value ⟨j, hj⟩ := by simp [stepAt, hj]\n rw [h1, h2]\n exact h.ordered (Fin.mk_le_mk.mpr hij)\nlemma cut_nonneg (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n 0 ≤ h.partition.cut i := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have h0 : (⟨0, Nat.zero_lt_succ h.partition.levels⟩ : Fin (h.partition.levels + 1)) ≤ i :=\n Fin.zero_le i\n have := hmono h0\n rwa [h.partition.first] at this\nlemma cut_le_one (h : FieldStep) (i : Fin (h.partition.levels + 1)) :\n h.partition.cut i ≤ 1 := by\n have hmono : Monotone h.partition.cut := h.partition.ordered.monotone\n have hlast : i ≤ (⟨h.partition.levels, Nat.lt_succ_self h.partition.levels⟩ :\n Fin (h.partition.levels + 1)) := Fin.le_last i\n have := hmono hlast\n rwa [h.partition.last] at this\nlemma stepAt_increment_nonneg (h : FieldStep) {i : ℕ} (hi : i < h.partition.levels) :\n 0 ≤ stepAt h i - (if i = 0 then 0 else stepAt h (i - 1)) := by\n by_cases h0 : i = 0\n · have hzi : stepAt h i = stepAt h 0 := by rw [h0]\n rw [h0, if_pos rfl]\n simp only [sub_zero]\n exact stepAt_nonneg h 0\n · have hle : i - 1 ≤ i := Nat.sub_le i 1\n have hmono := stepAt_mono_of_lt h hle hi\n rw [if_neg h0]\n linarith\nlemma sum_increments_eq (h : FieldStep) :\n ((List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum\n = stepAt h (h.partition.levels - 1) := by\n rw [List.map_ofFn, List.sum_ofFn]\n simp only [Function.comp_apply]\n rw [Fin.sum_univ_eq_sum_range\n (fun i => stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))) h.partition.levels]\n have htel := Finset.sum_range_sub\n (fun i : ℕ => if i = 0 then (0:ℝ) else stepAt h (i - 1)) h.partition.levels\n have hterm : ∀ i ∈ Finset.range h.partition.levels,\n stepAt h i - (if i = 0 then 0 else stepAt h (i - 1))\n = (if i + 1 = 0 then (0:ℝ) else stepAt h (i + 1 - 1))\n - (if i = 0 then 0 else stepAt h (i - 1)) := by\n intro i hi\n have : i + 1 ≠ 0 := Nat.succ_ne_zero i\n rw [if_neg this, Nat.succ_sub_one]\n rw [Finset.sum_congr rfl hterm, htel]\n have h0 : (if (0:ℕ) = 0 then (0:ℝ) else stepAt h (0 - 1)) = 0 := if_pos rfl\n rw [h0, sub_zero]\n have hk : h.partition.levels ≠ 0 := Nat.pos_iff_ne_zero.mp h.partition.positive\n rw [if_neg hk]\nlemma increments_mem (h : FieldStep) :\n ∀ p ∈ List.ofFn (fun i : Fin h.partition.levels =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc)), 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 := by\n intro p hp\n rw [List.mem_ofFn] at hp\n obtain ⟨i, rfl⟩ := hp\n exact ⟨stepAt_increment_nonneg h i.isLt,\n cut_nonneg h i.castSucc, cut_le_one h i.castSucc⟩\ntheorem fieldRecursion_le_zero (h : FieldStep) : fieldRecursion h ≤ 0 := by\n set k := h.partition.levels with hk\n set W := stepAt h (k - 1) with hW\n have hWnonneg : 0 ≤ W := stepAt_nonneg h (k - 1)\n have hincr := increments_mem h\n have hsum : ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum = W := by\n rw [hW]\n exact sum_increments_eq h\n have hVmeas : Measurable (fun x : ℝ => Real.log (Real.cosh x) - W / 2) := by fun_prop\n have hVlow : ∀ x, -(W / 2) ≤ Real.log (Real.cosh x) - W / 2 := by\n intro x\n have h1 : (1:ℝ) ≤ Real.cosh x := Real.one_le_cosh x\n have := Real.log_nonneg h1\n linarith\n have hVup : ∀ x, Real.log (Real.cosh x) - W / 2\n ≤ Real.log (Real.cosh x) + (-(W / 2)) := fun x => le_refl _\n have hcM : (-(W / 2)) + ((List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).map Prod.fst).sum / 2 ≤ W / 2 := by\n rw [hsum]; linarith\n have hfold := fold_gaussianTransform_bounds\n (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))) (W / 2) (-(W / 2)) hincr hcM hVmeas hVlow hVup\n have hmain : (List.ofFn (fun i : Fin k =>\n (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),\n h.partition.cut i.castSucc))).foldr\n (fun sd U => gaussianTransform sd.1 sd.2 U)\n (fun x => Real.log (Real.cosh x) - W / 2) 0 ≤ 0 := by\n have h1 := hfold.1 0\n rw [hsum] at h1\n have hc : Real.log (Real.cosh (0:ℝ)) = 0 := by simp\n rw [hc] at h1\n linarith\n simpa [fieldRecursion, hk] using hmain\ndef zeroPath : OverlapPath where\n val := AEEqFun.const ℝ (0 : ℝ)\n admissible := ⟨fun _ => 0, (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) 0).symm, by\n intro a b ha hb hab; exact le_refl 0, by\n intro u hu; exact ⟨le_refl 0, zero_le_one⟩⟩\nlemma stepFunction_measurable (h : FieldStep) : Measurable (stepFunction h) := by\n unfold stepFunction\n apply Finset.measurable_sum\n intro i hi\n apply Measurable.ite\n · exact (measurableSet_lt measurable_const measurable_id).inter\n (measurableSet_lt measurable_id measurable_const)\n · exact measurable_const\n · exact measurable_const\nlemma zeroPath_integral (h : FieldStep) :\n ∫ u, stepFunction h u * zeroPath.val u ∂pathMeasure = 0 := by\n have hzero : (zeroPath.val : ℝ → ℝ) =ᵐ[pathMeasure] Function.const ℝ (0:ℝ) := by\n simpa [zeroPath] using\n (AEEqFun.coeFn_const (α := ℝ) (μ := pathMeasure) (β := ℝ) (0:ℝ))\n have : (fun u => stepFunction h u * zeroPath.val u) =ᵐ[pathMeasure] (fun _ => (0:ℝ)) := by\n filter_upwards [hzero] with u hu\n simp [hu]\n rw [integral_congr_ae this]\n simp\nlemma isingEntropy_zeroPath_le_zero : isingEntropy zeroPath ≤ 0 := by\n unfold isingEntropy\n refine iSup_le ?_\n intro h\n rw [zeroPath_integral h]\n have := fieldRecursion_le_zero h\n simpa using (EReal.coe_le_coe_iff.mpr this :\n ((fieldRecursion h : ℝ) : EReal) ≤ (0 : EReal))\nlemma limUnder_bounds {u : ℕ → ℝ} {K : ℝ} (h : ∀ n, |u n| ≤ K) :\n min (-K) (Classical.choice (inferInstance : Nonempty ℝ)) ≤ Filter.limUnder atTop u ∧\n Filter.limUnder atTop u ≤ max K (Classical.choice (inferInstance : Nonempty ℝ)) := by\n by_cases hconv : ∃ x : ℝ, Tendsto u atTop (𝓝 x)\n · obtain ⟨x, hx⟩ := hconv\n have hlim : Filter.limUnder atTop u = x := hx.limUnder_eq\n rw [hlim]\n constructor\n · apply le_trans (min_le_left _ _)\n exact ge_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).1))\n · apply le_trans (le_of_tendsto hx (Filter.Eventually.of_forall (fun n => (abs_le.mp (h n)).2)))\n exact le_max_left _ _\n · have hlim : Filter.limUnder atTop u\n = Classical.choice (inferInstance : Nonempty ℝ) := limUnder_of_not_tendsto hconv\n rw [hlim]\n exact ⟨min_le_right _ _, le_max_right _ _⟩\nlemma ereal_iInf_eq_coe_of_bounds {ι : Type*} (f : ι → EReal) (i0 : ι) {a b : ℝ}\n (ha : ∀ i, (a : EReal) ≤ f i) (hb : f i0 ≤ (b : EReal)) :\n ∃ p : ℝ, (⨅ i, f i) = (p : EReal) := by\n have hle : (a : EReal) ≤ ⨅ i, f i := le_iInf ha\n have hge : (⨅ i, f i) ≤ (b : EReal) := (iInf_le f i0).trans hb\n have hne_bot : (⨅ i, f i) ≠ ⊥ := by\n intro h\n rw [h] at hle\n exact EReal.coe_ne_bot a (le_bot_iff.mp hle)\n have hne_top : (⨅ i, f i) ≠ ⊤ := by\n intro h\n rw [h] at hge\n exact absurd hge (not_le.mpr (EReal.coe_lt_top b))\n exact ⟨(⨅ i, f i).toReal, (EReal.coe_toReal hne_top hne_bot).symm⟩\ntheorem variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α)\n {f : ℝ → ℝ} (hf : Continuous f) (hbounded : ∃ K : ℝ, ∀ x, |f x| ≤ K) :\n ∃ p : ℝ, variationalValue α f = (p : EReal) := by\n obtain ⟨K, hK⟩ := hbounded\n let c : ℝ := Classical.choice (inferInstance : Nonempty ℝ)\n have hlow : ∀ q : OverlapPath,\n ((α * min (-K) c : ℝ) : EReal) ≤ (α * patternFunctional f q : ℝ) + isingEntropy q := by\n intro q\n have hpt : ∀ n : ℕ, |uniformPattern f q n| ≤ K := uniformPattern_abs_le f K hf hK q\n have hb : min (-K) c ≤ patternFunctional f q := (limUnder_bounds hpt).1\n have hmul : α * min (-K) c ≤ α * patternFunctional f q :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * min (-K) c : ℝ) : EReal) ≤ ((α * patternFunctional f q : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * min (-K) c : ℝ) : EReal)\n ≤ ((α * patternFunctional f q : ℝ) : EReal) := hcoe\n _ ≤ (α * patternFunctional f q : ℝ) + isingEntropy q :=\n le_add_of_nonneg_right (isingEntropy_nonneg q)\n have hup : ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * max K c : ℝ) : EReal) := by\n have hpt : ∀ n : ℕ, |uniformPattern f zeroPath n| ≤ K :=\n uniformPattern_abs_le f K hf hK zeroPath\n have hb : patternFunctional f zeroPath ≤ max K c := (limUnder_bounds hpt).2\n have hmul : α * patternFunctional f zeroPath ≤ α * max K c :=\n mul_le_mul_of_nonneg_left hb hα\n have hcoe : ((α * patternFunctional f zeroPath : ℝ) : EReal) ≤ ((α * max K c : ℝ) : EReal) :=\n EReal.coe_le_coe_iff.mpr hmul\n calc ((α * patternFunctional f zeroPath : ℝ) : EReal) + isingEntropy zeroPath\n ≤ ((α * patternFunctional f zeroPath : ℝ) : EReal) + 0 :=\n add_le_add_right isingEntropy_zeroPath_le_zero _\n _ = ((α * patternFunctional f zeroPath : ℝ) : EReal) := add_zero _\n _ ≤ ((α * max K c : ℝ) : EReal) := hcoe\n have hmain := ereal_iInf_eq_coe_of_bounds\n (fun q : OverlapPath => (α * patternFunctional f q : ℝ) + isingEntropy q) zeroPath hlow hup\n simpa [variationalValue] using hmain\nend IsingPerceptron\nend\n\nend OAI\n",
"sha256": "9ae908672b96f937d19b4b2f6b74aa1952a57184e264e1a08c9a0bc847c2775a"
}
}
}