# HG changeset patch # User Shinji KONO # Date 1624462666 -32400 # Node ID fb080920c104e3e9b748e3e8bf2c455dbf52c5a5 # Parent b21027d1d4a9e07da5ba83fd17655e3102c15060 ... diff -r b21027d1d4a9 -r fb080920c104 automaton-in-agda/src/prime.agda --- a/automaton-in-agda/src/prime.agda Wed Jun 23 22:35:04 2021 +0900 +++ b/automaton-in-agda/src/prime.agda Thu Jun 24 00:37:46 2021 +0900 @@ -48,79 +48,38 @@ open import logic open _∧_ -record Pair≤ : Set where - field - ox oy : ℕ - ox 0 → ¬ Prime p - is-g : (j : ℕ) → g ≤ j → j < p → gcd p j ≡ 1 - is-g= : {g p : ℕ} → g ≡ p → (j : ℕ) → g ≤ j → j < p → gcd p j ≡ 1 - is-g= eq _ g≤j j

¬a ¬b c = ⊥-elim ( nat-≤> ox≤oy c ) - ... | tri< a ¬b ¬c with <-cmp ox (gcd ox oy) - ... | tri< ox ¬a ¬b' c = record { ox = gcd ox oy ; oy = ox ; ox1 p ; div = {!!} ; npr = λ () ; is-g = {!!} } - ... | no np = {!!} -- record { p = suc (suc f) ; g = suc (suc f) ; 1

1 = G.1

¬a ¬b c = ⊥-elim ( nat-≤> ox≤oy c ) - ... | tri< a ¬b ¬c with <-cmp ox (gcd ox oy) - ... | tri< ox ox ) - ... | tri> ¬a ¬b' c = {!!} -- ¬ ox=oy ( → gcd ox oy ≡ 0 > ox ) - I : Ninduction Pair≤ _ (λ op → oy op ) - I = record { - pnext = next - ; fzero = λ {p} → pzero p - ; decline = λ {p} → decline p - ; ind = λ {p} → ind {p} - } - +data Factoring (m : ℕ ) : (n : ℕ) → Set where + findFactor : (n : ℕ) → ( (j : ℕ ) → m ≤ j → j < n → gcd n j ≡ 1 ) → Factoring m n + skipFactor : (n : ℕ) → n < m → Factoring m n nonPrime : { n : ℕ } → 1 < n → ¬ Prime n → NonPrime n -nonPrime {n} 1 n≤j j n≤j j ¬a ¬b c = ⊥-elim ( nat-≤> m1 = 11 = 1 ( gcd>0 n m (<-trans (s≤s z≤n) 1 a (subst (λ k → 1 < k) (sym (gcd20 n)) 1 ¬a ¬b c with PrimeP ( gcd n m ) ... | yes y = record { factor = gcd n m ; prime = y ; dividable = proj1 (gcd-dividable n m ) } - ... | no ngcd = np1 m (mg1 m mg {!!} ) + ... | no ngcd with np1 (gcd n m) m ngcd c (skipFactor (gcd n m) {!!}) + ... | cc = record { factor = NonPrime.factor cc ; prime = NonPrime.prime cc ; dividable = + record { factor = (Dividable.factor (proj1 (gcd-dividable n m))) * (Dividable.factor (NonPrime.dividable cc)) + ; is-factor = {!!} } } -- cc : NonPrime (gcd n m ) + np1 n zero np 1 a n ¬a ¬b c = np1 n m np 1 n≤j j n≤j j