changeset 16:ac362cc8b10f

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 14 May 2019 12:53:52 +0900
parents 497152f625ee
children 6a668c6086a5
files constructible-set.agda
diffstat 1 files changed, 126 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/constructible-set.agda	Tue May 14 03:52:42 2019 +0900
+++ b/constructible-set.agda	Tue May 14 12:53:52 2019 +0900
@@ -1,23 +1,28 @@
-module constructible-set  where
+open import Level
+module constructible-set (n : Level) where
 
-open import Level
 open import zf
 
 open import Data.Nat renaming ( zero to Zero ; suc to Suc ;  ℕ to Nat ) 
 
 open import  Relation.Binary.PropositionalEquality
 
-data Ordinal {n : Level } : (lv : Nat) → Set n where
-   Φ : {lv : Nat} → Ordinal {n} lv
-   T-suc : {lv : Nat} → Ordinal {n} lv → Ordinal lv
-   ℵ_ :  (lv : Nat) → Ordinal (Suc lv)
+data OridinalD  : (lv : Nat) → Set n where
+   Φ : {lv : Nat} → OridinalD  lv
+   OSuc : {lv : Nat} → OridinalD  lv → OridinalD lv
+   ℵ_ :  (lv : Nat) → OridinalD (Suc lv)
 
-data _o<_ {n : Level } :  {lx ly : Nat} → Ordinal {n} lx  →  Ordinal {n} ly  → Set n where
-   l< : {lx ly : Nat }  → {x : Ordinal {n} lx } →  {y : Ordinal {n} ly } → lx < ly → x o< y
-   Φ<  : {lx : Nat} → {x : Ordinal {n} lx}  →  Φ {n} {lx} o< T-suc {n} {lx} x
-   s<  : {lx : Nat} → {x y : Ordinal {n} lx}  →  x o< y  → T-suc {n} {lx} x o< T-suc {n} {lx} y
-   ℵΦ< : {lx : Nat} → {x : Ordinal {n} (Suc lx) } →  Φ {n} {Suc lx} o< (ℵ lx) 
-   ℵ<  : {lx : Nat} → {x : Ordinal {n} (Suc lx) } →  T-suc {n} {Suc lx} x o< (ℵ lx) 
+record Ordinal : Set n where
+   field
+     lv : Nat
+     ord : OridinalD lv
+
+data _o<_  :  {lx ly : Nat} → OridinalD  lx  →  OridinalD  ly  → Set n where
+   l< : {lx ly : Nat }  → {x : OridinalD  lx } →  {y : OridinalD  ly } → lx < ly → x o< y
+   Φ<  : {lx : Nat} → {x : OridinalD  lx}  →  Φ  {lx} o< OSuc  {lx} x
+   s<  : {lx : Nat} → {x y : OridinalD  lx}  →  x o< y  → OSuc  {lx} x o< OSuc  {lx} y
+   ℵΦ< : {lx : Nat} → {x : OridinalD  (Suc lx) } →  Φ  {Suc lx} o< (ℵ lx) 
+   ℵ<  : {lx : Nat} → {x : OridinalD  (Suc lx) } →  OSuc  {Suc lx} x o< (ℵ lx) 
 
 open import Data.Nat.Properties 
 open import Data.Empty
@@ -27,9 +32,9 @@
 open import Relation.Binary.Core
 
 
-nat< : { x y : Nat } → x ≡ y → x < y → ⊥
-nat< {Zero} {Zero} refl ()
-nat< {Suc x} {.(Suc x)} refl (s≤s t) = nat< {x} {x} refl t
+≡→¬< : { x y : Nat } → x ≡ y → x < y → ⊥
+≡→¬< {Zero} {Zero} refl ()
+≡→¬< {Suc x} {.(Suc x)} refl (s≤s t) = ≡→¬< {x} {x} refl t
 
 x≤x : { x : Nat } → x ≤ x
 x≤x {Zero} = z≤n
@@ -38,49 +43,69 @@
 x<>y : { x y : Nat } → x > y → x < y → ⊥
 x<>y {.(Suc _)} {.(Suc _)} (s≤s lt) (s≤s lt1) = x<>y lt lt1
 
-triO> : {n : Level } → {lx ly : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} ly }  →  ly < lx → x o< y → ⊥
-triO> {n} {lx} {ly} {x} {y} y<x xo<y with <-cmp  lx ly
-triO> {n} {lx} {ly} {x} {y} y<x xo<y | tri< a ¬b ¬c =  ¬c y<x 
-triO> {n} {lx} {ly} {x} {y} y<x xo<y | tri≈ ¬a b ¬c =  ¬c y<x 
-triO> {n} {lx} {ly} {x} {y} y<x (l< x₁) | tri> ¬a ¬b c =  ¬a x₁ 
-triO> {n} {lx} {ly} {Φ} {T-suc _} y<x Φ< | tri> ¬a ¬b c =  ¬b refl 
-triO> {n} {lx} {ly} {T-suc px} {T-suc py} y<x (s< w) | tri> ¬a ¬b c =  triO> y<x w
-triO> {n} {lx} {ly} {Φ {u}} {ℵ w} y<x ℵΦ< | tri> ¬a ¬b c = ¬b refl
-triO> {n} {lx} {ly} {(T-suc _)} {ℵ u} y<x ℵ< | tri> ¬a ¬b c =  ¬b refl
+triO> : {lx ly : Nat} {x  : OridinalD  lx } { y : OridinalD  ly }  →  ly < lx → x o< y → ⊥
+triO>  {lx} {ly} {x} {y} y<x xo<y with <-cmp  lx ly
+triO>  {lx} {ly} {x} {y} y<x xo<y | tri< a ¬b ¬c =  ¬c y<x 
+triO>  {lx} {ly} {x} {y} y<x xo<y | tri≈ ¬a b ¬c =  ¬c y<x 
+triO>  {lx} {ly} {x} {y} y<x (l< x₁) | tri> ¬a ¬b c =  ¬a x₁ 
+triO>  {lx} {ly} {Φ} {OSuc _} y<x Φ< | tri> ¬a ¬b c =  ¬b refl 
+triO>  {lx} {ly} {OSuc px} {OSuc py} y<x (s< w) | tri> ¬a ¬b c =  triO> y<x w
+triO>  {lx} {ly} {Φ {u}} {ℵ w} y<x ℵΦ< | tri> ¬a ¬b c = ¬b refl
+triO>  {lx} {ly} {(OSuc _)} {ℵ u} y<x ℵ< | tri> ¬a ¬b c =  ¬b refl
 
-trio! : {n : Level } → {lv : Nat} → {x  : Ordinal {n} lv }  → x o< x → ⊥
-trio! {n} {lx} {x} (l< y) = nat< refl y
-trio! {n} {lx} {T-suc y} (s< t) = trio! t
+≡→¬o< : {lv : Nat} → {x  : OridinalD  lv }  → x o< x → ⊥
+≡→¬o<  {lx} {x} (l< y) = ≡→¬< refl y
+≡→¬o<  {lx} {OSuc y} (s< t) = ≡→¬o< t
 
-trio<> : {n : Level } → {lx : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} lx }  →  y o< x → x o< y → ⊥
-trio<> {n} {lx} {x} {y} (l< lt) _ = nat< refl lt
-trio<> {n} {lx} {x} {y} _ (l< lt)  = nat< refl lt
-trio<> {n} {lx} {.(T-suc _)} {.(T-suc _)} (s< s) (s< t) = 
+trio<> : {lx : Nat} {x  : OridinalD  lx } { y : OridinalD  lx }  →  y o< x → x o< y → ⊥
+trio<>  {lx} {x} {y} (l< lt) _ = ≡→¬< refl lt
+trio<>  {lx} {x} {y} _ (l< lt)  = ≡→¬< refl lt
+trio<>  {lx} {.(OSuc _)} {.(OSuc _)} (s< s) (s< t) = 
     trio<> s t
 
-trio<≡ : {n : Level } → {lx : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} lx }  → x ≡ y  → x o< y → ⊥
-trio<≡ refl = trio!
+trio<≡ : {lx : Nat} {x  : OridinalD  lx } { y : OridinalD  lx }  → x ≡ y  → x o< y → ⊥
+trio<≡ refl = ≡→¬o<
 
-trio>≡ : {n : Level } → {lx : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} lx }  → x ≡ y  → y o< x → ⊥
-trio>≡ refl = trio!
+trio>≡ : {lx : Nat} {x  : OridinalD  lx } { y : OridinalD  lx }  → x ≡ y  → y o< x → ⊥
+trio>≡ refl = ≡→¬o<
 
-triO : {n : Level } → {lx ly : Nat} → Ordinal {n} lx  →  Ordinal {n} ly  → Tri (lx < ly) ( lx ≡ ly ) ( lx > ly )
-triO {n} {lx} {ly} x y = <-cmp lx ly
+triO : {lx ly : Nat} → OridinalD  lx  →  OridinalD  ly  → Tri (lx < ly) ( lx ≡ ly ) ( lx > ly )
+triO  {lx} {ly} x y = <-cmp lx ly
 
-triOonSameLevel : {n : Level } → {lx : Nat}   → Trichotomous  _≡_ ( _o<_ {n} {lx} {lx} )
-triOonSameLevel {n} {lv} Φ Φ = tri≈ trio! refl trio!
-triOonSameLevel {n} {Suc lv} (ℵ lv) (ℵ lv) = tri≈ trio! refl trio!
-triOonSameLevel {n} {lv} Φ (T-suc y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< )
-triOonSameLevel {n} {.(Suc lv)} Φ (ℵ lv) = tri<  (ℵΦ< {n} {lv} {Φ} ) (λ ()) ( λ lt → trio<> lt ((ℵΦ< {n} {lv} {Φ} )) )
-triOonSameLevel {n} {Suc lv} (ℵ lv) Φ = tri> ( λ lt → trio<> lt (ℵΦ< {n} {lv} {Φ} ) ) (λ ()) (ℵΦ< {n} {lv} {Φ} )
-triOonSameLevel {n} {Suc lv} (ℵ lv) (T-suc y) = tri> ( λ lt → trio<> lt (ℵ< {n} {lv} {y} )  ) (λ ()) (ℵ< {n} {lv} {y} )
-triOonSameLevel {n} {lv} (T-suc x) Φ = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ<
-triOonSameLevel {n} {.(Suc lv)} (T-suc x) (ℵ lv) = tri< ℵ< (λ ()) (λ lt → trio<> lt ℵ< )
-triOonSameLevel {n} {lv} (T-suc x) (T-suc y) with triOonSameLevel x y
-triOonSameLevel {n} {lv} (T-suc x) (T-suc y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) )  (  λ lt → trio<> lt (s< a) )
-triOonSameLevel {n} {lv} (T-suc x) (T-suc x) | tri≈ ¬a refl ¬c = tri≈ trio! refl trio!
-triOonSameLevel {n} {lv} (T-suc x) (T-suc y) | tri> ¬a ¬b c = tri> (  λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c)
+triOonSameLevel : {lx : Nat}   → Trichotomous  _≡_ ( _o<_  {lx} {lx} )
+triOonSameLevel  {lv} Φ Φ = tri≈ ≡→¬o< refl ≡→¬o<
+triOonSameLevel  {Suc lv} (ℵ lv) (ℵ lv) = tri≈ ≡→¬o< refl ≡→¬o<
+triOonSameLevel  {lv} Φ (OSuc y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< )
+triOonSameLevel  {.(Suc lv)} Φ (ℵ lv) = tri<  (ℵΦ<  {lv} {Φ} ) (λ ()) ( λ lt → trio<> lt ((ℵΦ<  {lv} {Φ} )) )
+triOonSameLevel  {Suc lv} (ℵ lv) Φ = tri> ( λ lt → trio<> lt (ℵΦ<  {lv} {Φ} ) ) (λ ()) (ℵΦ<  {lv} {Φ} )
+triOonSameLevel  {Suc lv} (ℵ lv) (OSuc y) = tri> ( λ lt → trio<> lt (ℵ<  {lv} {y} )  ) (λ ()) (ℵ<  {lv} {y} )
+triOonSameLevel  {lv} (OSuc x) Φ = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ<
+triOonSameLevel  {.(Suc lv)} (OSuc x) (ℵ lv) = tri< ℵ< (λ ()) (λ lt → trio<> lt ℵ< )
+triOonSameLevel  {lv} (OSuc x) (OSuc y) with triOonSameLevel x y
+triOonSameLevel  {lv} (OSuc x) (OSuc y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) )  (  λ lt → trio<> lt (s< a) )
+triOonSameLevel  {lv} (OSuc x) (OSuc x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬o< refl ≡→¬o<
+triOonSameLevel  {lv} (OSuc x) (OSuc y) | tri> ¬a ¬b c = tri> (  λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c)
 
+<→≤ : {lx ly : Nat} → lx < ly → (Suc lx ≤ ly)
+<→≤ {Zero} {Suc ly} (s≤s lt) = s≤s z≤n
+<→≤ {Suc lx} {Zero} ()
+<→≤ {Suc lx} {Suc ly} (s≤s lt) = s≤s (<→≤ lt) 
+
+orddtrans : {lx ly lz : Nat} {x  : OridinalD  lx } { y : OridinalD  ly } { z : OridinalD  lz } → x o< y → y o< z → x o< z 
+orddtrans {lx} {ly} {lz} x<y y<z with <-cmp lx ly  | <-cmp ly lz
+orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri< a₁ ¬b₁ ¬c₁ = l< ( <-trans a a₁ )
+orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri≈ ¬a refl ¬c₁ = l< a
+orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri> ¬a ¬b₁ c = l< {!!} -- ⊥-elim ( ¬a c )
+orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri< a ¬b₁ ¬c = l< {!!}
+orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri≈ ¬a₁ refl ¬c = l< {!!}
+orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri> ¬a₁ ¬b₁ c₁ = {!!}
+orddtrans {lx} {ly} {lz} x<y y<z | tri≈ ¬a refl ¬c | tri< a ¬b ¬c₁ = l< a
+orddtrans {lx} {ly} {lz} x<y y<z | tri≈ ¬a refl ¬c | tri> ¬a₁ ¬b c = l< {!!}
+orddtrans {lx} {lx} {lx} x<y y<z | tri≈ ¬a refl ¬c | tri≈ ¬a₁ refl ¬c₁ = orddtrans1  x<y y<z where
+  orddtrans1 : {lx : Nat} {x y z : OridinalD  lx }   → x o< y → y o< z → x o< z
+  orddtrans1 = {!!}
+
+  
 
 max : (x y : Nat) → Nat
 max Zero Zero = Zero
@@ -88,57 +113,80 @@
 max (Suc x) Zero = (Suc x)
 max (Suc x) (Suc y) = Suc ( max x y )
 
-maxα> : {n : Level } → { lx ly : Nat } → Ordinal {n} lx  →  Ordinal {n} ly  → lx > ly  → Ordinal {n} lx
+--  use cannot use OridinalD  (Data.Nat_⊔_ lx  ly), I don't know why
+
+maxα> : { lx ly : Nat } → OridinalD  lx  →  OridinalD  ly  → lx > ly  → OridinalD  lx
 maxα> x y _ = x
 
-maxα= : {n : Level } → { lx : Nat } → Ordinal {n} lx  →  Ordinal {n} lx  →  Ordinal {n} lx
+maxα= : { lx : Nat } → OridinalD  lx  →  OridinalD  lx  →  OridinalD  lx
 maxα= x y with triOonSameLevel x y
 maxα= x y | tri< a ¬b ¬c = y
 maxα= x y | tri≈ ¬a b ¬c = x
 maxα= x y | tri> ¬a ¬b c = x
 
+OrdTrans : Transitive (λ ( a b : Ordinal ) → (a ≡ b) ∨ (Ordinal.lv a < Ordinal.lv b) ∨ (Ordinal.ord a o< Ordinal.ord b) )
+OrdTrans (case1 refl) (case1 refl) = case1 refl
+OrdTrans (case1 refl) (case2 lt2) = case2 lt2
+OrdTrans (case2 lt1) (case1 refl) = case2 lt1
+OrdTrans (case2 (case1 x)) (case2 (case1 y)) = case2 ( case1 ( <-trans x y ) )
+OrdTrans (case2 (case1 x)) (case2 (case2 y)) = case2 {!!}
+OrdTrans (case2 (case2 x)) (case2 (case1 y)) = case2 {!!}
+OrdTrans (case2 (case2 x)) (case2 (case2 y)) = case2 {!!}
+
+OrdPreorder : Preorder n n n
+OrdPreorder = record { Carrier = Ordinal
+   ; _≈_  = _≡_ 
+   ; _∼_   = λ a b → (a ≡ b)  ∨ (Ordinal.lv a < Ordinal.lv b)  ∨ (Ordinal.ord a o< Ordinal.ord b )  
+   ; isPreorder   = record {
+        isEquivalence = record { refl = refl  ; sym = sym ; trans = trans }
+        ; reflexive     = case1 
+        ; trans         = OrdTrans
+     }
+ }
+
 -- X' = { x ∈ X |  ψ  x } ∪ X , Mα = ( ∪ (β < α) Mβ ) '
 
-data Constructible {n : Level } {lv : Nat} ( α : Ordinal {n} lv )  :  Set (suc n) where
-    fsub : ( ψ : Ordinal {n} lv → Set n ) → Constructible  α
-    xself : Ordinal {n} lv → Constructible  α
+data Constructible {lv : Nat} ( α : OridinalD  lv )  :  Set (suc n) where
+    fsub : ( ψ : OridinalD  lv → Set n ) → Constructible  α
+    xself : OridinalD  lv → Constructible  α
 
-record ConstructibleSet {n : Level } : Set (suc n) where
+record ConstructibleSet  : Set (suc n) where
   field
     level : Nat
-    α : Ordinal {n} level 
+    α : OridinalD  level 
     constructible : Constructible α
 
 open ConstructibleSet
 
-data _c∋_ {n : Level } : {lv lv' : Nat} {α : Ordinal {n} lv } {α' : Ordinal {n} lv' } →
-        Constructible {n} {lv} α → Constructible {n} {lv'} α' → Set n where
-    c> : {lv lv' : Nat} {α : Ordinal {n} lv } {α' : Ordinal {n} lv' }
-        (ta : Constructible {n} {lv} α ) ( tx : Constructible {n} {lv'} α' ) → α' o< α →  ta c∋ tx
-    xself-fsub  : {lv : Nat} {α : Ordinal {n} lv } 
-         (ta : Ordinal {n} lv ) ( ψ : Ordinal {n} lv → Set n ) → _c∋_ {n} {_} {_} {α} {α} (xself ta ) ( fsub ψ)  
-    fsub-fsub : {lv lv' : Nat} {α : Ordinal {n} lv } 
-          ( ψ : Ordinal {n} lv → Set n ) ( ψ₁ : Ordinal {n} lv → Set n ) →
-         ( ∀ ( x :  Ordinal {n} lv ) → ψ x →  ψ₁ x ) →  _c∋_ {n} {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁) 
+data _c∋_  : {lv lv' : Nat} {α : OridinalD  lv } {α' : OridinalD  lv' } →
+        Constructible  {lv} α → Constructible  {lv'} α' → Set n where
+    c> : {lv lv' : Nat} {α : OridinalD  lv } {α' : OridinalD  lv' }
+        (ta : Constructible  {lv} α ) ( tx : Constructible  {lv'} α' ) → α' o< α →  ta c∋ tx
+    xself-fsub  : {lv : Nat} {α : OridinalD  lv } 
+         (ta : OridinalD  lv ) ( ψ : OridinalD  lv → Set n ) → _c∋_  {_} {_} {α} {α} (xself ta ) ( fsub ψ)  
+    fsub-fsub : {lv lv' : Nat} {α : OridinalD  lv } 
+          ( ψ : OridinalD  lv → Set n ) ( ψ₁ : OridinalD  lv → Set n ) →
+         ( ∀ ( x :  OridinalD  lv ) → ψ x →  ψ₁ x ) →  _c∋_  {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁) 
 
-_∋_  : {n : Level} → (ConstructibleSet {n}) → (ConstructibleSet {n} ) → Set n 
+_∋_  : (ConstructibleSet ) → (ConstructibleSet  ) → Set n 
 a ∋ x  = constructible a c∋ constructible x
 
-transitiveness : {n : Level} → (a b c : ConstructibleSet {n}) → a ∋ b → b ∋ c → a ∋ c
-transitiveness = {!!}
+transitiveness : (a b c : ConstructibleSet ) → a ∋ b → b ∋ c → a ∋ c
+transitiveness  a b c a∋b b∋c with constructible a c∋ constructible b | constructible b c∋ constructible c
+... | t1 | t2 = {!!}
 
-data _c≈_ {n : Level } : {lv lv' : Nat} {α : Ordinal {n} lv } {α' : Ordinal {n} lv' } →
-        Constructible {n} {lv} α → Constructible {n} {lv'} α' → Set n where
-    crefl :  {lv : Nat} {α : Ordinal {n} lv } → _c≈_ {n} {_} {_} {α} {α} (xself α ) (xself α )
-    feq :  {lv : Nat} {α : Ordinal {n} lv }
-          → ( ψ : Ordinal {n} lv → Set n ) ( ψ₁ : Ordinal {n} lv → Set n ) 
-          → (∀ ( x :  Ordinal {n} lv ) → ψ x  ⇔ ψ₁ x ) → _c≈_ {n} {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁)
+data _c≈_  : {lv lv' : Nat} {α : OridinalD  lv } {α' : OridinalD  lv' } →
+        Constructible  {lv} α → Constructible  {lv'} α' → Set n where
+    crefl :  {lv : Nat} {α : OridinalD  lv } → _c≈_  {_} {_} {α} {α} (xself α ) (xself α )
+    feq :  {lv : Nat} {α : OridinalD  lv }
+          → ( ψ : OridinalD  lv → Set n ) ( ψ₁ : OridinalD  lv → Set n ) 
+          → (∀ ( x :  OridinalD  lv ) → ψ x  ⇔ ψ₁ x ) → _c≈_  {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁)
 
-_≈_  : {n : Level} → (ConstructibleSet {n}) → (ConstructibleSet {n} ) → Set n 
+_≈_  : (ConstructibleSet ) → (ConstructibleSet  ) → Set n 
 a ≈ x  = constructible a c≈ constructible x
 
-ConstructibleSet→ZF : {n : Level } → ZF {suc n} {n}
-ConstructibleSet→ZF {n}  = record { 
+ConstructibleSet→ZF : ZF {suc n} 
+ConstructibleSet→ZF   = record { 
     ZFSet = ConstructibleSet 
     ; _∋_ = _∋_
     ; _≈_ = _≈_