Beth.Semantics


universe u


namespace Beth


class BethFrame (W : Type u) extends HasCoverage W, Kripke.Frame W where
  sheaf_condition : ∀ {i : ℕ} {w : W} {S : Sieve w} (_S_covers : covers w S), (∀ qS , val q i) → val w i
  nonempty_covers : ∀ {w : W} {S : Sieve w}, covers w SNonempty S.carrier


open BethFrame

open Frame

open Syntax

open Tm



def at_world {W : Type u} [BethFrame W] (w : W) (tm : Tm) : Prop :=
  match tm with
  | var v => val w v
  | Tm.and p q => at_world w pat_world w q
  | Tm.or p q =>
      ∃ (S : Sieve w), covers w S ∧ (∀ w'S, at_world w' pat_world w' q)
  | imp p q => ∀ (w' : W), ww'at_world w' pat_world w' q
  | tt => True
  | ff => False


attribute [simp] at_world



def mono_at {W : Type u} [BethFrame W] {w w' : W} {t : Tm} (le : ww') (t_at_w : at_world w t)
    : at_world w' t :=
  match t with
  | var n => le_val le t_at_w
  | Tm.and p q => ⟨mono_at le t_at_w.1, mono_at le t_at_w.2⟩
  | Tm.or p q =>
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
t_at_w : at_world w (p q)
at_world w' (p q)
by
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
t_at_w : at_world w (p q)
at_world w' (p q)
simp
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
t_at_w : at_world w (p q)
S, covers w' S w'_1S, at_world w'_1 p at_world w'_1 q
obtainS, cov, pf⟩ := t_at_w
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
S, covers w' S w'_1S, at_world w'_1 p at_world w'_1 q
let covers_w' : covers w' (pullback le S) := covers_stable cov le
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
S, covers w' S w'_1S, at_world w'_1 p at_world w'_1 q
exists pullback le S
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
covers w' (pullback le S) w'_1pullback le S, at_world w'_1 p at_world w'_1 q
constructor
left
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
covers w' (pullback le S)
right
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
w'_1pullback le S, at_world w'_1 p at_world w'_1 q
·
left
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
covers w' (pullback le S)
exact covers_w' ·
right
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
w'_1pullback le S, at_world w'_1 p at_world w'_1 q
intro v hv
right
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
v : W
hv : v pullback le S
at_world v p at_world v q
simp [pullback] at hv
right
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
v : W
at_world v p at_world v q
apply pf
right.a
W : Type u
inst✝ : BethFrame W
w : W
w' : W
t : Tm
le : w w'
p : Tm
q : Tm
S : Sieve w
cov : covers w S
pf : w'S, at_world w' p at_world w' q
covers_w' : covers w' (pullback le S) := ···
v : W
v S
exact hv.1 | Tm.imp p q => fun w'' w'_le_w'' p_at_w'' => t_at_w w'' (le_trans le w'_le_w'') p_at_w'' | tt => trivial | ff => False.elim t_at_w



def sheaf_term {W : Type u} [BethFrame W] {w : W} {S : Sieve w} (S_covers : covers w S) (tm : Tm) : (∀ w'S , at_world w' tm) → at_world w tm :=
  match tm with
  | var n => sheaf_condition S_covers
  | Tm.and p q =>
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
intro pq_on_S
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
at_world w (p q)
constructor
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
at_world w p
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
at_world w q
·
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
at_world w p
apply sheaf_term S_covers p
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
w'S, at_world w' p
intro s s_in_S
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
s : W
s_in_S : s S
at_world s p
exact (pq_on_S s s_in_S).1 ·
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
at_world w q
apply sheaf_term S_covers q
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
w'S, at_world w' q
intro s s_in_S
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
pq_on_S : w'S, at_world w' (p q)
s : W
s_in_S : s S
at_world s q
exact (pq_on_S s s_in_S).2 | Tm.or p q =>
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
intro p_or_q_on_S
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
at_world w (p q)
have h_ex (w' : S.carrier) : ∃ (S' : Sieve (w' : W)), covers (w' : W) S' ∧ (∀ vS', at_world v pat_world v q) := p_or_q_on_S w' w'.property
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
h_ex : ∀ (w' : ↑S.carrier), ∃ S', covers (↑w') S' vS', at_world v p at_world v q
at_world w (p q)
choose f_sieve f_spec using h_ex
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
at_world w (p q)
let S_gl := glue_sieves S f_sieve
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
at_world w (p q)
simp
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
S, covers w S w'S, at_world w' p at_world w' q
exists S_gl
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
covers w S_gl w'S_gl, at_world w' p at_world w' q
constructor
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
covers w S_gl
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
w'S_gl, at_world w' p at_world w' q
·
left
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
covers w S_gl
apply covers_glue f_sieve S_covers (fun q => (f_spec q).1) ·
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
w'S_gl, at_world w' p at_world w' q
intro v hv
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
v : W
hv : v S_gl
at_world v p at_world v q
letq, hgv⟩ := hv
right
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q✝ : Tm
p_or_q_on_S : w'S, at_world w' (p q)
f_sieve : (w' : ↑S.carrier) → Sievew'
f_spec : ∀ (w' : ↑S.carrier), covers (↑w') (f_sieve w') vf_sieve w', at_world v p at_world v q
S_gl : Sieve w := glue_sieves S f_sieve
v : W
hv : v S_gl
q : S.carrier
hgv : v (f_sieve q).carrier
at_world v p at_world v q✝
exact (f_spec q).2 v hgv | Tm.imp p q =>
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
intro hS w'
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w w'at_world w' pat_world w' q
w_le_w'
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
at_world w' pat_world w' q
p_at_w'
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
at_world w' q
have pullback_covers : covers w' (pullback w_le_w' S) := by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
(∀ w'S, at_world w' (p q)) → at_world w (p q)
apply covers_stable
hU
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
covers w S
exact S_covers apply sheaf_term pullback_covers q
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
pullback_covers : covers w' (pullback w_le_w' S)
w'_1pullback w_le_w' S, at_world w'_1 q
intro w'' hw''
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
pullback_covers : covers w' (pullback w_le_w' S)
w'' : W
hw'' : w'' pullback w_le_w' S
at_world w'' q
simp [pullback] at hw''
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
pullback_covers : covers w' (pullback w_le_w' S)
w'' : W
hw'' : w'' { carrier := {r | r S.carrier w' r}, bounded :=, upward_closed :=}
at_world w'' q
apply hS w'' hw''.1 w'' (le_refl w'')
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
p : Tm
q : Tm
hS : w'S, at_world w' (p q)
w' : W
w_le_w' : w w'
p_at_w' : at_world w' p
pullback_covers : covers w' (pullback w_le_w' S)
w'' : W
hw'' : w'' { carrier := {r | r S.carrier w' r}, bounded :=, upward_closed :=}
at_world w'' p
apply mono_at hw''.2 p_at_w' | tt =>
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
(∀ w'S, at_world w' tt) → at_world w tt
by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
(∀ w'S, at_world w' tt) → at_world w tt
intro _
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
a✝ : w'S, at_world w' tt
at_world w tt
trivial | ff =>
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
(∀ w'S, at_world w' ff) → at_world w ff
by
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
(∀ w'S, at_world w' ff) → at_world w ff
intro ff_on_S
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
ff_on_S : w'S, at_world w' ff
at_world w ff
obtain ⟨⟨w', hw'⟩⟩ := nonempty_covers S_covers
W : Type u
inst✝ : BethFrame W
w : W
S : Sieve w
S_covers : covers w S
tm : Tm
ff_on_S : w'S, at_world w' ff
w' : W
hw' : w' S.carrier
at_world w ff
exact ff_on_S w' hw'


def all_at_world {W : Type u} [BethFrame W] (w : W) : CtxtProp
  | [] => True
  | (t :: ts) => at_world w tall_at_world w ts


attribute [simp] all_at_world


lemma all_at_append_left {W : Type u} [BethFrame W] {w : W} (Δ Γ : Ctxt) :
    all_at_world w (Δ ++ Γ) → all_at_world w Γ := by
W : Type u
inst✝ : BethFrame W
w : W
Δ : Ctxt
Γ : Ctxt
all_at_world w (Δ ++ Γ)all_at_world w Γ
induction Δ with | nil =>
nil
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
all_at_world w ([] ++ Γ)all_at_world w Γ
simp | cons t Δ ih =>
cons
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
t : Tm
Δ : List Tm
ih : all_at_world w (Δ ++ Γ)all_at_world w Γ
all_at_world w (t :: Δ ++ Γ)all_at_world w Γ
intro h
cons
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
t : Tm
Δ : List Tm
ih : all_at_world w (Δ ++ Γ)all_at_world w Γ
h : all_at_world w (t :: Δ ++ Γ)
all_at_world w Γ
simp [all_at_world] at h
cons
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
t : Tm
Δ : List Tm
ih : all_at_world w (Δ ++ Γ)all_at_world w Γ
h : at_world w t all_at_world w (Δ ++ Γ)
all_at_world w Γ
exact ih h.2


lemma all_at_of_suffix {W : Type u} [BethFrame W] {w : W} {Γ Δ : Ctxt} (h : ΓΔ) :
    all_at_world w Δall_at_world w Γ := by
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
Δ : Ctxt
h : Γ Δ
all_at_world w Δall_at_world w Γ
rcases h withxs, rfl
W : Type u
inst✝ : BethFrame W
w : W
Γ : Ctxt
xs : List Tm
all_at_world w (xs ++ Γ)all_at_world w Γ
exact all_at_append_left xs Γ


def mono_all {W : Type u} [BethFrame W] {w w' : W} {Γ : Ctxt} (w_le_w' : ww')
    (Γ_at_w : all_at_world w Γ) : all_at_world w' Γ :=
  match Γ, Γ_at_w with
  | [], _ => trivial
  | _ :: _, ⟨h, t⟩ => ⟨mono_at w_le_w' h, mono_all w_le_w' t


def Entails (W : Type u) [BethFrame W] (Γ : Ctxt) (t : Tm) : Prop :=
  ∀ (w : W), all_at_world w Γat_world w t


def SemEntails (Γ : Ctxt) (t : Tm) : Prop :=
  ∀ (W : Type u) [BethFrame W] (w : W), all_at_world w Γat_world w t


namespace Semantics

section ProofRules


  variable {W : Type u} [BethFrame W] (t p q c : Tm) (Γ : Ctxt)


  def assumption : Entails W (p :: Γ) p := fun _ all => all.1


  def wk : ΓΔEntails W Γ tEntails W Δ t :=
    fun hΓΔ Γ_to_t w all => Γ_to_t w (all_at_of_suffix hΓΔ all)


  def and_I : Entails W Γ pEntails W Γ qEntails W Γ (pq) :=
    fun p_holds q_holds w' all => p_holds w' all, q_holds w' all


  def and_E₁ : Entails W Γ (pq) → Entails W Γ p :=
    fun pq_holds w' all => (pq_holds w' all).1


  def and_E₂ : Entails W Γ (pq) → Entails W Γ q :=
    fun pq_holds w' all => (pq_holds w' all).2


  def or_I₁ : Entails W Γ pEntails W Γ (pq) := by
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
Entails W Γ pEntails W Γ (p q)
intro p_holds w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_at_world w' Γat_world w' (p q)
all_w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
at_world w' (p q)
simp
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
S, covers w' S w'_1S, at_world w'_1 p at_world w'_1 q
exists maximal_sieve w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w') w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
constructor
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w')
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
·
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w')
apply covers_maximal ·
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
intro v hv
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
at_world v p at_world v q
have le : w'v := hv
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
at_world v p at_world v q
left
right.h
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
at_world v p
apply p_holds v
right.h
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_holds : Entails W Γ p
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
all_at_world v Γ
apply mono_all le all_w'


  def or_I₂ : Entails W Γ qEntails W Γ (pq) := by
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
Entails W Γ qEntails W Γ (p q)
intro q_holds w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_at_world w' Γat_world w' (p q)
all_w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
at_world w' (p q)
simp
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
S, covers w' S w'_1S, at_world w'_1 p at_world w'_1 q
exists maximal_sieve w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w') w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
constructor
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w')
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
·
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
covers w' (maximal_sieve w')
apply covers_maximal ·
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
w'_1maximal_sieve w', at_world w'_1 p at_world w'_1 q
intro v hv
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
at_world v p at_world v q
have le : w'v := hv
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
at_world v p at_world v q
right
right.h
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
at_world v q
apply q_holds v
right.h
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
q_holds : Entails W Γ q
w' : W
all_w' : all_at_world w' Γ
v : W
hv : v maximal_sieve w'
le : w' v
all_at_world v Γ
apply mono_all le all_w'


  def or_E : Entails W Γ (pq) → Entails W (p :: Γ) cEntails W (q :: Γ) cEntails W Γ c := by
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
Entails W Γ (p q)Entails W (p :: Γ) cEntails W (q :: Γ) cEntails W Γ c
intro p_or_q c_ass_p
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
Entails W (q :: Γ) cEntails W Γ c
c_ass_q
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
Entails W Γ c
w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_at_world w' Γat_world w' c
all_w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
at_world w' c
letS, S_cov, pq_sem⟩ := p_or_q w' all_w'
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
at_world w' c
apply sheaf_term S_cov
a
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
w'_1S, at_world w'_1 c
intro v hv
a
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
at_world v c
let le : w'v := S.bounded hv
a
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
at_world v c
match pq_sem v hv with | Or.inl p_holds =>
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
at_world v c
apply c_ass_p v
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
all_at_world v (p :: Γ)
constructor
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
at_world v p
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
all_at_world v Γ
·
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
at_world v p
exact p_holds ·
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
p_holds : at_world v p
all_at_world v Γ
exact (mono_all le all_w') | Or.inr q_holds =>
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
at_world v c
apply c_ass_q v
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
all_at_world v (q :: Γ)
constructor
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
at_world v q
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
all_at_world v Γ
·
left
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
at_world v q
exact q_holds ·
right
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
p_or_q : Entails W Γ (p q)
c_ass_p : Entails W (p :: Γ) c
c_ass_q : Entails W (q :: Γ) c
w' : W
all_w' : all_at_world w' Γ
S : Sieve w'
S_cov : covers w' S
pq_sem : w'_1S, at_world w'_1 p at_world w'_1 q
v : W
hv : v S
le : w' v := ···
q_holds : at_world v q
all_at_world v Γ
exact (mono_all le all_w')


  def imp_I : Entails W (p :: Γ) qEntails W Γ (pq) :=
    fun q_ass_p _w' all_w' v w_le_v p_at_v =>
      q_ass_p v p_at_v, mono_all w_le_v all_w'


  def imp_E : Entails W Γ (pq) → Entails W Γ pEntails W Γ q :=
    fun q_if_p p_holds w' all_w' =>
      q_if_p w' all_w' w' (le_refl w') (p_holds w' all_w')


  def tt_I : Entails W Γ tt := fun _ _ => trivial


  def ff_E : Entails W Γ ffEntails W Γ p := by
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
Entails W Γ ffEntails W Γ p
intro ff_at_w w
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
ff_at_w : Entails W Γ ff
w : W
all_at_world w Γat_world w p
all_w
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
ff_at_w : Entails W Γ ff
w : W
all_w : all_at_world w Γ
at_world w p
exfalso
W : Type u
inst✝ : BethFrame W
t : Tm
p : Tm
q : Tm
c : Tm
Γ : Ctxt
ff_at_w : Entails W Γ ff
w : W
all_w : all_at_world w Γ
False
exact ff_at_w w all_w


end ProofRules

end Semantics