@@ -423,7 +423,7 @@ theorem monotone_dite
423
423
424
424
end monotone_lemmas
425
425
426
- section prod_order
426
+ section pprod_order
427
427
428
428
open PartialOrder
429
429
@@ -440,87 +440,96 @@ instance [PartialOrder α] [PartialOrder β] : PartialOrder (α ×' β) where
440
440
dsimp at *
441
441
rw [rel_antisymm ha.1 hb.1 , rel_antisymm ha.2 hb.2 ]
442
442
443
- theorem monotone_prod [PartialOrder α] [PartialOrder β] [PartialOrder γ]
443
+ theorem monotone_pprod [PartialOrder α] [PartialOrder β] [PartialOrder γ]
444
444
{f : γ → α} {g : γ → β} (hf : monotone f) (hg : monotone g) :
445
445
monotone (fun x => PProd.mk (f x) (g x)) :=
446
446
fun _ _ h12 => ⟨hf _ _ h12, hg _ _ h12⟩
447
447
448
- theorem monotone_fst [PartialOrder α] [PartialOrder β] [PartialOrder γ]
448
+ theorem monotone_pprod_fst [PartialOrder α] [PartialOrder β] [PartialOrder γ]
449
449
{f : γ → α ×' β} (hf : monotone f) : monotone (fun x => (f x).1 ) :=
450
450
fun _ _ h12 => (hf _ _ h12).1
451
451
452
- theorem monotone_snd [PartialOrder α] [PartialOrder β] [PartialOrder γ]
452
+ theorem monotone_pprod_snd [PartialOrder α] [PartialOrder β] [PartialOrder γ]
453
453
{f : γ → α ×' β} (hf : monotone f) : monotone (fun x => (f x).2 ) :=
454
454
fun _ _ h12 => (hf _ _ h12).2
455
455
456
- def chain_fst [CCPO α] [CCPO β] (c : α ×' β → Prop ) : α → Prop := ( fun a => ∃ b, c ⟨a, b⟩)
457
- def chain_snd [CCPO α] [CCPO β] (c : α ×' β → Prop ) : β → Prop := ( fun b => ∃ a, c ⟨a, b⟩)
456
+ def chain_pprod_fst [CCPO α] [CCPO β] (c : α ×' β → Prop ) : α → Prop := fun a => ∃ b, c ⟨a, b⟩
457
+ def chain_pprod_snd [CCPO α] [CCPO β] (c : α ×' β → Prop ) : β → Prop := fun b => ∃ a, c ⟨a, b⟩
458
458
459
- theorem chain.fst [CCPO α] [CCPO β] (c : α ×' β → Prop ) (hchain : chain c) :
460
- chain (chain_fst c) := by
459
+ theorem chain.pprod_fst [CCPO α] [CCPO β] (c : α ×' β → Prop ) (hchain : chain c) :
460
+ chain (chain_pprod_fst c) := by
461
461
intro a₁ a₂ ⟨b₁, h₁⟩ ⟨b₂, h₂⟩
462
462
cases hchain ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ h₁ h₂
463
463
case inl h => left; exact h.1
464
464
case inr h => right; exact h.1
465
465
466
- theorem chain.snd [CCPO α] [CCPO β] (c : α ×' β → Prop ) (hchain : chain c) :
467
- chain (chain_snd c) := by
466
+ theorem chain.pprod_snd [CCPO α] [CCPO β] (c : α ×' β → Prop ) (hchain : chain c) :
467
+ chain (chain_pprod_snd c) := by
468
468
intro b₁ b₂ ⟨a₁, h₁⟩ ⟨a₂, h₂⟩
469
469
cases hchain ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ h₁ h₂
470
470
case inl h => left; exact h.2
471
471
case inr h => right; exact h.2
472
472
473
473
instance [CCPO α] [CCPO β] : CCPO (α ×' β) where
474
- csup c := ⟨CCPO.csup (chain_fst c), CCPO.csup (chain_snd c)⟩
474
+ csup c := ⟨CCPO.csup (chain_pprod_fst c), CCPO.csup (chain_pprod_snd c)⟩
475
475
csup_spec := by
476
476
intro ⟨a, b⟩ c hchain
477
477
dsimp
478
478
constructor
479
479
next =>
480
480
intro ⟨h₁, h₂⟩ ⟨a', b'⟩ cab
481
- dsimp at *
482
- constructor <;> dsimp
481
+ constructor <;> dsimp at *
483
482
· apply rel_trans ?_ h₁
484
- apply le_csup hchain.fst
483
+ apply le_csup hchain.pprod_fst
485
484
exact ⟨b', cab⟩
486
485
· apply rel_trans ?_ h₂
487
- apply le_csup hchain.snd
486
+ apply le_csup hchain.pprod_snd
488
487
exact ⟨a', cab⟩
489
488
next =>
490
489
intro h
491
490
constructor <;> dsimp
492
- · apply csup_le hchain.fst
491
+ · apply csup_le hchain.pprod_fst
493
492
intro a' ⟨b', hcab⟩
494
493
apply (h _ hcab).1
495
- · apply csup_le hchain.snd
494
+ · apply csup_le hchain.pprod_snd
496
495
intro b' ⟨a', hcab⟩
497
496
apply (h _ hcab).2
498
497
499
- theorem admissible_fst {α : Sort u} {β : Sort v} [CCPO α] [CCPO β] (P : α → Prop )
498
+ theorem admissible_pprod_fst {α : Sort u} {β : Sort v} [CCPO α] [CCPO β] (P : α → Prop )
500
499
(hadm : admissible P) : admissible (fun (x : α ×' β) => P x.1 ) := by
501
500
intro c hchain h
502
- apply hadm _ hchain.fst
501
+ apply hadm _ hchain.pprod_fst
503
502
intro x ⟨y, hxy⟩
504
503
apply h ⟨x,y⟩ hxy
505
504
506
- theorem admissible_snd {α : Sort u} {β : Sort v} [CCPO α] [CCPO β] (P : β → Prop )
505
+ theorem admissible_pprod_snd {α : Sort u} {β : Sort v} [CCPO α] [CCPO β] (P : β → Prop )
507
506
(hadm : admissible P) : admissible (fun (x : α ×' β) => P x.2 ) := by
508
507
intro c hchain h
509
- apply hadm _ hchain.snd
508
+ apply hadm _ hchain.pprod_snd
510
509
intro y ⟨x, hxy⟩
511
510
apply h ⟨x,y⟩ hxy
512
511
513
- end prod_order
512
+ end pprod_order
514
513
515
514
section flat_order
516
515
517
516
variable {α : Sort u}
518
517
519
518
set_option linter.unusedVariables false in
519
+ /--
520
+ `FlatOrder b` wraps the type `α` with the flat partial order generated by `∀ x, b ⊑ x`.
521
+
522
+ This is intended to be used in the construction of `partial_fixpoint`, and not meant to be used otherwise.
523
+ -/
520
524
def FlatOrder {α : Sort u} (b : α) := α
521
525
522
526
variable {b : α}
523
527
528
+ /--
529
+ The flat partial order generated by `∀ x, b ⊑ x`.
530
+
531
+ This is intended to be used in the construction of `partial_fixpoint`, and not meant to be used otherwise.
532
+ -/
524
533
inductive FlatOrder.rel : (x y : FlatOrder b) → Prop where
525
534
| bot : rel b x
526
535
| refl : rel x x
@@ -590,9 +599,15 @@ end flat_order
590
599
591
600
section mono_bind
592
601
602
+ /--
603
+ The class `MonoBind m` indicates that every `m α` has a `PartialOrder`, and that the bind operation
604
+ on `m` is monotone in both arguments with regard to that order.
605
+
606
+ This is intended to be used in the construction of `partial_fixpoint`, and not meant to be used otherwise.
607
+ -/
593
608
class MonoBind (m : Type u → Type v) [Bind m] [∀ α, PartialOrder (m α)] where
594
- bind_mono_left ( a₁ a₂ : m α) ( f : α → m b) (h : a₁ ⊑ a₂) : a₁ >>= f ⊑ a₂ >>= f
595
- bind_mono_right ( a : m α) ( f₁ f₂ : α → m b) (h : ∀ x, f₁ x ⊑ f₂ x) : a >>= f₁ ⊑ a >>= f₂
609
+ bind_mono_left { a₁ a₂ : m α} { f : α → m b} (h : a₁ ⊑ a₂) : a₁ >>= f ⊑ a₂ >>= f
610
+ bind_mono_right { a : m α} { f₁ f₂ : α → m b} (h : ∀ x, f₁ x ⊑ f₂ x) : a >>= f₁ ⊑ a >>= f₂
596
611
597
612
theorem monotone_bind
598
613
(m : Type u → Type v) [Bind m] [∀ α, PartialOrder (m α)] [MonoBind m]
@@ -604,18 +619,18 @@ theorem monotone_bind
604
619
monotone (fun (x : γ) => f x >>= g x) := by
605
620
intro x₁ x₂ hx₁₂
606
621
apply PartialOrder.rel_trans
607
- · apply MonoBind.bind_mono_left _ _ _ (hmono₁ _ _ hx₁₂)
608
- · apply MonoBind.bind_mono_right _ _ _ (fun y => monotone_apply y _ hmono₂ _ _ hx₁₂)
622
+ · apply MonoBind.bind_mono_left (hmono₁ _ _ hx₁₂)
623
+ · apply MonoBind.bind_mono_right (fun y => monotone_apply y _ hmono₂ _ _ hx₁₂)
609
624
610
625
instance : PartialOrder (Option α) := inferInstanceAs (PartialOrder (FlatOrder none))
611
626
noncomputable instance : CCPO (Option α) := inferInstanceAs (CCPO (FlatOrder none))
612
627
noncomputable instance : MonoBind Option where
613
- bind_mono_left _ _ _ h := by
628
+ bind_mono_left h := by
614
629
cases h
615
630
· exact FlatOrder.rel.bot
616
631
· exact FlatOrder.rel.refl
617
- bind_mono_right a _ _ h := by
618
- cases a
632
+ bind_mono_right h := by
633
+ cases ‹Option _›
619
634
· exact FlatOrder.rel.refl
620
635
· exact h _
621
636
@@ -626,10 +641,10 @@ theorem admissible_eq_some (P : Prop) (y : α) :
626
641
instance [Monad m] [inst : ∀ α, PartialOrder (m α)] : PartialOrder (ExceptT ε m α) := inst _
627
642
instance [Monad m] [∀ α, PartialOrder (m α)] [inst : ∀ α, CCPO (m α)] : CCPO (ExceptT ε m α) := inst _
628
643
instance [Monad m] [∀ α, PartialOrder (m α)] [∀ α, CCPO (m α)] [MonoBind m] : MonoBind (ExceptT ε m) where
629
- bind_mono_left a₁ a₂ f h₁₂ := by
644
+ bind_mono_left h₁₂ := by
630
645
apply MonoBind.bind_mono_left (m := m)
631
646
exact h₁₂
632
- bind_mono_right a₁ a₂ f h₁₂ := by
647
+ bind_mono_right h₁₂ := by
633
648
apply MonoBind.bind_mono_right (m := m)
634
649
intro x
635
650
cases x
0 commit comments