Skip to content

Commit c18de4b

Browse files
authored
Merge branch 'master' into church-theorem
2 parents baed7e7 + a60543a commit c18de4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+688
-269
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- "master"
77
pull_request:
8+
merge_group:
89
workflow_dispatch:
910

1011
concurrency:

Foundation.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import Foundation.FirstOrder.Q.Basic
4747

4848
import Foundation.FirstOrder.PeanoMinus.Basic
4949
import Foundation.FirstOrder.PeanoMinus.Functions
50+
import Foundation.FirstOrder.PeanoMinus.Q
5051

5152
import Foundation.FirstOrder.TrueArithmetic.Basic
5253
import Foundation.FirstOrder.TrueArithmetic.Nonstandard

Foundation/FirstOrder/Incompleteness/Examples.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation.FirstOrder.Incompleteness.First
12
import Foundation.FirstOrder.Incompleteness.Second
23

34
/-!
@@ -16,13 +17,13 @@ attribute [instance] ISigma1_delta1Definable PA_delta1Definable
1617

1718
instance : 𝐈𝚺₁ ⪱ 𝐈𝚺₁ + 𝐈𝚺₁.Con := inferInstance
1819

19-
instance : 𝐈𝚺₁ + 𝐈𝚺₁.Con 𝐓𝐀 := inferInstance
20+
instance : 𝐈𝚺₁ + 𝐈𝚺₁.Con 𝐓𝐀 := inferInstance
2021

2122
instance : 𝐈𝚺₁ ⪱ 𝐈𝚺₁ + 𝐈𝚺₁.Incon := inferInstance
2223

2324
instance : 𝐏𝐀 ⪱ 𝐏𝐀 + 𝐏𝐀.Con := inferInstance
2425

25-
instance : 𝐏𝐀 + 𝐏𝐀.Con 𝐓𝐀 := inferInstance
26+
instance : 𝐏𝐀 + 𝐏𝐀.Con 𝐓𝐀 := inferInstance
2627

2728
instance : 𝐏𝐀 ⪱ 𝐏𝐀 + 𝐏𝐀.Incon := inferInstance
2829

Foundation/FirstOrder/Incompleteness/First.lean

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,35 @@ theorem incomplete
5656
, fun h ↦ not_consistent_iff_inconsistent.mpr
5757
(inconsistent_of_provable_of_unprovable (this.mp h) h) inferInstance ⟩
5858

59+
theorem exists_true_but_unprovable_sentence (T : ArithmeticTheory) [T.Δ₁] [𝐑₀ ⪯ T] [T.SoundOnHierarchy 𝚺 1] : ∃ σ : Sentence ℒₒᵣ, ℕ ⊧ₘ₀ σ ∧ T ⊬. σ := by
60+
obtain ⟨σ, hσ⟩ := incomplete_iff_exists_undecidable.mp $ Arithmetic.incomplete T;
61+
by_cases ℕ ⊧ₘ₀ σ;
62+
. use σ;
63+
constructor;
64+
. assumption;
65+
. exact hσ.1;
66+
. use ∼σ;
67+
constructor;
68+
. simpa;
69+
. exact hσ.2;
70+
71+
5972
end LO.FirstOrder.Arithmetic
73+
74+
namespace LO.FirstOrderTrueArith
75+
76+
open LO.Entailment FirstOrder Arithmetic
77+
78+
instance {T : ArithmeticTheory} [ℕ ⊧ₘ* T] [T.Δ₁] [𝐑₀ ⪯ T] [T.SoundOnHierarchy 𝚺 1] : T ⪱ 𝐓𝐀 := by
79+
constructor;
80+
. infer_instance
81+
. obtain ⟨σ, σTrue, σUnprov⟩ := exists_true_but_unprovable_sentence T;
82+
apply Entailment.not_weakerThan_iff.mpr;
83+
use σ;
84+
constructor;
85+
. apply FirstOrderTrueArith.provable_iff.mpr;
86+
simpa;
87+
. apply Axiom.provable_iff (σ := σ) |>.not.mp;
88+
simpa;
89+
90+
end LO.FirstOrderTrueArith
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
import Foundation.FirstOrder.Q.Basic
2+
import Foundation.FirstOrder.PeanoMinus.Basic
3+
4+
lemma Nat.iff_lt_exists_add_succ : n < m ↔ ∃ k, m = n + (k + 1) := by
5+
constructor;
6+
. intro h;
7+
use m - n - 1;
8+
omega;
9+
. rintro ⟨k, rfl⟩;
10+
apply Nat.lt_add_of_pos_right;
11+
omega;
12+
13+
14+
namespace LO.RobinsonQ
15+
16+
open FirstOrder FirstOrder.Arithmetic
17+
18+
namespace Countermodel
19+
20+
def OmegaAddOne := Option ℕ
21+
22+
namespace OmegaAddOne
23+
24+
instance : NatCast OmegaAddOne := ⟨fun i ↦ .some i⟩
25+
26+
instance (n : ℕ) : OfNat OmegaAddOne n := ⟨.some n⟩
27+
28+
instance : Top OmegaAddOne := ⟨.none⟩
29+
30+
instance : ORingStruc OmegaAddOne where
31+
add a b :=
32+
match a, b with
33+
| .some n, .some m => n + m
34+
| ⊤, _ => ⊤
35+
| _, ⊤ => ⊤
36+
mul a b :=
37+
match a, b with
38+
| .some n, .some m => n * m
39+
| .some 0, ⊤ => 0
40+
| ⊤, .some 0 => 0
41+
| _, _ => ⊤
42+
lt a b :=
43+
match a, b with
44+
| .some n, .some m => n < m
45+
| _, ⊤ => True
46+
| ⊤, .some _ => False
47+
48+
49+
@[simp] lemma coe_zero : (↑(0 : ℕ) : OmegaAddOne) = 0 := rfl
50+
51+
@[simp] lemma coe_one : (↑(1 : ℕ) : OmegaAddOne) = 1 := rfl
52+
53+
@[simp] lemma coe_add (a b : ℕ) : ↑(a + b) = ((↑a + ↑b) : OmegaAddOne) := rfl
54+
55+
-- @[simp] lemma coe_mul (a b : ℕ) : ↑(a * b) = ((↑a * ↑b) : OmegaAddOne) := sorry
56+
57+
@[simp] lemma lt_coe_iff (n m : ℕ) : (n : OmegaAddOne) < (m : OmegaAddOne) ↔ n < m := by rfl
58+
59+
@[simp] lemma not_top_lt (n : ℕ) : ¬⊤ < (n : OmegaAddOne) := by rintro ⟨⟩
60+
61+
@[simp] lemma lt_top {n : ℕ} : (n : OmegaAddOne) < ⊤ := by trivial
62+
63+
@[simp] lemma top_add_zero : (⊤ : OmegaAddOne) + 0 = ⊤ := by rfl
64+
65+
@[simp] lemma top_lt_top : (⊤ : OmegaAddOne) < ⊤ := by trivial
66+
67+
@[simp] lemma top_add : (⊤ : OmegaAddOne) + a = ⊤ := by match a with | ⊤ | .some n => rfl
68+
69+
@[simp] lemma add_top : a + (⊤ : OmegaAddOne) = ⊤ := by match a with | ⊤ | .some n => rfl
70+
71+
72+
variable {a b : OmegaAddOne}
73+
74+
@[simp] lemma add_zero : a + 0 = a := by match a with | ⊤ | .some n => trivial;
75+
76+
@[simp] lemma add_succ : a + (b + 1) = a + b + 1 := by match a, b with | ⊤, ⊤ | ⊤, .some n | .some m, ⊤ | .some n, .some m => tauto;
77+
78+
@[simp] lemma mul_zero : a * 0 = 0 := by match a with | ⊤ | .some 0 | .some (n + 1) => rfl;
79+
80+
@[simp]
81+
lemma mul_succ : a * (b + 1) = a * b + a := by
82+
match a, b with
83+
| ⊤ , ⊤
84+
| ⊤ , .some 0
85+
| ⊤ , .some (n + 1)
86+
| .some 0 , .some n
87+
| .some 0 , ⊤
88+
| .some (m + 1), .some n
89+
| .some (m + 1), ⊤
90+
=> rfl
91+
92+
lemma succ_inj : a + 1 = b + 1 → a = b := by
93+
match a, b with
94+
| ⊤, ⊤ | ⊤, .some m | .some n, ⊤ => simp;
95+
| .some n, .some m =>
96+
intro h;
97+
apply Option.mem_some_iff.mpr;
98+
simpa using Option.mem_some_iff.mp h;
99+
100+
@[simp]
101+
lemma succ_ne_zero : a + 10 := by
102+
match a with
103+
| ⊤ => simp;
104+
| .some n => apply Option.mem_some_iff.not.mpr; simp;
105+
106+
@[simp]
107+
lemma zero_or_succ : a = 0 ∨ ∃ b, a = b + 1 := by
108+
match a with
109+
| .some 0 => left; rfl;
110+
| .some (n + 1) => right; use n; rfl;
111+
| ⊤ => right; use ⊤; rfl;
112+
113+
@[simp]
114+
lemma lt_def : a < b ↔ ∃ c, a + c + 1 = b := by
115+
match a, b with
116+
| ⊤, ⊤ => simp;
117+
| ⊤, .some n => simp [(show ¬(⊤ : OmegaAddOne) < .some n by tauto)];
118+
| .some m, ⊤ =>
119+
simp only [(show .some m < (⊤ : OmegaAddOne) by tauto), true_iff];
120+
use ⊤;
121+
simp;
122+
| .some m, .some n =>
123+
apply Iff.trans (show some m < some n ↔ m < n by rfl);
124+
apply Iff.trans Nat.iff_lt_exists_add_succ;
125+
constructor;
126+
. intro h;
127+
obtain ⟨k, rfl⟩ : ∃ k : ℕ, m + (k + 1) = n := by tauto;
128+
use k;
129+
tauto;
130+
. rintro ⟨c, hc⟩;
131+
match c with
132+
| .none => simp at hc;
133+
| .some c => use c; exact Option.mem_some_iff.mp hc |>.symm;
134+
135+
end OmegaAddOne
136+
137+
set_option linter.flexible false in
138+
instance : OmegaAddOne ⊧ₘ* 𝐐 := ⟨by
139+
intro σ h;
140+
rcases h;
141+
case equal h =>
142+
have : OmegaAddOne ⊧ₘ* (𝐄𝐐 : ArithmeticTheory) := inferInstance
143+
exact modelsTheory_iff.mp this h
144+
case succInj =>
145+
suffices ∀ (f : ℕ → OmegaAddOne), f 0 + 1 = f 1 + 1 → f 0 = f 1 by simpa [models_iff];
146+
intro _; apply OmegaAddOne.succ_inj;
147+
all_goals simp [models_iff];
148+
149+
150+
end Countermodel
151+
152+
lemma unprovable_neSucc : 𝐐 ⊬ “x | x + 1 ≠ x” := unprovable_of_countermodel (M := Countermodel.OmegaAddOne) (fun x ↦ ⊤) _ (by simp)
153+
154+
end LO.RobinsonQ
155+
156+
157+
158+
namespace LO
159+
160+
open FirstOrder FirstOrder.Arithmetic
161+
162+
namespace PeanoMinus
163+
164+
variable {M : Type*} [ORingStruc M] [M ⊧ₘ* 𝐏𝐀⁻]
165+
166+
instance : M ⊧ₘ* 𝐐 := modelsTheory_iff.mpr <| by
167+
intro φ h
168+
rcases h
169+
case equal h =>
170+
have : M ⊧ₘ* (𝐄𝐐 : ArithmeticTheory) := inferInstance
171+
exact modelsTheory_iff.mp this h
172+
case addSucc h =>
173+
suffices ∀ (f : ℕ → M), f 0 + (f 1 + 1) = f 0 + f 1 + 1 by simpa [models_iff];
174+
intro f;
175+
rw [add_assoc]
176+
case mulSucc h =>
177+
suffices ∀ (f : ℕ → M), f 0 * (f 1 + 1) = f 0 * f 1 + f 0 by simpa [models_iff];
178+
intro f;
179+
calc
180+
f 0 * (f 1 + 1) = (f 0 * f 1) + (f 0 * 1) := by rw [mul_add_distr]
181+
_ = (f 0 * f 1) + f 0 := by rw [mul_one]
182+
;
183+
case zeroOrSucc h =>
184+
suffices ∀ (f : ℕ → M), f 0 = 0 ∨ ∃ x, f 0 = x + 1 by simpa [models_iff];
185+
intro f;
186+
by_cases h : 0 < f 0;
187+
. right; apply eq_succ_of_pos h;
188+
. left; simpa using h;
189+
case ltDef h =>
190+
suffices ∀ (f : ℕ → M), f 0 < f 1 ↔ ∃ x, f 0 + (x + 1) = f 1 by simpa [models_iff];
191+
intro f;
192+
apply Iff.trans lt_iff_exists_add;
193+
constructor;
194+
. rintro ⟨a, ha₁, ha₂⟩;
195+
obtain ⟨b, rfl⟩ : ∃ b, a = b + 1 := eq_succ_of_pos ha₁;
196+
use b;
197+
tauto;
198+
. rintro ⟨a, ha⟩;
199+
use (a + 1);
200+
constructor;
201+
. simp;
202+
. apply ha.symm;
203+
all_goals simp [models_iff];
204+
205+
instance : 𝐐 ⪯ 𝐏𝐀⁻ := oRing_weakerThan_of.{0} _ _ fun _ _ _ ↦ inferInstance
206+
207+
instance w : 𝐐 ⪱ 𝐏𝐀⁻ := Entailment.StrictlyWeakerThan.of_unprovable_provable RobinsonQ.unprovable_neSucc $ by
208+
apply oRing_provable_of.{0};
209+
intro _ _ _;
210+
simp [models_iff];
211+
212+
end PeanoMinus
213+
214+
end LO

0 commit comments

Comments
 (0)