forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElaborators.lean
More file actions
931 lines (759 loc) Β· 25.4 KB
/
Copy pathElaborators.lean
File metadata and controls
931 lines (759 loc) Β· 25.4 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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
import Mathlib.Geometry.Manifold.Elaborators
import Mathlib.Geometry.Manifold.VectorBundle.SmoothSection
import Mathlib.Geometry.Manifold.VectorBundle.Tangent
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions
import Mathlib.Geometry.Manifold.BumpFunction
import Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable
import Mathlib.Geometry.Manifold.VectorField.LieBracket
set_option pp.unicode.fun true
open Bundle Filter Function Topology
open scoped Bundle Manifold ContDiff
variable {π : Type*} [NontriviallyNormedField π]
section
variable {E : Type*} [NormedAddCommGroup E]
[NormedSpace π E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners π E H)
{M : Type*} [TopologicalSpace M] [ChartedSpace H M]
variable {E' : Type*} [NormedAddCommGroup E'] [NormedSpace π E']
variable (F : Type*) [NormedAddCommGroup F] [NormedSpace π F]
-- `F` model fiber
(n : WithTop ββ)
(V : M β Type*) [TopologicalSpace (TotalSpace F V)]
[β x, AddCommGroup (V x)] [β x, Module π (V x)]
[β x : M, TopologicalSpace (V x)] [β x, IsTopologicalAddGroup (V x)]
[β x, ContinuousSMul π (V x)]
[FiberBundle F V] [VectorBundle π F V]
-- `V` vector bundle
/-! Tests for the `T%` elaborator, inserting calls to `TotalSpace.mk'` automatically. -/
section TotalSpace
variable {Ο : Ξ x : M, V x}
{Ο' : (x : E) β Trivial E E' x} {Ο'' : (y : E) β Trivial E E' y} {s : E β E'}
/-- info: fun x β¦ TotalSpace.mk' F x (Ο x) : M β TotalSpace F V -/
#guard_msgs in
#check T% Ο
-- Testing precedence.
variable {x : M}
/-- info: (fun x β¦ TotalSpace.mk' F x (Ο x)) x : TotalSpace F V -/
#guard_msgs in
#check (T% Ο) x
/-- info: (fun x β¦ TotalSpace.mk' F x (Ο x)) x : TotalSpace F V -/
#guard_msgs in
#check T% Ο x
-- Nothing happening, as expected.
/-- info: Ο x : V x -/
#guard_msgs in
#check T% (Ο x)
-- Note how the name of the bound variable `x` resp. `y` is preserved.
/-- info: fun x β¦ TotalSpace.mk' E' x (Ο' x) : E β TotalSpace E' (Trivial E E') -/
#guard_msgs in
#check T% Ο'
/-- info: fun y β¦ TotalSpace.mk' E' y (Ο'' y) : E β TotalSpace E' (Trivial E E') -/
#guard_msgs in
#check T% Ο''
/-- info: fun a β¦ TotalSpace.mk' E' a (s a) : E β TotalSpace E' (Trivial E E') -/
#guard_msgs in
#check T% s
variable (X : (m : M) β TangentSpace I m) [IsManifold I 1 M]
/-- info: fun m β¦ TotalSpace.mk' E m (X m) : M β TotalSpace E (TangentSpace I) -/
#guard_msgs in
#check T% X
example : (fun m β¦ (X m : TangentBundle I M)) = (fun m β¦ TotalSpace.mk' E m (X m)) := rfl
-- Applying a section to an argument. TODO: beta-reduce instead!
/-- info: (fun m β¦ TotalSpace.mk' E m (X m)) x : TotalSpace E (TangentSpace I) -/
#guard_msgs in
#check (T% X) x
-- Applying the same elaborator twice is fine (and idempotent).
/-- info: (fun m β¦ TotalSpace.mk' E m (X m)) x : TotalSpace E (TangentSpace I) -/
#guard_msgs in
#check (T% (T% X)) x
end TotalSpace
/-! Tests for the elaborators for `MDifferentiable{WithinAt,At,On}`. -/
section differentiability
-- Start with some basic tests: a simple function, both in applied and unapplied form.
variable {EM' : Type*} [NormedAddCommGroup EM']
[NormedSpace π EM'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners π EM' H')
{M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
-- General case: a function between two manifolds.
variable {f : M β M'} {s : Set M} {m : M}
/-- info: MDifferentiableWithinAt I I' f s : M β Prop -/
#guard_msgs in
#check MDiffAt[s] f
/-- info: MDifferentiableWithinAt I I' f s m : Prop -/
#guard_msgs in
#check MDiffAt[s] f m
/-- info: MDifferentiableAt I I' f : M β Prop -/
#guard_msgs in
#check MDiffAt f
/-- info: MDifferentiableAt I I' f m : Prop -/
#guard_msgs in
#check MDiffAt f m
/-- info: MDifferentiableOn I I' f s : Prop -/
#guard_msgs in
#check MDiff[s] f
-- Testing an error message.
section
/--
error: Function expected at
MDifferentiableOn I I' f s
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check MDiff[s] f m
/--
error: Function expected at
MDifferentiableOn I I' f s
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check MDifferentiableOn I I' f s m
/-- info: MDifferentiable I I' f : Prop -/
#guard_msgs in
#check MDiff f
/--
error: Function expected at
MDifferentiable I I' f
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check MDiff f m
end
-- Function from a manifold into a normed space.
variable {g : M β E}
/-- info: MDifferentiableWithinAt I π(π, E) g s : M β Prop -/
#guard_msgs in
#check MDiffAt[s] g
/-- info: MDifferentiableWithinAt I π(π, E) g s m : Prop -/
#guard_msgs in
#check MDiffAt[s] g m
/-- info: MDifferentiableAt I π(π, E) g : M β Prop -/
#guard_msgs in
#check MDiffAt g
/-- info: MDifferentiableAt I π(π, E) g m : Prop -/
#guard_msgs in
#check MDiffAt g m
/-- info: MDifferentiableOn I π(π, E) g s : Prop -/
#guard_msgs in
#check MDiff[s] g
-- TODO: fix and enable! #check MDiff[s] g m
/-- info: MDifferentiable I π(π, E) g : Prop -/
#guard_msgs in
#check MDiff g
-- TODO: fix and enable! #check MDiff g m
-- From a manifold into a field.
variable {h : M β π}
/-- info: MDifferentiableWithinAt I π(π, π) h s : M β Prop -/
#guard_msgs in
#check MDiffAt[s] h
/-- info: MDifferentiableWithinAt I π(π, π) h s m : Prop -/
#guard_msgs in
#check MDiffAt[s] h m
/-- info: MDifferentiableAt I π(π, π) h : M β Prop -/
#guard_msgs in
#check MDiffAt h
/-- info: MDifferentiableAt I π(π, π) h m : Prop -/
#guard_msgs in
#check MDiffAt h m
/-- info: MDifferentiableOn I π(π, π) h s : Prop -/
#guard_msgs in
#check MDiff[s] h
-- TODO: fix and enable! #check MDiff[s] h m
/-- info: MDifferentiable I π(π, π) h : Prop -/
#guard_msgs in
#check MDiff h
-- TODO: fix and enable! #check MDiff h m
-- The following tests are more spotty, as most code paths are already covered above.
-- Add further details as necessary.
-- From a normed space into a manifold.
variable {f : E β M'} {s : Set E} {x : E}
/-- info: MDifferentiableWithinAt π(π, E) I' f s : E β Prop -/
#guard_msgs in
#check MDiffAt[s] f
/-- info: MDifferentiableAt π(π, E) I' f x : Prop -/
#guard_msgs in
#check MDiffAt f x
-- TODO: fix and enable! #check MDiff[s] f x
/-- info: MDifferentiable π(π, E) I' f : Prop -/
#guard_msgs in
#check MDiff f
-- TODO: should this error? if not, fix and enable! #check MDiff f x
-- same! #check MDifferentiable% f x
-- Between normed spaces.
variable {f : E β E'} {s : Set E} {x : E}
/-- info: MDifferentiableAt π(π, E) π(π, E') f x : Prop -/
#guard_msgs in
#check MDiffAt f x
/-- info: MDifferentiableAt π(π, E) π(π, E') f : E β Prop -/
#guard_msgs in
#check MDiffAt f
-- should this error or not? #check MDiff[s] f x
/-- info: MDifferentiableWithinAt π(π, E) π(π, E') f s : E β Prop -/
#guard_msgs in
#check MDiffAt[s] f
/-- info: MDifferentiableOn π(π, E) π(π, E') f s : Prop -/
#guard_msgs in
#check MDiff[s] f
-- Normed space to a field.
variable {f : E β π} {s : Set E} {x : E}
/-- info: MDifferentiableAt π(π, E) π(π, π) f x : Prop -/
#guard_msgs in
#check MDiffAt f x
-- Field into a manifold.
variable {f : π β M'} {u : Set π} {a : π}
/-- info: MDifferentiableAt π(π, π) I' f a : Prop -/
#guard_msgs in
#check MDiffAt f a
/-- info: MDifferentiableOn π(π, π) I' f u : Prop -/
#guard_msgs in
#check MDiff[u] f
-- Field into a normed space.
variable {f : π β E'} {u : Set π} {a : π}
/-- info: MDifferentiableAt π(π, π) π(π, E') f a : Prop -/
#guard_msgs in
#check MDiffAt f a
/-- info: MDifferentiableOn π(π, π) π(π, E') f u : Prop -/
#guard_msgs in
#check MDiff[u] f
-- On a field.
variable {f : π β π} {u : Set π} {a : π}
/-- info: MDifferentiableAt π(π, π) π(π, π) f a : Prop -/
#guard_msgs in
#check MDiffAt f a
/-- info: MDifferentiableOn π(π, π) π(π, π) f u : Prop -/
#guard_msgs in
#check MDiff[u] f
-- This elaborator can be combined with the total space elaborator.
-- XXX: these tests might be incomplete; extend as needed!
variable {Ο : Ξ x : M, V x} {Ο' : (x : E) β Trivial E E' x} {s : E β E'}
variable (X : (m : M) β TangentSpace I m) [IsManifold I 1 M]
/-- info: MDifferentiableAt I (I.prod π(π, E)) fun m β¦ TotalSpace.mk' E m (X m) : M β Prop -/
#guard_msgs in
#check MDiffAt (T% X)
/-- info: MDifferentiableAt I (I.prod π(π, F)) fun x β¦ TotalSpace.mk' F x (Ο x) : M β Prop -/
#guard_msgs in
#check MDiffAt (T% Ο)
/--
info: MDifferentiableAt π(π, E) (π(π, E).prod π(π, E')) fun x β¦ TotalSpace.mk' E' x (Ο' x) : E β Prop
-/
#guard_msgs in
#check MDiffAt (T% Ο')
/-! Error messages in case of a forgotten `T%`. -/
section
/--
error: Term X is a dependent function, of type (m : M) β TangentSpace I m
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiff X
/--
error: Term Ο is a dependent function, of type (x : M) β V x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiff Ο
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiff Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiff[s] Ο'
/--
error: Term X is a dependent function, of type (m : M) β TangentSpace I m
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiffAt (X)
/--
error: Term Ο is a dependent function, of type (x : M) β V x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiffAt ((Ο))
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiff[s] Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiffAt Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check MDiffAt[s] Ο'
end
end differentiability
/-! Tests for the custom elaborators for `ContMDiff{WithinAt,At,On}` -/
section smoothness
-- Copy-pasted the tests for differentiability mutatis mutandis.
-- Start with some basic tests: a simple function, both in applied and unapplied form.
variable {EM' : Type*} [NormedAddCommGroup EM']
[NormedSpace π EM'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners π EM' H')
{M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
-- TODO: add tests for the error message when smoothness hypotheses are missing
-- General case: a function between two manifolds.
variable {f : M β M'} {s : Set M} {m : M}
variable [IsManifold I 1 M] [IsManifold I' 1 M']
-- TODO: can there be better error messages when forgetting the smoothness exponent?
section error
-- yields a parse error, "unexpected toekn '/--'; expected term"
-- #check CMDiffAt[s] f
/--
error: Type mismatch
f
has type
M β M'
of sort `Type (max u_10 u_4)` but is expected to have type
WithTop ββ
of sort `Type`
---
error: Expected
m
of type
M
to be a function
-/
#guard_msgs in
#check CMDiffAt[s] f m
/--
error: Type mismatch
f
has type
M β M'
of sort `Type (max u_10 u_4)` but is expected to have type
WithTop ββ
of sort `Type`
---
error: Expected
m
of type
M
to be a function
-/
#guard_msgs in
#check CMDiffAt[s] f m
-- yields a parse error, "unexpected toekn '/--'; expected term"
-- #check CMDiffAt f
end error
/-- info: ContMDiffWithinAt I I' 1 f s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 f
/-- info: ContMDiffWithinAt I I' 1 f s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 f m
/-- info: ContMDiffWithinAt I I' 1 f s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 f m
/-- info: ContMDiffAt I I' 1 f : M β Prop -/
#guard_msgs in
#check CMDiffAt 1 f
/-- info: ContMDiffAt I I' 2 f m : Prop -/
#guard_msgs in
#check CMDiffAt 2 f m
/-- info: ContMDiffOn I I' 37 f s : Prop -/
#guard_msgs in
#check CMDiff[s] 37 f
-- Testing an error message.
section
/--
error: Function expected at
ContMDiffOn I I' 2 f s
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check CMDiff[s] 2 f m
variable {n : WithTop ββ}
/--
error: Function expected at
ContMDiffOn I I' n f s
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check ContMDiffOn I I' n f s m
/-- info: MDifferentiable I I' f : Prop -/
#guard_msgs in
#check MDiff f
/--
error: Function expected at
ContMDiff I I' n f
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check CMDiff n f m
end
/-! Tests for coercions from `β` or `ββ` to `WithTop ββ` -/
section coercions
variable {k : β} {k' : ββ}
/-- info: ContMDiffWithinAt I I' 0 f s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 0 f
/-- info: ContMDiffWithinAt I I' 1 f s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 f
/-- info: ContMDiffWithinAt I I' 37 f s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 37 f
/-- info: ContMDiffWithinAt I I' (βk) f s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] k f
/-- info: ContMDiffWithinAt I I' (βk') f s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] k' f m
/-- info: ContMDiffWithinAt I I' n f s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] n f m
/-- info: ContMDiffAt I I' (βk) f : M β Prop -/
#guard_msgs in
#check CMDiffAt k f
/-- info: ContMDiffAt I I' (βk') f m : Prop -/
#guard_msgs in
#check CMDiffAt k' f m
/-- info: ContMDiffOn I I' (βk) f s : Prop -/
#guard_msgs in
#check CMDiff[s] k f
/--
error: Function expected at
ContMDiffOn I I' (βk') f s
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check CMDiff[s] k' f m
/-- info: ContMDiff I I' (βk) f : Prop -/
#guard_msgs in
#check CMDiff k f
/--
error: Function expected at
ContMDiff I I' (βk') f
but this term has type
Prop
Note: Expected a function because this term is being applied to the argument
m
-/
#guard_msgs in
#check CMDiff k' f m
end coercions
/-! Error messages for a missing `T%` elaborator. -/
section dependent
variable {Ο : Ξ x : M, V x} {Ο' : (x : E) β Trivial E E' x} {s : E β E'}
variable (X : (m : M) β TangentSpace I m) [IsManifold I 1 M]
/--
error: Term X is a dependent function, of type (m : M) β TangentSpace I m
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiff 0 X
/--
error: Term Ο is a dependent function, of type (x : M) β V x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiff 0 Ο
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiff 0 Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiff[s] 0 Ο'
/--
error: Term X is a dependent function, of type (m : M) β TangentSpace I m
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiffAt 0 (X)
/--
error: Term Ο is a dependent function, of type (x : M) β V x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiffAt 0 ((Ο))
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiff[s] 0 Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiffAt 0 Ο'
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check CMDiffAt[s] 0 Ο'
end dependent
-- Function from a manifold into a normed space.
variable {g : M β E}
/-- info: ContMDiffWithinAt I π(π, E) 1 g s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 g
/-- info: ContMDiffWithinAt I π(π, E) 0 g s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] 0 g m
/-- info: ContMDiffAt I π(π, E) 1 g : M β Prop -/
#guard_msgs in
#check CMDiffAt 1 g
/-- info: ContMDiffAt I π(π, E) 1 g m : Prop -/
#guard_msgs in
#check CMDiffAt 1 g m
/-- info: ContMDiffOn I π(π, E) n g s : Prop -/
#guard_msgs in
#check CMDiff[s] n g
-- TODO: fix and enable! #check CMDiff[s] n g m
/-- info: ContMDiff I π(π, E) n g : Prop -/
#guard_msgs in
#check CMDiff n g
-- TODO: fix and enable! #check CMDiff n g m
-- From a manifold into a field.
variable {h : M β π}
/-- info: ContMDiffWithinAt I π(π, π) 0 h s : M β Prop -/
#guard_msgs in
#check CMDiffAt[s] 0 h
/-- info: ContMDiffWithinAt I π(π, π) 1 h s m : Prop -/
#guard_msgs in
#check CMDiffAt[s] 1 h m
/-- info: ContMDiffAt I π(π, π) 2 h : M β Prop -/
#guard_msgs in
#check CMDiffAt 2 h
/-- info: ContMDiffAt I π(π, π) n h m : Prop -/
#guard_msgs in
#check CMDiffAt n h m
/-- info: ContMDiffOn I π(π, π) n h s : Prop -/
#guard_msgs in
#check CMDiff[s] n h
-- TODO: fix and enable! #check CMDiff[s] n h m
/-- info: ContMDiff I π(π, π) 37 h : Prop -/
#guard_msgs in
#check CMDiff 37 h
-- TODO: fix and enable! #check CMDiff 0 h m
-- The following tests are more spotty, as most code paths are already covered above.
-- Add further details as necessary.
-- This list mirrors some of the tests for `MDifferentiable{WithinAt,At,On}`, but not all.
-- From a normed space into a manifold.
variable {f : E β M'} {s : Set E} {x : E}
/-- info: ContMDiffWithinAt π(π, E) I' 2 f s : E β Prop -/
#guard_msgs in
#check CMDiffAt[s] 2 f
/-- info: ContMDiffAt π(π, E) I' 3 f x : Prop -/
#guard_msgs in
#check CMDiffAt 3 f x
-- TODO: fix and enable! #check CMDiff[s] 1 f x
/-- info: ContMDiff π(π, E) I' 1 f : Prop -/
#guard_msgs in
#check CMDiff 1 f
-- TODO: should this error? if not, fix and enable! #check CMDiff 1 f x
-- same! #check MDifferentiable% f x
-- Between normed spaces.
variable {f : E β E'} {s : Set E} {x : E}
/-- info: ContMDiffAt π(π, E) π(π, E') 2 f x : Prop -/
#guard_msgs in
#check CMDiffAt 2 f x
/-- info: ContMDiffAt π(π, E) π(π, E') 2 f : E β Prop -/
#guard_msgs in
#check CMDiffAt 2 f
-- should this error or not? #check CMDiff[s] 2 f x
/-- info: ContMDiffWithinAt π(π, E) π(π, E') 2 f s : E β Prop -/
#guard_msgs in
#check CMDiffAt[s] 2 f
/-- info: ContMDiffOn π(π, E) π(π, E') 2 f s : Prop -/
#guard_msgs in
#check CMDiff[s] 2 f
end smoothness
/-! Tests for the custom elaborators for `mfderiv` and `mfderivWithin` -/
section mfderiv
variable {EM' : Type*} [NormedAddCommGroup EM']
[NormedSpace π EM'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners π EM' H')
{M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
variable {f : M β M'} {s : Set M} {m : M}
/-- info: mfderiv I I' f : (x : M) β TangentSpace I x βL[π] TangentSpace I' (f x) -/
#guard_msgs in
#check mfderiv% f
/-- info: mfderiv I I' f m : TangentSpace I m βL[π] TangentSpace I' (f m) -/
#guard_msgs in
#check mfderiv% f m
/-- info: mfderivWithin I I' f s : (x : M) β TangentSpace I x βL[π] TangentSpace I' (f x) -/
#guard_msgs in
#check mfderiv[s] f
/-- info: mfderivWithin I I' f s m : TangentSpace I m βL[π] TangentSpace I' (f m) -/
#guard_msgs in
#check mfderiv[s] f m
variable {f : E β EM'} {s : Set E} {m : E}
/--
info: mfderiv π(π, E) π(π, EM') f : (x : E) β TangentSpace π(π, E) x βL[π] TangentSpace π(π, EM') (f x)
-/
#guard_msgs in
#check mfderiv% f
/--
info: mfderiv π(π, E) π(π, EM') f m : TangentSpace π(π, E) m βL[π] TangentSpace π(π, EM') (f m)
-/
#guard_msgs in
#check mfderiv% f m
/--
info: mfderivWithin π(π, E) π(π, EM') f s : (x : E) β TangentSpace π(π, E) x βL[π] TangentSpace π(π, EM') (f x)
-/
#guard_msgs in
#check mfderiv[s] f
/--
info: mfderivWithin π(π, E) π(π, EM') f s m : TangentSpace π(π, E) m βL[π] TangentSpace π(π, EM') (f m)
-/
#guard_msgs in
#check mfderiv[s] f m
variable {Ο : Ξ x : M, V x} {Ο' : (x : E) β Trivial E E' x} {s : E β E'}
variable (X : (m : M) β TangentSpace I m) [IsManifold I 1 M] {x : M}
/--
info: mfderiv I (I.prod π(π, E)) (fun m β¦ TotalSpace.mk' E m (X m))
x : TangentSpace I x βL[π] TangentSpace (I.prod π(π, E)) (TotalSpace.mk' E x (X x))
-/
#guard_msgs in
#check mfderiv% (T% X) x
/--
info: mfderiv I (I.prod π(π, F)) (fun x β¦ TotalSpace.mk' F x (Ο x))
x : TangentSpace I x βL[π] TangentSpace (I.prod π(π, F)) (TotalSpace.mk' F x (Ο x))
-/
#guard_msgs in
#check mfderiv% (T% Ο) x
variable {t : Set E} {p : E}
/--
info: mfderivWithin π(π, E) (π(π, E).prod π(π, E')) (fun x β¦ TotalSpace.mk' E' x (Ο' x)) t
p : TangentSpace π(π, E) p βL[π] TangentSpace (π(π, E).prod π(π, E')) (TotalSpace.mk' E' p (Ο' p))
-/
#guard_msgs in
#check mfderiv[t] (T% Ο') p
/--
info: mfderivWithin π(π, E) (π(π, E).prod π(π, E')) (fun x β¦ TotalSpace.mk' E' x (Ο' x))
t : (x : E) β TangentSpace π(π, E) x βL[π] TangentSpace (π(π, E).prod π(π, E')) (TotalSpace.mk' E' x (Ο' x))
-/
#guard_msgs in
#check mfderiv[t] (T% Ο')
section errors
-- Test an error message, about mismatched types.
variable {s' : Set M} {m' : M}
/--
error: Application type mismatch: The argument
m'
has type
M
of sort `Type u_4` but is expected to have type
E
of sort `Type u_2` in the application
mfderiv π(π, E) π(π, EM') f m'
---
info: mfderiv π(π, E) π(π, EM') f sorry : TangentSpace π(π, E) sorry βL[π] TangentSpace π(π, EM') (f sorry)
-/
#guard_msgs in
#check mfderiv% f m'
-- Error messages: argument s has mismatched type.
/--
error: The domain E of f is not definitionally equal to the carrier type of the set s' : Set M
-/
#guard_msgs in
#check mfderiv[s'] f
/--
error: The domain E of f is not definitionally equal to the carrier type of the set s' : Set M
-/
#guard_msgs in
#check mfderiv[s'] f m
end errors
section
/--
error: Term X is a dependent function, of type (m : M) β TangentSpace I m
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check mfderiv% X x
/--
error: Term Ο is a dependent function, of type (x : M) β V x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check mfderiv% Ο x
variable {t : Set E} {p : E}
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check mfderiv[t] Ο' p
/--
error: Term Ο' is a dependent function, of type (x : E) β Trivial E E' x
Hint: you can use the `T%` elaborator to convert a dependent function to a non-dependent one
-/
#guard_msgs in
#check mfderiv[t] Ο'
end
end mfderiv
section trace
/- Test that basic tracing works. -/
set_option trace.Elab.DiffGeo true
variable {f : Unit β Unit}
/--
error: Could not find models with corners for Unit
---
trace: [Elab.DiffGeo.MDiff] Finding a model for: Unit
[Elab.DiffGeo.MDiff] βοΈ TotalSpace
[Elab.DiffGeo.MDiff] Failed with error:
Unit is not a `Bundle.TotalSpace`.
[Elab.DiffGeo.MDiff] βοΈ NormedSpace
[Elab.DiffGeo.MDiff] Failed with error:
Couldn't find a `NormedSpace` structure on Unit among local instances.
[Elab.DiffGeo.MDiff] βοΈ ChartedSpace
[Elab.DiffGeo.MDiff] Failed with error:
Couldn't find a `ChartedSpace` structure on Unit among local instances.
[Elab.DiffGeo.MDiff] βοΈ NormedField
[Elab.DiffGeo.MDiff] Failed with error:
failed to synthesize
NontriviallyNormedField Unit
β
Hint: Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
#check mfderiv% f
/--
info: fun a β¦ TotalSpace.mk' Unit a (f a) : Unit β TotalSpace Unit (Trivial Unit Unit)
---
trace: [Elab.DiffGeo.TotalSpaceMk] Section of a trivial bundle as a non-dependent function
-/
#guard_msgs in
#check T% f
end trace