### diff constructible-set.agda @ 14:e11e95d5ddee

separete constructible set
author Shinji KONO Tue, 14 May 2019 03:38:26 +0900 zf.agda@2df90eb0896c 497152f625ee
line wrap: on
line diff
```--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/constructible-set.agda	Tue May 14 03:38:26 2019 +0900
@@ -0,0 +1,162 @@
+module constructible-set  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 _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)
+
+open import Data.Nat.Properties
+open import Data.Empty
+open import Relation.Nullary
+
+open import Relation.Binary
+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≤x : { x : Nat } → x ≤ x
+x≤x {Zero} = z≤n
+x≤x {Suc x} =  s≤s ( x≤x  )
+
+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! : {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
+
+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<> s t
+
+trio<≡ : {n : Level } → {lx : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} lx }  → x ≡ y  → x o< y → ⊥
+trio<≡ refl = trio!
+
+trio>≡ : {n : Level } → {lx : Nat} {x  : Ordinal {n} lx } { y : Ordinal {n} lx }  → x ≡ y  → y o< x → ⊥
+trio>≡ refl = trio!
+
+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
+
+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)
+
+
+max : (x y : Nat) → Nat
+max Zero Zero = Zero
+max Zero (Suc x) = (Suc x)
+max (Suc x) Zero = (Suc x)
+max (Suc x) (Suc y) = Suc ( max x y )
+
+lvconv : { lx ly : Nat } → lx > ly → lx ≡ (max lx ly)
+lvconv {Zero} {Zero} ()
+lvconv {Zero} {Suc ly} ()
+lvconv {Suc lx} {Zero} (s≤s lt) = refl
+lvconv {Suc lx} {Suc ly} (s≤s lt) = cong ( λ x → Suc x ) ( lvconv lt )
+
+olconv : {n : Level } → { lx ly : Nat } → Ordinal {n} ly  → lx < ly  →  Ordinal {n} (max lx ly)
+olconv {n} {lx} {ly} (Φ {x}) lt = Φ
+olconv {n} {lx} {ly} (T-suc x) lt = T-suc (olconv x lt)
+olconv {n} {lx} {Suc lv} (ℵ lv) lt = {!!}
+
+maxα : {n : Level } → { lx ly : Nat } → Ordinal {n} lx  →  Ordinal {n} ly  → Ordinal {n} (max lx ly)
+maxα x y with triO x y
+maxα Φ y | tri< a ¬b ¬c = Φ
+maxα (T-suc x) y | tri< a ¬b ¬c = olconv x a
+maxα (ℵ lv) y | tri< a ¬b ¬c = {!!}
+maxα x y | tri> ¬a ¬b c = {!!}
+maxα Φ y | tri≈ ¬a b ¬c = Φ
+maxα (T-suc x) y | tri≈ ¬a b ¬c = T-suc  {!!}
+maxα (ℵ lv) y | tri≈ ¬a b ¬c = {!!}
+
+-- 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  α
+
+record ConstructibleSet {n : Level } : Set (suc n) where
+  field
+    level : Nat
+    α : Ordinal {n} 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 ψ₁)
+
+_∋_  : {n : Level} → (ConstructibleSet {n}) → (ConstructibleSet {n} ) → Set n
+a ∋ x  = constructible a c∋ constructible x
+
+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 ψ₁)
+
+_≈_  : {n : Level} → (ConstructibleSet {n}) → (ConstructibleSet {n} ) → Set n
+a ≈ x  = constructible a c≈ constructible x
+
+ConstructibleSet→ZF : {n : Level } → ZF {suc n} {n}
+ConstructibleSet→ZF {n}  = record {
+    ZFSet = ConstructibleSet
+    ; _∋_ = _∋_
+    ; _≈_ = _≈_
+    ; ∅  = record { level = Zero ; α = Φ ; constructible = xself Φ }
+    ; _×_ = {!!}
+    ; Union = {!!}
+    ; Power = {!!}
+    ; Select = {!!}
+    ; Replace = {!!}
+    ; infinite = {!!}
+    ; isZF = {!!}
+ }```