{"text": "/-\nCopyright (c) 2020 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Eric Wieser\n\n! This file was ported from Lean 3 source module algebra.char_p.quotient\n! leanprover-community/mathlib commit 85e3c05a94b27c84dc6f234cf88326d5e0096ec3\n! Please do not edit these lines, except to modify the commit id\n! if you have ported upstream changes.\n-/\nimport Mathbin.Algebra.CharP.Basic\nimport Mathbin.RingTheory.Ideal.Quotient\n\n/-!\n# Characteristic of quotients rings\n-/\n\n\nuniverse u v\n\nnamespace CharP\n\n/- warning: char_p.quotient -> CharP.quotient is a dubious translation:\nlean 3 declaration is\n forall (R : Type.{u1}) [_inst_1 : CommRing.{u1} R] (p : Nat) [hp1 : Fact (Nat.Prime p)], (Membership.Mem.{u1, u1} R (Set.{u1} R) (Set.hasMem.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p) (nonunits.{u1} R (Ring.toMonoid.{u1} R (CommRing.toRing.{u1} R _inst_1)))) -> (CharP.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))) (AddGroupWithOne.toAddMonoidWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))) (Ring.toAddCommGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))) (Ideal.Quotient.commRing.{u1} R _inst_1 (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.hasSingleton.{u1} R) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) p)))))))) p)\nbut is expected to have type\n forall (R : Type.{u1}) [_inst_1 : CommRing.{u1} R] (p : Nat) [hp1 : Fact (Nat.Prime p)], (Membership.mem.{u1, u1} R (Set.{u1} R) (Set.instMembershipSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p) (nonunits.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)))))) -> (CharP.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.instSingletonSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p)))) (AddGroupWithOne.toAddMonoidWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.instSingletonSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p)))) (Ring.toAddGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.instSingletonSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p)))) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.instSingletonSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p)))) (Ideal.Quotient.commRing.{u1} R _inst_1 (Ideal.span.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Singleton.singleton.{u1, u1} R (Set.{u1} R) (Set.instSingletonSet.{u1} R) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) p))))))) p)\nCase conversion may be inaccurate. Consider using '#align char_p.quotient CharP.quotientₓ'. -/\ntheorem quotient (R : Type u) [CommRing R] (p : ℕ) [hp1 : Fact p.Prime] (hp2 : ↑p ∈ nonunits R) :\n CharP (R ⧸ (Ideal.span {p} : Ideal R)) p :=\n have hp0 : (p : R ⧸ (Ideal.span {p} : Ideal R)) = 0 :=\n map_natCast (Ideal.Quotient.mk (Ideal.span {p} : Ideal R)) p ▸\n Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.subset_span <| Set.mem_singleton _)\n ringChar.of_eq <|\n Or.resolve_left ((Nat.dvd_prime hp1.1).1 <| ringChar.dvd hp0) fun h1 =>\n hp2 <|\n isUnit_iff_dvd_one.2 <|\n Ideal.mem_span_singleton.1 <|\n Ideal.Quotient.eq_zero_iff_mem.1 <|\n @Subsingleton.elim (@CharP.subsingleton _ <| ringChar.of_eq h1) _ _\n#align char_p.quotient CharP.quotient\n\n/- warning: char_p.quotient' -> CharP.quotient' is a dubious translation:\nlean 3 declaration is\n forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (p : Nat) [_inst_2 : CharP.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))) p] (I : Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))), (forall (x : Nat), (Membership.Mem.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (SetLike.hasMem.{u1, u1} (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) R (Submodule.setLike.{u1, u1} R R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))))) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) x) I) -> (Eq.{succ u1} R ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) x) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))))))))))) -> (CharP.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (AddGroupWithOne.toAddMonoidWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Ring.toAddCommGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Ideal.Quotient.commRing.{u1} R _inst_1 I))))) p)\nbut is expected to have type\n forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (p : Nat) [_inst_2 : CharP.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (Ring.toAddGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1))) p] (I : Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))), (forall (x : Nat), (Membership.mem.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (SetLike.instMembership.{u1, u1} (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) R (Submodule.setLike.{u1, u1} R R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))))) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))))) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) x) I) -> (Eq.{succ u1} R (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) x) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (CommMonoidWithZero.toZero.{u1} R (CommSemiring.toCommMonoidWithZero.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))))))) -> (CharP.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (AddGroupWithOne.toAddMonoidWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Ring.toAddGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Ideal.Quotient.commRing.{u1} R _inst_1 I)))) p)\nCase conversion may be inaccurate. Consider using '#align char_p.quotient' CharP.quotient'ₓ'. -/\n/-- If an ideal does not contain any coercions of natural numbers other than zero, then its quotient\ninherits the characteristic of the underlying ring. -/\ntheorem quotient' {R : Type _} [CommRing R] (p : ℕ) [CharP R p] (I : Ideal R)\n (h : ∀ x : ℕ, (x : R) ∈ I → (x : R) = 0) : CharP (R ⧸ I) p :=\n ⟨fun x => by\n rw [← cast_eq_zero_iff R p x, ← map_natCast (Ideal.Quotient.mk I)]\n refine' ideal.quotient.eq.trans (_ : ↑x - 0 ∈ I ↔ _)\n rw [sub_zero]\n exact ⟨h x, fun h' => h'.symm ▸ I.zero_mem⟩⟩\n#align char_p.quotient' CharP.quotient'\n\nend CharP\n\n/- warning: ideal.quotient.index_eq_zero -> Ideal.Quotient.index_eq_zero is a dubious translation:\nlean 3 declaration is\n forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (I : Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))), Eq.{succ u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (HasLiftT.mk.{1, succ u1} Nat (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (CoeTCₓ.coe.{1, succ u1} Nat (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Nat.castCoe.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (AddMonoidWithOne.toNatCast.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (AddGroupWithOne.toAddMonoidWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Ring.toAddCommGroupWithOne.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Ideal.Quotient.commRing.{u1} R _inst_1 I))))))))) (AddSubgroup.index.{u1} R (AddCommGroup.toAddGroup.{u1} R (NonUnitalNonAssocRing.toAddCommGroup.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))))) (Submodule.toAddSubgroup.{u1, u1} R R (CommRing.toRing.{u1} R _inst_1) (NonUnitalNonAssocRing.toAddCommGroup.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1)))) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) I))) (OfNat.ofNat.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) 0 (OfNat.mk.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) 0 (Zero.zero.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.hasQuotient.{u1} R _inst_1) I) (Submodule.Quotient.HasQuotient.Quotient.hasZero.{u1, u1} R R (CommRing.toRing.{u1} R _inst_1) (NonUnitalNonAssocRing.toAddCommGroup.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1)))) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) I))))\nbut is expected to have type\n forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (I : Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))), Eq.{succ u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Nat.cast.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (NonAssocRing.toNatCast.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Ring.toNonAssocRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (CommRing.toRing.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Ideal.Quotient.commRing.{u1} R _inst_1 I)))) (AddSubgroup.index.{u1} R (AddCommGroup.toAddGroup.{u1} R (Ring.toAddCommGroup.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Submodule.toAddSubgroup.{u1, u1} R R (CommRing.toRing.{u1} R _inst_1) (Ring.toAddCommGroup.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) I))) (OfNat.ofNat.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) 0 (Zero.toOfNat0.{u1} (HasQuotient.Quotient.{u1, u1} R (Ideal.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Ideal.instHasQuotientIdealToSemiringToRing.{u1} R _inst_1) I) (Submodule.Quotient.instZeroQuotientSubmoduleToSemiringToAddCommMonoidHasQuotient.{u1, u1} R R (CommRing.toRing.{u1} R _inst_1) (Ring.toAddCommGroup.{u1} R (CommRing.toRing.{u1} R _inst_1)) (Semiring.toModule.{u1} R (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1))) I)))\nCase conversion may be inaccurate. Consider using '#align ideal.quotient.index_eq_zero Ideal.Quotient.index_eq_zeroₓ'. -/\ntheorem Ideal.Quotient.index_eq_zero {R : Type _} [CommRing R] (I : Ideal R) :\n (I.toAddSubgroup.index : R ⧸ I) = 0 :=\n by\n rw [AddSubgroup.index, Nat.card_eq]\n split_ifs with hq; swap; simp\n by_contra h\n -- TODO: can we avoid rewriting the `I.to_add_subgroup` here?\n letI : Fintype (R ⧸ I) := @Fintype.ofFinite _ hq\n have h : (Fintype.card (R ⧸ I) : R ⧸ I) ≠ 0 := h\n simpa using h\n#align ideal.quotient.index_eq_zero Ideal.Quotient.index_eq_zero\n\n", "meta": {"author": "leanprover-community", "repo": "mathlib3port", "sha": "62505aa236c58c8559783b16d33e30df3daa54f4", "save_path": "github-repos/lean/leanprover-community-mathlib3port", "path": "github-repos/lean/leanprover-community-mathlib3port/mathlib3port-62505aa236c58c8559783b16d33e30df3daa54f4/Mathbin/Algebra/CharP/Quotient.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.6224593312018546, "lm_q2_score": 0.3208213008246071, "lm_q1q2_score": 0.19969821234659393}} {"text": "import mll\n\ndef sequent := list Form\n\ninstance : has_append sequent := ⟨list.append⟩\ninstance : has_mem Form sequent := ⟨list.mem⟩\n\ninductive proof : sequent → Type\n| ax (A) : proof [~A, A]\n| cut (A) {Γ Γ' Δ Δ'} : proof (Γ ++ [A] ++ Γ') → proof (Δ ++ [~A] ++ Δ') → proof (Γ++Γ'++Δ++Δ')\n| tensor {A B} {Γ Γ' Δ Δ'} : proof (Γ ++ [A] ++ Γ') → proof (Δ ++ [B] ++ Δ') → proof (Γ++Γ'++ [A ⊗ B] ++Δ++Δ') \n| par {A B} {Γ Γ'} : proof (Γ ++ [A,B] ++ Γ') → proof (Γ ++ [A ⅋ B] ++ Γ')\n| ex {A B} {Γ Γ'} : proof (Γ ++ [A,B] ++ Γ') → proof (Γ ++ [B,A] ++ Γ')\n\ninductive proof_net : sequent → Type\n| mk {Γ : sequent} (ps : proof_structure) : (Π A ∈ Γ, { i : ℕ // (A,i) ∈ ps ∧ ∀ Δ ∈ ps.links, ¬premise (A,i) Δ }) → proof_net Γ\n\ninstance {Γ : sequent} : has_coe (proof_net Γ) proof_structure := ⟨by rintro ⟨Γ,ps,_⟩; exact ps⟩\n\ndef relabel_Link (f : ℕ → ℕ) : Link → Link\n| (Link.ax pi ni A) := Link.ax (f pi) (f ni) A\n| (Link.cut pi ni A) := Link.cut (f pi) (f ni) A\n| (Link.tensor ai bi ci A B) := Link.tensor (f ai) (f bi) (f ci) A B\n| (Link.par ai bi ci A B) := Link.par (f ai) (f bi) (f ci) A B\n\nlemma relabel_valid {l f} (hf : function.injective f): valid_link l → valid_link (relabel_Link f l) :=\nbegin\n cases l,\n case Link.ax : pi ni A { rintro ⟨_⟩, constructor, },\n case Link.cut : pi ni A { rintro ⟨_⟩, constructor, },\n case Link.tensor : ai bi ci A B {\n rintro ⟨_⟩, constructor, rintro e, injection e with e₁ e₂, apply ᾰ_ᾰ, congr, assumption, exact hf e₂, },\n case Link.par : ai bi ci A B {\n rintro ⟨_⟩, constructor, rintro e, injection e with e₁ e₂, apply ᾰ_ᾰ, congr, assumption, exact hf e₂, },\nend\n\nlemma relabel_injective {f} (hf : function.injective f) : function.injective (relabel_Link f) :=\nby rintros ⟨l₁⟩ ⟨l₂⟩; intros h; injection h; congr; repeat {refl <|> assumption <|> apply hf}\n\nlemma relabel_premise {l f D i } (hf : function.injective f) : premise (D,i) (relabel_Link f l) → ∃ j, f j = i ∧ premise (D,j) l :=\nbegin\n cases l,\n case Link.ax : pi ni A { rintro ⟨_⟩ },\n case Link.cut : pi ni A { rintro ⟨_⟩, exact ⟨pi,rfl,premise.cut_pos⟩, exact ⟨ni,rfl,premise.cut_neg⟩, },\n case Link.tensor : ai bi ci A B {\n rintro ⟨_⟩, exact ⟨ai,rfl,premise.tensor_left⟩, exact ⟨bi,rfl,premise.tensor_right⟩, },\n case Link.par : ai bi ci A B {\n rintro ⟨_⟩, exact ⟨ai,rfl,premise.par_left⟩, exact ⟨bi,rfl,premise.par_right⟩, },\nend\n\nlemma relabel_conclusion {l f D i } (hf : function.injective f) : conclusion (D,i) (relabel_Link f l) → ∃j, f j = i ∧ conclusion (D,j) l :=\nbegin\n cases l,\n case Link.ax : pi ni A {\n rintro ⟨_⟩, exact ⟨pi,rfl,conclusion.ax_pos⟩, exact ⟨ni,rfl,conclusion.ax_neg⟩, },\n case Link.cut : pi ni A { rintro ⟨_⟩ },\n case Link.tensor : ai bi ci A B { rintro ⟨_⟩, exact ⟨ci,rfl,conclusion.tensor⟩ },\n case Link.par : ai bi ci A B { rintro ⟨_⟩, exact ⟨ci,rfl,conclusion.par⟩ },\nend\n\nlemma relabel_mem {Δ f A i} (hf : function.injective f) : (A,i) ∈ (relabel_Link f Δ) → ∃ j, f j = i ∧ (A,j) ∈ Δ :=\nbegin\n intro h, cases h with h h,\n rcases (relabel_premise hf h) with ⟨j, ⟨fji,pΔ⟩⟩, refine ⟨j,fji,mem_Link.prem pΔ⟩,\n rcases (relabel_conclusion hf h) with ⟨j, ⟨fji,pΔ⟩⟩, refine ⟨j,fji,mem_Link.con pΔ⟩,\nend\n\n\ndef proof_structure.relabel (ps : proof_structure) (f : ℕ → ℕ) (hf : function.injective f) : proof_structure :=\n⟨set.image (relabel_Link f) ps.links,\n by rintros l ⟨l', ⟨hl',⟨_⟩⟩⟩; exact relabel_valid hf (ps.valid l' hl'),\nbegin\n rintros ⟨A,i⟩ _ _ ⟨k₁, ⟨hk₁,⟨_⟩⟩⟩ ⟨k₂, ⟨hk₂,⟨_⟩⟩⟩,\n intros pk₁ pk₂,\n congr, \n rcases relabel_premise hf pk₁ with ⟨j,hfj,u₁⟩,\n rcases relabel_premise hf pk₂ with ⟨j',hfj',u₂⟩,\n have : j' = j, rw ←hfj at hfj', exact hf hfj', rw this at u₂, \n exact ps.prem_unique (A,j) _ _ hk₁ hk₂ u₁ u₂\nend\n,\nbegin\n rintros ⟨A,i⟩ _ _ ⟨k₁, ⟨hk₁,⟨_⟩⟩⟩ ⟨k₂, ⟨hk₂,⟨_⟩⟩⟩,\n intros pk₁ pk₂,\n congr, \n rcases relabel_conclusion hf pk₁ with ⟨j,hfj,u₁⟩,\n rcases relabel_conclusion hf pk₂ with ⟨j',hfj',u₂⟩,\n have : j' = j, rw ←hfj at hfj', exact hf hfj', rw this at u₂, \n exact ps.con_unique (A,j) _ _ hk₁ hk₂ u₁ u₂\nend⟩\n\ndef separators {α β} (f g : α → β) : Prop := ∀ x y, f x ≠ g y\n\nlemma sep_even_odd : separators (λ x, 2 * x) (λ x, 2 * x + 1) :=\n λ x y, nat.two_mul_ne_two_mul_add_one\n\ndef disjoint_of_separators {ps₁ ps₂ : proof_structure} {f g} (hf hg) : separators f g → disjoint { Ai | Ai ∈ (ps₁.relabel f hf) } { Ai | Ai ∈ (ps₂.relabel g hg) } :=\nbegin\n rintros s ⟨A,i⟩ ⟨⟨Δ₁,⟨Δ₁', hΔ₁', ⟨_⟩⟩,h₁⟩,⟨Δ₂,⟨Δ₂', hΔ₂', ⟨_⟩⟩,h₂⟩⟩,\n rcases (relabel_mem hf h₁) with ⟨j₁,hfg,h₁⟩,\n rcases (relabel_mem hg h₂) with ⟨j₂,⟨_⟩,h₂⟩,\n exact s j₁ j₂ hfg,\nend\n\ndef proof_net.disjoint {Γ Δ} : proof_net Γ → proof_net Δ → Prop :=\n by rintro ⟨_,ps₁,_⟩ ⟨_,ps₂,_⟩; exact disjoint {Ai | Ai ∈ ps₁} {Ai | Ai ∈ ps₂}\n\ndef net_links_ax (pi ni A) : set Link :=\n {Link.ax pi ni A}\n\ndef net_links_tensor (ai bi ci A B) (sA sB : set Link) : set Link :=\n {Link.tensor ai bi ci A B} ∪ sA ∪ sB\n\ndef net_links_par (ai bi ci A B) (s : set Link) : set Link :=\n {Link.par ai bi ci A B} ∪ s\n\ndef net_links_cut (pi ni A) (sA snA : set Link) : set Link :=\n {Link.cut pi ni A} ∪ sA ∪ snA\n\ndef proof_net_ax (A) : proof_net [~A,A] :=\n⟨\n ⟨{Link.ax 0 0 A},\n by rintro l ⟨h⟩; exact valid_link.ax,\n by rintro Ai Δ₁ Δ₂ ⟨_⟩ ⟨_⟩; finish,\n by rintro Ai Δ₁ Δ₂ ⟨_⟩ ⟨_⟩; finish ⟩\n,\n begin\n rintro B Bmem,\n refine ⟨0,_,_⟩, rcases Bmem with ⟨_,_⟩, use Link.ax 0 0 A, simp, exact mem_Link.con conclusion.ax_neg,\n \n -- exact ⟨0,Link.ax 0 0 A,by simp,conclusion.ax_neg,_⟩, rintro Δ' ⟨_⟩ ⟨_⟩,\n rcases H with ⟨⟨_⟩⟩,\n exact ⟨0,Link.ax 0 0 A,by simp,conclusion.ax_pos,_⟩, rintro Δ' ⟨_⟩ ⟨_⟩,\n cases H,\n end\n⟩\n\ndef proof_net_tensor {Γ Γ' A B Δ Δ'} (pnA : proof_net (Γ ++ [A] ++ Γ')) (pnB : proof_net (Δ ++ [B] ++ Δ')) : pnA.disjoint pnB → proof_net (Γ ++ Γ' ++ [A ⊗ B] ++ Δ ++ Δ') :=\nbegin\n rcases pnA with ⟨_,psA, hA⟩,\n rcases pnB with ⟨_,psB, hB⟩,\n intro dAB,\n specialize hA A (by refine list.mem_append_left _ (list.mem_append_right _ (list.mem_cons_self A list.nil))),\n specialize hB B,\n cases hA with ai ΔA hA,\n \nend", "meta": {"author": "blinkybool", "repo": "proofnet", "sha": "4c94599d3cb45530b0e082ef3991900f9dd023eb", "save_path": "github-repos/lean/blinkybool-proofnet", "path": "github-repos/lean/blinkybool-proofnet/proofnet-4c94599d3cb45530b0e082ef3991900f9dd023eb/src/sequent.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5389832354982645, "lm_q2_score": 0.3702253856469203, "lm_q1q2_score": 0.19954527621956986}} {"text": "import mcl\nimport parlang.lemmas_memory\n\nopen mcl\n\nnamespace coarsening\n\ndef sigc : signature_core\n| \"tid\" := { scope := scope.tlocal, type := ⟨1, type.int⟩ }\n| \"i\" := { scope := scope.tlocal, type := ⟨1, type.int⟩ }\n| \"j\" := { scope := scope.tlocal, type := ⟨1, type.int⟩ }\n| _ := { scope := scope.shared, type := ⟨1, type.float⟩ }\n\ndef sig : signature := ⟨sigc, ⟨rfl, rfl, rfl⟩⟩\n\nopen mcl.expression\nopen parlang\n\n/-- Copies the *j*-th element from a to b -/\ndef copy : mclk sig := mclk.shared_assign \"b\" v[@tlocal_var sig _ _ \"j\" (λ_, 0) rfl rfl rfl] rfl rfl (@shared_var sig _ _ \"a\" (v[@tlocal_var sig _ _ \"j\" (λ_, 0) rfl rfl rfl]).nth rfl rfl rfl)\n\ndef e₁ := 10\ndef f₁ := 10\ndef p₁ : mclp sig := mclp.intro (λ m, e₁) (\n mclk.for \"i\" rfl rfl (literal_int 0 rfl) (@tlocal_var sig _ _ \"i\" (λ_, 0) rfl rfl rfl < literal_int f₁ rfl) (mclk.tlocal_assign \"i\" v[0] rfl rfl $ tlocal_var \"i\" (λ_, 0) rfl rfl rfl + literal_int 1 rfl) (\n mclk.tlocal_assign \"j\" v[literal_int 0 rfl] rfl rfl (@tlocal_var sig _ _ \"tid\" (λ_, 0) rfl rfl rfl * literal_int e₁ rfl + @tlocal_var sig _ _ \"i\" (λ_, 0) rfl rfl rfl) ;;\n copy\n )\n)\n\ndef e₂ := 5\ndef f₂ := 20\ndef p₂ : mclp sig := mclp.intro (λ m, e₂) (\n mclk.for \"i\" rfl rfl (literal_int 0 rfl) (@tlocal_var sig _ _ \"i\" (λ_, 0) rfl rfl rfl < literal_int f₂ rfl) (mclk.tlocal_assign \"i\" v[0] rfl rfl $ @tlocal_var sig _ _ \"i\" (λ_, 0) rfl rfl rfl + literal_int 1 rfl) (\n mclk.tlocal_assign \"j\" v[literal_int 0 rfl] rfl rfl (@tlocal_var sig _ _ \"tid\" (λ_, 0) rfl rfl rfl * literal_int e₂ rfl + @tlocal_var sig _ _ \"i\" (λ_, 0) rfl rfl rfl) ;;\n copy\n )\n)\n\ndef read_tid {sig : signature} := @tlocal_var sig _ _ \"tid\" (λ_, 0) sig.property.left sig.property.right.left sig.property.right.right\n\ndef coarsen_kernel_assertion {sig : signature}\n(P : memory (parlang_mcl_shared sig) → memory (parlang_mcl_shared sig) → Prop)\n(f₁ : memory (parlang_mcl_shared sig) → ℕ) (f₂ : memory (parlang_mcl_shared sig) → ℕ) \n(m₁ : memory (parlang_mcl_shared sig)) (m₂ : memory (parlang_mcl_shared sig)) \n(n₁) (s₁ : state n₁ (memory $ parlang_mcl_tlocal sig) $ parlang_mcl_shared sig) \n(ac₁ : vector bool n₁) (n₂) (s₂ : state n₂ (memory $ parlang_mcl_tlocal sig) $ parlang_mcl_shared sig) \n(ac₂ : vector bool n₂) := \ns₁.syncable m₁ ∧ s₂.syncable m₂ ∧ n₁ = f₁ m₁ ∧ n₂ = f₂ m₂ ∧\n(∀ i : fin n₁, s₁.threads.nth i = { tlocal := mcl_init i, shared := m₁, stores := ∅, loads := ∅ }) ∧ \n(∀ i : fin n₂, s₂.threads.nth i = { tlocal := mcl_init i, shared := m₂, stores := ∅, loads := ∅ }) ∧\nP m₁ m₂ ∧ all_threads_active ac₁ ∧ all_threads_active ac₂\n\n/-- only works with constant number of threads -/\ntheorem coarsen (e₁ e₂) \n(sig) (k₁ : mclk sig) (k₂ : mclk sig) (h₁ : type_of (sig.val \"k\") = type.int) (h₂ : ((sig.val \"k\").type).dim = 1) (h₃) (Q : parlang.memory (parlang_mcl_shared sig) → parlang.memory (parlang_mcl_shared sig) → Prop)\n(h : rhl.mclk_rel (λn₁ (s₁ : state n₁ (memory (parlang_mcl_tlocal sig)) (parlang_mcl_shared sig)) ac₁ n₂ s₂ ac₂, ∃ m₁ m₂, \nparlang.initial_kernel_assertion mcl_init mcl_init eq (λm, e₁) (λm, e₂) m₁ m₂ n₁ \n(s₁.map_active_threads ac₁ $ λts, ts.compute $ λm, m.update ⟨\"k\", by rw h₂; exact v[0]⟩ (eq.mpr (show _ = ℕ, from begin unfold parlang_mcl_tlocal, simp, unfold signature.lean_type_of lean_type_of, rw h₁, end) 0)) ac₁ n₂ \n(s₂.map_active_threads ac₂ $ λts, ts.compute $ λm, m.update ⟨\"k\", by rw h₂; exact v[0]⟩ (eq.mpr (show _ = ℕ, from begin unfold parlang_mcl_tlocal, simp, unfold signature.lean_type_of lean_type_of, rw h₁, end) 0)) ac₂)\n k₁ k₂ \n (λn₁ s₁ ac₁ n₂ s₂ ac₂, ∃ m₁ m₂, s₁.syncable m₁ ∧ s₂.syncable m₂ ∧ Q m₁ m₂)) :\nrhl.mclp_rel eq \n(mclp.intro (λ m, e₁) (\n @mclk.tlocal_assign sig type.int _ \"k\" v[literal_int 0 rfl] h₁ h₂ read_tid ;;\n k₁\n))\n(mclp.intro (λ m, e₂) (\n mclk.for \"k\" h₁ h₂ read_tid ((@tlocal_var sig _ _ \"k\" (λ_, 0) h₁ h₂ h₃) < literal_int e₂ rfl) (mclk.tlocal_assign \"k\" v[0] h₁ h₂ $ tlocal_var \"k\" (λ_, 0) h₁ h₂ h₃ + literal_int e₂ rfl)\n k₂\n)) Q := begin\n apply rhl.rel_mclk_to_mclp,\n intros n₁ n₂ s₁ s₁' s₂ ac₁ ac₂ hp he₁,\n cases hp with m₁ hp,\n cases hp with m₂ hp,\n specialize h n₁ n₂ (state.map_active_threads ac₁ (thread_state.compute $ λm, m.update ⟨\"k\", by rw h₂; exact v[0]⟩ (eq.mpr _ $ m.get ⟨\"tid\", begin rw sig.property.right.left, exact v[0], end⟩)) s₁) s₁' s₂ ac₁ ac₂,\n swap 2, {\n unfold parlang_mcl_tlocal signature.lean_type_of lean_type_of,\n rw h₁,\n rw sig.property.left,\n },\n specialize h _,\n swap 2,\n {\n use m₁,\n use m₂,\n unfold initial_kernel_assertion,\n unfold initial_kernel_assertion at hp,\n delta thread_state.compute,\n rw ← state.syncable_tlocal,\n rw ← state.syncable_tlocal,\n rw ← state.syncable_tlocal,\n split, {\n exact hp.left,\n },\n split, {\n exact hp.right.left,\n },\n split, {\n exact hp.right.right.left,\n },\n split, {\n exact hp.right.right.right.left,\n },\n split, {\n intros i,\n have : vector.nth ac₁ i = tt := sorry,\n simp only [state.map_active_threads_nth_ac this],\n rw memory.update_update_eq,\n rw hp.right.right.right.right.left i,\n simp [mcl_init],\n funext i,\n cases i,\n by_cases a : i_fst = \"k\",\n {\n subst a,\n sorry,\n },\n sorry,\n },\n sorry,\n },\n sorry,\n sorry,\nend\n\nexample : rhl.mclp_rel eq p₁ p₂ eq := begin \n sorry,\n -- apply main transformation rule\nend\n\nend coarsening", "meta": {"author": "fischerman", "repo": "GPU-transformation-verifier", "sha": "75a5016f05382738ff93ce5859c4cfa47ccb63c1", "save_path": "github-repos/lean/fischerman-GPU-transformation-verifier", "path": "github-repos/lean/fischerman-GPU-transformation-verifier/GPU-transformation-verifier-75a5016f05382738ff93ce5859c4cfa47ccb63c1/src/use_cases/coarsening/defs.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5117166047041654, "lm_q2_score": 0.3886180267058489, "lm_q1q2_score": 0.19886229715274964}} {"text": "import analysis.inner_product_space.pi_L2\nimport topology.paracompact\n\n\n--OUTPUT 1\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume (A : set (euclidean_space ℝ (fin n))) (hA : is_open A) (hAcover : A ⊆ ⋃₀ A),\n have h1 : ∀ (x : ℝ^(fin n)), ∃ (m : ℕ), ∀ (y : ℝ^(fin n)), (∥ x ∥ ≤ m) → (∥ y ∥ ≤ m + 1) → (y ∈ A), from \n assume x : ℝ^(fin n),\n have h1_1 : ∃ (m : ℕ), ∀ (y : ℝ^(fin n)), (∥ x ∥ ≤ m) → (∥ y ∥ ≤ m + 1) → (y ∈ A), from\n begin\n have h1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) → (∥ x ∥ ≤ m + 1), from\n begin\n have h1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m), from\n begin\n have h1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1), from\n begin\n have h1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2), from\n begin\n have h1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3), from\n begin\n have h1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4), from\n begin\n have h1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5), from\n begin\n have h1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7) ∧ (∥ x ∥ ≤ m + 8), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7) ∧ (∥ x ∥ ≤ m + 8) ∧ (∥ x ∥ ≤ m + 9), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7) ∧ (∥ x ∥ ≤ m + 8) ∧ (∥ x ∥ ≤ m + 9) ∧ (∥ x ∥ ≤ m + 10), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7) ∧ (∥ x ∥ ≤ m + 8) ∧ (∥ x ∥ ≤ m + 9) ∧ (∥ x ∥ ≤ m + 10) ∧ (∥ x ∥ ≤ m + 11), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x ∥ ≤ m + 5) ∧ (∥ x ∥ ≤ m + 6) ∧ (∥ x ∥ ≤ m + 7) ∧ (∥ x ∥ ≤ m + 8) ∧ (∥ x ∥ ≤ m + 9) ∧ (∥ x ∥ ≤ m + 10) ∧ (∥ x ∥ ≤ m + 11) ∧ (∥ x ∥ ≤ m + 12), from\n begin\n have h1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1 : ∃ (m : ℕ), (∥ x ∥ ≤ m) ∧ (∥ x ∥ ≤ m + 1) ∧ (∥ x ∥ ≤ m + 2) ∧ (∥ x ∥ ≤ m + 3) ∧ (∥ x ∥ ≤ m + 4) ∧ (∥ x\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume A : set (euclidean_space ℝ (fin n)),\n assume hA : A.is_open,\n assume hA2 : A.is_cover,\n have hA3 : ∀ a : euclidean_space ℝ (fin n), ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume a : euclidean_space ℝ (fin n),\n have hA4 : A ≠ ∅, from by {\n assume hA5 : A = ∅,\n have hA6 : a ∉ A, from by {\n assume hA7 : a ∈ A,\n have hA8 : A = ∅, from by {\n assume hA9 : A ≠ ∅,\n have hA10 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA11 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA12 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA13 : a ∈ U),\n have hA14 : U ≠ ∅, from by {\n assume hA15 : U = ∅,\n have hA16 : a ∉ U, from by {\n assume hA17 : a ∈ U,\n have hA18 : U = ∅, from by {\n assume hA19 : U ≠ ∅,\n have hA20 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA21 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA22 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA23 : a ∈ U),\n have hA24 : U ≠ ∅, from by {\n assume hA25 : U = ∅,\n have hA26 : a ∉ U, from by {\n assume hA27 : a ∈ U,\n have hA28 : U = ∅, from by {\n assume hA29 : U ≠ ∅,\n have hA30 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA31 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA32 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA33 : a ∈ U),\n have hA34 : U ≠ ∅, from by {\n assume hA35 : U = ∅,\n have hA36 : a ∉ U, from by {\n assume hA37 : a ∈ U,\n have hA38 : U = ∅, from by {\n assume hA39 : U ≠ ∅,\n have hA40 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA41 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA42 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA43 : a ∈ U),\n have hA44 : U ≠ ∅, from by {\n assume hA45 : U = ∅,\n have hA46 : a ∉ U, from by {\n assume hA47 : a ∈ U,\n have hA48 : U = ∅, from by {\n assume hA49 : U ≠ ∅,\n have hA50 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA51 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA52 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA53 : a ∈ U),\n have hA54 : U ≠ ∅, from by {\n assume hA55 : U = ∅,\n have hA56 : a ∉ U, from by {\n assume hA57 : a ∈ U,\n have hA58 : U = ∅, from by {\n assume hA59 : U ≠ ∅,\n have hA60 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA61 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA62 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA63 : a ∈ U),\n have hA64 : U ≠ ∅, from by {\n assume hA65 : U = ∅,\n have hA66 : a ∉ U, from by {\n assume hA67 : a ∈ U,\n have hA68 : U = ∅, from by {\n assume hA69 : U ≠ ∅,\n have hA70 : ∃ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U, from by {\n assume hA71 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∉ U,\n have hA72 : ∀ (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A), a ∈ U → false, from by {\n assume (U : set (euclidean_space ℝ (fin n))) (hU : U ∈ A) (hA73 : a\nend --Needs more than 2000 tokens!\n\n--OUTPUT 3\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume (A : set (euclidean_space ℝ (fin n))) (hA : is_open A) (hAcover : ⋃₀ A = univ),\n have h1 : ∀ x : euclidean_space ℝ (fin n), ∃ m : ℕ, ∀ y : euclidean_space ℝ (fin n), (∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ y ∈ z) → dist x y ≤ m, from\n begin\n assume (x : euclidean_space ℝ (fin n)),\n have h1 : ∀ m : ℕ, ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n assume (m : ℕ),\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist x z ≤ m, from\n begin\n have h1 : ∃ z : euclidean_space ℝ (fin n), z ∈ A ∧ dist\nend --Needs more than 2000 tokens!\n\n--OUTPUT 4\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume (A : set (euclidean_space ℝ (fin n))) (hA : is_open A) (hAcover : A ⊃ univ),\n have h1 : ∀ (m : ℕ), is_compact (set.closure (ball (0 : ℝ^n) m)), from by {\n assume (m : ℕ),\n have h2 : is_open (set.compl (ball (0 : ℝ^n) m)), from by {\n rw set.compl_eq_univ_diff,\n apply is_open_ball,\n },\n have h3 : is_closed (ball (0 : ℝ^n) m), from by {\n apply is_closed_ball,\n },\n have h4 : is_compact (ball (0 : ℝ^n) m), from by {\n apply is_compact_of_is_closed_of_is_open h3 h2,\n },\n have h5 : (set.closure (ball (0 : ℝ^n) m)) ⊆ (ball (0 : ℝ^n) m), from by {\n apply set.closure_mono,\n apply set.subset_univ,\n },\n have h6 : (set.closure (ball (0 : ℝ^n) m)) ⊆ univ, from by {\n apply set.subset.trans h5,\n apply set.subset_univ,\n },\n have h7 : (set.closure (ball (0 : ℝ^n) m)) ∈ 𝒞 (ball (0 : ℝ^n) m), from by {\n apply set.mem_closure,\n apply set.mem_univ,\n },\n have h8 : (set.closure (ball (0 : ℝ^n) m)) ∈ 𝒞 univ, from by {\n apply set.mem_closure,\n apply set.mem_univ,\n },\n show is_compact (set.closure (ball (0 : ℝ^n) m)), from by {\n apply is_compact_of_is_closed_of_is_open h4 h2,\n },\n },\n have h2 : ∀ (m : ℕ), is_open (set.compl (set.closure (ball (0 : ℝ^n) m))), from by {\n assume (m : ℕ),\n have h3 : is_closed (set.closure (ball (0 : ℝ^n) m)), from by {\n apply is_closed_closure,\n },\n have h4 : is_open (set.compl (ball (0 : ℝ^n) m)), from by {\n rw set.compl_eq_univ_diff,\n apply is_open_ball,\n },\n have h5 : (set.compl (set.closure (ball (0 : ℝ^n) m))) ⊆ (set.compl (ball (0 : ℝ^n) m)), from by {\n apply set.compl_mono,\n },\n have h6 : (set.compl (set.closure (ball (0 : ℝ^n) m))) ⊆ univ, from by {\n apply set.subset.trans h5,\n apply set.subset_univ,\n },\n have h7 : (set.compl (set.closure (ball (0 : ℝ^n) m))) ∈ 𝒞 (set.compl (ball (0 : ℝ^n) m)), from by {\n apply set.mem_compl,\n apply set.mem_univ,\n },\n have h8 : (set.compl (set.closure (ball (0 : ℝ^n) m))) ∈ 𝒞 univ, from by {\n apply set.mem_compl,\n apply set.mem_univ,\n },\n show is_open (set.compl (set.closure (ball (0 : ℝ^n) m))), from by {\n apply is_open_of_is_closed_of_is_open h3 h4,\n },\n },\n have h3 : ∀ (m : ℕ), is_open (set.compl (ball (0 : ℝ^n) (m - 1))), from by {\n assume (m : ℕ),\n rw set.compl_eq_univ_diff,\n apply is_open_ball,\n },\n have h4 : ∀ (m : ℕ), ∃ (Cm : set (euclidean_space ℝ (fin n))), Cm ⊆ A ∧ Cm ⊆ (set.compl (ball (0 : ℝ^n) (m - 1))) ∧ Cm ⊆ (set.compl (set.closure (ball (0 : ℝ^n) m))) ∧ Cm ⊃ (set.closure (ball (0 : ℝ^n) m)), from by {\n assume (m : ℕ),\n have h5 : (set.closure (ball (0 : ℝ^n) m)) ⊆ univ, from by {\n apply set.subset_univ,\n },\n have h6 : (set.closure (ball (0 : ℝ^n) m)) ∈ 𝒞 univ, from by {\n apply set.mem_closure,\n apply set.mem_univ,\n },\n have h7 : (set.closure (ball (0 : ℝ^n) m)) ∈ 𝒞 (set.compl (ball (0 : ℝ^n) (m - 1))), from by {\n apply set.mem_closure,\n apply set.mem_compl,\n apply set.mem_univ,\n },\n have h8 : (set.closure (ball (0 : ℝ^n) m)) ∈ 𝒞 (set.compl (set.closure (ball (0 : ℝ^n) m))), from by {\n apply set.mem_closure,\n apply set.mem_compl,\n apply set.mem_univ,\n },\n have h9 : (set.closure (ball (0 : ℝ^n) m)) ⊆ A, from by {\n apply hAcover,\n },\n have h10 : (set.closure (ball (0 : ℝ^n) m)) ⊆ (set.compl (ball (0 : ℝ^n) (m - 1))), from by {\n apply set.subset.trans h9,\n apply set.subset_compl_iff.mpr,\n have h11 : (ball (0 : ℝ^n) m) ⊆ (ball (0 : ℝ^n) (m - 1)), from by {\n apply set.subset_ball,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.norm_eq_zero,\n rw real.\nend --Needs more than 2000 tokens!\n\n--OUTPUT 5\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume (U : set (euclidean_space ℝ (fin n))) (hU : is_open U) (hcover : ∀ x : euclidean_space ℝ (fin n), x ∈ U),\n have h1 : ∀ m : ℕ, ∃ (Cm : set (euclidean_space ℝ (fin n))), is_open Cm ∧ ∀ x : euclidean_space ℝ (fin n), x ∈ Cm → ∃ (A : set (euclidean_space ℝ (fin n))), x ∈ A ∧ A ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ A → y ∈ U ∧ ∀ z : euclidean_space ℝ (fin n), z ∈ A → ∃ (B : set (euclidean_space ℝ (fin n))), z ∈ B ∧ B ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y ∈ U ∧ ∀ y : euclidean_space ℝ (fin n), y ∈ B → y\nend --Needs more than 2000 tokens!\n\n--OUTPUT 6\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n assume A : set (euclidean_space ℝ (fin n)),\n assume hA : is_open A,\n assume hA2 : is_covering A,\n have h1 : ∀ (x : euclidean_space ℝ (fin n)), ∃ (m : ℕ), ∀ (y : euclidean_space ℝ (fin n)), dist x y < m → y ∈ A, from \n assume x : euclidean_space ℝ (fin n),\n have h2 : ∀ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A, from \n assume m : ℕ,\n have h3 : ∃ (y : euclidean_space ℝ (fin n)), dist x y < m, from \n by {exact exists_ball x m},\n have h4 : ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A, from \n by {exact classical.by_contradiction (hA2 (exists.elim h3 (assume y h5, h5.left)) x)},\n exact h4,\n have h5 : ∃ (m : ℕ), ∀ (y : euclidean_space ℝ (fin n)), dist x y < m → y ∈ A, from \n by {exact exists.intro 1 (assume y h6, h2 1)},\n exact h5,\n have h6 : ∀ (x : euclidean_space ℝ (fin n)), ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A, from \n assume x : euclidean_space ℝ (fin n),\n have h7 : ∃ (m : ℕ), ∀ (y : euclidean_space ℝ (fin n)), dist x y < m → y ∈ A, from h1 x,\n have h8 : ∃ (y : euclidean_space ℝ (fin n)), dist x y < (exists.elim h7 (assume m h9, m)), from \n by {exact exists_ball x (exists.elim h7 (assume m h9, m))},\n have h9 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A, from \n by {exact exists.intro (exists.elim h7 (assume m h10, m)) (exists.elim h8 (assume y h11, h11))},\n exact h9,\n have h10 : ∀ (x : euclidean_space ℝ (fin n)), ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A, from \n assume x : euclidean_space ℝ (fin n),\n have h11 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A, from h6 x,\n have h12 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A, from \n by {exact exists.intro (exists.elim h11 (assume m h13, m)) (exists.elim h11 (assume m h13, exists.elim h13 (assume y h14, exists.intro y (exists.intro (exists.elim h14 (assume h15 h16, h15)) (exists.elim h14 (assume h15 h16, h16))))))},\n exact h12,\n have h13 : ∀ (x : euclidean_space ℝ (fin n)), ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → ∃ (w : euclidean_space ℝ (fin n)), dist x w < m ∧ w ∈ A, from \n assume x : euclidean_space ℝ (fin n),\n have h14 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A, from h10 x,\n have h15 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → ∃ (w : euclidean_space ℝ (fin n)), dist x w < m ∧ w ∈ A, from \n by {exact exists.intro (exists.elim h14 (assume m h16, m)) (exists.elim h14 (assume m h16, exists.elim h16 (assume y h17, exists.intro y (exists.intro (exists.elim h17 (assume h18 h19, h18)) (exists.intro (exists.elim h17 (assume h18 h19, h19)) (exists.elim h17 (assume h18 h19, h1)))))))},\n exact h15,\n have h16 : ∀ (x : euclidean_space ℝ (fin n)), ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → ∃ (w : euclidean_space ℝ (fin n)), dist x w < m ∧ w ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → ∃ (w : euclidean_space ℝ (fin n)), dist x w < m ∧ w ∈ A, from \n assume x : euclidean_space ℝ (fin n),\n have h17 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → ∃ (w : euclidean_space ℝ (fin n)), dist x w < m ∧ w ∈ A, from h13 x,\n have h18 : ∃ (m : ℕ), ∃ (y : euclidean_space ℝ (fin n)), dist x y < m ∧ y ∈ A ∧ ∀ (z : euclidean_space ℝ (fin n)), dist x z < m → z ∈ A ∧ ∀ (z\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB},\n have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left,\n have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left},\n show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3},\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by rw sq\n ... = x*(x+y) + y*(x+y) : by rw add_mul\n ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring}\n ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring}\nend\n\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by {\n assume a b : G, use a⁻¹ * b, obviously, },\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by {\n assume a b : G, use b * a⁻¹, obviously, }, \n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from \n assume a : G, h1 a a,\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from\n assume a : G, h2 a a,\n\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G,\n exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a)))\n (mul_one a),\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G,\n exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), \n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {\n use (1 : G),\n have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {\n assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a),\n have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G),\n exists_unique.unique (h3 a) (hident a).right\n (classical.some_spec (exists_unique.exists (h3 a))), \n have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G),\n exists_unique.unique (h4 a) (hident a).left\n (classical.some_spec (exists_unique.exists (h4 a))),\n show e = (1 : G), from eq.trans (h9 e) (h6 _), \n },\n exact ⟨by obviously, h7⟩,\n }\nend\n\n/--`theorem`\n\\mathbb{R}^n is paracompact\n$\\mathbb{R}^n$ is paracompact for all $n$.\n`proof`\nLet $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$. We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$. First, we define a collection of pen balls. Let $B_0 = \\phi$, and for each $n \\in \\mathbb{N}$, let $B_m$ denote the ball of radius $m$\ncentered at 0. Given $m$, set $\\Bar{B_m}$ is compact in $\\mathbb{R}^n$ by the Heine-Borel theorem, so choose finitely many elements of $\\mathcal{A}$ that cover $\\Bar{B_m}$ and intersect each one with the open set $\\mathbb{R}^n \\setminus \\Bar{B_{m - 1}}$, and let $\\mathcal{C}_{m}$ denote this collection of open sets (each an open subset of an element of $\\mathcal{A}$). So $\\mathcal{C} = \\bigcup_{m = 0}^{\\infty} \\mathcal{C}_m$ is an open refinement of $\\mathcal{A}$. Note that $\\mathcal{C}$ covers $\\mathbb{R}^n$ since for any $x \\in \\mathbb{R}^n$, there is a smallest $m \\in \\mathbb{N}$ such that $x \\in \\Bar{B_{m}}$ (namely, some $m$ where $\\rVert x \\lVert \\leq m \\leq \\rVert x \\lVert + 1$), and so $x$ is an element of $\\mathcal{C}_m$. Now collection $\\mathcal{C}$ is locally finite since for given $x \\in \\mathbb{R}^n$, neighborhood $B_m$ intersects only finitely many elements of $\\mathcal{C}$, namely those elements in collection $\\mathcal{C}_1 \\cup \\mathcal{C}_2 \\cup \\cdots \\mathcal{C}_m$. So $\\mathcal{C}$ is a locally finite open refinement of $\\mathcal{A}$ that covers $\\mathbb{R}^n$, hence $\\mathbb{R}^n$ is paracompact.\n\nQED\n-/\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof-Natural-Language-Proof-Translation/Correct_statement-lean_proof-3_few_shot_temperature_0.4_max_tokens_2000_n_6/clean_files/Rn is paracompact.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5813030906443133, "lm_q2_score": 0.341582499438317, "lm_q1q2_score": 0.19856296263350307}} {"text": "import for_mathlib.category_theory.localization.derived_functor\nimport for_mathlib.category_theory.localization.triangulated\nimport for_mathlib.category_theory.triangulated.pretriangulated_misc\nimport for_mathlib.category_theory.triangulated.shift_triangle\nimport for_mathlib.category_theory.triangulated.triangulated\nimport for_mathlib.category_theory.preadditive_subcategory\nimport for_mathlib.category_theory.triangulated.coproducts\nimport for_mathlib.category_theory.limits.products\nimport for_mathlib.category_theory.triangulated.is_triangulated_subcategory\nimport category_theory.limits.full_subcategory\nimport data.int.order.units\n\nnoncomputable theory\n\nuniverses v₁ v₂ u₁ u₂\n\nopen_locale zero_object\n\nopen category_theory\n\nnamespace category_theory\n\nopen limits category preadditive category_theory\n\nnamespace functor\n\n@[simps]\ndef map_arrow_nat_trans_of_nat_trans {C : Type u₁} {D : Type u₂} [category.{v₁} C] [category.{v₂} D]\n {F G : C ⥤ D} (τ : F ⟶ G) : F.map_arrow ⟶ G.map_arrow :=\n{ app := λ f,\n { left := τ.app _,\n right := τ.app _, }, }\n\n@[simps]\ndef map_arrow_nat_iso_of_nat_iso {C : Type u₁} {D : Type u₂} [category.{v₁} C] [category.{v₂} D]\n {F G : C ⥤ D} (e : F ≅ G) : F.map_arrow ≅ G.map_arrow :=\n{ hom := map_arrow_nat_trans_of_nat_trans e.hom,\n inv := map_arrow_nat_trans_of_nat_trans e.inv, }\n\nend functor\n\nnamespace triangulated\n\nopen pretriangulated\n\nvariables (C : Type*) [category C] [has_zero_object C] [has_shift C ℤ]\n [preadditive C] [∀ (n : ℤ), functor.additive (shift_functor C n)]\n [pretriangulated C]\n\n/-structure subcategory :=\n(set : set C)\n(zero : (0 : C) ∈ set)\n(shift : ∀ (X : C) (n : ℤ) (hX : X ∈ set), (shift_functor C n).obj X ∈ set)\n(ext₂ : ∀ (T : triangle C) (hT : T ∈ dist_triang C) (h₁ : T.obj₁ ∈ set) (h₃ : T.obj₃ ∈ set), T.obj₂ ∈ set)-/\n\nvariable {C}\n\nnamespace subcategory\n\nvariables (S : set C) [is_triangulated_subcategory S]\n\ndef W : morphism_property C :=\nλ X Y f, ∃ (Z : C) (g : Y ⟶ Z) (h : Z ⟶ (shift_functor C (1 : ℤ)).obj X)\n (H : triangle.mk f g h ∈ dist_triang C), Z ∈ S\n\ndef W' : morphism_property C :=\nλ Y Z g, ∃ (X : C) (f : X ⟶ Y) (h : Z ⟶ X⟦(1 : ℤ)⟧) (H : triangle.mk f g h ∈ dist_triang C),\n X ∈ S\n\nvariable {S}\n\ndef W.mk {T : triangle C} (hT : T ∈ dist_triang C) (h : T.obj₃ ∈ S) :\n (W S) T.mor₁ :=\n⟨T.obj₃, T.mor₂, T.mor₃, (by { cases T, exact hT, }), h⟩\n\ndef W'.mk {T : triangle C} (hT : T ∈ dist_triang C) (h : T.obj₁ ∈ S) :\n (W' S) T.mor₂ :=\n⟨T.obj₁, T.mor₁, T.mor₃, (by { cases T, exact hT, }), h⟩\n\ndef W.triangle {X Y : C} (f : X ⟶ Y) (hf : (W S) f) : triangle C :=\ntriangle.mk f hf.some_spec.some hf.some_spec.some_spec.some\n\nlemma W.triangle_distinguished {X Y : C} (f : X ⟶ Y) (hf : (W S) f) :\n W.triangle f hf ∈ dist_triang C := hf.some_spec.some_spec.some_spec.some\n\nlemma W.triangle_obj₃_mem {X Y : C} (f : X ⟶ Y) (hf : (W S) f) :\n (W.triangle f hf).obj₃ ∈ S :=\nhf.some_spec.some_spec.some_spec.some_spec\n\nvariable (S)\n\nlemma W_eq_W' : W S = W' S :=\nbegin\n ext X Y f,\n split,\n { rintro ⟨Z, g, h, H, mem⟩,\n exact ⟨_, _, _, inv_rot_of_dist_triangle C _ H,\n is_triangulated_subcategory.shift _ _ mem⟩, },\n { rintro ⟨Z, g, h, H, mem⟩,\n refine ⟨_, _, _, rot_of_dist_triangle C _ H,\n is_triangulated_subcategory.shift _ _ mem⟩, },\nend\n\nvariable {S}\n\ndef W.mk' {T : triangle C} (hT : T ∈ dist_triang C) (h : T.obj₁ ∈ S) :\n (W S) T.mor₂ :=\nby simpa only [W_eq_W'] using W'.mk hT h\n\ninstance W_contains_identities : (W S).contains_identities :=\n⟨λ X, ⟨0, 0, 0, pretriangulated.contractible_distinguished X,\n is_triangulated_subcategory.zero S⟩⟩\n\nvariable (S)\n\nlemma W_stable_under_composition [is_triangulated C] : (W S).stable_under_composition :=\nλ X₁ X₂ X₃ u₁₂ u₂₃ h₁₂ h₂₃,\nbegin\n rcases h₁₂ with ⟨Z₁₂, v₁₂, w₁₂, H₁₂, mem₁₂⟩,\n rcases h₂₃ with ⟨Z₂₃, v₂₃, w₂₃, H₂₃, mem₂₃⟩,\n rcases pretriangulated.distinguished_cocone_triangle _ _ (u₁₂ ≫ u₂₃) with ⟨Z₁₃, v₁₃, w₁₃, H₁₃⟩,\n refine ⟨_, _, _, H₁₃, _⟩,\n exact is_triangulated_subcategory.ext₂ _\n (is_triangulated.octahedron_axiom rfl H₁₂ H₂₃ H₁₃).some.mem mem₁₂ mem₂₃,\nend\n\ninstance W_multiplicative [is_triangulated C] : (W S).multiplicative :=\n{ contains_identities := infer_instance,\n comp := W_stable_under_composition S, }\n\nlemma W_respects_iso : (W S).respects_iso :=\nbegin\n split,\n { rintro X' X Y e f ⟨Z, g, h, mem, mem'⟩,\n refine ⟨Z, g, h ≫ (shift_functor C 1).map e.inv, _, mem'⟩,\n refine pretriangulated.isomorphic_distinguished _ mem _ _,\n refine triangle.mk_iso _ _ e (iso.refl _) (iso.refl _) (by tidy) (by tidy) _,\n dsimp,\n simp only [assoc, ← functor.map_comp, e.inv_hom_id, functor.map_id, comp_id, id_comp], },\n { rintro X Y Y' e f ⟨Z, g, h, mem, mem'⟩,\n refine ⟨Z, e.inv ≫ g, h, _, mem'⟩,\n refine pretriangulated.isomorphic_distinguished _ mem _ _,\n refine triangle.mk_iso _ _ (iso.refl _) e.symm (iso.refl _) (by tidy) (by tidy) (by tidy), },\nend\n\ninstance [is_triangulated C] : left_calculus_of_fractions (W S) :=\n{ id := infer_instance,\n comp := W_stable_under_composition S,\n ex := λ X' X Y s hs u, begin\n obtain ⟨Z, f, g, H, mem⟩ := hs,\n obtain ⟨Y', s', f', mem'⟩ := pretriangulated.distinguished_cocone_triangle₂ (g ≫ u⟦1⟧'),\n obtain ⟨b, ⟨hb₁, hb₂⟩⟩ := pretriangulated.complete_distinguished_triangle_morphism₂ _ _\n H mem' u (𝟙 Z) (by { dsimp, rw id_comp, }),\n exact nonempty.intro ⟨Y', b, s', ⟨Z, f', g ≫ u⟦1⟧', mem', mem⟩, hb₁.symm⟩,\n end,\n ext := λ X' X Y f₁ f₂ s hs hf₁, begin\n let f := f₁ - f₂,\n have hf₂ : s ≫ f = 0 := by { dsimp [f], rw [comp_sub, hf₁, sub_self], },\n obtain ⟨Z, g, h, H, mem⟩ := hs,\n obtain ⟨q, hq⟩ := contravariant_yoneda_exact₂ _ H f hf₂,\n dsimp at q hq,\n obtain ⟨Y', r, t, mem'⟩ := pretriangulated.distinguished_cocone_triangle _ _ q,\n refine ⟨Y', r, _, _⟩,\n { exact ⟨_, _, _, rot_of_dist_triangle C _ mem',\n is_triangulated_subcategory.shift _ _ mem⟩, },\n { rw [← sub_eq_zero, ← sub_comp],\n change f ≫ r = 0,\n have eq := comp_dist_triangle_mor_zero₁₂ C _ mem',\n dsimp at eq,\n rw [hq, assoc, eq, comp_zero], },\n end, }\n\ninstance [is_triangulated C] : right_calculus_of_fractions (W S) :=\n{ id := infer_instance,\n comp := W_stable_under_composition S,\n ex := λ X Y Y' s hs u, begin\n obtain ⟨Z, f, g, H, mem⟩ := hs,\n obtain ⟨X', f', h', mem'⟩ := pretriangulated.distinguished_cocone_triangle₁ (u ≫ f),\n obtain ⟨a, ⟨ha₁, ha₂⟩⟩ := pretriangulated.complete_distinguished_triangle_morphism₁ _ _ mem' H u (𝟙 Z)\n (comp_id _),\n exact nonempty.intro ⟨X', a, f', ⟨Z, u ≫ f, h', mem', mem⟩, ha₁⟩,\n end,\n ext := λ Y Z Z' f₁ f₂ s hs hf₁, begin\n let f := f₁ - f₂,\n have hf₂ : f ≫ s = 0 := by { dsimp [f], rw [sub_comp, hf₁, sub_self], },\n rw W_eq_W' at hs,\n obtain ⟨X, g, h, H, mem⟩ := hs,\n obtain ⟨q, hq⟩ := covariant_yoneda_exact₂ _ H f hf₂,\n dsimp at q hq,\n obtain ⟨Y', r, t, mem'⟩ := pretriangulated.distinguished_cocone_triangle₁ q,\n refine ⟨Y', r, _, _⟩,\n { exact ⟨_, _, _, mem', mem⟩, },\n { rw [← sub_eq_zero, ← comp_sub],\n change r ≫ f = 0,\n have eq := comp_dist_triangle_mor_zero₁₂ C _ mem',\n dsimp at eq,\n rw [hq, ← assoc, eq, zero_comp], },\n end, }\n\nlemma mul_mem_W_iff {X Y : C} (f : X ⟶ Y) (n : ℤ) :\n (W S) ((↑((-1 : units ℤ) ^ n) : ℤ) • f) ↔ (W S) f :=\n(W_respects_iso S).arrow_mk_iso_iff\nbegin\n let e : X ≅ X :=\n { hom := (↑((-1 : units ℤ) ^ n) : ℤ) • 𝟙 X,\n inv := (↑((-1 : units ℤ) ^ n) : ℤ) • 𝟙 X,\n hom_inv_id' := by simp only [zsmul_comp, id_comp, smul_smul, int.units_coe_mul_self, one_smul],\n inv_hom_id' := by simp only [zsmul_comp, id_comp, smul_smul, int.units_coe_mul_self, one_smul], },\n refine arrow.iso_mk e (iso.refl _) _,\n dsimp,\n rw [comp_id, zsmul_comp, id_comp],\nend\n\ninstance W_compatible_with_shift : (W S).compatible_with_shift ℤ :=\n⟨begin\n have h : ∀ (X Y : C) (f : X ⟶ Y) (hf : (W S) f) (n : ℤ), (W S) (f⟦n⟧'),\n { rintro X Y f ⟨Z, g, h, H, mem⟩ n,\n rw ← mul_mem_W_iff S _ n,\n exact ⟨_, _, _, triangle.shift_distinguished C _ H n,\n is_triangulated_subcategory.shift Z n mem⟩, },\n intro n,\n ext X Y f,\n refine ⟨λ hf, _, λ hf, h _ _ f hf n⟩,\n exact ((W_respects_iso S).arrow_mk_iso_iff\n ((functor.map_arrow_nat_iso_of_nat_iso\n (shift_functor_comp_shift_functor_neg C n)).app (arrow.mk f))).mp (h _ _ _ hf (-n)),\nend⟩\n\nvariable {S}\n\nlemma W.shift {X₁ X₂ : C} {f : X₁ ⟶ X₂} (hf : (W S) f) (n : ℤ) :\n (W S) ((shift_functor C n).map f) :=\nby simpa only [(morphism_property.compatible_with_shift.iff (W S) f n)] using hf\n\nlemma W.unshift {X₁ X₂ : C} {f : X₁ ⟶ X₂} (n : ℤ) (hf : (W S) ((shift_functor C n).map f)) :\n (W S) f :=\nby simpa only [← (morphism_property.compatible_with_shift.iff (W S) f n)] using hf\n\nvariable (S)\n\nlemma binary_product_stable (X₁ X₂ : C) (hX₁ : X₁ ∈ S)\n (hX₂ : X₂ ∈ S) : (X₁ ⨯ X₂) ∈ S :=\nis_triangulated_subcategory.ext₂ _ (binary_product_triangle_distinguished X₁ X₂) hX₁ hX₂\n\nlemma pi_finite_stable {J : Type} [finite J]\n (X : J → C) (hX : ∀ j, X j ∈ S) : (∏ X) ∈ S :=\nbegin\n revert hX X,\n let P : Type → Prop := λ J,\n ∀ [hJ : finite J] (X : J → C) (hX : ∀ j, X j ∈ S),\n by { haveI := hJ, exact (∏ X) ∈ S, },\n suffices : P J,\n { exact this, },\n refine finite.induction_empty_option _ _ _ J,\n { intros J₁ J₂ e hJ₁, introI, intros X hX,\n haveI : finite J₁ := finite.of_equiv _ e.symm,\n haveI := has_product_of_equiv X e,\n exact set.respects_iso.condition S (product_iso_of_equiv X e)\n (hJ₁ (X ∘ e) (λ j₁, hX _)), },\n { introI, intros X hX,\n refine set.respects_iso.condition S _ (is_triangulated_subcategory.zero S),\n refine (limits.is_zero.iso_zero _).symm,\n haveI : mono (0 : ∏ X ⟶ 0),\n { constructor,\n intros Z f₁ f₂ hf,\n ext,\n discrete_cases,\n induction j, },\n exact limits.is_zero.of_mono (0 : ∏ X ⟶ 0) (is_zero_zero C), },\n { intro J,\n introI,\n intros hJ hJ' X hX,\n exact set.respects_iso.condition _ (product_iso_option X).symm\n (binary_product_stable S _ _ (hJ (λ j, X (some j)) (λ j, hX _)) (hX none)), },\nend\n\ninstance W_stable_under_finite_products : (W S).stable_under_finite_products :=\n⟨λ J, begin\n introI,\n refine morphism_property.stable_under_products_of_shape.mk _ _ (W_respects_iso S) _,\n intros X₁ X₂ f hf,\n let T := λ j, W.triangle _ (hf j),\n exact W.mk (triangle.product_distinghished T (λ j, W.triangle_distinguished _ (hf j)))\n (pi_finite_stable S (λ j, (T j).obj₃) (λ j, W.triangle_obj₃_mem _ (hf j))),\nend⟩\n\ninstance W_compatible_with_triangulation [is_triangulated C] :\n (W S).compatible_with_triangulation :=\n⟨λ T₁ T₃ hT₁ hT₃ a b ha hb comm, begin\n let T'₁ := triangle.mk T₁.mor₁ T₁.mor₂ T₁.mor₃,\n let T'₃ := triangle.mk T₃.mor₁ T₃.mor₂ T₃.mor₃,\n have mem₁ : T'₁ ∈ dist_triang C := by { cases T₁, exact hT₁, },\n have mem₃ : T'₃ ∈ dist_triang C := by { cases T₃, exact hT₃, },\n rcases pretriangulated.distinguished_cocone_triangle _ _ (T₁.mor₁ ≫ b) with ⟨Z₂, g₂, h₂, mem₂⟩,\n let T'₂ := triangle.mk (T₁.mor₁ ≫ b) g₂ h₂,\n change T'₂ ∈ dist_triang C at mem₂,\n rcases hb with ⟨Z₄, g₄, h₄, mem₄, mem₄'⟩,\n let H := (is_triangulated.octahedron_axiom rfl mem₁ mem₄ mem₂).some,\n let φ₁₂ : T'₁ ⟶ T'₂ := H.triangle_morphism₁,\n have hφ₁₂ : (W S) φ₁₂.hom₃ := W.mk H.mem mem₄',\n rcases ha with ⟨Z₅, g₅, h₅, mem₅, mem₅'⟩,\n let H' := (is_triangulated.octahedron_axiom comm.symm mem₅ mem₃ mem₂).some,\n let φ₂₃ : T'₂ ⟶ T'₃ := H'.triangle_morphism₂,\n have hφ₂₃ : (W S) φ₂₃.hom₃ := W.mk' H'.mem mem₅',\n refine ⟨(φ₁₂ ≫ φ₂₃).hom₃, W_stable_under_composition S _ _ hφ₁₂ hφ₂₃, ⟨_, _⟩⟩,\n { have h := (φ₁₂ ≫ φ₂₃).comm₂,\n dsimp at h,\n simpa only [comp_id] using h, },\n { have h := (φ₁₂ ≫ φ₂₃).comm₃,\n dsimp at h,\n simpa only [triangle_category_comp, triangle_morphism.comp_hom₃, id_comp] using h, },\nend⟩\n\n\ninstance W_is_saturated [saturated S] [is_triangulated C] : (W S).is_saturated :=\n⟨λ X₁ X₂ X₃ X₄ f₁₂ f₂₃ f₃₄ h₁₃ h₂₄, begin\n obtain ⟨Y₁₃, g₁₃, h₁₃, H₁₃, mem₁₃⟩ := h₁₃,\n obtain ⟨Y₂₄, g₂₄, h₂₄, H₂₄, mem₂₄⟩ := h₂₄,\n obtain ⟨Y₁₂, g₁₂, h₁₂, H₁₂⟩ := pretriangulated.distinguished_cocone_triangle _ _ f₁₂,\n obtain ⟨Y₂₃, g₂₃, h₂₃, H₂₃⟩ := pretriangulated.distinguished_cocone_triangle _ _ f₂₃,\n obtain ⟨Y₃₄, g₃₄, h₃₄, H₃₄⟩ := pretriangulated.distinguished_cocone_triangle _ _ f₃₄,\n refine ⟨Y₂₃, g₂₃, h₂₃, H₂₃, _⟩,\n have H₁₂₃ := (is_triangulated.octahedron_axiom rfl H₁₂ H₂₃ H₁₃).some,\n have H₂₃₄ := (is_triangulated.octahedron_axiom rfl H₂₃ H₃₄ H₂₄).some,\n let s := h₂₃ ≫ g₁₂⟦1⟧',\n let t := h₃₄ ≫ g₂₃⟦1⟧',\n have hs : (W S) s := W.mk (rot_of_dist_triangle _ _\n (rot_of_dist_triangle _ _ H₁₂₃.mem)) (set.is_stable_by_shift.condition 1 _ mem₁₃),\n have ht : (W S) t := W.mk (rot_of_dist_triangle _ _\n (rot_of_dist_triangle _ _ H₂₃₄.mem)) (set.is_stable_by_shift.condition 1 _ mem₂₄),\n let st := t ≫ s⟦1⟧',\n have hst : st = 0,\n { dsimp [st],\n have eq : g₂₃ ≫ h₂₃ = 0 := triangle.comp_zero₂₃ _ H₂₃,\n simp only [assoc, ← functor.map_comp, reassoc_of eq,\n zero_comp, functor.map_zero, comp_zero], },\n have hst' := W_stable_under_composition S t (s⟦1⟧') ht (hs.shift 1),\n obtain ⟨Z, g, h, H, mem⟩ := hst',\n let i := (triangle.mk (t ≫ (shift_functor C 1).map s) g h).mor₂,\n haveI : mono i := mono_of_dist_triang₂ _ H hst,\n haveI : is_split_mono i := is_split_mono_of_mono i,\n have mem₁₂ := saturated.condition i mem,\n dsimp [triangle.mk] at mem₁₂,\n rw [← is_triangulated_subcategory.shift_iff, ← is_triangulated_subcategory.shift_iff] at mem₁₂,\n exact is_triangulated_subcategory.ext₃ _ H₁₂₃.mem mem₁₂ mem₁₃,\nend⟩\n\nlemma category_closed_under_finite_products (J : Type) [finite J] :\n closed_under_limits_of_shape (discrete J) S :=\nλ F c hc mem, begin\n let X := λ j, F.obj ⟨j⟩,\n refine set.respects_iso.condition S _ (pi_finite_stable S X (λ j, mem ⟨j⟩)),\n exact\n { hom := hc.lift (cone.mk (∏ X) (discrete.nat_trans (by { rintro ⟨i⟩, exact pi.π _ i,}))),\n inv := pi.lift (λ i, c.π.app ⟨i⟩),\n hom_inv_id' := begin\n ext i,\n discrete_cases,\n simp only [assoc, limit.lift_π, fan.mk_π_app, is_limit.fac, discrete.nat_trans_app, id_comp],\n end,\n inv_hom_id' := hc.hom_ext begin\n rintro ⟨i⟩,\n simp only [assoc, is_limit.fac, discrete.nat_trans_app, limit.lift_π, fan.mk_π_app, id_comp],\n end, },\nend\n\n--instance category_has_finite_products : has_finite_products (full_subcategory S) :=\n--infer_instance\n\n--instance shift_functor_additive (n : ℤ) : (shift_functor (full_subcategory S) n).additive :=\n-- infer_instance\n\n--instance full_subcategory_inclusion_has_comm_shift :\n-- A.inclusion.has_comm_shift ℤ := infer_instance\n\n--instance category_inclusion_additive : A.inclusion.additive := infer_instance\n\n--instance : pretriangulated (full_subcategory S) := infer_instance\n\nlemma dist_triang_iff {X Y Z : full_subcategory S} (f : X ⟶ Y) (g : Y ⟶ Z) (h : Z ⟶ X⟦(1 : ℤ)⟧) :\n (triangle.mk f g h ∈ dist_triang (full_subcategory S)) ↔\n (@triangle.mk C _ _ _ _ _ f g h ∈ dist_triang C) :=\nbegin\n change (_ ∈ dist_triang C) ↔ _,\n let e : (full_subcategory_inclusion S).map_triangle.obj (triangle.mk f g h) ≅\n @triangle.mk C _ _ _ _ _ f g h,\n { refine triangle.mk_iso _ _ (iso.refl _) (iso.refl _) (iso.refl _) (by tidy) (by tidy) _,\n dsimp,\n erw [id_comp, functor.map_id, comp_id, comp_id], },\n split,\n { exact λ h, pretriangulated.isomorphic_distinguished _ h _ e.symm, },\n { exact λ h, pretriangulated.isomorphic_distinguished _ h _ e, },\nend\n\ninstance is_triangulated_full_subcategory [is_triangulated C] :\n is_triangulated (full_subcategory S) := infer_instance\n\n--instance inclusion_is_triangulated : (full_subcategory_inclusion S).is_triangulated :=\n--infer_instance\n\n\ndef Q [is_triangulated C] : C ⥤ (W S).localization :=\nbegin\n let F := localization_functor (W S).Q (W S),\n exact F,\nend\n\ninstance Q_has_comm_shift [is_triangulated C] : (Q S).has_comm_shift ℤ :=\n(infer_instance : (localization_functor (W S).Q (W S)).has_comm_shift ℤ)\n\ninstance Q_is_triangulated [is_triangulated C] : (Q S).is_triangulated :=\n(infer_instance : (localization_functor (W S).Q (W S)).is_triangulated)\n\n\n/- TODO :\n1) show a universal property for the triangulated functor `L` : if\n`G : D ⥤ E` is a functor which lifts a triangulated functor `F : C ⥤ E`\nthen `G` is a triangulated functor.\n -/\n\ninstance Q_to_functor_is_localization [is_triangulated C] : (Q S).is_localization (W S) :=\n(infer_instance : (W S).Q.is_localization (W S))\n\nlemma is_iso_map_iff [saturated S] [is_triangulated C] {D : Type*} [category D] (L : C ⥤ D)\n [L.is_localization (W S)] {X Y : C} (f : X ⟶ Y) : is_iso (L.map f) ↔ (W S) f :=\nlocalization.is_iso_map_iff_of_calculus_of_fractions L (W S) f\n\nlemma is_zero_obj_iff' [is_triangulated C] (X : C) :\n is_zero ((Q S).obj X) ↔ ∃ (Y : C) (i : X ⟶ Y) [is_split_mono i], Y ∈ S :=\nbegin\n rw limits.is_zero.iff_id_eq_zero,\n split,\n { intro h,\n have h' : (W S).Q.map (𝟙 X) = (W S).Q.map 0 :=\n by simpa only [functor.map_id, functor.map_zero] using h,\n rw right_calculus_of_fractions.L_map_eq_iff (W S).Q (W S) at h',\n obtain ⟨Z, s, hs, eq⟩ := h',\n rw [comp_id, comp_zero] at eq,\n obtain ⟨Y, i, p, H, mem⟩ := hs,\n haveI : mono i := mono_of_dist_triang₂ _ H eq,\n exact ⟨Y, i, is_split_mono_of_mono i, mem⟩, },\n { rintro ⟨Y, i, hi, mem⟩,\n haveI : is_iso ((W S).Q.map (0 : Y ⟶ 0)) := localization.inverts (W S).Q (W S) _\n (W.mk' (contractible_distinguished Y) mem),\n rw [← cancel_mono ((W S).Q.map i), id_comp, zero_comp,\n ← cancel_mono ((W S).Q.map (0 : Y ⟶ 0)), functor.map_zero, comp_zero, comp_zero], },\nend\n\nlemma is_zero_obj_iff [saturated S] [is_triangulated C] (X : C) :\n is_zero ((Q S).obj X) ↔ X ∈ S :=\nbegin\n rw is_zero_obj_iff',\n split,\n { intro h,\n obtain ⟨Y, i, hi, mem⟩ := h,\n haveI := hi,\n exact saturated.condition i mem, },\n { exact λ h, ⟨X, 𝟙 X, infer_instance, h⟩, },\nend\n\nlemma left_orthogonal_comp_W_bijective (X : C) (hX : X ∈ left_orthogonal S)\n {Y Z : C} (w : Y ⟶ Z) (hw : (W S) w) :\n function.bijective (λ (f : X ⟶ Y), f ≫ w) :=\nbegin\n rw W_eq_W' at hw,\n obtain ⟨U, f, g, H, mem⟩ := hw,\n split,\n { intros y₁ y₂ hy,\n let y := y₁ - y₂,\n suffices : y = 0,\n { rw ← sub_eq_zero,\n exact this, },\n dsimp at hy,\n obtain ⟨u, hu⟩ := covariant_yoneda_exact₂ _ H y\n (by { dsimp [y], rw [sub_comp, hy, sub_self], }),\n rw [hu, hX u mem, zero_comp], },\n { intro z,\n obtain ⟨y, hy⟩ := covariant_yoneda_exact₃ _ H z\n (hX _ (is_triangulated_subcategory.shift _ _ mem)),\n exact ⟨y, hy.symm⟩, },\nend\n\nlemma left_orthogonal_bijective_L_map [is_triangulated C] {D : Type*} [category D]\n (L : C ⥤ D) [L.is_localization (W S)] (X Y : C) (hX : X ∈ left_orthogonal S) :\n function.bijective (λ (f : X ⟶ Y), L.map f) :=\nbegin\n split,\n { intros f₁ f₂ hf,\n dsimp at hf,\n rw left_calculus_of_fractions.L_map_eq_iff L (W S) at hf,\n rcases hf with ⟨Z, s, hs, eq⟩,\n exact (left_orthogonal_comp_W_bijective S _ hX s hs).1 eq, },\n { intro g,\n obtain ⟨z, hz⟩ := left_calculus_of_fractions.L_map_fac L (W S) g,\n dsimp [left_calculus_of_fractions.map_roof] at hz,\n obtain ⟨f, hf⟩ := (left_orthogonal_comp_W_bijective S _ hX z.s z.hs).2 z.f,\n refine ⟨f, _⟩,\n dsimp at hf ⊢,\n rw [hz, ← hf, L.map_comp, assoc, is_iso.hom_inv_id, comp_id], },\nend\n\nlemma left_orthogonal_bijective_Q_map [is_triangulated C]\n (X Y : C) (hX : X ∈ left_orthogonal S) :\n function.bijective (λ (f : X ⟶ Y), (Q S).map f) :=\nleft_orthogonal_bijective_L_map S (Q S) _ _ hX\n\nlemma right_orthogonal_comp_W_bijective (Z : C) (hZ : Z ∈ right_orthogonal S)\n {X Y : C} (w : X ⟶ Y) (hw : (W S) w) :\n function.bijective (λ (f : Y ⟶ Z), w ≫ f) :=\nbegin\n split,\n { intros y₁ y₂ hy,\n let y := y₁ - y₂,\n suffices : y = 0,\n { rw ← sub_eq_zero,\n exact this, },\n dsimp at hy,\n obtain ⟨U, f, g, H, mem⟩ := hw,\n obtain ⟨u, hu⟩ := contravariant_yoneda_exact₂ _ H y\n (by { dsimp [y], rw [comp_sub, hy, sub_self], }),\n rw [hu, hZ u mem, comp_zero], },\n { intro z,\n rw W_eq_W' at hw,\n obtain ⟨U, f, g, H, mem⟩ := hw,\n obtain ⟨y, hy⟩ := contravariant_yoneda_exact₂ _ H z (hZ _ mem),\n exact ⟨y, hy.symm⟩, },\nend\n\nlemma right_orthogonal_bijective_L_map [is_triangulated C] {D : Type*} [category D]\n (L : C ⥤ D) [L.is_localization (W S)] (X Y : C) (hY : Y ∈ right_orthogonal S) :\n function.bijective (λ (f : X ⟶ Y), L.map f) :=\nbegin\n split,\n { intros f₁ f₂ hf,\n dsimp at hf,\n rw right_calculus_of_fractions.L_map_eq_iff L (W S) at hf,\n rcases hf with ⟨Z, s, hs, eq⟩,\n exact (right_orthogonal_comp_W_bijective S _ hY s hs).1 eq, },\n { intro g,\n obtain ⟨z, hz⟩ := right_calculus_of_fractions.L_map_fac L (W S) g,\n dsimp [right_calculus_of_fractions.map_roof] at hz,\n obtain ⟨f, hf⟩ := (right_orthogonal_comp_W_bijective S _ hY z.s z.hs).2 z.f,\n refine ⟨f, _⟩,\n dsimp at hf ⊢,\n rw [hz, ← hf, L.map_comp, is_iso.inv_hom_id_assoc], },\nend\n\nlemma right_orthogonal_bijective_Q_map\n [is_triangulated C] (X Y : C) (hY : Y ∈ right_orthogonal S) :\n function.bijective (λ (f : X ⟶ Y), (Q S).map f) :=\nright_orthogonal_bijective_L_map S (Q S) _ _ hY\n\nend subcategory\n\nend triangulated\n\nend category_theory\n", "meta": {"author": "joelriou", "repo": "homotopical_algebra", "sha": "697f49d6744b09c5ef463cfd3e35932bdf2c78a3", "save_path": "github-repos/lean/joelriou-homotopical_algebra", "path": "github-repos/lean/joelriou-homotopical_algebra/homotopical_algebra-697f49d6744b09c5ef463cfd3e35932bdf2c78a3/src/for_mathlib/category_theory/localization/triangulated_subcategory.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5156199157230156, "lm_q2_score": 0.3849121444839335, "lm_q1q2_score": 0.198468367499571}} {"text": "import breen_deligne.apply_Pow\n\nnoncomputable theory\n\nuniverses v\n\nnamespace breen_deligne\n\nopen category_theory category_theory.category category_theory.limits universal_map\n category_theory.preadditive\n\nvariables {A₁ A₂ : Type*} [category.{v} A₁] [category.{v} A₂]\n [preadditive A₁] [preadditive A₂] [has_finite_biproducts A₁] [has_finite_biproducts A₂]\n (BD : data)\n (F₁ : A₁ ⥤ A₁) (F₂ : A₂ ⥤ A₂) {G G' : A₁ ⥤ A₂} [functor.additive G] [functor.additive G']\n (τ : G ⟶ G')\n (e : F₁ ⋙ G ≅ G ⋙ F₂) (e' : F₁ ⋙ G' ≅ G' ⋙ F₂)\n\nlemma eval_Pow_functor_nat_trans_compatibility\n (h : e.hom ≫ whisker_right τ F₂ = whisker_left F₁ τ ≫ e'.hom) (M : A₁) (n : FreeMat) :\n τ.app (((eval_Pow_functor F₁).obj n).obj M) ≫ e'.hom.app _ ≫\n F₂.map ((apply_Pow G' n).hom.app M) =\n e.hom.app _ ≫ F₂.map ((apply_Pow G n).hom.app M) ≫\n ((eval_Pow_functor F₂).obj n).map (τ.app M) :=\nbegin\n dsimp only [eval_Pow_functor],\n have h₁ := nat_trans.congr_app h ((Pow n).obj M),\n simp only [nat_trans.comp_app, whisker_right_app, whisker_left] at h₁,\n slice_lhs 1 2 { erw ← h₁, },\n simp only [category.assoc],\n erw [← F₂.map_comp, ← F₂.map_comp],\n congr' 2,\n apply apply_Pow_naturality,\nend\n\nend breen_deligne\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/breen_deligne/eval_Pow_functor_nat_trans_compatibility.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.523420348936324, "lm_q2_score": 0.3775406687981454, "lm_q1q2_score": 0.1976124685999784}} {"text": "import pseudo_normed_group.CLC\n/-!\n\n# V-hat((M_c)^n)^{T⁻¹}\n\nThis file defines a fundamental construction defined just above Definition 9.3\nin `analytic.pdf`: the subspac of V-hat(M_c^n) where the two actions of T⁻¹ coincide.\n\n## Main definition\n\nHere `M` is a profinitely filtered pseudo-normed group with `T⁻¹` scaling things by `r'`,\n`V` is a seminormed group with `T⁻¹` scaling norms by `r`, `c` is a real (a filtration coefficient)\nand `n` is a natural.\n\n- `CLCFPTinv r V r' c n M`: the seminormed group defined as the subgroup of `V-hat(M_c^n)` where\n the two actions of `T⁻¹` (one coming from the action on M, the other coming from the\n action on V) coincide.\n\n-/\nopen_locale classical nnreal\nnoncomputable theory\nlocal attribute [instance] type_pow\n\nnamespace category_theory\n\ntheorem comm_sq₂ {C} [category C] {A₁ A₂ A₃ B₁ B₂ B₃ : C}\n {f₁ : A₁ ⟶ B₁} {f₂ : A₂ ⟶ B₂} {f₃ : A₃ ⟶ B₃}\n {a : A₁ ⟶ A₂} {a' : A₂ ⟶ A₃} {b : B₁ ⟶ B₂} {b' : B₂ ⟶ B₃}\n (h₁ : a ≫ f₂ = f₁ ≫ b) (h₂ : a' ≫ f₃ = f₂ ≫ b') : (a ≫ a') ≫ f₃ = f₁ ≫ b ≫ b' :=\nby rw [category.assoc, h₂, ← category.assoc, h₁, ← category.assoc]\n\nend category_theory\n\nopen SemiNormedGroup opposite Profinite pseudo_normed_group category_theory breen_deligne\nopen profinitely_filtered_pseudo_normed_group category_theory.limits\nopen normed_group_hom\n\nnamespace SemiNormedGroup\n\ndef equalizer {V W : SemiNormedGroup} (f g : V ⟶ W) := of (f.equalizer g)\n\nnamespace equalizer\n\ndef ι {V W : SemiNormedGroup} (f g : V ⟶ W) :\n equalizer f g ⟶ V :=\nnormed_group_hom.equalizer.ι _ _\n\n@[reassoc] lemma condition {V W : SemiNormedGroup} (f g : V ⟶ W) :\n ι f g ≫ f = ι f g ≫ g :=\nnormed_group_hom.equalizer.comp_ι_eq _ _\n\nlemma ι_range {V W : SemiNormedGroup} (f g : V ⟶ W) :\n (ι f g).range = (f - g).ker :=\nbegin\n ext, rw [normed_group_hom.mem_range, normed_group_hom.mem_ker],\n split,\n { rintro ⟨x, rfl⟩, rw [normed_group_hom.sub_apply], exact x.2 },\n { intro h, refine ⟨⟨x, h⟩, rfl⟩, }\nend\n\nlemma ι_range' {V W : SemiNormedGroup} (f g : V ⟶ W) :\n (ι f g).range = (g - f).ker :=\nbegin\n rw ι_range, ext x,\n simp only [normed_group_hom.mem_ker, normed_group_hom.sub_apply, sub_eq_zero],\n rw eq_comm\nend\n\ndef map {V₁ V₂ W₁ W₂ : SemiNormedGroup} {f₁ f₂ g₁ g₂} (φ : V₁ ⟶ V₂) (ψ : W₁ ⟶ W₂)\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ) :\n equalizer f₁ g₁ ⟶ equalizer f₂ g₂ :=\nnormed_group_hom.equalizer.map _ _ hf.symm hg.symm\n\nlemma map_comp_ι {V₁ V₂ W₁ W₂ : SemiNormedGroup} {f₁ f₂ g₁ g₂} (φ : V₁ ⟶ V₂) (ψ : W₁ ⟶ W₂)\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ) :\n map φ ψ hf hg ≫ ι _ _ = ι _ _ ≫ φ :=\nrfl\n\ntheorem map_congr\n {V₁ V₂ W₁ W₂ : SemiNormedGroup} {f₁ f₂ g₁ g₂} {φ : V₁ ⟶ V₂} {ψ : W₁ ⟶ W₂}\n {V₁' V₂' W₁' W₂' : SemiNormedGroup} {f₁' f₂' g₁' g₂'} {φ' : V₁' ⟶ V₂'} {ψ' : W₁' ⟶ W₂'}\n {hf : φ ≫ f₂ = f₁ ≫ ψ} {hg : φ ≫ g₂ = g₁ ≫ ψ}\n {hf' : φ' ≫ f₂' = f₁' ≫ ψ'} {hg' : φ' ≫ g₂' = g₁' ≫ ψ'}\n (Hφ : arrow.mk φ = arrow.mk φ') (Hψ : arrow.mk ψ = arrow.mk ψ')\n (Hf₁ : arrow.mk f₁ = arrow.mk f₁') (Hf₂ : arrow.mk f₂ = arrow.mk f₂')\n (Hg₁ : arrow.mk g₁ = arrow.mk g₁') (Hg₂ : arrow.mk g₂ = arrow.mk g₂') :\n arrow.mk (map φ ψ hf hg) = arrow.mk (map φ' ψ' hf' hg') :=\nby { cases Hφ, cases Hψ, cases Hf₁, cases Hf₂, cases Hg₁, cases Hg₂, refl }\n\nlemma map_comp_map {V₁ V₂ V₃ W₁ W₂ W₃ : SemiNormedGroup} {f₁ f₂ f₃ g₁ g₂ g₃}\n {φ : V₁ ⟶ V₂} {ψ : W₁ ⟶ W₂} {φ' : V₂ ⟶ V₃} {ψ' : W₂ ⟶ W₃}\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ)\n (hf' : φ' ≫ f₃ = f₂ ≫ ψ') (hg' : φ' ≫ g₃ = g₂ ≫ ψ') :\n map φ ψ hf hg ≫ map φ' ψ' hf' hg' =\n map (φ ≫ φ') (ψ ≫ ψ') (comm_sq₂ hf hf') (comm_sq₂ hg hg') :=\nby { ext, refl }\n\nlemma map_id {J} [category J] {V W : SemiNormedGroup} (f g : V ⟶ W) :\n map (𝟙 V) (𝟙 W) (show 𝟙 V ≫ f = f ≫ 𝟙 W, by simp) (show 𝟙 V ≫ g = g ≫ 𝟙 W, by simp) = 𝟙 _ :=\nby { ext, refl }\n\nlemma norm_map_le {V₁ V₂ W₁ W₂ : SemiNormedGroup} {f₁ f₂ g₁ g₂} {φ : V₁ ⟶ V₂} {ψ : W₁ ⟶ W₂}\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ) (C : ℝ) (hφ : ∥ι f₁ g₁ ≫ φ∥ ≤ C) :\n ∥map φ ψ hf hg∥ ≤ C :=\nnormed_group_hom.equalizer.norm_map_le _ _ C hφ\n\n@[simps obj map]\nprotected def F {J} [category J] {V W : J ⥤ SemiNormedGroup} (f g : V ⟶ W) : J ⥤ SemiNormedGroup :=\n{ obj := λ X, of ((f.app X).equalizer (g.app X)),\n map := λ X Y φ, equalizer.map (V.map φ) (W.map φ) (f.naturality _) (g.naturality _),\n map_id' := λ X, by simp only [category_theory.functor.map_id]; exact normed_group_hom.equalizer.map_id,\n map_comp' := λ X Y Z φ ψ, begin\n simp only [functor.map_comp],\n exact (map_comp_map _ _ _ _).symm\n end }\n\n@[simps]\ndef map_nat {J} [category J] {V₁ V₂ W₁ W₂ : J ⥤ SemiNormedGroup}\n {f₁ f₂ g₁ g₂} (φ : V₁ ⟶ V₂) (ψ : W₁ ⟶ W₂)\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ) :\n equalizer.F f₁ g₁ ⟶ equalizer.F f₂ g₂ :=\n{ app := λ X, equalizer.map (φ.app X) (ψ.app X)\n (by rw [← nat_trans.comp_app, ← nat_trans.comp_app, hf])\n (by rw [← nat_trans.comp_app, ← nat_trans.comp_app, hg]),\n naturality' := λ X Y α, by simp only [equalizer.F_map, map_comp_map, nat_trans.naturality] }\n\nlemma map_nat_comp_map_nat {J} [category J] {V₁ V₂ V₃ W₁ W₂ W₃ : J ⥤ SemiNormedGroup}\n {f₁ f₂ f₃ g₁ g₂ g₃} {φ : V₁ ⟶ V₂} {ψ : W₁ ⟶ W₂} {φ' : V₂ ⟶ V₃} {ψ' : W₂ ⟶ W₃}\n (hf : φ ≫ f₂ = f₁ ≫ ψ) (hg : φ ≫ g₂ = g₁ ≫ ψ)\n (hf' : φ' ≫ f₃ = f₂ ≫ ψ') (hg' : φ' ≫ g₃ = g₂ ≫ ψ') :\n map_nat φ ψ hf hg ≫ map_nat φ' ψ' hf' hg' =\n map_nat (φ ≫ φ') (ψ ≫ ψ') (comm_sq₂ hf hf') (comm_sq₂ hg hg') :=\nby { ext, refl }\n\nlemma map_nat_id {J} [category J] {V W : J ⥤ SemiNormedGroup} (f g : V ⟶ W) :\n map_nat (𝟙 V) (𝟙 W) (show 𝟙 V ≫ f = f ≫ 𝟙 W, by simp) (show 𝟙 V ≫ g = g ≫ 𝟙 W, by simp) = 𝟙 _ :=\nby { ext, refl }\n\nend equalizer\nend SemiNormedGroup\n\nuniverse variable u\nvariables (r : ℝ≥0) (V : SemiNormedGroup) [normed_with_aut r V] [fact (0 < r)]\nvariables (r' : ℝ≥0) [fact (0 < r')] [fact (r' ≤ 1)]\nvariables (M M₁ M₂ M₃ : ProFiltPseuNormGrpWithTinv.{u} r')\nvariables (c c₁ c₂ c₃ c₄ c₅ c₆ c₇ c₈ : ℝ≥0) (l m n : ℕ)\nvariables (f : M₁ ⟶ M₂) (g : M₂ ⟶ M₃)\n\ndef CLCTinv (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : Profiniteᵒᵖ} (f g : A ⟶ B) :\n SemiNormedGroup :=\nSemiNormedGroup.of $ normed_group_hom.equalizer\n ((CLC V).map f)\n ((CLC V).map g ≫ (CLC.T_inv r V).app B)\n\nnamespace CLCTinv\n\ndef ι (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : Profiniteᵒᵖ} (f g : A ⟶ B) :\n CLCTinv r V f g ⟶ (CLC V).obj A :=\nSemiNormedGroup.equalizer.ι _ _\n\nlemma ι_range (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : Profiniteᵒᵖ} (f g : A ⟶ B) :\n (ι r V f g).range =\n normed_group_hom.ker ((CLC V).map f - ((CLC V).map g ≫ (CLC.T_inv r V).app B)) :=\nSemiNormedGroup.equalizer.ι_range _ _\n\nlemma ι_range' (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : Profiniteᵒᵖ} (f g : A ⟶ B) :\n (ι r V f g).range =\n normed_group_hom.ker (((CLC V).map g ≫ (CLC.T_inv r V).app B) - (CLC V).map f) :=\nSemiNormedGroup.equalizer.ι_range' _ _\n\ndef map {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ : ϕ ≫ f₂ = f₁ ≫ ψ) (h₂ : ϕ ≫ g₂ = g₁ ≫ ψ) :\n CLCTinv r V f₁ g₁ ⟶ CLCTinv r V f₂ g₂ :=\nSemiNormedGroup.equalizer.map ((CLC V).map ϕ) ((CLC V).map ψ)\n (by rw [← functor.map_comp, ← functor.map_comp, h₁]) $\nby rw [← category.assoc, ← functor.map_comp, h₂, functor.map_comp,\n category.assoc, (CLC.T_inv _ _).naturality, category.assoc]\n\nlemma map_comp_ι {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ : ϕ ≫ f₂ = f₁ ≫ ψ) (h₂ : ϕ ≫ g₂ = g₁ ≫ ψ) :\n map r V f₁ g₁ f₂ g₂ ϕ ψ h₁ h₂ ≫ ι r V _ _ = ι _ _ _ _ ≫ (CLC V).map ϕ :=\nnormed_group_hom.equalizer.ι_comp_map _ _\n\nlemma map_norm_noninc {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ h₂) :\n (CLCTinv.map r V f₁ g₁ f₂ g₂ ϕ ψ h₁ h₂).norm_noninc :=\nequalizer.map_norm_noninc _ _ $ CLC.map_norm_noninc _ _\n\nlemma norm_map_le {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ h₂) (C : ℝ≥0)\n (H : ∥SemiNormedGroup.equalizer.ι\n ((CLC V).map f₁)\n ((CLC V).map g₁ ≫ (CLC.T_inv r V).app B₁) ≫\n (CLC V).map ϕ∥ ≤ C) :\n ∥CLCTinv.map r V f₁ g₁ f₂ g₂ ϕ ψ h₁ h₂∥ ≤ C :=\nSemiNormedGroup.equalizer.norm_map_le _ _ C H\n\n@[simp] lemma map_id {A B : Profiniteᵒᵖ} (f g : A ⟶ B) :\n map r V f g f g (𝟙 A) (𝟙 B) rfl rfl = 𝟙 _ :=\nbegin\n simp only [map, SemiNormedGroup.equalizer.map, category_theory.functor.map_id],\n exact equalizer.map_id,\nend\n\nlemma map_comp {A₁ A₂ A₃ B₁ B₂ B₃ : Profiniteᵒᵖ}\n {f₁ g₁ : A₁ ⟶ B₁} {f₂ g₂ : A₂ ⟶ B₂} {f₃ g₃ : A₃ ⟶ B₃}\n (ϕ₁ : A₁ ⟶ A₂) (ϕ₂ : A₂ ⟶ A₃) (ψ₁ : B₁ ⟶ B₂) (ψ₂ : B₂ ⟶ B₃)\n (h1 h2 h3 h4 h5 h6) :\n CLCTinv.map r V f₁ g₁ f₃ g₃ (ϕ₁ ≫ ϕ₂) (ψ₁ ≫ ψ₂) h1 h2 =\n CLCTinv.map r V f₁ g₁ f₂ g₂ ϕ₁ ψ₁ h3 h4 ≫\n CLCTinv.map r V f₂ g₂ f₃ g₃ ϕ₂ ψ₂ h5 h6 :=\nbegin\n simp only [map, SemiNormedGroup.equalizer.map, category_theory.functor.map_comp],\n exact (equalizer.map_comp_map _ _ _ _).symm,\nend\n\nlemma map_comp_map {A₁ A₂ A₃ B₁ B₂ B₃ : Profiniteᵒᵖ}\n {f₁ g₁ : A₁ ⟶ B₁} {f₂ g₂ : A₂ ⟶ B₂} {f₃ g₃ : A₃ ⟶ B₃}\n (ϕ₁ : A₁ ⟶ A₂) (ϕ₂ : A₂ ⟶ A₃) (ψ₁ : B₁ ⟶ B₂) (ψ₂ : B₂ ⟶ B₃)\n (h₁ h₂ h₃ h₄) :\n CLCTinv.map r V f₁ g₁ f₂ g₂ ϕ₁ ψ₁ h₁ h₂ ≫\n CLCTinv.map r V f₂ g₂ f₃ g₃ ϕ₂ ψ₂ h₃ h₄ =\n CLCTinv.map r V f₁ g₁ f₃ g₃ (ϕ₁ ≫ ϕ₂) (ψ₁ ≫ ψ₂) (comm_sq₂ h₁ h₃) (comm_sq₂ h₂ h₄) :=\n(map_comp _ _ _ _ _ _ _ _ _ _ _ _).symm\n\n@[simps]\ndef map_iso {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ≅ A₂) (ψ : B₁ ≅ B₂) (h₁ : ϕ.hom ≫ f₂ = f₁ ≫ ψ.hom) (h₂ : ϕ.hom ≫ g₂ = g₁ ≫ ψ.hom) :\n CLCTinv r V f₁ g₁ ≅ CLCTinv r V f₂ g₂ :=\n{ hom := map r V f₁ g₁ f₂ g₂ ϕ.hom ψ.hom h₁ h₂,\n inv := map r V f₂ g₂ f₁ g₁ ϕ.inv ψ.inv\n (by rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, h₁])\n (by rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, h₂]),\n hom_inv_id' := by { simp only [map_comp_map, iso.hom_inv_id], apply map_id },\n inv_hom_id' := by { simp only [map_comp_map, iso.inv_hom_id], apply map_id } }\n\nlemma map_iso_isometry {A₁ B₁ A₂ B₂ : Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ≅ A₂) (ψ : B₁ ≅ B₂) (h₁ : ϕ.hom ≫ f₂ = f₁ ≫ ψ.hom) (h₂ : ϕ.hom ≫ g₂ = g₁ ≫ ψ.hom) :\n isometry (map_iso r V f₁ g₁ f₂ g₂ ϕ ψ h₁ h₂).hom :=\nbegin\n apply SemiNormedGroup.iso_isometry_of_norm_noninc;\n apply map_norm_noninc\nend\n\n@[simps]\nprotected def F {J} [category J] (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : J ⥤ Profiniteᵒᵖ} (f g : A ⟶ B) :\n J ⥤ SemiNormedGroup :=\n{ obj := λ X, CLCTinv r V (f.app X) (g.app X),\n map := λ X Y φ, map _ _ _ _ _ _ (A.map φ) (B.map φ) (f.naturality _) (g.naturality _),\n map_id' := λ X, by simp only [category_theory.functor.map_id]; apply map_id,\n map_comp' := λ X Y Z φ ψ, by simp only [functor.map_comp]; apply map_comp }\n\ntheorem F_def {J} [category J] (r : ℝ≥0) (V : SemiNormedGroup)\n [normed_with_aut r V] [fact (0 < r)] {A B : J ⥤ Profiniteᵒᵖ} (f g : A ⟶ B) :\n CLCTinv.F r V f g = SemiNormedGroup.equalizer.F\n (whisker_right f (CLC V))\n (whisker_right g (CLC V) ≫ whisker_left B (CLC.T_inv r V)) := rfl\n\n@[simps]\ndef map_nat {J} [category J] {A₁ B₁ A₂ B₂ : J ⥤ Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ : ϕ ≫ f₂ = f₁ ≫ ψ) (h₂ : ϕ ≫ g₂ = g₁ ≫ ψ) :\n CLCTinv.F r V f₁ g₁ ⟶ CLCTinv.F r V f₂ g₂ :=\n{ app := λ X, map _ _ _ _ _ _ (ϕ.app X) (ψ.app X)\n (by rw [← nat_trans.comp_app, h₁, nat_trans.comp_app])\n (by rw [← nat_trans.comp_app, h₂, nat_trans.comp_app]),\n naturality' := λ X Y α, by simp only [CLCTinv.F_map, map_comp_map, ϕ.naturality, ψ.naturality] }\n\ntheorem map_nat_def {J} [category J] {A₁ B₁ A₂ B₂ : J ⥤ Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ⟶ A₂) (ψ : B₁ ⟶ B₂) (h₁ : ϕ ≫ f₂ = f₁ ≫ ψ) (h₂ : ϕ ≫ g₂ = g₁ ≫ ψ) :\n map_nat r V f₁ g₁ f₂ g₂ ϕ ψ h₁ h₂ = begin\n dsimp only [F_def],\n refine SemiNormedGroup.equalizer.map_nat\n (whisker_right ϕ (CLC V))\n (whisker_right ψ (CLC V))\n (by rw [← whisker_right_comp, ← whisker_right_comp, h₁])\n (comm_sq₂ _ _).symm,\n { exact whisker_right ψ _ },\n { rw [← whisker_right_comp, ← whisker_right_comp, h₂] },\n ext x : 2,\n simp only [nat_trans.comp_app, whisker_left_app, whisker_right_app,\n (CLC.T_inv _ _).naturality],\n end := rfl\n.\n\n-- @[simps]\ndef map_nat_iso {J} [category J] {A₁ B₁ A₂ B₂ : J ⥤ Profiniteᵒᵖ} (f₁ g₁ : A₁ ⟶ B₁) (f₂ g₂ : A₂ ⟶ B₂)\n (ϕ : A₁ ≅ A₂) (ψ : B₁ ≅ B₂) (h₁ : ϕ.hom ≫ f₂ = f₁ ≫ ψ.hom) (h₂ : ϕ.hom ≫ g₂ = g₁ ≫ ψ.hom) :\n CLCTinv.F r V f₁ g₁ ≅ CLCTinv.F r V f₂ g₂ :=\n{ hom := map_nat r V f₁ g₁ f₂ g₂ ϕ.hom ψ.hom h₁ h₂,\n inv := map_nat r V f₂ g₂ f₁ g₁ ϕ.inv ψ.inv\n (by rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, h₁])\n (by rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, h₂]),\n hom_inv_id' :=\n begin\n simp only [map_nat_def, _root_.id, SemiNormedGroup.equalizer.map_nat_comp_map_nat,\n ← whisker_right_comp, iso.hom_inv_id, whisker_right_id', SemiNormedGroup.equalizer.map_nat_id],\n refl\n end,\n inv_hom_id' :=\n begin\n simp only [map_nat_def, _root_.id, SemiNormedGroup.equalizer.map_nat_comp_map_nat,\n ← whisker_right_comp, iso.inv_hom_id, whisker_right_id', SemiNormedGroup.equalizer.map_nat_id],\n refl\n end, }\n\nend CLCTinv\n\nlemma aux (r' c c₂ : ℝ≥0) [r1 : fact (r' ≤ 1)] [h : fact (c₂ ≤ r' * c)] : fact (c₂ ≤ c) :=\n⟨h.1.trans $ (mul_le_mul' r1.1 le_rfl).trans (by simp)⟩\n\n@[simps obj]\ndef CLCFPTinv₂ (r : ℝ≥0) (V : SemiNormedGroup)\n (r' : ℝ≥0) [fact (0 < r)] [fact (0 < r')] [r1 : fact (r' ≤ 1)] [normed_with_aut r V]\n (c c₂ : ℝ≥0) [fact (c₂ ≤ r' * c)] (n : ℕ) : (ProFiltPseuNormGrpWithTinv r')ᵒᵖ ⥤ SemiNormedGroup :=\nby haveI : fact (c₂ ≤ c) := aux r' c c₂; exact\nCLCTinv.F r V\n (nat_trans.op (FiltrationPow.Tinv r' c₂ c n))\n (nat_trans.op (FiltrationPow.cast_le r' c₂ c n))\n\ntheorem CLCFPTinv₂_def (r : ℝ≥0) (V : SemiNormedGroup)\n (r' : ℝ≥0) [fact (0 < r)] [fact (0 < r')] [r1 : fact (r' ≤ 1)] [normed_with_aut r V]\n (c c₂ : ℝ≥0) [fact (c₂ ≤ r' * c)] (n : ℕ) :\n CLCFPTinv₂ r V r' c c₂ n = SemiNormedGroup.equalizer.F\n (CLCFP.Tinv V r' c c₂ n)\n (@CLCFP.res V r' c c₂ n (aux r' c c₂) ≫ CLCFP.T_inv r V r' c₂ n) := rfl\n\ninstance CLCFPTinv₂.separated_space [fact (c₂ ≤ r' * c₁)] (M) :\n separated_space ((CLCFPTinv₂ r V r' c₁ c₂ n).obj M) :=\nbegin\n rw separated_iff_t2,\n refine @subtype.t2_space _ _ (id _) (id _),\n rw ← separated_iff_t2,\n apply uniform_space.completion.separated_space\nend\n\ninstance CLCFPTinv₂.complete_space [fact (c₂ ≤ r' * c₁)] (M) :\n complete_space ((CLCFPTinv₂ r V r' c₁ c₂ n).obj M) :=\nbegin\n refine @is_closed.complete_space_coe _ (id _) (id _) _ _,\n { apply uniform_space.completion.complete_space },\n { refine is_closed_eq _ continuous_const,\n apply normed_group_hom.continuous }\nend\n\n/-- The functor that sends `M` and `c` to `V-hat((filtration M c)^n)^{T⁻¹}`,\ndefined by taking `T⁻¹`-invariants for two different actions by `T⁻¹`:\n\n* The first comes from the action of `T⁻¹` on `M`.\n* The second comes from the action of `T⁻¹` on `V`.\n\nWe take the equalizer of those two actions.\n\nSee the lines just above Definition 9.3 of [Analytic]. -/\ndef CLCFPTinv (r : ℝ≥0) (V : SemiNormedGroup) (r' : ℝ≥0)\n (c : ℝ≥0) (n : ℕ) [normed_with_aut r V] [fact (0 < r)] [fact (0 < r')] [fact (r' ≤ 1)] :\n (ProFiltPseuNormGrpWithTinv r')ᵒᵖ ⥤ SemiNormedGroup :=\nCLCFPTinv₂ r V r' c (r' * c) n\n\nnamespace CLCFPTinv₂\n\nlemma map_norm_noninc [fact (c₂ ≤ r' * c)] [fact (c₂ ≤ c)]\n {M₁ M₂} (f : M₁ ⟶ M₂) : ((CLCFPTinv₂ r V r' c c₂ n).map f).norm_noninc :=\nCLCTinv.map_norm_noninc _ _ _ _ _ _ _ _ _ _\n\ndef res [fact (c₂ ≤ r' * c₁)] [fact (c₂ ≤ c₁)] [fact (c₄ ≤ r' * c₃)] [fact (c₄ ≤ c₃)]\n [fact (c₃ ≤ c₁)] [fact (c₄ ≤ c₂)] : CLCFPTinv₂ r V r' c₁ c₂ n ⟶ CLCFPTinv₂ r V r' c₃ c₄ n :=\nCLCTinv.map_nat r V _ _ _ _\n (nat_trans.op (FiltrationPow.cast_le _ c₃ c₁ n))\n (nat_trans.op (FiltrationPow.cast_le _ c₄ c₂ n)) rfl rfl\n\n@[simp] lemma res_refl [fact (c₂ ≤ r' * c₁)] [fact (c₂ ≤ c₁)] : res r V r' c₁ c₂ c₁ c₂ n = 𝟙 _ :=\nby { simp only [res, FiltrationPow.cast_le_refl, nat_trans.op_id], ext x : 2, apply CLCTinv.map_id }\n\nlemma res_comp_res\n [fact (c₂ ≤ r' * c₁)] [fact (c₂ ≤ c₁)]\n [fact (c₄ ≤ r' * c₃)] [fact (c₄ ≤ c₃)]\n [fact (c₆ ≤ r' * c₅)] [fact (c₆ ≤ c₅)]\n [fact (c₃ ≤ c₁)] [fact (c₄ ≤ c₂)]\n [fact (c₅ ≤ c₃)] [fact (c₆ ≤ c₄)]\n [fact (c₅ ≤ c₁)] [fact (c₆ ≤ c₂)] :\n res r V r' c₁ c₂ c₃ c₄ n ≫ res r V r' c₃ c₄ c₅ c₆ n = res r V r' c₁ c₂ c₅ c₆ n :=\nbegin\n ext x : 2, simp only [res, nat_trans.comp_app],\n exact (CLCTinv.map_comp _ _ _ _ _ _ _ _ _ _ _ _).symm\nend\n\nlemma res_norm_noninc {_ : fact (c₂ ≤ r' * c₁)} {_ : fact (c₂ ≤ c₁)}\n {_ : fact (c₄ ≤ r' * c₃)} {_ : fact (c₄ ≤ c₃)} {_ : fact (c₃ ≤ c₁)} {_ : fact (c₄ ≤ c₂)} (M) :\n ((res r V r' c₁ c₂ c₃ c₄ n).app M).norm_noninc :=\nCLCTinv.map_norm_noninc _ _ _ _ _ _ _ _ _ _\n\nlemma norm_res_le [fact (c₂ ≤ r' * c₁)] [fact (c₂ ≤ c₁)] [fact (c₄ ≤ r' * c₃)] [fact (c₄ ≤ c₃)]\n [fact (c₃ ≤ c₁)] [fact (c₄ ≤ c₂)] (h₂₃ : c₂ = c₃) (M) :\n ∥(res r V r' c₁ c₂ c₃ c₄ n).app M∥ ≤ r :=\nbegin\n apply CLCTinv.norm_map_le,\n rw [← category.comp_id ((CLC V).map ((nat_trans.op (FiltrationPow.cast_le r' c₃ c₁ n)).app M))],\n have := nat_trans.congr_app (CLC.T r V).inv_hom_id ((FiltrationPow r' c₃ n).op.obj M),\n dsimp only [nat_trans.id_app] at this,\n rw [← this, CLC.T_inv_eq, nat_trans.comp_app, ← category.assoc ((CLC V).map _)],\n unfreezingI { subst c₃ },\n rw [← SemiNormedGroup.equalizer.condition_assoc, ← category.assoc],\n refine normed_group_hom.norm_comp_le_of_le' 1 r r (mul_one ↑r).symm _ _,\n { apply CLC.norm_T_le },\n { apply norm_noninc.norm_noninc_iff_norm_le_one.1,\n exact (CLC.map_norm_noninc V _).comp equalizer.ι_norm_noninc }\nend\n\nend CLCFPTinv₂\n\nnamespace CLCFPTinv\n\nlemma map_norm_noninc {M₁ M₂} (f : M₁ ⟶ M₂) : ((CLCFPTinv r V r' c n).map f).norm_noninc :=\nCLCFPTinv₂.map_norm_noninc _ _ _ _ _ _ _\n\ndef res [fact (c₂ ≤ c₁)] : CLCFPTinv r V r' c₁ n ⟶ CLCFPTinv r V r' c₂ n :=\nCLCFPTinv₂.res r V r' c₁ _ c₂ _ n\n\n@[simp] lemma res_refl : res r V r' c₁ c₁ n = 𝟙 _ :=\nCLCFPTinv₂.res_refl _ _ _ _ _ _\n\nlemma res_comp_res [fact (c₃ ≤ c₁)] [fact (c₅ ≤ c₃)] [fact (c₅ ≤ c₁)] :\n res r V r' c₁ c₃ n ≫ res r V r' c₃ c₅ n = res r V r' c₁ c₅ n :=\nCLCFPTinv₂.res_comp_res _ _ _ _ _ _ _ _ _ _\n\nlemma res_norm_noninc {_ : fact (c₂ ≤ c₁)} (M) :\n ((res r V r' c₁ c₂ n).app M).norm_noninc :=\nCLCFPTinv₂.res_norm_noninc r V r' _ _ _ _ _ _\n\nlemma norm_res_le [fact (c₂ ≤ c₁)] [fact (c₂ ≤ r' * c₁)] (M) :\n ∥(res r V r' c₁ c₂ n).app M∥ ≤ r :=\nbegin\n rw ← res_comp_res r V r' c₁ (r' * c₁) c₂,\n refine norm_comp_le_of_le' _ _ _ (one_mul ↑r).symm _ (CLCFPTinv₂.norm_res_le r V r' _ _ _ _ n rfl M),\n apply norm_noninc.norm_noninc_iff_norm_le_one.1,\n exact CLCTinv.map_norm_noninc r V _ _ _ _ _ _ _ _\nend\n\nlemma norm_res_le_pow (N : ℕ) [fact (c₂ ≤ c₁)] [h : fact (c₂ ≤ r' ^ N * c₁)] (M) :\n ∥(res r V r' c₁ c₂ n).app M∥ ≤ (r ^ N) :=\nbegin\n unfreezingI { induction N with N ih generalizing c₁ c₂ },\n { rw pow_zero,\n apply norm_noninc.norm_noninc_iff_norm_le_one.1,\n exact CLCTinv.map_norm_noninc r V _ _ _ _ _ _ _ _ },\n haveI : fact (c₂ ≤ r' ^ N * c₁) := nnreal.fact_le_pow_mul_of_le_pow_succ_mul _ _ _,\n rw [pow_succ, mul_assoc] at h, resetI,\n rw [← res_comp_res r V r' c₁ (r' ^ N * c₁) c₂],\n exact norm_comp_le_of_le' _ _ _ (pow_succ _ _) (norm_res_le r V r' _ _ n M) (ih _ _)\nend\n\nend CLCFPTinv\n\nnamespace breen_deligne\n\nopen CLCFPTinv\n\nvariables (M) {l m n}\n\nnamespace universal_map\n\nvariables (ϕ ψ : universal_map m n)\n\ndef eval_CLCFPTinv₂\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)]\n [ϕ.suitable c₃ c₁] [ϕ.suitable c₄ c₂] :\n CLCFPTinv₂ r V r' c₁ c₂ n ⟶ CLCFPTinv₂ r V r' c₃ c₄ m :=\nbegin\n dsimp only [CLCFPTinv₂_def],\n refine SemiNormedGroup.equalizer.map_nat (ϕ.eval_CLCFP _ _ _ _) (ϕ.eval_CLCFP _ _ _ _)\n (Tinv_comp_eval_CLCFP V r' c₁ c₂ c₃ c₄ ϕ).symm _,\n haveI : fact (c₂ ≤ c₁) := aux r' _ _, haveI : fact (c₄ ≤ c₃) := aux r' _ _,\n have h₁ := res_comp_eval_CLCFP V r' c₁ c₂ c₃ c₄ ϕ,\n have h₂ := T_inv_comp_eval_CLCFP r V r' c₂ c₄ ϕ,\n have := comm_sq₂ h₁ h₂,\n exact this.symm\nend\n\n@[simp] lemma eval_CLCFPTinv₂_zero\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)] :\n (0 : universal_map m n).eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ = 0 :=\nby { simp only [eval_CLCFPTinv₂, eval_CLCFP_zero], ext, refl }\n\n@[simp] lemma eval_CLCFPTinv₂_add\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)]\n [ϕ.suitable c₃ c₁] [ϕ.suitable c₄ c₂]\n [ψ.suitable c₃ c₁] [ψ.suitable c₄ c₂] :\n (ϕ + ψ : universal_map m n).eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ =\n ϕ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ + ψ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ :=\nby { simp only [eval_CLCFPTinv₂, eval_CLCFP_add], ext, refl }\n\n@[simp] lemma eval_CLCFPTinv₂_sub\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)]\n [ϕ.suitable c₃ c₁] [ϕ.suitable c₄ c₂]\n [ψ.suitable c₃ c₁] [ψ.suitable c₄ c₂] :\n (ϕ - ψ : universal_map m n).eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ =\n ϕ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ - ψ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ :=\nby { simp only [eval_CLCFPTinv₂, eval_CLCFP_sub], ext, refl }\n\nlemma eval_CLCFPTinv₂_comp {l m n : FreeMat} (f : l ⟶ m) (g : m ⟶ n)\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)] [fact (c₆ ≤ r' * c₅)]\n [f.suitable c₅ c₃] [f.suitable c₆ c₄] [g.suitable c₃ c₁] [g.suitable c₄ c₂] :\n @eval_CLCFPTinv₂ r V _ _ r' _ _ c₁ c₂ c₅ c₆ _ _ (f ≫ g)\n _ _ (suitable.comp c₃) (suitable.comp c₄) =\n g.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄ ≫ f.eval_CLCFPTinv₂ r V r' c₃ c₄ c₅ c₆ :=\nbegin\n dsimp only [eval_CLCFPTinv₂, CLCFPTinv₂_def], delta id,\n simp only [SemiNormedGroup.equalizer.map_nat_comp_map_nat],\n generalize_proofs h1 h2 h3 h4 h5 h6 h7 h8,\n revert h5 h6 h7 h8, resetI,\n have H1 : eval_CLCFP V r' c₁ c₅ (f ≫ g) = eval_CLCFP V r' c₁ c₃ g ≫ eval_CLCFP V r' c₃ c₅ f :=\n eval_CLCFP_comp V r' c₁ c₃ c₅ g f,\n have H2 : eval_CLCFP V r' c₂ c₆ (f ≫ g) = eval_CLCFP V r' c₂ c₄ g ≫ eval_CLCFP V r' c₄ c₆ f :=\n eval_CLCFP_comp V r' c₂ c₄ c₆ g f,\n rw [H1, H2],\n intros, refl,\nend\n\nlemma res_comp_eval_CLCFPTinv₂\n [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)]\n [fact (c₆ ≤ r' * c₅)] [fact (c₈ ≤ r' * c₇)]\n [fact (c₂ ≤ c₁)] [fact (c₃ ≤ c₁)] [fact (c₄ ≤ c₂)] [fact (c₄ ≤ c₃)]\n [fact (c₆ ≤ c₅)] [fact (c₇ ≤ c₅)] [fact (c₈ ≤ c₆)] [fact (c₈ ≤ c₇)]\n [ϕ.suitable c₅ c₁] [ϕ.suitable c₆ c₂]\n [ϕ.suitable c₇ c₃] [ϕ.suitable c₈ c₄] :\n CLCFPTinv₂.res r V r' c₁ c₂ c₃ c₄ n ≫ ϕ.eval_CLCFPTinv₂ r V r' c₃ c₄ c₇ c₈ =\n ϕ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₅ c₆ ≫ CLCFPTinv₂.res r V r' c₅ c₆ c₇ c₈ m :=\nbegin\n dsimp only [CLCFPTinv₂.res, eval_CLCFPTinv₂, CLCFPTinv₂_def, CLCTinv.map_nat_def], delta id,\n simp only [SemiNormedGroup.equalizer.map_nat_comp_map_nat],\n congr' 1; { simp only [← CLCFP.res_def], apply res_comp_eval_CLCFP },\nend\n\nlemma norm_eval_CLCFPTinv₂_le [fact (c₂ ≤ r' * c₁)] [fact (c₄ ≤ r' * c₃)]\n [ϕ.suitable c₃ c₁] [ϕ.suitable c₄ c₂] (N : ℕ) (h : ϕ.bound_by N) (M) :\n ∥(ϕ.eval_CLCFPTinv₂ r V r' c₁ c₂ c₃ c₄).app M∥ ≤ N :=\nbegin\n apply SemiNormedGroup.equalizer.norm_map_le,\n refine normed_group_hom.norm_comp_le_of_le' _ _ _ (mul_one _).symm _ _,\n { apply norm_eval_CLCFP_le, exact h },\n { apply norm_noninc.norm_noninc_iff_norm_le_one.1,\n exact equalizer.ι_norm_noninc }\nend\n\ndef eval_CLCFPTinv [ϕ.suitable c₂ c₁] :\n CLCFPTinv r V r' c₁ n ⟶ CLCFPTinv r V r' c₂ m :=\nϕ.eval_CLCFPTinv₂ r V r' c₁ _ c₂ _\n\nlemma eval_CLCFPTinv_def [ϕ.suitable c₂ c₁] :\n ϕ.eval_CLCFPTinv r V r' c₁ c₂ = ϕ.eval_CLCFPTinv₂ r V r' c₁ _ c₂ _ := rfl\n\n@[simp] lemma eval_CLCFPTinv_zero :\n (0 : universal_map m n).eval_CLCFPTinv r V r' c₁ c₂ = 0 :=\nby apply eval_CLCFPTinv₂_zero\n\n@[simp] lemma eval_CLCFPTinv_add [ϕ.suitable c₂ c₁] [ψ.suitable c₂ c₁] :\n (ϕ + ψ : universal_map m n).eval_CLCFPTinv r V r' c₁ c₂ =\n ϕ.eval_CLCFPTinv r V r' c₁ c₂ + ψ.eval_CLCFPTinv r V r' c₁ c₂ :=\neval_CLCFPTinv₂_add _ _ _ _ _ _ _ _ _\n\n@[simp] lemma eval_CLCFPTinv_sub [ϕ.suitable c₂ c₁] [ψ.suitable c₂ c₁] :\n (ϕ - ψ : universal_map m n).eval_CLCFPTinv r V r' c₁ c₂ =\n ϕ.eval_CLCFPTinv r V r' c₁ c₂ - ψ.eval_CLCFPTinv r V r' c₁ c₂ :=\neval_CLCFPTinv₂_sub _ _ _ _ _ _ _ _ _\n\nlemma eval_CLCFPTinv_comp {l m n : FreeMat} (f : l ⟶ m) (g : m ⟶ n)\n [hg : g.suitable c₂ c₁] [hf : f.suitable c₃ c₂] :\n @eval_CLCFPTinv r V _ _ r' _ _ c₁ c₃ _ _ (f ≫ g) (suitable.comp c₂) =\n g.eval_CLCFPTinv r V r' c₁ c₂ ≫ f.eval_CLCFPTinv r V r' c₂ c₃ :=\nby apply eval_CLCFPTinv₂_comp\n\nlemma res_comp_eval_CLCFPTinv\n [fact (c₂ ≤ c₁)] [ϕ.suitable c₄ c₂] [ϕ.suitable c₃ c₁] [fact (c₄ ≤ c₃)] :\n res r V r' c₁ c₂ n ≫ ϕ.eval_CLCFPTinv r V r' c₂ c₄ =\n ϕ.eval_CLCFPTinv r V r' c₁ c₃ ≫ res r V r' c₃ c₄ m :=\nby apply res_comp_eval_CLCFPTinv₂\n\nlemma res_comp_eval_CLCFPTinv_absorb\n [fact (c₂ ≤ c₁)] [hϕ : ϕ.suitable c₃ c₂] :\n res r V r' c₁ c₂ n ≫ ϕ.eval_CLCFPTinv r V r' c₂ c₃ =\n @eval_CLCFPTinv r V _ _ r' _ _ c₁ c₃ _ _ ϕ (hϕ.le _ _ _ _ le_rfl (fact.out _)) :=\nby rw [@res_comp_eval_CLCFPTinv r V _ _ r' _ _ c₁ c₂ c₃ c₃ _ _ ϕ\n (_root_.id _) (_root_.id _) (_root_.id _) (_root_.id _),\n res_refl, category.comp_id]\n\nlemma eval_CLCFPTinv_comp_res_absorb\n {_: fact (c₃ ≤ c₂)} [hϕ : ϕ.suitable c₂ c₁] :\n ϕ.eval_CLCFPTinv r V r' c₁ c₂ ≫ res r V r' c₂ c₃ m =\n @eval_CLCFPTinv r V _ _ r' _ _ c₁ c₃ _ _ ϕ (hϕ.le _ _ _ _ (fact.out _) le_rfl) :=\nby rw [← @res_comp_eval_CLCFPTinv r V _ _ r' _ _ c₁ c₁ c₂ c₃ _ _ ϕ\n (_root_.id _) (_root_.id _) (_root_.id _) (_root_.id _),\n res_refl, category.id_comp]\n\nlemma norm_eval_CLCFPTinv_le [normed_with_aut r V] [fact (0 < r)] [ϕ.suitable c₂ c₁]\n (N : ℕ) (h : ϕ.bound_by N) (M) :\n ∥(ϕ.eval_CLCFPTinv r V r' c₁ c₂).app M∥ ≤ N :=\nnorm_eval_CLCFPTinv₂_le r V r' _ _ _ _ _ N h M\n\nlemma eval_CLCFPTinv_norm_noninc [normed_with_aut r V] [fact (0 < r)]\n [h : ϕ.very_suitable r r' c₂ c₁] (M) :\n ((ϕ.eval_CLCFPTinv r V r' c₁ c₂).app M).norm_noninc :=\nbegin\n apply norm_noninc.norm_noninc_iff_norm_le_one.2,\n have h' := h,\n unfreezingI { rcases h with ⟨N, k, c', hN, hϕ, hr, H⟩ },\n haveI : fact (c' ≤ c₁) := ⟨H.trans $ fact.out _⟩,\n have aux := res_comp_eval_CLCFPTinv r V r' c₁ c' c₂ c₂ ϕ,\n rw [res_refl, category.comp_id] at aux,\n rw ← aux,\n refine le_trans _ hr,\n rw mul_comm,\n apply normed_group_hom.norm_comp_le_of_le,\n { apply_mod_cast norm_eval_CLCFPTinv_le, exact hN },\n { haveI : fact (c' ≤ r' ^ k * c₁) := ⟨H⟩,\n rw nnreal.coe_pow,\n apply norm_res_le_pow },\nend\n\nend universal_map\n\nend breen_deligne\n\nattribute [irreducible] CLCFPTinv₂ CLCFPTinv₂.res\n breen_deligne.universal_map.eval_CLCFPTinv₂\n", "meta": {"author": "bentoner", "repo": "debug", "sha": "b8a75381caa90aa9942c20e08a44e45d0ae60d18", "save_path": "github-repos/lean/bentoner-debug", "path": "github-repos/lean/bentoner-debug/debug-b8a75381caa90aa9942c20e08a44e45d0ae60d18/src/pseudo_normed_group/Tinv.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5078118642792044, "lm_q2_score": 0.38861802670584894, "lm_q1q2_score": 0.19734484463400281}} {"text": "-- Copyright (c) 2018 Scott Morrison. All rights reserved.\n-- Released under Apache 2.0 license as described in the file LICENSE.\n-- Authors: Scott Morrison\n\nimport category_theory.const\n\nuniverses v w u -- declare the `v`'s first; see `category_theory.category` for an explanation\n\nnamespace category_theory\n\ninstance punit_category : small_category punit :=\n{ hom := λ X Y, punit,\n id := λ _, punit.star,\n comp := λ _ _ _ _ _, punit.star }\n\nnamespace functor\nvariables {C : Type u} [𝒞 : category.{v} C]\ninclude 𝒞\n\n/-- The constant functor. For `X : C`, `of.obj X` is the functor `punit ⥤ C`\n that maps `punit.star` to `X`. -/\ndef of : C ⥤ (punit.{w+1} ⥤ C) := const punit\n\nnamespace of\n@[simp] lemma obj_obj (X : C) : (of.obj X).obj = λ _, X := rfl\n@[simp] lemma obj_map (X : C) : (of.obj X).map = λ _ _ _, 𝟙 X := rfl\n@[simp] lemma map_app {X Y : C} (f : X ⟶ Y) : (of.map f).app = λ _, f := rfl\nend of\n\nend functor\n\nend category_theory\n", "meta": {"author": "digama0", "repo": "mathlib-ITP2019", "sha": "5cbd0362e04e671ef5db1284870592af6950197c", "save_path": "github-repos/lean/digama0-mathlib-ITP2019", "path": "github-repos/lean/digama0-mathlib-ITP2019/mathlib-ITP2019-5cbd0362e04e671ef5db1284870592af6950197c/src/category_theory/punit.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5583269943353745, "lm_q2_score": 0.35220178204788966, "lm_q1q2_score": 0.19664376237036088}} {"text": "import mcl.defs\nimport mcl.rhl\nimport mcl.compute_list\nimport mcl.ts_updates\nimport syncablep\nimport mcl.syncablep\nimport mcl.lemmas\nimport .defs\n\nopen mcl\nopen mcl.mclk\nopen mcl.rhl\nopen parlang\nopen parlang.state\nopen parlang.thread_state\n\nnamespace assign_mcl\nnamespace proof2\n\nnotation m ` & ` n ` ::= ` v := memory.update m n v\nnotation s ` § ` f ` ⇂ ` ac := map_active_threads ac f s\n\nlemma assign_rel' : mclp_rel eq p₁ p₂ eq := begin\n apply rel_mclk_to_mclp,\n\n apply skip_right.mpr,\n apply rhl.seq,\n swap,\n\n apply skip_left_after.mpr,\n apply skip_right.mpr,\n apply rhl.seq,\n swap,\n\n -- break it down into individual proofs\n apply add_skip_left.mpr,\n apply rhl.seq,\n swap,\n {\n apply shared_assign_right,\n },{\n apply shared_assign_right,\n }, {\n apply shared_assign_left,\n },\n apply shared_assign_left',\n intros _ _ _ _ _ _ h hs,\n cases h with m₁ h,\n cases h with m₂ h,\n simp only [map_map_active_threads],\n have : n₁ = n₂ := begin\n sorry\n end,\n subst this,\n have hseq : s₁ = s₂ := begin\n sorry\n end,\n\n -- the proof obligation in the form of a map thread on syncable is the simple version because we never consider threads to change active state (here all threads are always active)\n\n -- the two updates store indepedently because \"a\" ≠ \"b\"\n -- the two updates read indepedently because they both depend on the same state (AFAIK they could still be swaped because the state is fixed)\n apply exists.intro _,\n apply exists.intro _,\n\n -- split up the proof for the individual memories\n split, {\n have : thread_state.update_shared_vars_for_expr read_tid = id := by refl,\n rw this,\n have : thread_state.update_shared_vars_for_exprs v[read_tid] = id := by refl,\n rw this,\n have : thread_state.update_shared_vars_for_expr (read_tid + (expression.literal_int 1 (show type_of (sig.val \"b\") = type_of (sig.val \"b\"), by refl))) = id := by refl,\n rw this,\n simp,\n\n -- resolve get and update (the result should only be mcl_init, literals and memory (in case of loads))\n rw ← syncable_syncable',\n rw function.comp.assoc,\n rw ← ts_updates_nil (thread_state.tlocal_to_shared _ _ _ _ ∘ _),\n rw [ts_updates_store, ts_updates_compute, ts_updates_store],\n rw [← function.comp.right_id (compute _)],\n rw [ts_updates_compute],\n rw [function.comp.right_id],\n apply syncable'_store (show ((sig.val \"a\").type).dim = 1, by refl),\n {\n simp,\n }, {\n simp,\n }, {\n intros tid₁ tid₂ hneq,\n simp [vector.map_cons],\n repeat { rw vector.map_nil },\n rw initial_kernel_assertion_left_thread_state h,\n rw initial_kernel_assertion_left_thread_state h,\n simp,\n rw ← vector.eq_one',\n intro a,\n cases tid₁,\n cases tid₂,\n have : tid₁_val = tid₂_val := begin\n apply a,\n end,\n subst this,\n contradiction,\n },\n rw ts_updates_merge_computes_list,\n apply syncable'_store (show ((sig.val \"b\").type).dim = 1, by refl),\n {\n intro idx,\n have : \"b\" ≠ \"a\" := by intro; cases a,\n simp [this],\n }, {\n intro idx,\n have : \"b\" ≠ \"a\" := by intro; cases a,\n simp [this],\n }, {\n intros tid₁ tid₂ hneq,\n simp [vector.map_cons],\n repeat { rw vector.map_nil },\n rw initial_kernel_assertion_left_thread_state h,\n rw initial_kernel_assertion_left_thread_state h,\n simp,\n rw ← vector.eq_one',\n intro a,\n cases tid₁,\n cases tid₂,\n have : tid₁_val = tid₂_val := begin\n apply a,\n end,\n subst this,\n contradiction,\n },\n simp [append, list.append],\n apply syncable'_compute_list_syncable,\n exact h.left,\n sorry, --trivial from h\n sorry, --trivial from h\n }, \n split, {\n have : thread_state.update_shared_vars_for_expr read_tid = id := by refl,\n rw this,\n have : thread_state.update_shared_vars_for_exprs v[read_tid] = id := by refl,\n rw this,\n have : thread_state.update_shared_vars_for_expr (read_tid + (expression.literal_int 1 (show type_of (sig.val \"b\") = type_of (sig.val \"b\"), by refl))) = id := by refl,\n rw this,\n simp,\n\n -- resolve get and update (the result should only be mcl_init, literals and memory (in case of loads))\n rw ← syncable_syncable',\n rw function.comp.assoc,\n rw ← ts_updates_nil (thread_state.tlocal_to_shared _ _ _ _ ∘ _),\n rw [ts_updates_store, ts_updates_compute, ts_updates_store],\n rw [← function.comp.right_id (compute _)],\n rw [ts_updates_compute],\n rw [function.comp.right_id],\n apply syncable'_store (show ((sig.val \"b\").type).dim = 1, by refl),\n {\n simp,\n }, {\n simp,\n }, {\n intros tid₁ tid₂ hneq,\n simp [vector.map_cons],\n repeat { rw vector.map_nil },\n rw h.right_thread_state,\n rw h.right_thread_state,\n simp,\n rw ← vector.eq_one',\n intro a,\n cases tid₁,\n cases tid₂,\n have : tid₁_val = tid₂_val := begin\n apply a,\n end,\n subst this,\n contradiction,\n },\n rw ts_updates_merge_computes_list,\n apply syncable'_store (show ((sig.val \"a\").type).dim = 1, by refl),\n {\n intro idx,\n have : \"a\" ≠ \"b\" := by intro; cases a,\n simp [this],\n }, {\n intro idx,\n have : \"a\" ≠ \"b\" := by intro; cases a,\n simp [this],\n }, {\n intros tid₁ tid₂ hneq,\n simp [vector.map_cons],\n repeat { rw vector.map_nil },\n rw h.right_thread_state,\n rw h.right_thread_state,\n simp,\n rw ← vector.eq_one',\n intro a,\n cases tid₁,\n cases tid₂,\n have : tid₁_val = tid₂_val := begin\n apply a,\n end,\n subst this,\n contradiction,\n },\n simp [append, list.append],\n apply syncable'_compute_list_syncable,\n exact h.right.left,\n sorry, --trivial from h\n sorry, --trivial from h\n }, {\n -- show post-condition\n simp [append, list.append],\n rw ts_update_compute_list,\n rw from_tlocal_comm,\n have := h.precondition,\n subst this,\n have := h.initial_state_eq,\n subst this,\n apply from_tlocal_eq,\n {\n intro tid,\n rw map_active_threads_nth_ac,\n rw map_active_threads_nth_ac,\n refl,\n sorry, -- trivial\n sorry, -- trivial\n },\n apply from_tlocal_eq,\n {\n intro tid,\n rw map_active_threads_nth_ac,\n rw map_active_threads_nth_ac,\n refl,\n sorry, -- trivial\n sorry, -- trivial\n },\n refl,\n }, {\n sorry, --trivial\n }\nend\n\nend proof2\nend assign_mcl", "meta": {"author": "fischerman", "repo": "GPU-transformation-verifier", "sha": "75a5016f05382738ff93ce5859c4cfa47ccb63c1", "save_path": "github-repos/lean/fischerman-GPU-transformation-verifier", "path": "github-repos/lean/fischerman-GPU-transformation-verifier/GPU-transformation-verifier-75a5016f05382738ff93ce5859c4cfa47ccb63c1/src/use_cases/assign_mcl/proof2.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5078118642792044, "lm_q2_score": 0.3849121444839335, "lm_q1q2_score": 0.19546295367409278}} {"text": "import order\n\nimport lib.list\n\nimport etv\n\nopen order_dual\n\nvariables {α : Type*} [linear_order α] (C : config α)\n\nlemma config.join_n2_n3_n2_ff \n (S : finset α) (cap4_free : ¬C.has_ncap 4 S)\n {n : ℕ} (x y : α)\n {P : list α} (hPx : C.ncup (n+2) (P ++ [x])) (Px_in_S : (P ++ [x]).in S)\n {Q : list α} (hxQy : C.ncup (n+3) (x :: Q ++ [y])) \n (xQy_in_S : (x :: Q ++ [y]).in S)\n {R : list α} (hyR : C.ncup (n+2) (y :: R)) (yR_in_S : (y :: R).in S)\n (label : C.label S) (sxy : ¬label.slope x y) :\n ∃ p q r s, C.has_interweaved_laced (n+3) S p q r s :=\nbegin\n have x_in_S : x ∈ S := by simp at xQy_in_S; tauto,\n have y_in_S : y ∈ S := by simp at xQy_in_S; tauto,\n have x_lt_y : x < y := by apply hxQy.head'_lt_last' x y; simp,\n \n have hP := hPx.init, simp at hP,\n have hQy := hxQy.tail, simp at hQy,\n rcases hP.init_append_last with ⟨P', a, eq_P, hP'⟩, subst eq_P,\n rcases hQy.cons_head_tail with ⟨b, Q', eq_Q, hQ'⟩,\n have eq_xQy : x :: Q ++ [y] = x :: (Q ++ [y]) := by simp,\n rw [eq_xQy, eq_Q] at *, clear eq_xQy,\n have a_in_S : a ∈ S := by simp at Px_in_S; tauto,\n have b_in_S : b ∈ S := by simp at xQy_in_S; tauto,\n\n have hR := hyR.tail, simp at hR,\n rcases hR.init_append_last with ⟨R', z, eq_R, hR'⟩,\n have xy_laced : C.has_laced (n+3) S x y := begin\n have hy : C.ncup 1 [y] := by simp,\n existsi [_, _, _, _, _, hPx, hxQy, hy], \n refine ⟨_, _, _⟩, \n split, assumption, split, assumption,\n simp, simp at xQy_in_S, tauto,\n simp, simp, rw ←eq_Q, simp,\n end,\n have xz_laced : C.has_laced (n+3) S x z := begin\n have hxyR : C.ncup (n+3) (x :: y :: R) := begin\n apply hyR.extend_left sxy; try {assumption}, simp,\n end,\n rw eq_R at hxyR,\n have hz : C.ncup 1 [z] := by simp,\n existsi [_, _, _, _, _, hPx, hxyR, hz],\n refine ⟨_, _, _⟩,\n split, assumption, rw eq_R at yR_in_S,\n simp, simp at yR_in_S, tauto,\n simp, simp,\n end,\n\n have a_lt_x : a < x := \n by rw [config.ncup, config.cup] at hPx; simp at hPx; tauto,\n have x_lt_b : x < b :=\n by rw [config.ncup, config.cup] at hxQy; simp at hxQy; tauto,\n have y_lt_z : y < z := begin\n rw eq_R at hyR, apply hyR.head'_lt_last' y z,\n simp, simp,\n end,\n have a_lt_b : a < b := has_lt.lt.trans a_lt_x x_lt_b,\n by_cases sab : label.slope a b, swap,\n -- case ¬label.slope a b\n { have hQy := hxQy.tail, simp at hQy, rw ←eq_Q at hQy,\n have haQy : C.ncup (n+3) (a :: Q ++ [y]) := begin\n apply hQy.extend_left sab; try {assumption},\n simp, rw ←eq_Q at xQy_in_S, simp at xQy_in_S, tauto, simp,\n rw eq_Q, simp,\n end,\n have ha : C.ncup 1 [a] := by simp,\n have ay_laced : C.has_laced (n+3) S a y := begin\n existsi [_, _, _, _, _, ha, haQy, hyR],\n refine ⟨_, _, _⟩, \n simp, rw ←eq_Q at xQy_in_S, simp at xQy_in_S yR_in_S, tauto,\n rw nat.add_comm, simp,\n end,\n use [a, x, y, z], split,\n { split, assumption, split, \n exact le_of_lt x_lt_y, assumption },\n { tauto }, },\n -- case label.slope a b\n have b_lt_y : b < y := begin\n have hQy := hxQy.tail, simp at hQy,\n apply hQy.head'_lt_last' b y; simp,\n rw ←eq_Q, simp,\n end,\n have hP := hPx.init, simp at hP,\n have hPb : C.ncup (n+2) (P' ++ [a] ++ [b]) := begin\n apply hP.extend_right sab; try { assumption },\n simp; simp at Px_in_S; tauto,\n simp,\n end,\n by_cases sby : label.slope b y, swap,\n { have bz_laced : C.has_laced (n+3) S b z := begin\n have hbyR : C.ncup (n+3) (b :: y :: R) := begin\n apply hyR.extend_left sby; try {assumption}, simp,\n end,\n have hz : C.ncup 1 [z] := by simp,\n existsi [_, _, _, _, _, hPb, hbyR, hz], rw eq_R,\n refine ⟨_, _, _⟩, \n rw eq_R at yR_in_S, simp at Px_in_S yR_in_S, simp, tauto,\n simp, simp,\n end,\n use [x, b, y, z], split, \n split, assumption, split, apply le_of_lt, assumption, assumption,\n tauto, },\n { have hPby : C.ncup (n+3) (P' ++ [a] ++ [b] ++ [y]) := begin\n apply hPb.extend_right sby; try { assumption },\n simp; simp at Px_in_S; tauto, simp,\n end,\n have P_nnil : P' ++ [a] ≠ [] := by simp,\n rcases list.take_head P_nnil with ⟨w, P_, eq_P_⟩,\n rw eq_P_ at hPby,\n have wy_laced : C.has_laced (n+3) S w y := begin\n have hw : C.ncup 1 [w] := by simp,\n existsi [_, _, _, _, _, hw, hPby, hyR], \n refine ⟨_, _, _⟩,\n rw eq_P_ at Px_in_S, simp at yR_in_S Px_in_S, simp, tauto,\n rw nat.add_comm, simp,\n end,\n use [w, x, y, z], split, split,\n rw eq_P_ at hPx, apply hPx.head'_lt_last' w x; simp,\n split, exact le_of_lt x_lt_y, assumption, tauto, },\nend\n\nlemma config.join_n2_n3_n2_tt\n (S : finset α) (cap4_free : ¬C.has_ncap 4 S)\n {n : ℕ} (x y : α)\n {P : list α} (hPx : C.ncup (n+2) (P ++ [x])) (Px_in_S : (P ++ [x]).in S)\n {Q : list α} (hxQy : C.ncup (n+3) (x :: Q ++ [y])) \n (xQy_in_S : (x :: Q ++ [y]).in S)\n {R : list α} (hyR : C.ncup (n+2) (y :: R)) (yR_in_S : (y :: R).in S)\n (label : C.label S) (sxy : label.slope x y) :\n ∃ p q r s, C.has_interweaved_laced (n+3) S p q r s :=\nbegin\n have mirrored_goal : ∃ s r q p, \n C.mirror.has_interweaved_laced (n+3) S.mirror s r q p :=\n begin\n rw ←mirror.ncup at hPx hxQy hyR, simp at hPx hxQy hyR,\n rw ←mirror.has_ncap at cap4_free,\n rw ←list.mirror_in at Px_in_S xQy_in_S yR_in_S,\n simp [-list.cons_in, -list.append_in] at Px_in_S xQy_in_S yR_in_S,\n have syx := sxy, rw ←mirror_slope at syx,\n apply C.mirror.join_n2_n3_n2_ff \n _ _ (to_dual y) (to_dual x)\n hyR _ hxQy _ hPx _ label.mirror _; assumption,\n end,\n simp at mirrored_goal,\n rcases mirrored_goal with ⟨s, r, q, p, h⟩,\n rw mirror.has_interweaved_laced at h,\n use [p, q, r, s], exact h,\nend\n\nlemma config.join_n2_n3_n2 (S : finset α) {n : ℕ}\n (cap4_free : ¬C.has_ncap 4 S) (cup_free : ¬C.has_ncup (n+4) S)\n {cx : list α} (cx_ncup : C.ncup (n+2) cx) (cx_in_S : cx.in S)\n {c : list α} (c_ncup : C.ncup (n+3) c) (c_in_S : c.in S)\n {cy : list α} (cy_ncup : C.ncup (n+2) cy) (cy_in_S : cy.in S)\n (x : α) (hxcx : x ∈ cx.last') (hxc : x ∈ c.head')\n (y : α) (hyc : y ∈ c.last') (hycy : y ∈ cy.head') : \n ∃ p q r s, C.has_interweaved_laced (n+3) S p q r s :=\nbegin\n rcases c_ncup.take_head_last with ⟨x, Q, y, eq_Q, Q_ncup⟩,\n subst eq_Q, simp at hxc hyc, subst hxc, subst hyc,\n rcases cx_ncup.init_append_last with ⟨P, x, eq_P, P_ncup⟩, \n subst eq_P, simp at hxcx, subst hxcx,\n rcases cy_ncup.cons_head_tail with ⟨y, R, eq_R, R_ncup⟩,\n subst eq_R, simp at hycy, subst hycy,\n\n have label := cap4_free_label cap4_free,\n by_cases sxy : label.slope x y,\n { apply C.join_n2_n3_n2_tt S; try {assumption}, },\n { apply C.join_n2_n3_n2_ff S; try {assumption}, },\nend", "meta": {"author": "jcpaik", "repo": "erdos-tuza-valtr", "sha": "7fceb6f4f7d73bc3a0a09f48426b0e9350bc82ef", "save_path": "github-repos/lean/jcpaik-erdos-tuza-valtr", "path": "github-repos/lean/jcpaik-erdos-tuza-valtr/erdos-tuza-valtr-7fceb6f4f7d73bc3a0a09f48426b0e9350bc82ef/src/main/lemmas/join_n2_n3_n2.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5273165233795671, "lm_q2_score": 0.3702253925955866, "lm_q1q2_score": 0.19522596689034008}} {"text": "import for_mathlib.valuation_subring\nimport morphisms.proper\nimport algebraic_geometry.properties\n\nnoncomputable theory\n\nopen category_theory category_theory.limits opposite topological_space\n\nuniverses v u\n\nnamespace algebraic_geometry\n\nvariables {X Y : Scheme.{u}} (f : X ⟶ Y)\n\nopen category_theory.morphism_property\nopen algebraic_geometry.morphism_property (topologically)\n\nstructure valuative_comm_sq {X Y : Scheme.{u}} (f : X ⟶ Y) :=\n(R : Type.{u})\n[hR : comm_ring R]\n[hR₁ : is_domain R]\n[hR₂ : valuation_ring R]\n(K : Type.{u})\n[hK : field K]\n[hRK : algebra R K]\n[hRK' : is_fraction_ring R K]\n(i₁ : Scheme.Spec.obj (op $ CommRing.of K) ⟶ X)\n(i₂ : Scheme.Spec.obj (op $ CommRing.of R) ⟶ Y)\n(comm_sq : comm_sq i₁ (Scheme.Spec.map (CommRing.of_hom $ algebra_map R K).op) f i₂)\n.\ndef valuative_criterion.existence : morphism_property Scheme :=\nλ X Y f, ∀ S : valuative_comm_sq f, S.comm_sq.has_lift\n\ndef valuative_criterion.uniqueness : morphism_property Scheme :=\nλ X Y f, ∀ S : valuative_comm_sq f, subsingleton S.comm_sq.lift_struct\n\ndef valuative_criterion : morphism_property Scheme :=\nλ X Y f, ∀ S : valuative_comm_sq f, nonempty (unique (S.comm_sq.lift_struct))\n\nsection existence\n\nlemma valuative_criterion.existence.specializing_map (H : valuative_criterion.existence f) :\n specializing_map f.1.base :=\nbegin\n rintros x y (h : f.1.base x ⤳ y),\n let ϕ := Y.presheaf.stalk_specializes h ≫ PresheafedSpace.stalk_map f.1 x ≫ X.stalk_residue x,\n obtain ⟨A, hA, hA'⟩ := exists_factor_valuation_ring ϕ,\n let ϕ' := ϕ.cod_restrict A.to_subring hA,\n have : CommRing.of_hom ϕ' ≫ CommRing.of_hom (algebra_map ↥A ↥(X.residue_field x)) = ϕ,\n { ext, refl },\n obtain ⟨⟨H'⟩⟩ := H ⟨A, X.residue_field x, X.from_Spec_residue_field x,\n Scheme.Spec.map (CommRing.of_hom ϕ').op ≫ Y.from_Spec_stalk y, ⟨_⟩⟩,\n refine ⟨H'.l.1.base (local_ring.closed_point A), _, _⟩,\n { simp only [← functor.map_comp_assoc, ← op_comp, this, ϕ],\n erw op_comp,\n simp only [op_comp, functor.map_comp_assoc],\n erw Scheme.stalk_specializes_from_Spec_stalk h,\n rw [stalk_map_from_Spec_stalk, ← category.assoc], refl },\n { show local_ring A, by apply_instance },\n { change _ ⤳ _,\n conv_lhs { rw [← Scheme.from_Spec_residue_field_base x (⊥ : prime_spectrum $ X.residue_field x),\n ← (show _ = X.from_Spec_residue_field x, from H'.fac_left)] },\n refine specializes.map _ H'.l.1.base.2,\n apply_with local_ring.specializes_closed_point { instances := ff } },\n { rw [← Scheme.comp_val_base_apply, H'.fac_right],\n dsimp only,\n erw Scheme.comp_val_base_apply,\n convert Scheme.from_Spec_stalk_closed_point _,\n apply_with local_ring.comap_closed_point { instances := ff },\n exact hA' }\nend\n\n-- move me\nlemma _root_.category_theory.functor.preimage_injective {C D} [category C] [category D]\n (F : C ⥤ D) [full F] {X Y : C} : \n function.injective (F.preimage : _ → (X ⟶ Y)) :=\nλ f g e, by rw [← F.image_preimage f, ← F.image_preimage g, e]\n\nlemma valuative_criterion.existence.of_specializing_map\n (H : universally (topologically @specializing_map) f) :\n valuative_criterion.existence f :=\nbegin\n rintros ⟨R, K, i₁, i₂, c⟩,\n resetI,\n let X' := pullback f i₂,\n let S := Scheme.Spec.obj (op $ CommRing.of R),\n let f' : X' ⟶ S := pullback.snd,\n let i₁' : _ ⟶ X' := pullback.lift i₁ _ c.1,\n let x' : X'.carrier := i₁'.1.base (show prime_spectrum K, from local_ring.closed_point _),\n let s' : S.carrier := (show prime_spectrum R, from local_ring.closed_point _),\n have hxs : f'.1.base x' ⤳ s' := local_ring.specializes_closed_point _,\n have hf' : specializing_map f'.1.base := H _ _ _ (is_pullback.of_has_pullback _ _).flip,\n obtain ⟨x, hx : _ ⤳ _, e⟩ := hf' hxs,\n let ϕ : CommRing.of R ⟶ X'.stalk x := structure_sheaf.to_stalk R s' ≫\n S.presheaf.stalk_specializes (specializes_of_eq e) ≫ PresheafedSpace.stalk_map f'.1 x,\n haveI : is_local_ring_hom ϕ := by apply is_local_ring_hom_comp,\n let ψ : X'.presheaf.stalk x ⟶ CommRing.of K :=\n X'.presheaf.stalk_specializes hx ≫ stalk_closed_point_to _ i₁',\n have hϕ : ϕ ≫ ψ = CommRing.of_hom (algebra_map R K),\n { simp only [ϕ, stalk_closed_point_to, category.assoc,\n ← PresheafedSpace.stalk_map.stalk_specializes_stalk_map_assoc,\n Top.presheaf.stalk_specializes_comp_assoc],\n slice_lhs 3 4 { erw ← PresheafedSpace.stalk_map.comp },\n have : i₁'.val ≫ f'.val = (Scheme.Spec.map (CommRing.of_hom (algebra_map R K)).op).1 := \n congr_arg LocallyRingedSpace.hom.val (pullback.lift_snd i₁ _ c.1),\n erw [PresheafedSpace.stalk_map.congr_hom' _ _ this],\n simp only [category.assoc, Top.presheaf.stalk_specializes_comp_assoc],\n erw structure_sheaf.to_stalk_stalk_specializes_assoc,\n slice_lhs 1 2 { erw stalk_map_to_stalk },\n rw iso.comp_inv_eq,\n simp_rw category.assoc,\n erw structure_sheaf.to_stalk_comp_stalk_to_fiber_ring_hom,\n refl },\n have hψ := @bijective_range_restrict_comp_of_valuation_ring R (X'.presheaf.stalk x) K\n _ _ _ _ _ _ _ _ _ _ hϕ _,\n let ψ' : _ ⟶ CommRing.of R :=\n (ring_equiv.of_bijective _ hψ).symm.to_ring_hom.comp ψ.range_restrict,\n haveI : is_local_ring_hom ψ',\n { apply_with is_local_ring_hom_comp { instances := ff },\n { exact is_local_ring_hom_equiv (ring_equiv.of_bijective _ hψ).symm },\n { exact is_local_ring_hom_of_surjective _ ψ.range_restrict_surjective } },\n have hψ'' : ϕ ≫ ψ' = 𝟙 _, \n { ext1 y, exact (ring_equiv.of_bijective _ hψ).symm_apply_apply y },\n haveI : mono (CommRing.of_hom (algebra_map R K)),\n { apply functor.mono_of_mono_map (forget CommRing), rw mono_iff_injective,\n exact (is_fraction_ring.injective R K : _) },\n have hψ' : ψ' ≫ CommRing.of_hom (algebra_map R K) = ψ, \n { rw ← hϕ, apply ring_hom.ext, intro y,\n change ((ring_equiv.of_bijective _ hψ) $ (ring_equiv.of_bijective _ hψ).symm _).1 = _,\n rw ring_equiv.apply_symm_apply, refl },\n haveI : local_ring (CommRing.of R) := show local_ring R, by apply_instance,\n refine ⟨⟨⟨(Spec_to_equiv_of_local_ring (CommRing.of R) _).symm ⟨_, ψ', infer_instance⟩\n ≫ pullback.fst, _, _⟩⟩⟩,\n { dsimp only,\n transitivity i₁' ≫ pullback.fst, swap, { exact pullback.lift_fst _ _ _ },\n rw ← category.assoc, congr' 1,\n refine (functor.map_comp_assoc _ _ _ _).symm.trans _,\n dsimp only,\n rw [← op_comp, hψ', op_comp, functor.map_comp_assoc, Scheme.stalk_specializes_from_Spec_stalk],\n exact Spec_map_stalk_closed_point_to_from_stalk _ _ },\n { dsimp only,\n rw [category.assoc, pullback.condition, ← category.assoc],\n convert category.id_comp _,\n show (_ ≫ _) ≫ f' = 𝟙 _,\n apply Scheme.Spec.preimage_injective,\n rw ← cancel_epi (CommRing.of_hom (algebra_map R K)).op,\n apply Scheme.Spec.map_injective,\n simp only [functor.map_comp, op_comp, functor.image_preimage, category.assoc],\n rw [← functor.map_comp_assoc, ← op_comp, hψ', op_comp, functor.map_comp_assoc,\n Scheme.stalk_specializes_from_Spec_stalk_assoc],\n erw Spec_map_stalk_closed_point_to_from_stalk_assoc,\n rw [pullback.lift_snd, category.comp_id] }\nend\n.\nlemma valuative_criterion.existence_stable_under_base_change : \n valuative_criterion.existence.stable_under_base_change :=\nbegin\n rintros X Y Y' S f g h k H hg ⟨R, K, i₄, i₂, c⟩,\n resetI,\n obtain ⟨⟨⟨l, hl₁, hl₂⟩⟩⟩ := hg ⟨R, K, i₄ ≫ h, i₂ ≫ f, ⟨_⟩⟩,\n obtain ⟨l', hl₃, hl₄⟩ := pullback_cone.is_limit.lift' H.is_limit l i₂ hl₂,\n refine ⟨⟨⟨l', _, hl₄⟩⟩⟩,\n apply pullback_cone.is_limit.hom_ext H.is_limit,\n { simp only [category.assoc, hl₃, hl₁], refl },\n { simp only [category.assoc, hl₄, c.w.symm], refl },\n { simp only [category.assoc, ← c.w_assoc, H.w] }\nend\n\nlemma valuative_criterion.existence_eq :\n valuative_criterion.existence = universally (topologically @specializing_map) :=\nbegin\n apply le_antisymm,\n { rw ← valuative_criterion.existence_stable_under_base_change.universally_eq,\n exact universally_mono (λ X Y f, valuative_criterion.existence.specializing_map f) },\n { exact λ X Y f, valuative_criterion.existence.of_specializing_map f }\nend\n\nlemma universally_closed_eq_valuative_criterion : \n @universally_closed = @quasi_compact ⊓ valuative_criterion.existence :=\nby rw [valuative_criterion.existence_eq,\n universally_closed_eq_quasi_compact_and_universally_specializing]\n\nlemma universally_closed_of_valuative_criterion [quasi_compact f]\n (hf : valuative_criterion.existence f) : universally_closed f :=\nbegin\n rw universally_closed_eq_valuative_criterion,\n exact ⟨infer_instance, hf⟩\nend\n\n\nend existence\n\nsection uniqueness\n\nlemma separated_of_valuative_criterion [quasi_separated f]\n (hf : valuative_criterion.uniqueness f) : separated f :=\nbegin\n suffices : universally_closed (pullback.diagonal f),\n { constructor,\n apply is_closed_immersion.of_is_immersion,\n exactI (universally_closed.is_closed_map $ pullback.diagonal f).closed_range },\n apply universally_closed_of_valuative_criterion,\n rintro ⟨R, K, i₁, i₂, c⟩,\n resetI,\n have c' : comm_sq i₁ (Scheme.Spec.map (CommRing.of_hom (algebra_map R K)).op) f\n (i₂ ≫ pullback.fst ≫ f),\n { constructor, rw [← c.w_assoc, pullback.diagonal_fst_assoc] },\n have : i₂ ≫ pullback.fst = i₂ ≫ pullback.snd,\n { injection @@subsingleton.elim (hf ⟨R, K, i₁, i₂ ≫ pullback.fst ≫ f, c'⟩)\n ⟨i₂ ≫ pullback.fst, _, category.assoc _ _ _⟩ ⟨i₂ ≫ pullback.snd, _, _⟩; dsimp only,\n { rw [← c.w_assoc, pullback.diagonal_fst, category.comp_id] },\n { rw [← c.w_assoc, pullback.diagonal_snd, category.comp_id] },\n { rw [category.assoc, pullback.condition] } },\n refine ⟨⟨⟨i₂ ≫ pullback.fst, _, _⟩⟩⟩; dsimp only,\n { rw [← c.w_assoc, pullback.diagonal_fst, category.comp_id] },\n { apply pullback.hom_ext; simp only [category.assoc, pullback.diagonal_fst, pullback.diagonal_snd,\n category.comp_id, this] }\nend\n\nlemma separated.valuative_criterion [separated f] :\n valuative_criterion.uniqueness f :=\nbegin\n rintro ⟨R, K, i₁, i₂, c⟩,\n constructor,\n rintro ⟨l₁, hl₁, hl₁'⟩ ⟨l₂, hl₂, hl₂'⟩,\n ext1,\n dsimp only at *,\n let h := hl₁'.trans hl₂'.symm,\n have := is_closed_immersion_stable_under_base_change\n (pullback_fst_map_snd_is_pullback f f (pullback.diagonal f)\n (pullback.lift l₁ l₂ h)) infer_instance,\n haveI : is_iso (pullback.diagonal f ≫ pullback.snd),\n { rw [pullback.diagonal_snd], apply_instance },\n rw ← is_closed_immersion_respects_iso.cancel_right_is_iso _ pullback.snd at this,\n swap, { apply_instance },\n rw [pullback.lift_snd, category.comp_id] at this,\n let Z := pullback (pullback.diagonal f) (pullback.lift l₁ l₂ h),\n let g : Z ⟶ _ := pullback.snd,\n change is_closed_immersion g at this,\n resetI,\n haveI : is_affine Z := is_affine_of_affine g,\n have hg₂ := ((is_closed_immersion_over_affine_iff g).mp this).2,\n suffices : is_iso g,\n { resetI, \n refine (pullback.lift_fst l₁ l₂ h).symm.trans (eq.trans _ (pullback.lift_snd l₁ l₂ h)),\n rw [← cancel_epi g, ← pullback.condition_assoc, ← pullback.condition_assoc,\n pullback.diagonal_fst, pullback.diagonal_snd] },\n let l : Scheme.Spec.obj (op $ CommRing.of K) ⟶ Z :=\n pullback.lift i₁ (Scheme.Spec.map (CommRing.of_hom (algebra_map R K)).op) _,\n swap,\n { apply pullback.hom_ext; simp only [pullback.diagonal_fst, pullback.diagonal_snd,\n category.assoc, category.comp_id, pullback.lift_fst, pullback.lift_snd, hl₁, hl₂] },\n have hg : l ≫ g = Scheme.Spec.map (CommRing.of_hom (algebra_map R K)).op := pullback.lift_snd _ _ _,\n have hg₁ := ((morphism_property.injective_respects_iso _).arrow_mk_iso_iff\n (Γ_Spec_arrow_iso $ CommRing.of_hom $ algebra_map R K)).mp (is_fraction_ring.injective R K : _),\n rw [← hg, op_comp, functor.map_comp] at hg₁,\n rw is_iso_respects_iso.arrow_mk_iso_iff (Spec_Γ_arrow_iso_of_is_affine g),\n convert_to is_iso\n (Scheme.Spec.map (ring_equiv.of_bijective _ ⟨hg₁.of_comp, hg₂⟩).to_CommRing_iso.hom.op),\n apply_instance\nend\n\nlemma separated_eq_valuative_criterion :\n @separated = @quasi_separated ⊓ valuative_criterion.uniqueness :=\nbegin\n ext X Y f, split,\n { introI H, exact ⟨infer_instance, separated.valuative_criterion f⟩ },\n { rintro ⟨h₁, h₂⟩, exactI separated_of_valuative_criterion f h₂ }\nend\n\nend uniqueness\n\nlemma valuative_criterion_eq :\n valuative_criterion = valuative_criterion.existence ⊓ valuative_criterion.uniqueness :=\nbegin\n ext X Y f,\n refine (forall_congr _).trans forall_and_distrib,\n intro S,\n split,\n { rintro ⟨h⟩, exactI ⟨⟨⟨h.1.1⟩⟩, infer_instance⟩ },\n { rintro ⟨⟨⟨h₁⟩⟩, _⟩, exactI ⟨⟨⟨h₁⟩, λ _, subsingleton.elim _ _⟩⟩ }\nend\n\nlemma proper_eq_valuative_criterion :\n @proper = @quasi_compact ⊓ @quasi_separated ⊓ @locally_of_finite_type ⊓ valuative_criterion :=\nbegin\n rw [proper_eq, valuative_criterion_eq, separated_eq_valuative_criterion,\n universally_closed_eq_valuative_criterion],\n simp_rw [inf_comm, inf_assoc, inf_left_comm],\n congr' 2,\n rw [inf_comm, inf_assoc]\nend\n\nend algebraic_geometry", "meta": {"author": "erdOne", "repo": "lean-AG-morphisms", "sha": "bfb65e7d5c17f333abd7b1806717f12cd29427fd", "save_path": "github-repos/lean/erdOne-lean-AG-morphisms", "path": "github-repos/lean/erdOne-lean-AG-morphisms/lean-AG-morphisms-bfb65e7d5c17f333abd7b1806717f12cd29427fd/src/morphisms/valuative_criterion.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.640635868562172, "lm_q2_score": 0.30404167496654744, "lm_q1q2_score": 0.1947800025212917}} {"text": "import for_mathlib.category_theory.abelian.extensions\nimport for_mathlib.algebra.homology.double\n\nnoncomputable theory\n\nopen category_theory category_theory.limits category_theory.category derived_category\n\nnamespace homological_complex\n\nvariables {C ι : Type*} [category C] [has_zero_morphisms C] [has_zero_object C]\n (c : complex_shape ι) (n : ι) [decidable_eq ι]\n\nend homological_complex\n\nvariables {C : Type*} [category C] [abelian C]\n\n@[simps]\ndef category_theory.short_complex.short_exact.extension\n {S : short_complex C} (ex : S.short_exact) :\n category_theory.abelian.extension S.X₃ S.X₁ :=\n{ X := S.X₂,\n i := S.f,\n p := S.g,\n w := S.zero,\n ex := begin\n refine (short_complex.short_exact.iff_of_iso _).1 ex,\n exact (short_complex.mk_iso (iso.refl _) (iso.refl _) (iso.refl _) (by tidy) (by tidy)),\n end, }\n\ninstance category_theory.preadditive.is_iso_neg {C : Type*} [category C] [preadditive C]\n {X Y : C} (f : X ⟶ Y) [is_iso f] : is_iso (-f) :=\nby simpa only [iso.trans_hom, preadditive.mul_iso_hom, units.coe_neg_one, iso.refl_hom,\n neg_smul, one_zsmul, as_iso_hom, preadditive.neg_comp, id_comp]\n using is_iso.of_iso ((preadditive.mul_iso (-1 : units ℤ) (iso.refl X)).trans (as_iso f))\n\n@[simp]\nlemma category_theory.preadditive.neg_inv {C : Type*} [category C] [preadditive C]\n {X Y : C} (f : X ⟶ Y) [is_iso f] : inv (-f) = - inv f :=\nby rw [← cancel_mono (-f), is_iso.inv_hom_id, preadditive.neg_comp,\n preadditive.comp_neg, neg_neg, is_iso.inv_hom_id]\n\nopen category_theory category_theory.limits category_theory.category derived_category\n\nnamespace category_theory.abelian\n\nnamespace extension\n\nvariables {A B : C} (e : extension A B)\n\ndef σ := cochain_complex.double.σ (neg_add_self 1) e.w\ndef ι := cochain_complex.double.ι (neg_add_self 1) e.p\ndef σ' := cochain_complex.double.σ' (neg_add_self 1) e.w\ndef π := cochain_complex.double.π (neg_add_self 1) e.i\n\ndef homotopy_πσ'_σι : homotopy (e.π ≫ e.σ') (-e.σ ≫ e.ι) :=\ncochain_complex.double.homotopy_πσ'_σι (neg_add_self 1) e.w\n\ninstance : quasi_iso e.σ :=\ncochain_complex.double.quasi_iso_σ (neg_add_self 1) e.w e.ex\n\ninstance : quasi_iso e.σ' :=\ncochain_complex.double.quasi_iso_σ' (neg_add_self 1) e.w e.ex\n\ndef δ' : (single_functor C 0).obj A ⟶ (single_functor C (-1)).obj B :=\n-inv (Q.map e.σ) ≫ Q.map e.π\n\nlemma δ'_eq : e.δ' = -inv (Q.map e.σ) ≫ Q.map e.π := rfl\n\nlemma δ'_eq' : e.δ' = Q.map e.ι ≫ inv (Q.map e.σ') :=\nby simp only [δ', ← cancel_epi (Q.map e.σ), ← cancel_mono (Q.map e.σ'), assoc,\n is_iso.hom_inv_id_assoc, preadditive.comp_neg, preadditive.neg_comp, is_iso.inv_hom_id,\n comp_id, ← Q.map_comp, derived_category.Q_map_eq_of_homotopy _ _ e.homotopy_πσ'_σι,\n functor.map_neg, neg_neg]\n\nlemma δ_eq'' : e.δ' = (short_complex.short_exact.extension e.ex).δ' := rfl\n\ndef δ : (single_functor C 0).obj A ⟶ ((single_functor C 0).obj B)⟦(1 : ℤ)⟧ :=\ne.δ' ≫ (single_functor_shift_iso C 0 1 (-1) (neg_add_self 1)).inv.app B\n\ndef triangle : pretriangulated.triangle (derived_category C) :=\npretriangulated.triangle.mk ((single_functor C 0).map e.i) ((single_functor C 0).map e.p) e.δ\n\n@[simps]\ndef single_short_complex : short_complex (cochain_complex C ℤ) :=\nshort_complex.mk ((homological_complex.single C _ 0).map e.i)\n ((homological_complex.single C _ 0).map e.p)\n (by rw [← functor.map_comp, e.w, functor.map_zero])\n\nlemma single_short_complex_short_exact : e.single_short_complex.short_exact :=\nshort_complex.short_exact.map_of_exact e.ex (homological_complex.single C (complex_shape.up ℤ) 0)\n\ndef iso_mapping_cone := cochain_complex.double_iso_mapping_cone e.i\n\nlemma compatibility_mapping_cone_σ : e.σ = (cochain_complex.double_iso_mapping_cone e.i).hom ≫\n cochain_complex.from_mapping_cone_of_ses e.single_short_complex_short_exact :=\nbegin\n refine cochain_complex.from_double_ext (neg_add_self 1) _ _ _ _,\n { dsimp,\n simp only [σ, cochain_complex.from_mapping_cone_of_ses, single_short_complex_g,\n cochain_complex.double.σ_f₁, id_comp, cochain_complex.double.desc.f₁, assoc,\n zero_eq_neg, preadditive.is_iso.comp_left_eq_zero],\n erw [cochain_complex.mapping_cone.inl_desc_v, cochain_complex.hom_complex.cochain.zero_v,\n comp_zero], },\n { dsimp,\n simp only [σ, cochain_complex.from_mapping_cone_of_ses, single_short_complex_g,\n cochain_complex.double.σ_f₂, homological_complex.single_obj_X_self_inv,\n eq_to_hom_refl, comp_id, id_comp, cochain_complex.double.desc.f₂, assoc],\n erw [cochain_complex.mapping_cone.inr_desc_f],\n dsimp,\n simp only [eq_self_iff_true, comp_id, id_comp, if_true], },\nend\n\nopen cochain_complex.hom_complex\n\nlemma compatibility_mapping_cone_π :\n e.π = -(cochain_complex.double_iso_mapping_cone e.i).hom ≫\n cochain_complex.mapping_cone.δ ((homological_complex.single C _ 0).map e.i) ≫\n (cochain_complex.single_shift_iso C 0 1 (-1) (neg_add_self 1).symm).hom.app B :=\nbegin\n refine cochain_complex.to_single_ext _ _ (-1) _,\n simp only [π, cochain_complex.mapping_cone.δ, cochain_complex.double.π_f, eq_to_hom_refl,\n cochain_complex.double.desc.f₁, comp_id, homological_complex.single_obj_X_self_inv,\n id_comp, cochain_complex.double_iso_mapping_cone_hom, homological_complex.neg_f_apply,\n homological_complex.comp_f, cochain_complex.double.desc_f,\n cochain_complex.hom_complex.cocycle.hom_of_f,\n cochain_complex.hom_complex.cocycle.right_shift_coe,\n cochain_complex.mapping_cone.δ_as_cocycle_coe, assoc,\n cochain_complex.hom_complex.cochain.right_shift_v _ 1 0\n (zero_add 1).symm (-1) (-1) (by linarith) 0 (neg_add_self 1).symm, cochain.neg_v,\n preadditive.neg_comp, preadditive.comp_neg, neg_neg],\n erw cochain_complex.mapping_cone.inl_fst_assoc,\n dsimp [cochain_complex.double.X_iso₁, homological_complex.X_iso_of_eq, iso.refl,\n cochain_complex.single_shift_iso, cochain_complex.single_shift_iso_app],\n simp only [cochain_complex.lift_single_f, id_comp],\n erw [id_comp, id_comp],\n refl,\nend\n\nlemma δ_eq_triangle_of_ses_δ :\n e.δ = triangle_of_ses_δ e.single_short_complex_short_exact :=\nbegin\n dsimp [triangle_of_ses_δ, δ, δ', mapping_cone_triangle],\n simp only [← cancel_epi (Q.map (cochain_complex.from_mapping_cone_of_ses\n e.single_short_complex_short_exact)), is_iso.hom_inv_id_assoc,\n ← Q.map (cochain_complex.double_iso_mapping_cone e.i).hom,\n preadditive.neg_comp, preadditive.comp_neg,\n e.compatibility_mapping_cone_σ, functor.map_neg, Q.map_comp, preadditive.neg_inv,\n is_iso.inv_comp, neg_neg, assoc,\n ← cancel_epi (Q.map (cochain_complex.double_iso_mapping_cone e.i).hom), mapping_cone_δ,\n ← cancel_mono ((Q.comm_shift_iso (1 : ℤ)).inv.app ((homological_complex.single C _ 0).obj B)),\n iso.hom_inv_id_app, single_functor_shift_iso_inv_app, compatibility_mapping_cone_π],\n erw [← Q.map_comp, iso.hom_inv_id_app, Q.map_id],\n refl,\nend\n\nlemma triangle_iso : e.triangle ≅ triangle_of_ses e.single_short_complex_short_exact :=\npretriangulated.triangle.mk_iso _ _ (iso.refl _) (iso.refl _) (iso.refl _) (by tidy) (by tidy)\n (by { dsimp [triangle], simp only [category_theory.functor.map_id, comp_id,\n id_comp, δ_eq_triangle_of_ses_δ], })\n\nlemma triangle_distinguished : e.triangle ∈ dist_triang (derived_category C) :=\npretriangulated.isomorphic_distinguished _ (triangle_of_ses_dist _) _ e.triangle_iso\n\nlemma iso_of_triangle_map (e₁ e₂ : extension A B)\n (φ : e₁.triangle ⟶ e₂.triangle) (hφ₁ : φ.hom₁ = 𝟙 _) (hφ₃ : φ.hom₃ = 𝟙 _) : e₁ ≅ e₂ :=\nas_iso begin\n have eq₁ := φ.comm₁,\n have eq₂ := φ.comm₂,\n dsimp only [triangle] at eq₁ eq₂,\n simp only [pretriangulated.triangle.mk_mor₁, hφ₁] at eq₁,\n erw id_comp at eq₁,\n simp only [pretriangulated.triangle.mk_mor₂, hφ₃] at eq₂,\n erw comp_id at eq₂,\n refine extension.hom.mk' ((single_functor C 0).preimage φ.hom₂) _ _,\n { apply (single_functor C 0).map_injective,\n rw [functor.map_comp, functor.image_preimage, eq₁], },\n { apply (single_functor C 0).map_injective,\n rw [functor.map_comp, functor.image_preimage, eq₂], },\nend\n\nsection naturality\n\nvariables {S₁ S₂ : short_complex C} (φ : S₁ ⟶ S₂)\n (ex₁ : S₁.short_exact) (ex₂ : S₂.short_exact)\n\ninclude φ ex₁ ex₂\n\n@[reassoc]\nlemma σ_naturality :\n ex₁.extension.σ ≫ (homological_complex.single C _ 0).map φ.τ₃ =\n cochain_complex.double.map (neg_add_self 1) S₁.f S₂.f φ.τ₁ φ.τ₂ φ.comm₁₂.symm ≫\n ex₂.extension.σ :=\nbegin\n refine cochain_complex.to_single_ext _ _ 0 _,\n { dsimp only [short_complex.short_exact.extension, extension.σ],\n simp only [homological_complex.comp_f, cochain_complex.double.σ_f₂,\n homological_complex.single_obj_X_self_inv, eq_to_hom_refl,\n comp_id, homological_complex.single_map_f_self, homological_complex.single_obj_X_self_hom,\n assoc, cochain_complex.double.map_f₂, iso.inv_hom_id_assoc, iso.cancel_iso_hom_left,\n φ.comm₂₃],\n erw id_comp, },\nend\n\n@[reassoc]\nlemma π_naturality :\n ex₁.extension.π ≫ (homological_complex.single C _ (-1 : ℤ)).map φ.τ₁ =\n cochain_complex.double.map (neg_add_self 1) S₁.f S₂.f φ.τ₁ φ.τ₂ φ.comm₁₂.symm ≫\n ex₂.extension.π :=\nbegin\n refine cochain_complex.to_single_ext _ _ (-1) _,\n { dsimp only [short_complex.short_exact.extension, extension.π],\n simp only [homological_complex.comp_f, cochain_complex.double.π_f, eq_to_hom_refl,\n cochain_complex.double.desc.f₁, comp_id, homological_complex.single_map_f_self,\n homological_complex.single_obj_X_self_hom, homological_complex.single_obj_X_self_inv,\n cochain_complex.double.map_f₁, assoc, iso.inv_hom_id, iso.cancel_iso_hom_left],\n apply id_comp, },\nend\n\n@[reassoc]\nlemma δ'_naturality :\n ex₁.extension.δ' ≫ (single_functor C (-1)).map φ.τ₁ =\n (single_functor C 0).map φ.τ₃ ≫ ex₂.extension.δ' :=\nbegin\n dsimp only [extension.δ', single_functor, functor.comp_map],\n have hσ := Q.congr_map (σ_naturality φ ex₁ ex₂),\n have hπ := Q.congr_map (π_naturality φ ex₁ ex₂),\n simp only [Q.map_comp, ← cancel_mono (inv (Q.map ex₂.extension.σ)), assoc,\n is_iso.hom_inv_id, comp_id] at hσ,\n simp only [Q.map_comp] at hπ,\n simp only [← cancel_epi (Q.map ex₁.extension.σ), assoc, is_iso.hom_inv_id_assoc,\n hπ, ← hσ, preadditive.comp_neg, preadditive.neg_comp],\nend\n\n@[reassoc]\nlemma δ_naturality :\n ex₁.extension.δ ≫ ((single_functor C 0).map φ.τ₁)⟦1⟧' =\n (single_functor C 0).map φ.τ₃ ≫ ex₂.extension.δ :=\nbegin\n dsimp only [extension.triangle, pretriangulated.triangle.mk, extension.δ],\n simpa only [← δ'_naturality_assoc φ ex₁ ex₂, assoc, nat_trans.naturality],\nend\n\n@[simps]\ndef triangle_map : ex₁.extension.triangle ⟶ ex₂.extension.triangle :=\n{ hom₁ := (single_functor C 0).map φ.τ₁,\n hom₂ := (single_functor C 0).map φ.τ₂,\n hom₃ := (single_functor C 0).map φ.τ₃,\n comm₁' := by simpa only [functor.map_comp] using (single_functor C 0).congr_map φ.comm₁₂.symm,\n comm₂' := by simpa only [functor.map_comp] using (single_functor C 0).congr_map φ.comm₂₃.symm,\n comm₃' := δ_naturality φ ex₁ ex₂, }\n\nend naturality\n\nend extension\n\nnamespace extensions\n\nvariables {A B : C} (e : extension A B)\n\ndef δ : extensions A B → ((single_functor C 0).obj A ⟶\n ((single_functor C 0).obj B)⟦(1 : ℤ)⟧) :=\nquot.lift extension.δ begin\n rintros E₁ E₂ ⟨e⟩,\n have eq := extension.δ_naturality\n ((extension.to_short_exact_sequence_functor A B).map e.hom) E₁.ex E₂.ex,\n dsimp at eq,\n simpa only [category_theory.functor.map_id, id_comp, comp_id] using eq,\nend\n\nvariable (C)\n\n@[simps]\ndef δ_nat_trans : extensions_functor C ⟶\n ((single_functor C 0).op ⋙ (single_functor C 0 ⋙ shift_functor _ (1 : ℤ) ⋙ yoneda).flip).flip :=\n{ app := λ B,\n { app := λ A, extensions.δ,\n naturality' := λ A₁ A₂ π, begin\n ext e,\n obtain ⟨E, rfl⟩ := quotient.surjective_quotient_mk' e,\n have eq := extension.δ_naturality (E.pull_short_complex π.unop)\n ((E.pull π.unop).ex) E.ex,\n dsimp at eq,\n simpa only [category_theory.functor.map_id, comp_id] using eq,\n end, },\n naturality' := begin\n rintro B₁ B₂ ι,\n ext A e,\n obtain ⟨E, rfl⟩ := quotient.surjective_quotient_mk' e,\n have eq := extension.δ_naturality (E.push_short_complex ι) E.ex (E.push ι).ex,\n dsimp at eq,\n simpa only [category_theory.functor.map_id, id_comp] using eq.symm,\n end, }\n\nvariables {C}\n\nlemma δ_nat_trans_surjective'\n (φ : (single_functor C 0).obj A ⟶ ((single_functor C 0).obj B)⟦(1 : ℤ)⟧) :\n ∃ (e : extension A B), φ = e.δ :=\nbegin\n obtain ⟨φ, rfl⟩ : ∃ (φ' : (single_functor C 0).obj A ⟶ (single_functor C (-1)).obj B),\n φ = φ' ≫ (single_functor_shift_iso C 0 1 (-1) (neg_add_self 1)).inv.app B,\n { refine ⟨φ ≫ (single_functor_shift_iso C 0 1 (-1) (neg_add_self 1)).hom.app B, _⟩,\n simp only [assoc, iso.hom_inv_id_app],\n erw comp_id, },\n suffices : ∃ (E' A' : C) (f' : A ⟶ A') (i' : B ⟶ E') (p' : E' ⟶ A') (w : i' ≫ p' = 0)\n (ex : (short_complex.mk _ _ w).short_exact),\n φ ≫ Q.map ex.extension.σ' = (single_functor C 0).map f' ≫ Q.map ex.extension.ι,\n { obtain ⟨E', A', f', i', p', w, ex, z⟩ := this,\n refine ⟨ex.extension.pull f', _⟩,\n have eq := extension.δ_naturality (ex.extension.pull_short_complex f')\n (ex.extension.pull f').ex ex.extension.ex,\n simp only [extension.pull_short_complex, category_theory.functor.map_id, comp_id] at eq,\n refine trans _ eq.symm,\n dsimp only [extension.δ],\n rw ← assoc,\n congr' 1,\n erw [extension.δ'_eq', ← cancel_mono (Q.map ex.extension.σ'), assoc, assoc, is_iso.inv_hom_id,\n comp_id],\n exact z, },\n haveI : cochain_complex.is_strictly_le ((homological_complex.single C\n (complex_shape.up ℤ) (-1)).obj B) 0 :=\n cochain_complex.is_strictly_le_of_le _ (-1) 0 (by linarith),\n obtain ⟨E', A', p', f, s, hs, eq⟩ : ∃ (B' E' : C) (i' : B' ⟶ E')\n (f : (homological_complex.single C _ 0).obj A ⟶ cochain_complex.double (neg_add_self 1) i')\n (s : (homological_complex.single C _ (-1)).obj B ⟶ cochain_complex.double (neg_add_self 1) i')\n (hs : quasi_iso s), by { haveI := hs, exact φ = Q.map f ≫ inv (Q.map s), },\n { obtain ⟨L', L'_le, L'_ge, f, s, hs, hφ⟩ :=\n left_factorisation_of_is_strictly_le_of_is_strictly_ge φ 0 (-1),\n haveI := L'_le,\n obtain ⟨E', A', p', ⟨e⟩⟩ := cochain_complex.exists_iso_double (neg_add_self 1) L',\n refine ⟨E', A', p', f ≫ e.hom, s ≫ e.hom, infer_instance, _⟩,\n simp only [hφ, Q.map_comp, is_iso.inv_comp, assoc, is_iso.hom_inv_id_assoc], },\n obtain ⟨f', rfl⟩ := cochain_complex.eq_single_to_double' f,\n obtain ⟨i', w, hs'⟩ := cochain_complex.eq_single_to_double s,\n refine ⟨E', A', f', i', p', w, _, _⟩,\n { simpa only [hs', cochain_complex.single_to_double_quasi_iso_iff] using hs, },\n { dsimp only [single_functor, functor.comp_map],\n rw ← Q.map_comp,\n haveI := hs,\n simp only [← cancel_mono (Q.map s), assoc, is_iso.inv_hom_id, comp_id, hs'] at eq,\n convert eq,\n refine cochain_complex.from_single_ext _ _ 0 _,\n dsimp [short_complex.short_exact.extension, extension.ι],\n simp only [eq_self_iff_true, comp_id, id_comp, if_true, cochain_complex.double.lift.f₂,\n cochain_complex.desc_single_f],\n erw id_comp, },\nend\n\nlemma _root_.category_theory.abelian.extension.δ_eq_iff (e₁ e₂ : extension A B) :\n (e₁.δ = e₂.δ) ↔ nonempty (e₁ ≅ e₂) :=\nbegin\n split,\n { intro h,\n obtain ⟨β, hβ₁, hβ₂⟩ := pretriangulated.complete_distinguished_triangle_morphism₂ _ _\n e₁.triangle_distinguished e₂.triangle_distinguished (𝟙 _) (𝟙 _)\n (by simpa only [category_theory.functor.map_id, comp_id, id_comp] using h),\n let γ : e₁.triangle ⟶ e₂.triangle :=\n { hom₁ := 𝟙 _,\n hom₂ := β,\n hom₃ := 𝟙 _, },\n exact ⟨extension.iso_of_triangle_map e₁ e₂ γ rfl rfl⟩, },\n { rintro ⟨h⟩,\n change extensions.δ (quot.mk _ e₁) = extensions.δ (quot.mk _ e₂),\n congr' 1,\n exact quot.sound ⟨h⟩, },\nend\n\nvariables (A B)\n\nlemma δ_nat_trans_bijective :\n function.bijective (@extensions.δ _ _ _ A B) :=\nbegin\n split,\n { rintros ⟨e₁⟩ ⟨e₂⟩ (h : e₁.δ = e₂.δ),\n rw extension.δ_eq_iff at h,\n exact quot.sound h, },\n { intro φ,\n obtain ⟨e, rfl⟩ := δ_nat_trans_surjective' φ,\n exact ⟨quotient.mk' e, rfl⟩, },\nend\n\ninstance : is_iso (δ_nat_trans C) :=\nbegin\n haveI : ∀ (A : C), is_iso ((δ_nat_trans C).app A),\n { intro A,\n haveI : ∀ (B : Cᵒᵖ), is_iso (((δ_nat_trans C).app A).app B),\n { intro B,\n rw is_iso_iff_bijective,\n apply δ_nat_trans_bijective, },\n apply nat_iso.is_iso_of_is_iso_app, },\n apply nat_iso.is_iso_of_is_iso_app,\nend\n\nvariable (C)\n\n@[simps]\ndef δ_nat_iso := as_iso (δ_nat_trans C)\n\nend extensions\n\nnamespace extension\n\nvariables (A B : C)\n\n@[simp]\nlemma trivial.δ : (trivial A B).δ = 0 :=\nbegin\n haveI : is_split_epi (abelian.extension.trivial A B).triangle.mor₂ := is_split_epi.mk'\n { section_ := Q.map ((homological_complex.single _ _ _).map biprod.inr),\n id' := begin\n erw [← functor.map_comp, ← functor.map_comp, biprod.inr_snd,\n category_theory.functor.map_id, category_theory.functor.map_id],\n refl,\n end, },\n simpa only [← cancel_epi (abelian.extension.trivial A B).triangle.mor₂, comp_zero]\n using pretriangulated.triangle.comp_zero₂₃ _ (trivial A B).triangle_distinguished,\nend\n\n\nvariables {A B}\n\nlemma δ_eq_zero_iff (e : extension A B) : e.δ = 0 ↔ nonempty (e ≅ trivial A B) :=\nby simp only [← extension.δ_eq_iff, trivial.δ]\n\nlemma δ_neq_zero_iff (e : extension A B) : e.δ ≠ 0 ↔ is_empty (e ≅ trivial A B) :=\nby simpa only [not_nonempty_iff] using e.δ_eq_zero_iff.not\n\nend extension\n\nend category_theory.abelian\n", "meta": {"author": "joelriou", "repo": "homotopical_algebra", "sha": "697f49d6744b09c5ef463cfd3e35932bdf2c78a3", "save_path": "github-repos/lean/joelriou-homotopical_algebra", "path": "github-repos/lean/joelriou-homotopical_algebra/homotopical_algebra-697f49d6744b09c5ef463cfd3e35932bdf2c78a3/src/for_mathlib/category_theory/abelian/extensions_derived_category.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5350984286266116, "lm_q2_score": 0.3629692055196168, "lm_q1q2_score": 0.1942242515133966}} {"text": "import dnf\n\nnamespace first_order\n\nsection quantifier_elimination\n\nvariables {L : language} (A : Type) (Γ : list (formula L)) {φ φ₁ φ₂ ψ : formula L} {p q : formula L}\nvariable [has_coe A (formula L)]\n\n/- If a formula φ has has quantifier elimination in a theory -/\n@[simp]\ndef equiv_qf (φ : formula L) := ∃ ψ : qf L, (A∣[] ⊢ φ) ↔ (A∣[] ⊢ (ψ : formula L))\n\ndef Eq_equiv_qf {A : Type} [has_coe A (formula L)] : ((A∣[] ⊢ p) ↔ (A∣[] ⊢ q)) → (equiv_qf A p → equiv_qf A q) := begin\n intros h₁ h₂,\n rcases h₂ with ⟨φ₃, h₃⟩,\n existsi φ₃,\n split,\n intro h₄,\n apply h₃.mp (h₁.mpr h₄),\n intro h₄,\n apply h₁.mp (h₃.mpr h₄),\nend\n\n/- If a theory Γ has quantifier elimination -/\n@[simp]\ndef qe := ∀ (φ : formula L), equiv_qf A φ\n\n/- If a theory Γ has quantifier elimination on conjunctions of literals with\n with a single existential quantifier -/\ndef qe_ecl1 := ∀ (φ : ecl1 L), equiv_qf A (φ : formula L)\n\n/- If a theory Γ has quantifier elimination on disjunctions of conjunctions\n of literals with a single existential quantifier -/\ndef qe_edcl1 := ∀ (φ : edcl1 L), equiv_qf A (φ : formula L)\n\n/- If a theory Γ has quantifier elimination on disjunctions of conjugations \n of literals with a single quantifier -/\n@[simp]\ndef qe_qdcl1 := ∀ (φ : qdcl1 L), equiv_qf A (φ : formula L)\n\n@[simp]\ndef qe_dnf := ∀ (φ : dnf L), equiv_qf A (φ : formula L)\n\n/- If a theory Γ has quantifier elimination on quantifier free formulas -/\n@[simp]\ndef qe_qf := ∀ (φ : qf L), equiv_qf A (φ : formula L)\n\n/- All theories have quantifier elimination on quantifier free formulas -/\ndef for_all_qe_qf : @qe_qf L A _ := by { intros φ, existsi φ, refl }\n\n/- If a theory has quantifier elimination on φ₁ φ₂ then it has quantifier \n elimination on (φ₁ or φ₂) -/\nlemma equiv_qf_or_equiv_qf : equiv_qf A φ₁ → equiv_qf A φ₂ → equiv_qf A (φ₁ or φ₂) := begin\n intros h_φ₁ h_φ₂,\n rcases h_φ₁ with ⟨φ₁', h₁⟩,\n rcases h_φ₂ with ⟨φ₂', h₂⟩,\n apply Eq_equiv_qf (R_Eq_Or_ ⟨h₁.mpr, h₁.mp⟩ ⟨h₂.mpr, h₂.mp⟩),\n existsi (qf.o φ₁' φ₂'), refl,\nend\n\nlemma qe_ecl1_qe_edcl1 : (∀ x : ℕ, @var_not_free_in_axioms L x A _) → ((@qe_ecl1 L A _) → (@qe_edcl1 L A _)) := begin\n intros h h₁ φ,\n cases φ,\n { existsi (φ : qf L), refl, },\n { induction φ_ᾰ_1,\n rcases (h₁ (ecl1.ex φ_ᾰ φ_ᾰ_1)) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨h₂.mpr, h₂.mp⟩,\n existsi φ₂, refl,\n rcases φ_ᾰ_1_ih_ᾰ with ⟨φ₂, h₂⟩,\n rcases φ_ᾰ_1_ih_ᾰ_1 with ⟨φ₃, h₃⟩,\n apply Eq_equiv_qf ⟨R_ (ExOrOut (h φ_ᾰ)), R_ (ExOrIn (h φ_ᾰ))⟩,\n apply Eq_equiv_qf (R_Eq_Or_ ⟨h₂.mpr, h₂.mp⟩ ⟨h₃.mpr, h₃.mp⟩),\n existsi qf.o φ₂ φ₃, refl,\n },\nend\n\nlemma qe_edcl1_qe_qdcl1 : (@qe_edcl1 L A _) → (@qe_qdcl1 L A _) := begin\n intros h₁ φ,\n induction φ,\n { existsi (φ : qf L), refl, },\n { \n rcases (qf_equiv_dcl A (qf.n ↑φ_ᾰ_1)) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨R_ Ex_To_All, R_ All_To_Ex⟩,\n apply Eq_equiv_qf\n (R_Eq_Not_ (R_Eq_Ex_ ⟨h₂.mpr, h₂.mp⟩)),\n rcases (h₁ (edcl1.ex φ_ᾰ φ₂)) with ⟨φ₃, h₃⟩,\n apply Eq_equiv_qf (R_Eq_Not_ ⟨h₃.mpr, h₃.mp⟩),\n existsi (qf.n φ₃), refl,\n },\n { rcases (h₁ (edcl1.ex φ_ᾰ φ_ᾰ_1)) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨h₂.mpr, h₂.mp⟩,\n existsi φ₂, refl,\n }\nend\n\nlemma qe_qdcl1_qe_dnf : (@qe_qdcl1 L A _) → (@qe_dnf L A _) := begin\n intros h₁ φ₁,\n induction φ₁,\n { existsi (φ₁ : qf L), refl, },\n { cases φ₁_ᾰ_1,\n { rcases (h₁ (qdcl1.al φ₁_ᾰ φ₁_ᾰ_1)) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨h₂.mpr, h₂.mp⟩,\n existsi φ₂, refl, },\n all_goals { rcases φ₁_ih with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf (R_Eq_All_ ⟨h₂.mpr, h₂.mp⟩),\n rcases (qf_equiv_dcl A φ₂) with ⟨φ₃, h₃⟩,\n apply Eq_equiv_qf (R_Eq_All_ ⟨h₃.mpr, h₃.mp⟩),\n rcases (h₁ (qdcl1.al φ₁_ᾰ φ₃)) with ⟨φ₄, h₄⟩,\n apply Eq_equiv_qf ⟨h₄.mpr, h₄.mp⟩,\n existsi φ₄, refl,\n },\n },\n { induction φ₁_ᾰ_1,\n { rcases (h₁ (qdcl1.ex φ₁_ᾰ φ₁_ᾰ_1)) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨h₂.mpr, h₂.mp⟩,\n existsi φ₂, refl, },\n all_goals { rcases φ₁_ih with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf (R_Eq_Ex_ ⟨h₂.mpr, h₂.mp⟩),\n rcases (qf_equiv_dcl A φ₂) with ⟨φ₃, h₃⟩,\n apply Eq_equiv_qf (R_Eq_Ex_ ⟨h₃.mpr, h₃.mp⟩),\n rcases (h₁ (qdcl1.ex φ₁_ᾰ φ₃)) with ⟨φ₄, h₄⟩,\n apply Eq_equiv_qf ⟨h₄.mpr, h₄.mp⟩,\n existsi φ₄, refl,\n },\n }\nend\n\n/- If a theory has quantifer elimination on conjunctions of literals with \n a single existential quantifier, it has quantifier elimination -/\nlemma qe_ecl1_qe : (∀ x : ℕ, @var_not_free_in_axioms L x A _) → ((@qe_ecl1 L A _) → (@qe L A _)) := begin\n intros h₁ h₂,\n have h_dnf : qe_dnf A := \n by { apply qe_qdcl1_qe_dnf, apply qe_edcl1_qe_qdcl1,\n apply qe_ecl1_qe_edcl1 A h₁, assumption },\n intro φ₁,\n rcases (for_all_equiv_dnf A φ₁) with ⟨φ₂, h₂⟩,\n apply Eq_equiv_qf ⟨h₂.mpr, h₂.mp⟩,\n rcases (h_dnf φ₂) with ⟨φ₃, h₃⟩,\n apply Eq_equiv_qf ⟨h₃.mpr, h₃.mp⟩,\n existsi φ₃, refl,\nend\n\n/- Deciable sentences in a theory -/\n--def decidable_sent (φ : sentence L) : Prop \n-- := ((A∣[] ⊢ (φ : formula L)) ↔ (A∣Γ ⊢ F)) ∨ ((A∣[] ⊢ φ) ↔ (A∣Γ ⊢ T))\n\nend quantifier_elimination\n\nend first_order", "meta": {"author": "pilottinick", "repo": "QuantifierElimination", "sha": "770ebc3f8075c9c75d791d1cc0ffde4dd9c8dafc", "save_path": "github-repos/lean/pilottinick-QuantifierElimination", "path": "github-repos/lean/pilottinick-QuantifierElimination/QuantifierElimination-770ebc3f8075c9c75d791d1cc0ffde4dd9c8dafc/src/quantifier_elimination.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5428632831725052, "lm_q2_score": 0.35577489351363034, "lm_q1q2_score": 0.1931371267631578}} {"text": "import parlang\n\n/- IDEA: try to remove the active map from the assertions -/\n\nnamespace parlang\n\nopen kernel\n\n-- notation ac ` ⇃ ` c ` ◂ ` x:(foldr ` ◂ ` (h t, deactivate_threads c ac h) ac) := x\nnotation ac ` ⇃ ` c ` ◂ ` s := deactivate_threads c ac s\n\nexample {σ₁ ι₁ ι₂ : Type} {τ₁ : ι₁ → Type} {τ₂ : ι₂ → Type} [decidable_eq ι₁] [decidable_eq ι₂] : \n{* λ n₁ s₁ ac₁ n₂ (s₂ : state n₂ (memory (λ (n: string), ℕ)) τ₂) ac₂, 0 < n₂ ∧ all_threads_active ac₂ *} \n@kernel.compute ι₁ σ₁ τ₁ id ~> kernel.ite (λm, m.get \"tid\" = 1) (kernel.compute (λ m, m.update \"x\" 1)) (kernel.compute (λm, m.update \"x\" 0)) \n{* λ n₁ s₁ ac₁ n₂ s₂ ac₂, ∀ (h : 0 < n₂), (s₂.threads.nth ⟨0, h⟩).tlocal.get \"x\" = 1 *} := begin\n suffices : {* λ n₁ s₁ ac₁ n₂ (s₂ : state n₂ (memory (λ (n: string), ℕ)) τ₂) ac₂, 0 < n₂ ∧ (λac₂, all_threads_active ac₂) ac₂ *} \n @kernel.compute ι₁ σ₁ τ₁ id ~> kernel.ite (λm, m.get \"tid\" = 1) (kernel.compute (λ m, m.update \"x\" 1)) (kernel.compute (λm, m.update \"x\" 0)) \n {* λ n₁ s₁ ac₁ n₂ s₂ ac₂, (∀ (h : 0 < n₂), (s₂.threads.nth ⟨0, h⟩).tlocal.get \"x\" = 1) ∧ (λac₂, all_threads_active ac₂) ac₂ *},\n {\n apply consequence,\n exact this,\n simp,\n intros,\n exact ⟨a, a_1⟩,\n intros,\n exact (a.left) h,\n },\n apply ite_right,\n swap 7,\n exact (λn₁ s₁ ac₁ n₂ s₂ ac₂, ∀ (h : 0 < n₂), (s₂.threads.nth ⟨0, h⟩).tlocal.get \"x\" = 1),\n {\n intros,\n simp *,\n }, {\n intros,\n exact a,\n }, {\n intros,\n exact a,\n }, {\n intros,\n exact a h,\n }, {\n apply consequence_pre,\n apply compute_right,\n intros _ _ _ _ _ _ hp _,\n rw state.map_active_threads_nth_ac,\n refl,\n sorry,\n }, {\n apply consequence_pre,\n apply compute_right,\n intros _ _ _ _ _ _ hp _,\n rw ← state.map_active_threads_nth_inac,\n exact hp.left h,\n sorry,\n }\nend\n\nsection\n\nparameters (k : kernel bool (λ (s : string), ℕ))\n\ndef p₁ : program bool (λ (s : string), ℕ) :=\nprogram.intro (λm, m.get \"x\") (\n compute (λ_, tt) ;;\n ite id (\n k\n ) (\n store (λ_, ⟨\"a\", 5⟩)\n )\n)\n\ndef p₂ : program bool (λ (s : string), ℕ) :=\nprogram.intro (λm, m.get \"x\") (\n compute (λ_, tt) ;;\n k\n)\n\nexample : rel_hoare_program (λ_, ff) (λ_, ff) (λ m₁ m₂, eq m₁ m₂ ∧ 0 < m₁.get \"x\") p₁ p₂ eq := begin\n apply rel_kernel_to_program,\n apply single_step_left,\n swap,\n apply single_step_right,\n swap,\n {\n apply known_branch_left,\n swap,\n {\n apply consequence,\n apply rhl_eq,\n swap,\n {intros,\n cases a_1 with m₁,\n use m₁,\n use m₁,\n split,\n assumption,\n cases a,\n subst a_left,\n specialize a_right rfl,\n cases a_right,\n subst a_right_left,\n split,\n exact a_1_h,\n refl,},\n intros,\n have : (∀ (tid : fin n₁), id ((vector.nth (s₁.threads) tid).tlocal) = tt) ∧ n₁ = n₂ ∧ ∀ h : n₁ = n₂, s₁ = (by rw h; exact s₂) ∧ ac₁ = (by rw h; exact ac₂) := a,\n exact this.right,\n },\n intros,\n exact a.left tid,\n },\n apply compute_right,\n {\n apply consequence_pre,\n apply swap (compute_right _),\n {\n intros,\n use s₁,\n apply exec_skip,\n }, {\n intros _ _ _ _ _ _ h,\n simp[assertion_swap_side],\n cases h with m₁ h,\n cases h with m₂ h,\n cases h with h₁ h,\n cases h with h₂ h,\n cases h with h₃ h,\n cases h with h₄ h,\n cases h with h₅ h,\n cases h with h₆ h,\n cases h with h₇ h,\n cases h with h₈ h₉,\n split,\n {\n intro tid,\n rw state.map_active_threads_nth_ac,\n refl,\n apply all_threads_active_nth h₈,\n }, \n split,\n {\n cases h₇,\n subst h₇_left,\n rw [h₃, ← h₄],\n },\n intro h',\n subst h',\n split, {\n rw eq.mpr.intro,\n unfold state.map_active_threads,\n simp,\n apply vector.eq_element_wise,\n intro i,\n simp,\n have : ac₁ = ac₂ := all_threads_active_eq h₈ h₉,\n subst this,\n rw h₆,\n rw h₅,\n cases h₇,\n subst h₇_left,\n }, {\n have : ac₁ = ac₂ := all_threads_active_eq h₈ h₉,\n exact this,\n }\n }\n }, {\n intros,\n exact a.right,\n }\nend\n\nend\n\nend parlang", "meta": {"author": "fischerman", "repo": "GPU-transformation-verifier", "sha": "75a5016f05382738ff93ce5859c4cfa47ccb63c1", "save_path": "github-repos/lean/fischerman-GPU-transformation-verifier", "path": "github-repos/lean/fischerman-GPU-transformation-verifier/GPU-transformation-verifier-75a5016f05382738ff93ce5859c4cfa47ccb63c1/src/use_cases/parlang/if.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5583269943353745, "lm_q2_score": 0.34510528442897664, "lm_q1q2_score": 0.19268159618448505}} {"text": "import pseudo_normed_group.FP2\nimport condensed.adjunctions\nimport free_pfpng.acyclic\nimport for_mathlib.derived.ext_coproducts\nimport for_mathlib.derived.example\nimport breen_deligne.eval2\nimport system_of_complexes.shift_sub_id\nimport for_mathlib.AddCommGroup.explicit_products\nimport condensed.Qprime_isoms\nimport condensed.short_exact\nimport condensed.bd_ses\nimport condensed.filtered_colimits\n\nnoncomputable theory\n\nopen_locale nnreal\n\nuniverse u\n\nopen category_theory category_theory.limits breen_deligne\n\ndef ProFiltPseuNormGrpWithTinv₁.to_CHFPNG {r'} (M : ProFiltPseuNormGrpWithTinv₁.{u} r') :\n CompHausFiltPseuNormGrp :=\n(PFPNGT₁_to_CHFPNG₁ₑₗ r' ⋙ CHFPNG₁_to_CHFPNGₑₗ).obj M\n\nsection step1\n\nvariables (r' : ℝ≥0)\nvariables (BD : breen_deligne.data) (κ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ c, BD.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\n\nabbreviation freeCond := Profinite_to_Condensed.{u} ⋙ CondensedSet_to_Condensed_Ab\n\ndef QprimeFP_nat : ℝ≥0 ⥤ chain_complex (Condensed.{u} Ab.{u+1}) ℕ :=\nFPsystem r' BD ⟨M⟩ κ ⋙ (freeCond.{u}.map_FreeAb ⋙ FreeAb.eval _).map_homological_complex _\n\ndef QprimeFP_int : ℝ≥0 ⥤ cochain_complex (Condensed.{u} Ab.{u+1}) ℤ :=\nQprimeFP_nat r' BD κ M ⋙ homological_complex.embed complex_shape.embedding.nat_down_int_up\n\ndef QprimeFP : ℝ≥0 ⥤ bounded_homotopy_category (Condensed.{u} Ab.{u+1}) :=\nQprimeFP_nat r' BD κ M ⋙ chain_complex.to_bounded_homotopy_category\n\nend step1\n\nsection step2\n\nvariables {r' : ℝ≥0}\nvariables (BD : breen_deligne.package) (κ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ c, BD.data.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\n\ndef ProFiltPseuNormGrpWithTinv₁.to_Condensed : Condensed.{u} Ab.{u+1} :=\n(PFPNGT₁_to_CHFPNG₁ₑₗ r' ⋙ CHFPNG₁_to_CHFPNGₑₗ.{u} ⋙\n CompHausFiltPseuNormGrp.to_Condensed.{u}).obj M\n\n-- move me\n/-- `Tinv : M → M` as hom of condensed abelian groups -/\ndef _root_.ProFiltPseuNormGrpWithTinv₁.Tinv_cond : M.to_Condensed ⟶ M.to_Condensed :=\n(CompHausFiltPseuNormGrp.to_Condensed.{u}).map\n profinitely_filtered_pseudo_normed_group_with_Tinv.Tinv\n\nlocal attribute [instance] type_pow\n\nset_option pp.universes true\n\ndef QprimeFP_incl_aux'' (c : ℝ≥0) (n : ℕ) (M : ProFiltPseuNormGrpWithTinv.{u} r') (i : fin n) :\n (FiltrationPow r' c n).obj M ⟶ ((Filtration r').obj c).obj M :=\n((Filtration r').obj c).map $\n profinitely_filtered_pseudo_normed_group_with_Tinv.pi_proj _ _ i\n\ndef QprimeFP_incl_aux'\n (c : ℝ≥0) (n : ℕ) (i : (fin n)) (S : Profinite.{u}ᵒᵖ) :\n ulift_functor.{u+1 u}.obj (opposite.unop.{u+2} S ⟶ pseudo_normed_group.filtration_obj.{u} (M ^ n) c) ⟶\n ulift_functor.{u+1 u}.obj ((CompHausFiltPseuNormGrp.of.{u} ↥((PFPNGT₁_to_PFPNG₁ₑₗ.{u} r').obj M)).presheaf (opposite.unop.{u+2} S)) :=\nulift_functor.map $ λ f, ⟨subtype.val ∘ QprimeFP_incl_aux'' c n ⟨M⟩ i ∘ f,\n by refine ⟨_, _, continuous.comp _ _, rfl⟩; apply continuous_map.continuous⟩\n\n-- move me\ninstance : preserves_limits (Condensed_Ab_to_CondensedSet.{u}) :=\nadjunction.right_adjoint_preserves_limits Condensed_Ab_CondensedSet_adjunction\n\n-- move me\ninstance : preserves_limits CondensedSet_to_presheaf :=\nadjunction.right_adjoint_preserves_limits CondensedSet_presheaf_adjunction\n\nuniverse v\n\nlemma _root_.Ab.ulift_map_apply {A B : Ab.{u}} (f : A ⟶ B) :\n ⇑(Ab.ulift.{v}.map f) = ulift_functor.map f :=\nby { ext, refl }\n\n-- def QprimeFP_incl_aux_foo (c : ℝ≥0) (n : ℕ) :\n-- (pseudo_normed_group.filtration_obj (M ^ n) c).to_Condensed ⟶\n-- (Condensed_Ab_to_CondensedSet.obj (⨁ λ (i : ulift (fin n)), M.to_Condensed)) :=\n-- begin\n-- let x := biproduct.is_bilimit (λ (i : ulift (fin n)), M.to_Condensed),\n-- let y := is_bilimit_of_preserves Condensed_Ab_to_presheaf x,\n-- refine ⟨y.is_limit.lift ⟨_, ⟨λ i, ⟨_, _⟩, _⟩⟩⟩,\n-- { refine QprimeFP_incl_aux' _ _ _ i.down, },\n-- { intros S T f,\n-- dsimp [QprimeFP_incl_aux', ProFiltPseuNormGrpWithTinv₁.to_Condensed],\n-- rw [← ulift_functor.map_comp, Ab.ulift_map_apply, ← ulift_functor.map_comp],\n-- congr' 1, },\n-- { clear y x,\n-- rintros ⟨i⟩ ⟨j⟩ ⟨⟨⟨⟩⟩⟩,\n-- ext S : 2,\n-- dsimp [QprimeFP_incl_aux', ProFiltPseuNormGrpWithTinv₁.to_Condensed],\n-- simp only [discrete.functor_map_id, category.id_comp],\n-- symmetry, apply category.comp_id, }\n-- end\n\ndef QprimeFP_incl_aux (c : ℝ≥0) (n : ℕ) :\n (pseudo_normed_group.filtration_obj (M ^ n) c).to_Condensed ⟶\n (Condensed_Ab_to_CondensedSet.obj (⨁ λ (i : (fin n)), M.to_Condensed)) :=\nbegin\n let x := biproduct.is_limit (λ (i : (fin n)), M.to_Condensed),\n let y := is_limit_of_preserves (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf) x,\n refine ⟨y.lift ⟨_, ⟨λ i, ⟨_, _⟩, _⟩⟩⟩,\n { refine QprimeFP_incl_aux' _ _ _ i.as, },\n { intros S T f,\n rcases i with ⟨⟨i⟩⟩,\n dsimp [QprimeFP_incl_aux', ProFiltPseuNormGrpWithTinv₁.to_Condensed],\n rw [← ulift_functor.map_comp, Ab.ulift_map_apply, ← ulift_functor.map_comp],\n congr' 1, },\n { clear y x,\n rintros ⟨i⟩ ⟨j⟩ ⟨⟨⟨⟩⟩⟩,\n ext S : 2,\n dsimp [QprimeFP_incl_aux', ProFiltPseuNormGrpWithTinv₁.to_Condensed],\n simp only [discrete.functor_map_id, category.id_comp],\n symmetry, apply category.comp_id, }\nend\n.\n\nset_option pp.universes false\n\nlemma lift_app {C 𝓐 ι : Type*} [category C] [category 𝓐] [preadditive 𝓐]\n {F G : C ⥤ 𝓐} (f : ι → (F ⟶ G)) (x) (T) :\n (free_abelian_group.lift f x).app T = free_abelian_group.lift (λ i, (f i).app T) x :=\nbegin\n simp only [← nat_trans.app_hom_apply, ← add_monoid_hom.comp_apply],\n congr' 1, clear x, ext x,\n simp only [add_monoid_hom.coe_comp, function.comp_app, free_abelian_group.lift.of],\nend\n\nlemma map_FreeAb_comp_map {X Y Z : Type*} [category X] [category Y] [category Z]\n (F : X ⥤ Y) (G : Y ⥤ Z) {α β : FreeAb X} (f : α ⟶ β) :\n (F ⋙ G).map_FreeAb.map f = G.map_FreeAb.map (F.map_FreeAb.map f) :=\nbegin\n dsimp only [functor.map_FreeAb, functor.comp_map],\n rw [← add_monoid_hom.comp_apply], congr' 1, clear f,\n ext f,\n simp only [free_abelian_group.map_of_apply, functor.comp_map, add_monoid_hom.coe_comp, function.comp_app],\nend\n\nopen category_theory.preadditive\nopen_locale big_operators\n\nlemma biproduct.desc_eq_sum {𝓐 ι : Type*} [category 𝓐] [abelian 𝓐] [fintype ι]\n (M : ι → 𝓐) (X : 𝓐) (f : Π i, M i ⟶ X) :\n biproduct.desc f = ∑ i : ι, (biproduct.π _ _) ≫ (f i) :=\nbegin\n classical,\n ext i, simp only [biproduct.ι_desc, comp_sum],\n rw finset.sum_eq_single_of_mem i (finset.mem_univ _),\n { rw [biproduct.ι_π_assoc, dif_pos rfl, eq_to_hom_refl, category.id_comp], },\n { rintro j - hj, rw [biproduct.ι_π_ne_assoc, zero_comp], exact hj.symm }\nend\n\ninstance group_of_sections (A : Condensed.{u} Ab.{u+1})\n (S : Profinite.{u}ᵒᵖ) :\n add_comm_group (((Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).obj A).obj S) :=\nAddCommGroup.add_comm_group_instance\n ((@Sheaf.val Profinite Profinite.category proetale_topology Ab AddCommGroup.large_category A).obj S)\n\ninstance group_of_homs (X A : Type u) [add_comm_group A] :\n add_comm_group (X ⟶ A) :=\n@pi.add_comm_group X _ _\n\ninstance ulift_functor_group (A : Type u) [add_comm_group A] :\n add_comm_group (ulift_functor.obj A) :=\nulift.add_comm_group\n\nlemma QprimeFP_incl_aux3 {X A : Type u} [add_comm_group A] {ι : Type*}\n (s : finset ι) (n : ι → ℤ) (f : ι → (X ⟶ A)) :\n (∑ i in s, n i • (ulift_functor.{v}).map (f i)) = ulift_functor.map (∑ i in s, n i • (f i)) :=\nbegin\n let φ := add_monoid_hom.mk' (λ g : X ⟶ A, ulift_functor.{v}.map g) _,\n { show ∑ i in s, n i • φ (f i) = _, simp only [← φ.map_sum, ← φ.map_zsmul], refl },\n intros g₁ g₂, refl,\nend\n\ninstance group_of_sheaf_homs (X) (A : Condensed.{u} Ab.{u+1}) :\n add_comm_group (X ⟶ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).obj A) :=\n{ add := λ f g, ⟨λ S, f.app S + g.app S,\n by { intros S T φ, show X.map φ ≫ f.app T + X.map φ ≫ g.app T = _,\n simp only [nat_trans.naturality], ext1 x, symmetry,\n exact (A.val.map φ).map_add (f.app S x) (g.app S x) }⟩,\n add_assoc := by { intros, ext : 2, apply add_assoc },\n zero := ⟨λ S, 0, by { intros S T φ, ext1 x, symmetry, exact (A.val.map φ).map_zero }⟩,\n zero_add := by { intros, ext : 2, apply zero_add },\n add_zero := by { intros, ext : 2, apply add_zero },\n nsmul := λ n f, ⟨λ S, n • f.app S,\n by { intros S T φ, show n • (X.map φ ≫ f.app T) = _,\n simp only [nat_trans.naturality], ext1 x, symmetry,\n exact (A.val.map φ).map_nsmul (f.app S x) n }⟩,\n nsmul_zero' := by { intros, ext : 2, apply add_comm_group.nsmul_zero' },\n nsmul_succ' := by { intros, ext : 2, apply add_comm_group.nsmul_succ' },\n neg := λ f, ⟨λ S, -f.app S,\n by { intros S T φ, show -(X.map φ ≫ f.app T) = _,\n simp only [nat_trans.naturality], ext1 x, symmetry,\n exact (A.val.map φ).map_neg (f.app S x) }⟩,\n sub := λ f g, ⟨λ S, f.app S - g.app S,\n by { intros S T φ, show X.map φ ≫ f.app T - X.map φ ≫ g.app T = _,\n simp only [nat_trans.naturality], ext1 x, symmetry,\n exact (A.val.map φ).map_sub (f.app S x) (g.app S x) }⟩,\n sub_eq_add_neg := by { intros, ext : 2, apply sub_eq_add_neg },\n zsmul := λ n f, ⟨λ S, n • f.app S,\n by { intros S T φ, show n • (X.map φ ≫ f.app T) = _,\n simp only [nat_trans.naturality], ext1 x, symmetry,\n exact (A.val.map φ).map_zsmul (f.app S x) n }⟩,\n zsmul_zero' := by { intros, ext : 2, apply add_comm_group.zsmul_zero' },\n zsmul_succ' := by { intros, ext : 2, apply add_comm_group.zsmul_succ' },\n zsmul_neg' := by { intros, ext : 2, apply add_comm_group.zsmul_neg' },\n add_left_neg := by { intros, ext : 2, apply add_left_neg },\n add_comm := by { intros, ext : 2, apply add_comm } }\n\nlemma QprimeFP_incl_aux1 {A B : Condensed.{u} Ab.{u+1}} {ι : Type*} {X}\n (f : X ⟶ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).obj A)\n (s : finset ι) (n : ι → ℤ) (g : ι → (A ⟶ B)) :\n f ≫ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map (∑ i in s, n i • g i) =\n ∑ i in s, n i • (f ≫ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map (g i)) :=\nbegin\n let φ := add_monoid_hom.mk' (λ g : A ⟶ B, f ≫ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map g) _,\n { show φ _ = _, simp only [φ.map_sum, φ.map_zsmul], refl },\n intros g₁ g₂, refl,\nend\n\nlemma QprimeFP_incl_aux2 {A : Condensed.{u} Ab.{u+1}} {ι : Type*} {X}\n (s : finset ι) (n : ι → ℤ)\n (f : ι → (X ⟶ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).obj A)) (S) :\n (∑ i in s, n i • f i).app S = ∑ i in s, n i • ((f i).app S) :=\nbegin\n let φ := add_monoid_hom.mk' (λ g : X ⟶ (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).obj A, nat_trans.app g S) _,\n { show φ _ = _, simp only [φ.map_sum, φ.map_zsmul], refl },\n intros g₁ g₂, refl,\nend\n\n-- move me\n-- lemma _root_.comphaus_filtered_pseudo_normed_group_hom.coe_to_add_monoid_hom\n-- {M N : Type*} [comphaus_filtered_pseudo_normed_group M] [comphaus_filtered_pseudo_normed_group N]\n-- (f : comphaus_filtered_pseudo_normed_group_hom M N) :\n-- ⇑f.to_add_monoid_hom = f := rfl\n\n@[simps] def _root_.CompHausFiltPseuNormGrp.presheaf_incl\n (A : CompHausFiltPseuNormGrp.{u}) (S : Profinite.{u}) :\n CompHausFiltPseuNormGrp.presheaf A S →+ (S → A) :=\nadd_monoid_hom.mk' subtype.val $ λ _ _, rfl\n\ndef QprimeFP_incl (c : ℝ≥0) :\n (QprimeFP_int r' BD.data κ M).obj c ⟶\n (BD.eval' freeCond').obj M.to_Condensed :=\n(homological_complex.embed complex_shape.embedding.nat_down_int_up).map\n{ f := λ n, CondensedSet_to_Condensed_Ab.map $ QprimeFP_incl_aux _ _ _,\n comm' := begin\n rintro _ n (rfl : _ = _),\n rw [package.eval_functor_obj_d],\n dsimp only [universal_map.eval_Pow],\n dsimp only [QprimeFP_nat, FPsystem, functor.comp_obj, functor.map_homological_complex_obj_d],\n rw [chain_complex.of_d],\n delta freeCond freeCond',\n rw [functor.comp_map, map_FreeAb_comp_map, lift_app],\n dsimp only [FreeAb.eval, functor.map_FreeAb, FPsystem.d,\n universal_map.eval_FP2],\n simp only [whisker_right_app, free_abelian_group.lift_map, function.comp.left_id,\n nat_trans.app_sum, map_sum, basic_universal_map.eval_Pow_app,\n nat_trans.app_zsmul, basic_universal_map.eval_FP2, map_zsmul],\n dsimp only [FreeAb.of_functor],\n simp only [free_abelian_group.lift.of, function.comp_app],\n rw [free_abelian_group.lift_eq_sum, comp_sum, sum_comp, ← finset.sum_coe_sort],\n apply finset.sum_congr rfl,\n rintro t -,\n rw [comp_zsmul, zsmul_comp], refine congr_arg2 _ rfl _,\n rw [functor.comp_map, ← functor.map_comp, ← functor.map_comp],\n congr' 1,\n ext1,\n let x := λ n, biproduct.is_limit (λ (i : (fin (BD.data.X n))), M.to_Condensed),\n let y := λ n, is_limit_of_preserves (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf) (x n),\n apply (y _).hom_ext, rintro ⟨j⟩,\n rw [← CondensedSet_to_presheaf_map, ← CondensedSet_to_presheaf_map, functor.map_comp,\n ← functor.comp_map, category.assoc, functor.map_comp, category.assoc],\n erw [← functor.map_comp, biproduct.matrix_π],\n dsimp only [QprimeFP_incl_aux, CondensedSet_to_presheaf_map],\n rw (y _).fac,\n simp only [biproduct.desc_eq_sum, comp_zsmul, category.comp_id],\n rw [QprimeFP_incl_aux1],\n have help : ∀ n i,\n ((Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map_cone\n (biproduct.bicone (λ (i : (fin (BD.data.X n))), M.to_Condensed)).to_cone).π.app ⟨i⟩ =\n (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map\n (biproduct.π (λ (i : (fin (BD.data.X n))), M.to_Condensed) i),\n { intros, refl },\n simp only [← help, (y _).fac], clear help,\n dsimp only [basic_universal_map.eval_FP, Profinite_to_Condensed_map_val,\n basic_universal_map.eval_png₀],\n ext S : 2,\n erw QprimeFP_incl_aux2,\n dsimp only [nat_trans.comp_app, whisker_right_app, QprimeFP_incl_aux'],\n rw [← ulift_functor.map_comp, types_comp, QprimeFP_incl_aux3],\n congr' 1,\n dsimp only [function.comp, yoneda_map_app, yoneda_obj_obj, chain_complex.of_X,\n Profinite.coe_comp_apply, continuous_map.coe_mk, QprimeFP_incl_aux''],\n ext f s, clear y x,\n dsimp only [subtype.coe_mk, Filtration_obj_map_apply, add_monoid_hom.mk'_apply,\n comphaus_filtered_pseudo_normed_group_with_Tinv_hom.level, pseudo_normed_group.level,\n profinitely_filtered_pseudo_normed_group_with_Tinv.pi_proj,\n comphaus_filtered_pseudo_normed_group_with_Tinv_hom.coe_mk,\n pi.eval_add_monoid_hom_apply, breen_deligne.basic_universal_map.eval_png₀,\n breen_deligne.basic_universal_map.eval_png,\n comphaus_filtered_pseudo_normed_group.pi_lift,\n comphaus_filtered_pseudo_normed_group_hom.coe_mk, add_monoid_hom.mk_to_pi_apply],\n simp only [← comphaus_filtered_pseudo_normed_group_hom.to_add_monoid_hom_hom_apply,\n add_monoid_hom.map_sum],\n rw [fintype.sum_apply, ← add_monoid_hom.eval_apply_apply, add_monoid_hom.map_sum,\n ← CompHausFiltPseuNormGrp.presheaf_incl_apply, add_monoid_hom.map_sum, fintype.sum_apply],\n --rw [← equiv.ulift.{u+1 0}.sum_comp],\n refine finset.sum_congr rfl _,\n intros t ht, refl,\n end }\n\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\n\ndef QprimeFP_sigma_proj :\n ∐ (λ k, (QprimeFP_int r' BD.data κ M).obj (ι k)) ⟶\n (BD.eval' freeCond').obj M.to_Condensed :=\nsigma.desc $ λ n, QprimeFP_incl BD κ M _\n\ninstance QprimeFP.uniformly_bounded :\n bounded_homotopy_category.uniformly_bounded (λ k, (QprimeFP r' BD.data κ M).obj (ι k)) :=\nbegin\n use 1, intro k, apply chain_complex.bounded_by_one,\nend\n\nend step2\n\nsection step3\nopen bounded_homotopy_category\n\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\nvariables {C : Type*} [category C] [preadditive C]\nvariables (A B : ℝ≥0 ⥤ C)\nvariables [has_coproduct (λ (k : ulift ℕ), A.obj (ι k))]\nvariables [has_coproduct (λ (k : ulift ℕ), B.obj (ι k))]\n\ninclude hι\n\ndef sigma_shift_cone (c : cofan (λ k, A.obj (ι k))) :\n cofan (λ k, A.obj (ι k)) :=\n{ X := c.X,\n ι := discrete.nat_trans $ λ ⟨(j: ulift ℕ)⟩,\n A.map (hom_of_le $ hι $ (by { cases j, apply nat.le_succ } : j ≤ ⟨j.down+1⟩)) ≫\n c.ι.app ⟨⟨j.down + 1⟩⟩ }\n\nomit hι\n\ndef sigma_shift' (c : cofan (λ k, A.obj (ι k))) (hc : is_colimit c) :\n c.X ⟶ (sigma_shift_cone ι hι A c).X := hc.desc _\n\ndef sigma_shift : ∐ (λ k, A.obj (ι k)) ⟶ ∐ (λ k, A.obj (ι k)) :=\nsigma_shift' _ hι _ _ (colimit.is_colimit _)\n\ndef QprimeFP.shift_sub_id : ∐ (λ k, A.obj (ι k)) ⟶ ∐ (λ k, A.obj (ι k)) :=\nsigma_shift _ hι _ - 𝟙 _\n\nvariables {A B}\n\ndef sigma_map (f : A ⟶ B) : ∐ (λ k, A.obj (ι k)) ⟶ ∐ (λ k, B.obj (ι k)) :=\nsigma.desc $ λ k, f.app _ ≫ sigma.ι _ k\n\nend step3\n\nsection step4\n\nvariables {r' : ℝ≥0}\nvariables (BD : breen_deligne.package) (κ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ c, BD.data.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\n\nopen opposite category_theory.preadditive\n\nopen_locale classical\n\nset_option pp.universes true\n\ndef coproduct_eval_iso\n {α : Type (u+1)} (X : α → homological_complex (Condensed.{u} Ab.{u+1}) (complex_shape.up ℤ))\n (n : ℤ) (T : ExtrDisc.{u}) :\n ((∐ X).X n).val.obj (op T.val) ≅\n AddCommGroup.of (direct_sum α (λ a, ((X a).X n).val.obj (op T.val))) :=\nbegin\n refine preserves_colimit_iso\n ((homological_complex.eval (Condensed.{u} Ab.{u+1}) (complex_shape.up ℤ) n\n ⋙ Condensed.evaluation Ab.{u+1} T.val)) _ ≪≫ _,\n refine _ ≪≫ (colimit.is_colimit $ discrete.functor\n (λ a, ((X a).X n).val.obj (op T.val))).cocone_point_unique_up_to_iso\n (AddCommGroup.is_colimit_direct_sum_cofan.{u+1 u+1} (λ a, ((X a).X n).val.obj (op T.val))),\n refine has_colimit.iso_of_nat_iso (discrete.nat_iso _),\n intros i, exact iso.refl _,\nend\n\nlemma sigma_ι_coproduct_eval_iso\n {α : Type (u+1)} (X : α → homological_complex (Condensed.{u} Ab.{u+1}) (complex_shape.up ℤ))\n (n : ℤ) (T : ExtrDisc.{u}) (a : α) :\n ((sigma.ι X a : X a ⟶ _).f n).val.app (op T.val) ≫\n (coproduct_eval_iso _ _ _).hom =\n direct_sum.of ((λ a, ((X a).X n).val.obj (op T.val))) a :=\nbegin\n dsimp only [coproduct_eval_iso],\n erw (is_colimit_of_preserves (homological_complex.eval.{u+1 u+2 0}\n (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ) n ⋙\n Condensed.evaluation.{u+2 u+1 u} Ab.{u+1} T.val) _).fac_assoc,\n dsimp,\n erw colimit.ι_desc_assoc,\n dsimp, simpa only [category.id_comp, colimit.comp_cocone_point_unique_up_to_iso_hom],\nend\n\n-- Move this!\ninstance CondensedSet_to_Condensed_Ab_preserves_colimits :\n preserves_colimits CondensedSet_to_Condensed_Ab.{u} :=\nadjunction.left_adjoint_preserves_colimits Condensed_Ab_CondensedSet_adjunction\n\nsection ses_setup\n\nlocal attribute [instance] type_pow\n\ndef Condensed_prod_val_iso {α : Type (u+1)} (X : α → CondensedSet.{u}) :\n (∏ X).val ≅ ∏ (λ i, (X i).val) :=\npreserves_limit_iso CondensedSet_to_presheaf _ ≪≫\nhas_limit.iso_of_nat_iso (discrete.nat_iso $ λ p, iso.refl _)\n\n@[simp, reassoc]\nlemma Condensed_prod_val_iso_spec {α : Type (u+1)} (X : α → CondensedSet.{u}) (i : α) :\n (Condensed_prod_val_iso X).hom ≫ pi.π _ i =\n (pi.π X i : ∏ X ⟶ X i).val :=\nbegin\n dsimp [Condensed_prod_val_iso],\n simp only [category.assoc],\n erw limit.lift_π,\n dsimp,\n erw limit.lift_π_assoc,\n erw category.comp_id,\n refl,\nend\n\n@[simp, reassoc]\nlemma Condensed_prod_val_iso_spec' {α : Type (u+1)} (X : α → CondensedSet.{u}) (i : α) :\n (Condensed_prod_val_iso X).inv ≫ (pi.π X i : ∏ X ⟶ X i).val = pi.π _ _ :=\nby { rw iso.inv_comp_eq, rw Condensed_prod_val_iso_spec }\n\ndef functor_prod_eval_iso {α : Type (u+1)} (X : α → (Profinite.{u}ᵒᵖ ⥤ Type (u+1))) (T) :\n (∏ X).obj T ≅ ∏ (λ i, (X i).obj T) :=\npreserves_limit_iso ((evaluation _ _).obj T) _ ≪≫\nhas_limit.iso_of_nat_iso (discrete.nat_iso $ λ p, iso.refl _)\n\n@[simp, reassoc]\nlemma functor_prod_eval_iso_spec\n {α : Type (u+1)} (X : α → (Profinite.{u}ᵒᵖ ⥤ Type (u+1))) (T) (i : α) :\n (functor_prod_eval_iso X T).hom ≫ pi.π _ i =\n (pi.π X i : ∏ X ⟶ X i).app _ :=\nbegin\n dsimp [functor_prod_eval_iso],\n simp only [category.assoc],\n erw limit.lift_π,\n dsimp,\n erw limit.lift_π_assoc,\n erw category.comp_id,\n refl,\nend\n\n@[simp, reassoc]\nlemma functor_prod_eval_iso_spec'\n {α : Type (u+1)} (X : α → (Profinite.{u}ᵒᵖ ⥤ Type (u+1))) (T) (i : α) :\n (functor_prod_eval_iso X T).inv ≫ (pi.π X i : ∏ X ⟶ X i).app _ =\n pi.π _ i :=\nby { rw iso.inv_comp_eq, rw functor_prod_eval_iso_spec }\n\ndef filtration_pow_iso_aux (j : ℕ) (r : ℝ≥0) :\n (ProFiltPseuNormGrp₁.level.obj r).obj\n (∏ λ i : ulift.{u} (fin j), (PFPNGT₁_to_PFPNG₁ₑₗ _).obj M) ≅\n (∏ λ i : ulift.{u} (fin j), pseudo_normed_group.filtration_obj M r) :=\npreserves_limit_iso (ProFiltPseuNormGrp₁.level.obj r) _ ≪≫\nhas_limit.iso_of_nat_iso (discrete.nat_iso $ λ q, iso.refl _)\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux_spec (j : ℕ) (r : ℝ≥0) (i) :\n (filtration_pow_iso_aux M j r).hom ≫ pi.π\n (λ i : ulift.{u} (fin j), pseudo_normed_group.filtration_obj M r) i =\n (ProFiltPseuNormGrp₁.level.obj r).map (pi.π _ i) :=\nbegin\n dsimp [filtration_pow_iso_aux],\n simp only [category.assoc],\n erw limit.lift_π,\n dsimp,\n erw limit.lift_π_assoc,\n erw category.comp_id,\n refl,\nend\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux_spec' (j : ℕ) (r : ℝ≥0) (i) :\n (filtration_pow_iso_aux M j r).inv ≫\n (ProFiltPseuNormGrp₁.level.obj r).map (pi.π _ i) =\n pi.π _ i :=\nby { rw iso.inv_comp_eq, rw filtration_pow_iso_aux_spec }\n\ndef ProFiltPseuNormGrp₁.product_fan {α : Type u} [fintype α] (X : α → ProFiltPseuNormGrp₁.{u}) :\n fan X :=\nfan.mk (ProFiltPseuNormGrp₁.product X) $ λ i, ProFiltPseuNormGrp₁.product.π _ _\n\ndef ProFiltPseuNormGrp₁.is_limit_product_fan {α : Type u} [fintype α]\n (X : α → ProFiltPseuNormGrp₁.{u}) :\n is_limit (ProFiltPseuNormGrp₁.product_fan X) :=\n{ lift := λ S, ProFiltPseuNormGrp₁.product.lift _ _ $ λ i, S.π.app ⟨i⟩,\n fac' := begin\n rintro S ⟨j⟩,\n dsimp,\n erw ProFiltPseuNormGrp₁.product.lift_π,\n end,\n uniq' := begin\n intros S m hm,\n apply ProFiltPseuNormGrp₁.product.hom_ext,\n rintro j,\n erw hm ⟨j⟩,\n erw ProFiltPseuNormGrp₁.product.lift_π,\n end }\n\ndef ProFiltPseuNormGrp₁.product_pow_iso {α : Type u} [fintype α]\n (X : α → ProFiltPseuNormGrp₁.{u}) :\n ∏ X ≅ ProFiltPseuNormGrp₁.product X :=\n(limit.is_limit _).cone_point_unique_up_to_iso (ProFiltPseuNormGrp₁.is_limit_product_fan _)\n\n@[simp, reassoc]\nlemma ProFiltPseuNormGrp₁.product_pow_iso_spec {α : Type u} [fintype α]\n (X : α → ProFiltPseuNormGrp₁.{u}) (i) :\n (ProFiltPseuNormGrp₁.product_pow_iso X).hom ≫\n ProFiltPseuNormGrp₁.product.π _ _ = pi.π _ i :=\nbegin\n erw ProFiltPseuNormGrp₁.product.lift_π,\n refl,\nend\n\n@[simp, reassoc]\nlemma ProFiltPseuNormGrp₁.product_pow_iso_spec' {α : Type u} [fintype α]\n (X : α → ProFiltPseuNormGrp₁.{u}) (i) :\n (ProFiltPseuNormGrp₁.product_pow_iso X).inv ≫ pi.π _ i =\n ProFiltPseuNormGrp₁.product.π _ _ :=\nby { rw iso.inv_comp_eq, rw ProFiltPseuNormGrp₁.product_pow_iso_spec }\n\ndef filtration_pow_proj (j : ℕ) (r : ℝ≥0) (i : fin j) :\n pseudo_normed_group.filtration_obj.{u} (↥M ^ j) r ⟶\n pseudo_normed_group.filtration_obj.{u} M r :=\n{ to_fun := λ t, ⟨t.1 i, t.2 _⟩,\n continuous_to_fun := begin\n let e := (comphaus_filtered_pseudo_normed_group.filtration_pi_homeo\n (λ i : (fin j), M) r),\n let t := _, change continuous t,\n suffices : continuous (t ∘ e.symm), by simpa using this,\n convert continuous_apply i,\n ext, refl,\n end }\n\ndef filtration_pow_iso_aux'₀ (j : ℕ) (r : ℝ≥0) :\n pseudo_normed_group.filtration_obj.{u} (↥M ^ j) r ≅\n (ProFiltPseuNormGrp₁.level.{u}.obj r).obj\n (ProFiltPseuNormGrp₁.product.{u} (λ (i : ulift.{u 0} (fin j)),\n (PFPNGT₁_to_PFPNG₁ₑₗ.{u} r').obj M)) :=\n-- This can't be the best way to do this, but at this point I'm quite annoyed.\n{ hom :=\n { to_fun := λ q, ⟨λ i, q.1 i.down, begin\n intros i,\n apply q.2,\n end⟩,\n continuous_to_fun := begin\n rw (comphaus_filtered_pseudo_normed_group.filtration_pi_homeo\n (λ i : ulift.{u} (fin j), M) r).inducing.continuous_iff,\n apply continuous_pi,\n intros i, dsimp,\n let e := (comphaus_filtered_pseudo_normed_group.filtration_pi_homeo\n (λ i : (fin j), M) r),\n let t := _, change continuous t,\n suffices : continuous (t ∘ e.symm), by simpa using this,\n convert continuous_apply i.down,\n ext, refl,\n end },\n inv :=\n { to_fun := λ q, ⟨λ i, q.1 ⟨i⟩, begin\n intros i,\n apply q.2,\n end⟩,\n continuous_to_fun := begin\n let e₁ := (comphaus_filtered_pseudo_normed_group.filtration_pi_homeo\n (λ i : (fin j), M) r),\n let e₂ := (comphaus_filtered_pseudo_normed_group.filtration_pi_homeo\n (λ i : ulift.{u} (fin j), M) r),\n let t := _, change continuous t,\n suffices : continuous (e₁ ∘ t ∘ e₂.symm), by simpa using this,\n apply continuous_pi,\n intros i, convert continuous_apply (ulift.up i),\n ext, refl,\n end },\n hom_inv_id' := by { ext, refl },\n inv_hom_id' := by { ext _ ⟨⟩, refl } }\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux'₀_spec (j : ℕ) (r : ℝ≥0) (i) :\n (filtration_pow_iso_aux'₀ M j r).hom ≫\n ((ProFiltPseuNormGrp₁.level.obj r).map $ ProFiltPseuNormGrp₁.product.π _ i) =\n filtration_pow_proj M j r i.down := by { ext, refl }\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux'₀_spec' (j : ℕ) (r : ℝ≥0) (i : ulift.{u} (fin j)) :\n (filtration_pow_iso_aux'₀ M j r).inv ≫ filtration_pow_proj M j r i.down =\n ((ProFiltPseuNormGrp₁.level.obj r).map $ ProFiltPseuNormGrp₁.product.π _ i) :=\nby { cases i, ext _ ⟨k⟩, refl }\n\ndef filtration_pow_iso_aux' (j : ℕ) (r : ℝ≥0) :\n pseudo_normed_group.filtration_obj.{u} (↥M ^ j) r ≅\n (ProFiltPseuNormGrp₁.level.obj r).obj\n (∏ λ i : ulift.{u} (fin j), (PFPNGT₁_to_PFPNG₁ₑₗ _).obj M) :=\nfiltration_pow_iso_aux'₀ _ _ _ ≪≫\n(ProFiltPseuNormGrp₁.level.obj r).map_iso (ProFiltPseuNormGrp₁.product_pow_iso _).symm\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux'_spec (j : ℕ) (r : ℝ≥0) (i) :\n (filtration_pow_iso_aux' M j r).hom ≫\n (ProFiltPseuNormGrp₁.level.obj r).map (pi.π _ i) =\n filtration_pow_proj _ _ _ i.down :=\nbegin\n dsimp [filtration_pow_iso_aux'],\n simp only [category.assoc],\n simp only [← functor.map_comp, ProFiltPseuNormGrp₁.product_pow_iso_spec'],\n simp,\nend\n\n@[simp, reassoc]\nlemma filtration_pow_iso_aux'_spec' (j : ℕ) (r : ℝ≥0) (i : ulift.{u} (fin j)) :\n (filtration_pow_iso_aux' M j r).inv ≫ filtration_pow_proj _ _ _ i.down =\n (ProFiltPseuNormGrp₁.level.obj r).map (pi.π _ i) :=\nby { rw iso.inv_comp_eq, rw filtration_pow_iso_aux'_spec }\n\ndef filtration_pow_iso (j : ℕ) (r : ℝ≥0) :\n pseudo_normed_group.filtration_obj.{u} (M ^ j) r ≅\n ∏ λ i : ulift.{u} (fin j), pseudo_normed_group.filtration_obj M r :=\nfiltration_pow_iso_aux' _ _ _ ≪≫ filtration_pow_iso_aux _ _ _\n\n@[simp, reassoc]\nlemma filtration_pow_iso_spec (j : ℕ) (r : ℝ≥0) (i : ulift.{u} (fin j)) :\n (filtration_pow_iso M j r).hom ≫ pi.π _ i =\n filtration_pow_proj _ _ _ i.down :=\nbegin\n dsimp [filtration_pow_iso],\n simp,\nend\n\n@[simp, reassoc]\nlemma filtration_pow_iso_spec' (j : ℕ) (r : ℝ≥0) (i : ulift.{u} (fin j)) :\n (filtration_pow_iso M j r).inv ≫ filtration_pow_proj _ _ _ i.down =\n pi.π _ i :=\nby { rw iso.inv_comp_eq, rw filtration_pow_iso_spec }\n\ndef profinite_pow_filtration_iso_component (j : ℕ) (r : ℝ≥0) (T : Profinite.{u}) :\n ulift.{u+1} (T ⟶ pseudo_normed_group.filtration_obj.{u} (↥M ^ j) r) ≅\n ∏ λ (i : ulift.{u+1} (fin j)), ulift.{u+1}\n (T ⟶ (ProFiltPseuNormGrp₁.level.{u}.obj r).obj ((PFPNGT₁_to_PFPNG₁ₑₗ.{u} r').obj M)) :=\nulift_functor.map_iso\n((yoneda.flip.obj (op T)).map_iso $ filtration_pow_iso _ _ _) ≪≫\n{ hom := pi.lift $ λ i f, ulift.up $ ulift.down f ≫ pi.π _ (ulift.up i.down),\n inv := λ t, ulift.up $ pi.lift $ λ i,\n let q := pi.π (λ (i : ulift.{u+1 0} (fin j)),\n ulift.{u+1 u}\n (T ⟶ (ProFiltPseuNormGrp₁.level.{u}.obj r).obj\n ((PFPNGT₁_to_PFPNG₁ₑₗ.{u} r').obj M))) (ulift.up $ ulift.down i) t in q.down,\n hom_inv_id' := begin\n ext ⟨t⟩ : 2, dsimp,\n apply limit.hom_ext, rintros ⟨⟨q⟩⟩,\n simp,\n end,\n inv_hom_id' := begin\n apply limit.hom_ext, rintro ⟨⟨q⟩⟩,\n simp only [category.assoc, limit.lift_π, fan.mk_π_app, category.id_comp],\n ext t,\n dsimp,\n rw [← comp_apply, limit.lift_π],\n refl,\n end }\n\n.\n\n@[simp, reassoc]\nlemma profinite_pow_filtration_iso_component_spec (j : ℕ) (r : ℝ≥0) (T : Profinite.{u})\n (i : ulift.{u+1} (fin j)) :\n (profinite_pow_filtration_iso_component M j r T).hom ≫ pi.π _ i =\n ulift_functor.map ((yoneda.flip.obj (op T)).map $ filtration_pow_proj _ _ _ i.down) :=\nbegin\n dsimp [profinite_pow_filtration_iso_component],\n simp,\n ext ⟨t⟩ : 2,\n dsimp,\n simp,\nend\n\n@[simp, reassoc]\nlemma profinite_pow_filtration_iso_component_spec' (j : ℕ) (r : ℝ≥0) (T : Profinite.{u})\n (i : ulift.{u+1} (fin j)) :\n (profinite_pow_filtration_iso_component M j r T).inv ≫\n ulift_functor.map ((yoneda.flip.obj (op T)).map $ filtration_pow_proj _ _ _ i.down) =\n pi.π _ i :=\nby { rw iso.inv_comp_eq, rw profinite_pow_filtration_iso_component_spec }\n\ndef profinite_pow_filtration_iso (j : ℕ) (r : ℝ≥0) :\n (pseudo_normed_group.filtration_obj.{u} (↥M ^ j) r).to_Condensed ≅\n ∏ λ (k : ulift.{u+1 0} (fin j)), ((ProFiltPseuNormGrp₁.level.obj r).obj\n ((PFPNGT₁_to_PFPNG₁ₑₗ _).obj M)).to_Condensed :=\nbegin\n refine Sheaf.iso.mk _ _ _,\n refine _ ≪≫ (Condensed_prod_val_iso _).symm,\n refine nat_iso.of_components _ _,\n { intros T,\n refine _ ≪≫ (functor_prod_eval_iso _ _).symm,\n refine profinite_pow_filtration_iso_component _ _ _ _ },\n { intros X Y f, dsimp,\n apply (is_limit_of_preserves ((evaluation _ _).obj Y) (limit.is_limit _)).hom_ext,\n rintro ⟨i⟩, swap, apply_instance,\n dsimp, simp only [category.assoc],\n erw [functor_prod_eval_iso_spec', nat_trans.naturality,\n functor_prod_eval_iso_spec'_assoc, profinite_pow_filtration_iso_component_spec,\n profinite_pow_filtration_iso_component_spec_assoc],\n ext, refl }\nend\n\n@[simp, reassoc]\nlemma profinite_pow_filtration_iso_spec (j : ℕ) (r : ℝ≥0) (i : ulift.{u+1} (fin j)) :\n (profinite_pow_filtration_iso M j r).hom ≫ pi.π _ i =\n Profinite_to_Condensed.map (filtration_pow_proj _ _ _ i.down) :=\nbegin\n dsimp [profinite_pow_filtration_iso, Sheaf.iso.mk],\n ext1, dsimp,\n simp only [category.assoc],\n rw Condensed_prod_val_iso_spec',\n ext T : 2,\n dsimp,\n simp only [category.assoc],\n rw functor_prod_eval_iso_spec',\n erw profinite_pow_filtration_iso_component_spec,\n refl,\nend\n\n@[simp, reassoc]\nlemma profinite_pow_filtration_iso_spec' (j : ℕ) (r : ℝ≥0) (i : ulift.{u+1} (fin j)) :\n (profinite_pow_filtration_iso M j r).inv ≫\n Profinite_to_Condensed.map (filtration_pow_proj _ _ _ i.down) = pi.π _ i :=\nby { rw iso.inv_comp_eq, rw profinite_pow_filtration_iso_spec }\n\ndef combine (hι : monotone ι) (n : ℕ) : ℕ →o ℝ≥0 :=\n{ to_fun := λ t, κ (ι $ ulift.up t) n,\n monotone' := begin\n intros a b h,\n apply (fact.out (monotone (function.swap κ n))),\n apply hι,\n exact h\n end }\n\ndef iso_on_the_left_zero₀ :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X 0 ≅\n (∐ λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X 0) :=\nbegin\n refine preserves_colimit_iso (homological_complex.eval _ _ 0) _ ≪≫ _,\n refine has_colimit.iso_of_nat_iso (discrete.nat_iso $ λ i, iso.refl _),\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_zero₀_spec' (i : ulift.{u+1} ℕ) :\n sigma.ι (λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X 0) i ≫\n (iso_on_the_left_zero₀ BD κ M ι).inv =\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) i).f 0 :=\nbegin\n dsimp [iso_on_the_left_zero₀],\n erw colimit.ι_desc_assoc, dsimp, simp only [category.id_comp],\n erw colimit.ι_desc, refl,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_zero₀_spec (i : ulift.{u+1} ℕ) :\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) i).f 0 ≫\n (iso_on_the_left_zero₀ BD κ M ι).hom =\n sigma.ι (λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X 0) i :=\nby { rw ← iso.eq_comp_inv, rw iso_on_the_left_zero₀_spec', }\n\ndef iso_on_the_left_zero :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X 0 ≅\n ∐ λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X 0))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι 0)).obj i) :=\nbegin\n refine iso_on_the_left_zero₀ BD κ M _ ≪≫ _,\n refine sigma.map_iso _,\n rintros ⟨j⟩,\n dsimp [QprimeFP_int, QprimeFP_nat, FreeAb.eval, functor.map_FreeAb,\n FPsystem, FPsystem.X],\n refine CondensedSet_to_Condensed_Ab.map_iso _,\n refine profinite_pow_filtration_iso M (BD.data.X 0) (κ (ι ⟨j⟩) 0), --≪≫ _,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_zero_spec' (k : ℕ) :\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X 0))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι 0)).obj i))\n ⟨k⟩ ≫ (iso_on_the_left_zero _ _ _ _ _).inv =\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X 0) (κ (ι ⟨k⟩) 0)).inv ≫\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f 0 :=\nbegin\n dsimp [iso_on_the_left_zero],\n erw colimit.ι_desc_assoc, dsimp,\n rw [category.assoc],\n slice_lhs 2 3\n { rw iso_on_the_left_zero₀_spec' },\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_zero_spec (k : ℕ) :\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X 0) (κ (ι ⟨k⟩) 0)).inv ≫\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f 0 ≫\n (iso_on_the_left_zero _ _ _ _ _).hom =\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X 0))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι 0)).obj i))\n ⟨k⟩ :=\nbegin\n rw [← category.assoc, ← iso.eq_comp_inv, iso_on_the_left_zero_spec'],\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_zero_spec_alt (k : ℕ) :\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f 0 ≫\n (iso_on_the_left_zero _ _ _ _ _).hom =\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X 0) (κ (ι ⟨k⟩) 0)).hom ≫\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X 0))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι 0)).obj i))\n ⟨k⟩ :=\nbegin\n rw [← functor.map_iso_hom, ← iso.inv_comp_eq,\n functor.map_iso_inv, iso_on_the_left_zero_spec],\nend\n\ndef pseudo_normed_group.map_filtration (M : Type*) [profinitely_filtered_pseudo_normed_group M]\n (a b : ℝ≥0) (h : a ≤ b) :\n pseudo_normed_group.filtration_obj M a ⟶ pseudo_normed_group.filtration_obj M b :=\n{ to_fun := pseudo_normed_group.cast_le' h,\n continuous_to_fun := begin\n haveI : fact (a ≤ b) := ⟨h⟩,\n apply comphaus_filtered_pseudo_normed_group.continuous_cast_le,\n end }\n\nlemma pow_filtration_hom_ext {T : Profinite.{u}} (j : ℕ) (r : ℝ≥0)\n (f g : T ⟶ pseudo_normed_group.filtration_obj (M^j) r)\n (h : ∀ k, f ≫ filtration_pow_proj M j r k = g ≫ filtration_pow_proj M j r k) : f = g :=\nbegin\n ext t x,\n specialize h x,\n apply_fun (λ e, (e t).1) at h,\n exact h,\nend\n\nlemma iso_on_the_left_zero_conj_aux (j : ℕ) :\n ((profinite_pow_filtration_iso.{u} M (BD.data.X 0) (κ (ι {down := j}) 0)).hom ≫\n (Condensed.as_nat_diagram_pow.{u} M.to_CHFPNG (combine.{u} κ ι hι 0) (BD.data.X 0)).map\n (as_small.up.{0 0 u+1}.map (hom_of_le.{0} (nat.le_succ _)))) ≫\n (profinite_pow_filtration_iso.{u} M (BD.data.X 0) (κ (ι {down := j + 1}) 0)).inv =\n Profinite_to_Condensed.map (pseudo_normed_group.map_filtration _ _ _\n (fact.out (monotone (function.swap κ 0)) (hι $ by { exact_mod_cast j.le_succ }))) :=\nbegin\n rw iso.comp_inv_eq,\n apply limit.hom_ext, rintro ⟨k⟩,\n dsimp [Condensed.as_nat_diagram_pow, pow_functor], simp only [category.assoc],\n erw profinite_pow_filtration_iso_spec,\n simp only [lim_map_π, discrete.nat_trans_app],\n erw profinite_pow_filtration_iso_spec_assoc,\n dsimp [Condensed.as_nat_diagram, restrict_diagram,\n CompHausFiltPseuNormGrp.level_Condensed_diagram,\n CompHausFiltPseuNormGrp.level_Condensed_diagram'],\n rw ← Profinite_to_Condensed.map_comp,\n have h : κ (ι ⟨j⟩) 0 ≤ κ (ι ⟨j+1⟩) 0,\n { apply fact.out (monotone (function.swap κ 0)),\n apply hι,\n exact_mod_cast j.le_succ },\n change _ ≫ Profinite_to_Condensed.map (pseudo_normed_group.map_filtration M _ _ h) = _,\n rw ← Profinite_to_Condensed.map_comp,\n congr' 1,\nend\n\nlemma iso_on_the_left_zero_conj :\n ((QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)).f 0) =\n (iso_on_the_left_zero _ _ _ _ hι).hom ≫\n (Condensed.coproduct_to_coproduct (Condensed.as_nat_diagram_pow M.to_CHFPNG\n (combine κ ι hι 0) _ ⋙ _) - 𝟙 _) ≫ (iso_on_the_left_zero _ _ _ _ hι).inv :=\nbegin\n dsimp [QprimeFP.shift_sub_id],\n simp only [comp_sub, sub_comp, category.id_comp, iso.hom_inv_id,\n category.assoc], congr' 1,\n apply (is_colimit_of_preserves (homological_complex.eval _ _ _)\n (colimit.is_colimit _)).hom_ext, swap, apply_instance,\n rintros ⟨⟨j⟩⟩, dsimp,\n erw [← homological_complex.comp_f, colimit.ι_desc],\n dsimp [sigma_shift_cone],\n rw iso_on_the_left_zero_spec_alt_assoc,\n erw colimit.ι_desc_assoc, dsimp,\n simp only [category.assoc],\n slice_rhs 3 4\n { erw iso_on_the_left_zero_spec' },\n simp only [← category.assoc],\n congr' 1,\n dsimp [CondensedSet_to_Condensed_Ab],\n simp only [← functor.map_comp],\n dsimp [QprimeFP_int, QprimeFP_nat, FreeAb.eval, functor.map_FreeAb,\n FPsystem, FPsystem.X, FreeAb.of_functor],\n rw free_abelian_group.lift.of, dsimp,\n congr' 1,\n ext S : 2,\n dsimp,\n simp only [← functor.map_comp], congr' 1,\n simp only [← nat_trans.comp_app, ← Sheaf.hom.comp_val],\n rw iso_on_the_left_zero_conj_aux,\n ext, refl,\nend\n\ndef iso_on_the_left_neg₀ (q : ℕ) :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X (-[1+q]) ≅\n (∐ λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X (-[1+q])) :=\nbegin\n refine preserves_colimit_iso (homological_complex.eval _ _ _) _ ≪≫ _,\n refine has_colimit.iso_of_nat_iso (discrete.nat_iso $ λ i, iso.refl _),\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_neg₀_spec' (q : ℕ) (i : ulift.{u+1} ℕ) :\n sigma.ι (λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X (-[1+q])) i ≫\n (iso_on_the_left_neg₀ BD κ M ι q).inv =\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) i).f (-[1+q]) :=\nbegin\n dsimp [iso_on_the_left_neg₀],\n erw colimit.ι_desc_assoc, dsimp, simp only [category.id_comp],\n erw colimit.ι_desc, refl,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_neg₀_spec (q : ℕ) (i : ulift.{u+1} ℕ) :\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) i).f (-[1+q]) ≫\n (iso_on_the_left_neg₀ BD κ M ι q).hom =\n sigma.ι (λ (k : ulift.{u+1 0} ℕ), ((QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X (-[1+q])) i :=\nby { rw ← iso.eq_comp_inv, rw iso_on_the_left_neg₀_spec', }\n\ndef iso_on_the_left_neg (q : ℕ) :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)).X (-[1+q]) ≅\n ∐ λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X (q+1)))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1))).obj i) :=\nbegin\n refine iso_on_the_left_neg₀ BD κ M _ q ≪≫ _,\n refine sigma.map_iso _,\n rintros ⟨j⟩,\n dsimp [QprimeFP_int, QprimeFP_nat, FreeAb.eval, functor.map_FreeAb,\n FPsystem, FPsystem.X],\n refine CondensedSet_to_Condensed_Ab.map_iso _,\n refine profinite_pow_filtration_iso M (BD.data.X (q+1)) (κ (ι ⟨j⟩) (q+1)),\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_neg_spec' (q : ℕ) (k : ℕ) :\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X (q+1)))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1))).obj i))\n ⟨k⟩ ≫ (iso_on_the_left_neg _ _ _ _ _ q).inv =\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X (q+1)) (κ (ι ⟨k⟩) (q+1))).inv ≫\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f (-[1+q]) :=\nbegin\n dsimp [iso_on_the_left_neg],\n erw colimit.ι_desc_assoc, dsimp,\n rw [category.assoc],\n slice_lhs 2 3\n { rw iso_on_the_left_neg₀_spec' },\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_neg_spec (q : ℕ) (k : ℕ) :\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X (q+1)) (κ (ι ⟨k⟩) (q+1))).inv ≫\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f (-[1+q]) ≫\n (iso_on_the_left_neg _ _ _ _ _ q).hom =\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X (q+1)))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1))).obj i))\n ⟨k⟩ :=\nbegin\n rw [← category.assoc, ← iso.eq_comp_inv, iso_on_the_left_neg_spec'],\nend\n\n@[simp, reassoc]\nlemma iso_on_the_left_neg_spec_alt (q : ℕ) (k : ℕ) :\n (sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)) ⟨k⟩).f (-[1+q]) ≫\n (iso_on_the_left_neg _ _ _ _ _ q).hom =\n CondensedSet_to_Condensed_Ab.map (profinite_pow_filtration_iso M\n (BD.data.X (q+1)) (κ (ι ⟨k⟩) (q+1))).hom ≫\n sigma.ι (λ (i : as_small.{u+1 0 0} ℕ), CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X (q+1)))),\n (Condensed.as_nat_diagram.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1))).obj i))\n ⟨k⟩ :=\nbegin\n rw [← functor.map_iso_hom, ← iso.inv_comp_eq,\n functor.map_iso_inv, iso_on_the_left_neg_spec],\nend\n\nlemma iso_on_the_left_neg_conj_aux (q : ℕ) (j : ℕ) :\n ((profinite_pow_filtration_iso.{u} M (BD.data.X (q+1)) (κ (ι {down := j}) (q+1))).hom ≫\n (Condensed.as_nat_diagram_pow.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1)) (BD.data.X (q+1))).map\n (as_small.up.{0 0 u+1}.map (hom_of_le.{0} (nat.le_succ _)))) ≫\n (profinite_pow_filtration_iso.{u} M (BD.data.X (q+1)) (κ (ι {down := j + 1}) (q+1))).inv =\n Profinite_to_Condensed.map (pseudo_normed_group.map_filtration _ _ _\n (fact.out (monotone (function.swap κ (q+1))) (hι $ by { exact_mod_cast j.le_succ }))) :=\nbegin\n rw iso.comp_inv_eq,\n apply limit.hom_ext, rintro ⟨k⟩,\n dsimp [Condensed.as_nat_diagram_pow, pow_functor], simp only [category.assoc],\n erw profinite_pow_filtration_iso_spec,\n simp only [lim_map_π, discrete.nat_trans_app],\n erw profinite_pow_filtration_iso_spec_assoc,\n dsimp [Condensed.as_nat_diagram, restrict_diagram,\n CompHausFiltPseuNormGrp.level_Condensed_diagram,\n CompHausFiltPseuNormGrp.level_Condensed_diagram'],\n rw ← Profinite_to_Condensed.map_comp,\n have h : κ (ι ⟨j⟩) (q+1) ≤ κ (ι ⟨j+1⟩) (q+1),\n { apply fact.out (monotone (function.swap κ (q+1))),\n apply hι,\n exact_mod_cast j.le_succ },\n change _ ≫ Profinite_to_Condensed.map (pseudo_normed_group.map_filtration M _ _ h) = _,\n rw ← Profinite_to_Condensed.map_comp,\n congr' 1,\nend\n\nlemma iso_on_the_left_neg_conj (q : ℕ) :\n ((QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)).f (-[1+q])) =\n (iso_on_the_left_neg _ _ _ _ hι _).hom ≫\n (Condensed.coproduct_to_coproduct (Condensed.as_nat_diagram_pow M.to_CHFPNG\n (combine κ ι hι (q+1)) _ ⋙ _) - 𝟙 _) ≫ (iso_on_the_left_neg _ _ _ _ hι _).inv :=\nbegin\n dsimp [QprimeFP.shift_sub_id],\n simp only [comp_sub, sub_comp, category.id_comp, iso.hom_inv_id,\n category.assoc], congr' 1,\n apply (is_colimit_of_preserves (homological_complex.eval _ _ _)\n (colimit.is_colimit _)).hom_ext, swap, apply_instance,\n rintros ⟨⟨j⟩⟩, dsimp,\n erw [← homological_complex.comp_f, colimit.ι_desc],\n dsimp [sigma_shift_cone],\n rw iso_on_the_left_neg_spec_alt_assoc,\n erw colimit.ι_desc_assoc, dsimp,\n simp only [category.assoc],\n slice_rhs 3 4\n { erw iso_on_the_left_neg_spec' },\n simp only [← category.assoc],\n congr' 1,\n dsimp [CondensedSet_to_Condensed_Ab],\n simp only [← functor.map_comp],\n dsimp [QprimeFP_int, QprimeFP_nat, FreeAb.eval, functor.map_FreeAb,\n FPsystem, FPsystem.X, FreeAb.of_functor],\n rw free_abelian_group.lift.of, dsimp,\n congr' 1,\n ext S : 2,\n dsimp,\n simp only [← functor.map_comp], congr' 1,\n simp only [← nat_trans.comp_app, ← Sheaf.hom.comp_val],\n rw iso_on_the_left_neg_conj_aux,\n ext, refl,\nend\n\n.\n\ndef product_iso_biproduct {A : Type (u+2)} [category.{u+1} A]\n [abelian A] {α : Type (u+1)} [fintype α] (X : α → A) :\n ∏ X ≅ biproduct X :=\n(limit.is_limit _).cone_point_unique_up_to_iso (biproduct.is_limit _)\n\n@[simp, reassoc]\nlemma product_iso_biproduct_spec' {A : Type (u+2)} [category.{u+1} A]\n [abelian A] {α : Type (u+1)} [fintype α] (X : α → A) (t) :\n (product_iso_biproduct X).inv ≫ pi.π _ t =\n biproduct.π _ t :=\nbegin\n erw limit.lift_π, refl,\nend\n\n@[simp, reassoc]\nlemma product_iso_biproduct_spec {A : Type (u+2)} [category.{u+1} A]\n [abelian A] {α : Type (u+1)} [fintype α] (X : α → A) (t) :\n (product_iso_biproduct X).hom ≫ biproduct.π _ t = pi.π _ t :=\nbegin\n rw [← iso.eq_inv_comp, product_iso_biproduct_spec'],\nend\n\ndef Condensed_product_iso_biproduct (q : ℕ) :\n Condensed_Ab_to_CondensedSet.{u}.obj\n (∏ λ (i : ulift.{u+1 0} (fin (q))), M.to_Condensed) ≅\n Condensed_Ab_to_CondensedSet.{u}.obj\n (⨁ λ (i : (fin (q))), M.to_Condensed) :=\nCondensed_Ab_to_CondensedSet.map_iso $\n{ hom := biproduct.lift $ λ i, pi.π _ ⟨i⟩,\n inv := pi.lift $ λ i, biproduct.π _ i.down,\n hom_inv_id' := by { apply limit.hom_ext, rintros ⟨⟨j⟩⟩, dsimp, simp, },\n inv_hom_id' := by { apply biproduct.hom_ext, rintros ⟨j⟩, dsimp, simp } }\n--(limit.is_limit _).cone_point_unique_up_to_iso (biproduct.is_limit _)\n\n@[simp, reassoc]\nlemma Condensed_product_iso_biproduct_spec' (q : ℕ) (i : ulift.{u+1} (fin q)) :\n (Condensed_product_iso_biproduct M q).inv ≫\n Condensed_Ab_to_CondensedSet.map (pi.π _ i) =\n Condensed_Ab_to_CondensedSet.map (biproduct.π _ i.down) :=\nbegin\n dsimp only [Condensed_product_iso_biproduct, functor.map_iso_inv, functor.map_iso_hom],\n rw ← Condensed_Ab_to_CondensedSet.map_comp,\n erw limit.lift_π,\n refl,\nend\n\n@[simp, reassoc]\nlemma Condensed_product_iso_biproduct_spec (q : ℕ) (i : ulift.{u+1} (fin q)) :\n (Condensed_product_iso_biproduct M q).hom ≫\n Condensed_Ab_to_CondensedSet.map (biproduct.π _ i.down) =\n Condensed_Ab_to_CondensedSet.map (pi.π _ i) :=\nbegin\n rw ← iso.eq_inv_comp, rw Condensed_product_iso_biproduct_spec',\nend\n\ndef Condensed_product_iso_product (q : ℕ) :\n Condensed_Ab_to_CondensedSet.{u}.obj\n (∏ λ (i : ulift.{u+1 0} (fin (q))), M.to_Condensed) ≅\n ∏ λ i : ulift.{u+1} (fin q), Condensed_Ab_to_CondensedSet.obj M.to_Condensed :=\npreserves_limit_iso Condensed_Ab_to_CondensedSet _ ≪≫\nhas_limit.iso_of_nat_iso (discrete.nat_iso $ λ i, iso.refl _)\n\n@[simp, reassoc]\nlemma Condensed_product_iso_product_spec (q : ℕ) (i : ulift.{u+1} (fin q)) :\n (Condensed_product_iso_product M q).hom ≫ pi.π _ i =\n Condensed_Ab_to_CondensedSet.map (pi.π _ i) :=\nbegin\n dsimp [Condensed_product_iso_product], simp only [category.assoc],\n erw limit.lift_π,\n dsimp,\n erw [category.comp_id, limit.lift_π], refl,\nend\n\n@[simp, reassoc]\nlemma Condensed_product_iso_product_spec' (q : ℕ) (i : ulift.{u+1} (fin q)) :\n (Condensed_product_iso_product M q).inv ≫ Condensed_Ab_to_CondensedSet.map (pi.π _ i) =\n pi.π _ i :=\nby { rw iso.inv_comp_eq, rw Condensed_product_iso_product_spec }\n\ndef iso_on_the_right_zero :\n CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X 0))),\n (Condensed.as_nat_cocone.{u} M.to_CHFPNG (combine.{u} κ ι hι 0)).X) ≅\n ((BD.eval' freeCond'.{u}).obj M.to_Condensed).X 0 :=\nbegin\n refine CondensedSet_to_Condensed_Ab.map_iso _,\n dsimp,\n refine _ ≪≫ Condensed_product_iso_biproduct _ _,\n refine (Condensed_product_iso_product _ _).symm,\nend\n\n-- Why is this thing tagged with simp in the first place!?\nlocal attribute [-simp] forget_map_eq_coe\n\n@[simp, reassoc]\nlemma iso_on_the_right_zero_spec' (i : ulift.{u+1} (fin (BD.data.X 0))) :\n (iso_on_the_right_zero BD κ M ι hι).inv ≫\n CondensedSet_to_Condensed_Ab.map (pi.π _ i) =\n CondensedSet_to_Condensed_Ab.map (Condensed_Ab_to_CondensedSet.map $ biproduct.π _ i.down) :=\nbegin\n dsimp [iso_on_the_right_zero], simp only [← functor.map_comp], congr' 1, ext S : 2,\n dsimp, simp_rw [← functor.map_comp, ← nat_trans.comp_app, ← Sheaf.hom.comp_val, category.assoc],\n erw Condensed_product_iso_product_spec,\n erw Condensed_product_iso_biproduct_spec',\n refl,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_right_zero_spec (i : ulift.{u+1} (fin (BD.data.X 0))) :\n (iso_on_the_right_zero BD κ M ι hι).hom ≫\n CondensedSet_to_Condensed_Ab.map (Condensed_Ab_to_CondensedSet.map $ biproduct.π _ i.down) =\n CondensedSet_to_Condensed_Ab.map (pi.π _ i) :=\nby { rw ← iso.eq_inv_comp, rw iso_on_the_right_zero_spec' }\n\nlemma iso_on_the_right_zero_conj :\n ((QprimeFP_sigma_proj BD κ M ι).f 0) =\n (iso_on_the_left_zero _ _ _ _ hι).hom ≫\n Condensed.coproduct_presentation_with_pow CondensedSet_to_Condensed_Ab M.to_CHFPNG\n (combine _ _ _ _) _ ≫ (iso_on_the_right_zero _ _ _ _ _).hom :=\nbegin\n dsimp [QprimeFP_sigma_proj],\n apply (is_colimit_of_preserves (homological_complex.eval _ _ 0)\n (colimit.is_colimit (discrete.functor $\n λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)))).hom_ext,\n rintros ⟨⟨i⟩⟩, dsimp, rw [← homological_complex.comp_f, colimit.ι_desc], dsimp,\n slice_rhs 1 2 { erw iso_on_the_left_zero_spec_alt BD κ M ι hι i },\n dsimp [Condensed.coproduct_presentation_with_pow,\n -CondensedSet_to_Condensed_Ab_map], simp only [category.assoc, colimit.ι_desc],\n dsimp [-CondensedSet_to_Condensed_Ab_map],\n dsimp [QprimeFP_incl, -CondensedSet_to_Condensed_Ab_map, iso_on_the_right_zero],\n simp only [← functor.map_comp], congr' 1,\n simp_rw ← category.assoc, rw [← iso.comp_inv_eq, iso.eq_comp_inv],\n apply limit.hom_ext, rintro ⟨j⟩,\n simp only [category.assoc, lim_map_π],\n erw Condensed_product_iso_product_spec,\n erw Condensed_product_iso_biproduct_spec',\n erw profinite_pow_filtration_iso_spec_assoc,\n ext S : 3,\n dsimp [QprimeFP_incl_aux],\n rw [← whisker_right_app, ← nat_trans.comp_app],\n have := (is_limit_of_preserves\n (Condensed_Ab_to_CondensedSet.{u} ⋙ CondensedSet_to_presheaf.{u})\n (biproduct.is_limit (λ (i : (fin (BD.data.X 0))), M.to_Condensed))).fac,\n dsimp at this, erw this _ ⟨j.down⟩,\n ext, refl,\nend\n\n.\n\ndef iso_on_the_right_neg (q : ℕ) :\n CondensedSet_to_Condensed_Ab.{u}.obj\n (∏ λ (j : ulift.{u+1 0} (fin (BD.data.X (q+1)))),\n (Condensed.as_nat_cocone.{u} M.to_CHFPNG (combine.{u} κ ι hι (q+1))).X) ≅\n ((BD.eval' freeCond'.{u}).obj M.to_Condensed).X (-[1+q]) :=\nbegin\n refine CondensedSet_to_Condensed_Ab.map_iso _,\n dsimp,\n refine _ ≪≫ Condensed_product_iso_biproduct _ _,\n refine (Condensed_product_iso_product _ _).symm,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_right_neg_spec' (q : ℕ) (i : ulift.{u+1} (fin (BD.data.X (q+1)))) :\n (iso_on_the_right_neg BD κ M ι hι q).inv ≫\n CondensedSet_to_Condensed_Ab.map (pi.π _ i) =\n CondensedSet_to_Condensed_Ab.map (Condensed_Ab_to_CondensedSet.map $ biproduct.π _ i.down) :=\nbegin\n dsimp [iso_on_the_right_neg], simp only [← functor.map_comp], congr' 1, ext S : 2,\n dsimp, simp_rw [← functor.map_comp, ← nat_trans.comp_app, ← Sheaf.hom.comp_val, category.assoc],\n erw Condensed_product_iso_product_spec,\n erw Condensed_product_iso_biproduct_spec',\n refl,\nend\n\n@[simp, reassoc]\nlemma iso_on_the_right_neg_spec (q : ℕ) (i : ulift.{u+1} (fin (BD.data.X (q+1)))) :\n (iso_on_the_right_neg BD κ M ι hι q).hom ≫\n CondensedSet_to_Condensed_Ab.map (Condensed_Ab_to_CondensedSet.map $ biproduct.π _ i.down) =\n CondensedSet_to_Condensed_Ab.map (pi.π _ i) :=\nby { rw ← iso.eq_inv_comp, rw iso_on_the_right_neg_spec' }\n\nlemma iso_on_the_right_neg_conj (q : ℕ) :\n ((QprimeFP_sigma_proj BD κ M ι).f (-[1+q])) =\n (iso_on_the_left_neg _ _ _ _ hι q).hom ≫\n Condensed.coproduct_presentation_with_pow CondensedSet_to_Condensed_Ab M.to_CHFPNG\n (combine _ _ _ _) _ ≫ (iso_on_the_right_neg _ _ _ _ _ _).hom :=\nbegin\n dsimp [QprimeFP_sigma_proj],\n apply (is_colimit_of_preserves (homological_complex.eval _ _ (-[1+q]))\n (colimit.is_colimit (discrete.functor $\n λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj (ι k)))).hom_ext,\n rintros ⟨⟨i⟩⟩, dsimp, rw [← homological_complex.comp_f, colimit.ι_desc], dsimp,\n slice_rhs 1 2 { erw iso_on_the_left_neg_spec_alt BD κ M ι hι q i },\n dsimp [Condensed.coproduct_presentation_with_pow,\n -CondensedSet_to_Condensed_Ab_map], simp only [category.assoc, colimit.ι_desc],\n dsimp [-CondensedSet_to_Condensed_Ab_map],\n dsimp [QprimeFP_incl, -CondensedSet_to_Condensed_Ab_map, iso_on_the_right_neg],\n simp only [← functor.map_comp], congr' 1,\n simp_rw ← category.assoc, rw [← iso.comp_inv_eq, iso.eq_comp_inv],\n apply limit.hom_ext, rintro ⟨j⟩,\n simp only [category.assoc, lim_map_π],\n erw Condensed_product_iso_product_spec,\n erw Condensed_product_iso_biproduct_spec',\n erw profinite_pow_filtration_iso_spec_assoc,\n ext S : 3,\n dsimp [QprimeFP_incl_aux],\n rw [← whisker_right_app, ← nat_trans.comp_app],\n erw (is_limit_of_preserves (Condensed_Ab_to_CondensedSet.{u} ⋙\n CondensedSet_to_presheaf.{u})\n (biproduct.is_limit (λ (i : (fin (BD.data.X (q+1)))), M.to_Condensed))).fac _ ⟨j.down⟩,\n ext, refl,\nend\n\nend ses_setup\n\nlemma QprimeFP.mono (n : ℤ) :\n mono ((QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)).f n) :=\nbegin\n rcases n with (_|q)|q,\n { erw iso_on_the_left_zero_conj,\n apply_with mono_comp { instances := ff }, apply_instance,\n apply_with mono_comp { instances := ff }, swap, apply_instance,\n apply Condensed.mono_coproduct_to_coproduct },\n { apply mono_of_is_zero_object,\n let e :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj\n (ι k)).X (int.of_nat q.succ) ≅\n ∐ λ k : ulift.{u+1} ℕ, ((QprimeFP_int.{u} r' BD.data κ M).obj\n (ι k)).X (int.of_nat q.succ) :=\n preserves_colimit_iso (homological_complex.eval _ _ _) _ ≪≫\n has_colimit.iso_of_nat_iso (discrete.nat_iso $ λ p, iso.refl _),\n apply is_zero_of_iso_of_zero _ e.symm,\n apply is_zero_colimit, intros j,\n exact is_zero_zero _ },\n { erw iso_on_the_left_neg_conj,\n apply_with mono_comp { instances := ff }, apply_instance,\n apply_with mono_comp { instances := ff }, swap, apply_instance,\n apply Condensed.mono_coproduct_to_coproduct },\n\n /-\n rw Condensed.mono_iff_ExtrDisc, intros T,\n let Q := QprimeFP_int r' BD.data κ M,\n let e : ((∐ λ (k : ulift.{u+1 0} ℕ), Q.obj (ι k)).X n).val.obj\n (op T.val) ≅ _ := coproduct_eval_iso _ _ _,\n let φ : ulift.{u+1} ℕ → Ab.{u+1} := λ k, ((Q.obj (ι k)).X n).val.obj (op T.val),\n let D := AddCommGroup.direct_sum_cofan.{u+1 u+1} φ,\n let hD := AddCommGroup.is_colimit_direct_sum_cofan.{u+1 u+1} φ,\n let g : D.X ⟶ D.X := sigma_shift'.{u u+2 u+1} _ hι (Q ⋙ (homological_complex.eval\n (Condensed.{u} Ab.{u+1}) (complex_shape.up ℤ) n) ⋙ Condensed.evaluation _ T.val) D hD,\n let f := _, change mono f,\n have hf : f = e.hom ≫ (g - 𝟙 _) ≫ e.inv,\n { rw [← category.assoc, iso.eq_comp_inv],\n dsimp [f, QprimeFP.shift_sub_id],\n change (_ - _) ≫ _ = _,\n simp only [comp_sub, sub_comp, category.id_comp, category.comp_id, Sheaf.hom.id_val,\n nat_trans.id_app], congr' 1,\n refine ((is_colimit_of_preserves (homological_complex.eval.{u+1 u+2 0}\n (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ) n ⋙\n Condensed.evaluation.{u+2 u+1 u} Ab.{u+1} T.val) (colimit.is_colimit _))).hom_ext (λ j, _),\n dsimp [sigma_shift],\n slice_lhs 1 2\n { erw [← nat_trans.comp_app, ← Sheaf.hom.comp_val, ← homological_complex.comp_f,\n colimit.ι_desc] },\n slice_rhs 1 2\n { erw sigma_ι_coproduct_eval_iso },\n dsimp [sigma_shift_cone],\n rw category.assoc,\n slice_lhs 2 3\n { erw sigma_ι_coproduct_eval_iso },\n erw hD.fac, refl },\n suffices : mono (g - 𝟙 _),\n { rw hf,\n apply_with mono_comp { instances := ff },\n apply_instance,\n apply_with mono_comp { instances := ff },\n exact this,\n apply_instance },\n rw [AddCommGroup.mono_iff_injective, injective_iff_map_eq_zero],\n intros x hx,\n erw [sub_eq_zero, id_apply] at hx,\n ext ⟨i⟩,\n classical,\n induction i with i IH,\n { rw ← hx,\n dsimp [g, sigma_shift', sigma_shift_cone, hD, AddCommGroup.is_colimit_direct_sum_cofan,\n AddCommGroup.direct_sum_desc, discrete.nat_trans, direct_sum.to_add_monoid],\n rw [dfinsupp.sum_add_hom_apply, dfinsupp.sum_apply],\n apply finset.sum_eq_zero,\n rintro ⟨j⟩ -,\n convert dif_neg _,\n rw [finset.mem_singleton],\n intro H, rw ulift.ext_iff at H, revert H, apply nat.no_confusion, },\n { rw ← hx,\n classical,\n dsimp [g, sigma_shift', sigma_shift_cone, hD, AddCommGroup.is_colimit_direct_sum_cofan,\n AddCommGroup.direct_sum_desc, discrete.nat_trans, direct_sum.to_add_monoid],\n rw [dfinsupp.sum_add_hom_apply, dfinsupp.sum_apply],\n rw dfinsupp.zero_apply at IH,\n convert finset.sum_eq_single (ulift.up $ i) _ _,\n { rw [IH, add_monoid_hom.map_zero, dfinsupp.zero_apply], },\n { rintro ⟨j⟩ - hj, convert dif_neg _, rw [finset.mem_singleton],\n intro H, apply hj, rw ulift.ext_iff at H ⊢, change i+1 = j+1 at H,\n change j = i, linarith only [H] },\n { intro, rw [IH, add_monoid_hom.map_zero, dfinsupp.zero_apply], }, },\n recover, all_goals { classical; apply_instance }\n -/\nend\n.\n\nlemma QprimeFP_sigma_proj_eq_0 (n : ℕ) : ((QprimeFP_sigma_proj BD κ M ι).f (n+1:ℤ)) = 0 :=\nby { apply is_zero.eq_of_tgt, apply is_zero_zero }\n\n-- move me\nlemma AddCommGroup.eq_of_is_zero (A : AddCommGroup) (hA : is_zero A) (x y : A) : x = y :=\nbegin\n rw [← Ab.pt_apply' x, ← Ab.pt_apply' y], congr' 1, apply hA.eq_of_tgt,\nend\n\nattribute [simps] Condensed_Ab_to_presheaf\n\nlemma QprimeFP.epi (hι : monotone ι)\n (hκι : ∀ (r : ℝ≥0) q, ∃ (n : ℕ), r ≤ (combine.{u} κ ι hι q) n)\n (n : ℤ) : epi ((QprimeFP_sigma_proj BD κ M ι).f n) :=\nbegin\n rcases n with (_|q)|q,\n { erw iso_on_the_right_zero_conj,\n swap, assumption,\n apply_with epi_comp { instances := ff }, apply_instance,\n apply_with epi_comp { instances := ff }, swap, apply_instance,\n rw Condensed.coproduct_presentation_with_pow_eq,\n apply_with epi_comp { instances := ff }, swap, apply_instance,\n swap, { intros r, apply hκι },\n exact Condensed.epi_coproduct_to_colimit (Condensed.as_nat_diagram_pow.{u} M.to_CHFPNG\n (combine.{u} κ ι hι 0) (BD.data.X 0) ⋙ CondensedSet_to_Condensed_Ab.{u}) },\n { apply epi_of_is_zero,\n exact is_zero_zero _ },\n { erw iso_on_the_right_neg_conj, swap, assumption,\n apply_with epi_comp { instances := ff }, apply_instance,\n apply_with epi_comp { instances := ff }, swap, apply_instance,\n rw Condensed.coproduct_presentation_with_pow_eq,\n apply_with epi_comp { instances := ff }, swap, apply_instance,\n swap, { intros r, apply hκι },\n exact Condensed.epi_coproduct_to_colimit (Condensed.as_nat_diagram_pow.{u} M.to_CHFPNG\n (combine.{u} κ ι hι (q + 1)) (BD.data.X (q + 1)) ⋙ CondensedSet_to_Condensed_Ab.{u}) }\n\n /-\n rw is_epi_iff_forall_surjective,\n intros S,\n rcases n with ((_|n)|n),\n swap,\n { intro f,\n refine ⟨0, _⟩, apply AddCommGroup.eq_of_is_zero,\n rw [← evaluation_obj_obj, ← Condensed_Ab_to_presheaf_obj],\n apply functor.map_is_zero, apply functor.map_is_zero, exact is_zero_zero _, },\n { admit },\n { admit },\n -/\nend\n\nlemma QprimeFP.exact (n : ℤ)\n (hκι : ∀ (r : ℝ≥0) q, ∃ (n : ℕ), r ≤ (combine.{u} κ ι hι q) n) :\n exact\n ((QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)).f n)\n ((QprimeFP_sigma_proj BD κ M ι).f n) :=\nbegin\n rcases n with (_|q)|q,\n { erw iso_on_the_left_zero_conj,\n erw iso_on_the_right_zero_conj, swap, assumption,\n rw ← category.assoc,\n apply category_theory.exact_comp_inv_hom_comp,\n rw exact_iso_comp, rw exact_comp_iso,\n apply (Condensed.short_exact_sequence_with_pow _ _ _ _ _).exact,\n intros r, apply hκι },\n { apply exact_of_is_zero,\n let e :\n (∐ λ (k : ulift.{u+1 0} ℕ), (QprimeFP_int.{u} r' BD.data κ M).obj\n (ι k)).X (int.of_nat q.succ) ≅\n ∐ λ k : ulift.{u+1} ℕ, ((QprimeFP_int.{u} r' BD.data κ M).obj\n (ι k)).X (int.of_nat q.succ) :=\n preserves_colimit_iso (homological_complex.eval _ _ _) _ ≪≫\n has_colimit.iso_of_nat_iso (discrete.nat_iso $ λ p, iso.refl _),\n apply is_zero_of_iso_of_zero _ e.symm,\n apply is_zero_colimit, intros j,\n exact is_zero_zero _ },\n { erw iso_on_the_left_neg_conj,\n erw iso_on_the_right_neg_conj, swap, assumption,\n rw ← category.assoc,\n apply category_theory.exact_comp_inv_hom_comp,\n rw exact_iso_comp, rw exact_comp_iso,\n apply (Condensed.short_exact_sequence_with_pow _ _ _ _ _).exact,\n intros r, apply hκι },\nend\n\nlemma QprimeFP.short_exact\n (hκι : ∀ (r : ℝ≥0) q, ∃ (n : ℕ), r ≤ (combine.{u} κ ι hι q) n) (n : ℤ) :\n short_exact\n ((QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)).f n)\n ((QprimeFP_sigma_proj BD κ M ι).f n) :=\nbegin\n apply_with short_exact.mk {instances:=ff},\n { apply QprimeFP.mono },\n { apply QprimeFP.epi, assumption, },\n { apply QprimeFP.exact, assumption },\nend\n\nend step4\n\nsection step5\n\nvariables {r' : ℝ≥0} [fact (0 < r')] [fact (r' ≤ 1)]\nvariables (BD : breen_deligne.data)\nvariables (κ κ₂ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ (c : ℝ≥0), BD.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables [∀ (c : ℝ≥0), BD.suitable (κ₂ c)] [∀ n, fact (monotone (function.swap κ₂ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\n\ndef QprimeFP_nat.Tinv [∀ c n, fact (κ c n ≤ r' * κ₂ c n)] :\n (QprimeFP_nat r' BD κ M) ⟶ (QprimeFP_nat r' BD κ₂ M) :=\nwhisker_right (FPsystem.Tinv.{u} r' BD ⟨M⟩ _ _) _\n\ndef QprimeFP_int.Tinv [∀ c n, fact (κ c n ≤ r' * κ₂ c n)] :\n (QprimeFP_int r' BD κ M) ⟶ (QprimeFP_int r' BD κ₂ M) :=\nwhisker_right (QprimeFP_nat.Tinv _ _ _ _)\n (homological_complex.embed complex_shape.embedding.nat_down_int_up)\n\ndef QprimeFP.Tinv [∀ c n, fact (κ c n ≤ r' * κ₂ c n)] :\n (QprimeFP r' BD κ M) ⟶ (QprimeFP r' BD κ₂ M) :=\nwhisker_right (QprimeFP_nat.Tinv _ _ _ _) chain_complex.to_bounded_homotopy_category\n\n/-- The natural inclusion map -/\ndef QprimeFP_nat.ι [∀ c n, fact (κ c n ≤ κ₂ c n)] :\n (QprimeFP_nat r' BD κ M) ⟶ (QprimeFP_nat r' BD κ₂ M) :=\nwhisker_right (FPsystem.res r' BD ⟨M⟩ _ _) _\n\n/-- The natural inclusion map -/\ndef QprimeFP_int.ι [∀ c n, fact (κ c n ≤ κ₂ c n)] :\n (QprimeFP_int r' BD κ M) ⟶ (QprimeFP_int r' BD κ₂ M) :=\nwhisker_right (QprimeFP_nat.ι _ _ _ _)\n (homological_complex.embed complex_shape.embedding.nat_down_int_up)\n\n/-- The natural inclusion map -/\ndef QprimeFP.ι [∀ c n, fact (κ c n ≤ κ₂ c n)] :\n (QprimeFP r' BD κ M) ⟶ (QprimeFP r' BD κ₂ M) :=\nwhisker_right (QprimeFP_nat.ι _ _ _ _) chain_complex.to_bounded_homotopy_category\n\nopen category_theory.preadditive\n\nlemma commsq_shift_sub_id_Tinv [∀ (c : ℝ≥0) (n : ℕ), fact (κ₂ c n ≤ r' * κ c n)] :\n commsq (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD κ₂ M))\n (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.Tinv BD κ₂ κ M))\n (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.Tinv BD κ₂ κ M))\n (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD κ M)) :=\ncommsq.of_eq begin\n delta QprimeFP.shift_sub_id,\n rw [sub_comp, comp_sub, category.id_comp, category.comp_id],\n refine congr_arg2 _ _ rfl,\n apply colimit.hom_ext, rintro ⟨⟨j⟩⟩,\n dsimp [sigma_shift, sigma_shift', sigma_shift_cone, sigma_map],\n rw [colimit.ι_desc_assoc, colimit.ι_desc_assoc],\n dsimp [sigma_shift_cone],\n simp only [category.assoc, colimit.ι_desc],\n dsimp [sigma_shift_cone],\n simp only [sigma_shift, sigma_shift', sigma_shift_cone, sigma_map, colimit.ι_desc_assoc,\n colimit.ι_desc, cofan.mk_ι_app, category.assoc, nat_trans.naturality_assoc,\n discrete.nat_trans_app],\nend\n\nlemma commsq_shift_sub_id_ι [∀ (c : ℝ≥0) (n : ℕ), fact (κ₂ c n ≤ κ c n)] :\n commsq (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD κ₂ M))\n (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.ι BD κ₂ κ M))\n (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.ι BD κ₂ κ M))\n (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD κ M)) :=\ncommsq.of_eq begin\n delta QprimeFP.shift_sub_id,\n rw [sub_comp, comp_sub, category.id_comp, category.comp_id],\n refine congr_arg2 _ _ rfl,\n apply colimit.hom_ext, rintro ⟨⟨j⟩⟩,\n dsimp [sigma_shift, sigma_shift', sigma_shift_cone],\n simp only [sigma_shift_cone, sigma_map, colimit.ι_desc_assoc, colimit.ι_desc, cofan.mk_ι_app,\n category.assoc, nat_trans.naturality_assoc, discrete.nat_trans_app, colimit.cocone_ι],\nend\n\nend step5\n\nsection step6\n\nvariables {r' : ℝ≥0} [fact (0 < r')] [fact (r' ≤ 1)]\nvariables (BD : breen_deligne.package)\nvariables (κ κ₂ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ (c : ℝ≥0), BD.data.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables [∀ (c : ℝ≥0), BD.data.suitable (κ₂ c)] [∀ n, fact (monotone (function.swap κ₂ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\n\nopen category_theory.preadditive\n\n-- lemma commsq_sigma_proj_Tinv' (j) (n : ℕ) [fact (κ₂ (ι j) n ≤ r' * κ (ι j) n)] :\n-- QprimeFP_incl_aux M (κ₂ (ι j) n) (BD.data.X n) ≫\n-- Condensed_Ab_to_CondensedSet.map (biproduct.map (λ (i : ulift (fin (BD.data.X n))), M.Tinv_cond)) =\n-- Profinite_to_Condensed.map\n-- ((FiltrationPow.Tinv r' (κ₂ (ι j) n) (κ (ι j) n) (BD.data.X n)).app ⟨M⟩) ≫\n-- QprimeFP_incl_aux M (κ (ι j) n) (BD.data.X n) :=\n-- by admit\n\nlemma commsq_sigma_proj_Tinv [∀ (c : ℝ≥0) (n : ℕ), fact (κ₂ c n ≤ r' * κ c n)] :\n commsq (QprimeFP_sigma_proj BD κ₂ M ι) (sigma_map (λ (k : ulift ℕ), ι k)\n (QprimeFP_int.Tinv BD.data κ₂ κ M))\n ((BD.eval' freeCond').map M.Tinv_cond)\n (QprimeFP_sigma_proj BD κ M ι) :=\ncommsq.of_eq begin\n apply colimit.hom_ext, rintro ⟨j⟩,\n simp only [QprimeFP_sigma_proj, sigma_map, colimit.ι_desc_assoc, colimit.ι_desc,\n cofan.mk_ι_app, category.assoc, nat_trans.naturality_assoc],\n dsimp only [QprimeFP_incl, QprimeFP_int.Tinv, whisker_right_app,\n package.eval', functor.comp_map],\n rw [← functor.map_comp, ← functor.map_comp],\n refine congr_arg _ _,\n ext n : 2,\n dsimp only [homological_complex.comp_f, data.eval_functor, functor.comp_obj, functor.flip_obj_map,\n homological_complex.functor_eval_map_app_f, data.eval_functor'_obj_X_map, functor.comp_map,\n QprimeFP_nat.Tinv, whisker_right_app, functor.map_homological_complex_map_f],\n rw [map_FreeAb_comp_map],\n dsimp only [FreeAb.eval, functor.map_FreeAb, FPsystem.Tinv, FP2.Tinv_app, FreeAb.of_functor],\n simp only [free_abelian_group.lift_map, function.comp, function.comp.left_id],\n rw [free_abelian_group.lift.of],\n simp only [← functor.map_comp],\n congr' 1,\n ext1,\n let x := biproduct.is_limit (λ (i : (fin (BD.data.X n))), M.to_Condensed),\n let y := is_limit_of_preserves (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf) x,\n apply y.hom_ext, rintro ⟨k⟩,\n simp only [Sheaf.hom.comp_val, category.assoc, QprimeFP_incl_aux, y.fac],\n rw [← CondensedSet_to_presheaf_map, ← functor.comp_map],\n simp only [functor.map_cone_π_app, bicone.to_cone_π_app, biproduct.bicone_π],\n rw [← functor.map_comp, biproduct.map_π, functor.map_comp],\n have : ((Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map_cone\n (biproduct.bicone (λ (i : (fin (BD.data.X n))), M.to_Condensed)).to_cone).π.app ⟨k⟩ =\n (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf).map\n (biproduct.π (λ (j : (fin (BD.data.X n))), M.to_Condensed) k) := rfl,\n rw [← this, ← category.assoc, y.fac], clear this y x,\n ext S : 2,\n dsimp only [nat_trans.comp_app, QprimeFP_incl_aux', functor.comp_map,\n Condensed_Ab_to_CondensedSet_map, CondensedSet_to_presheaf_map,\n Profinite_to_Condensed_map_val, whisker_right_app, ProFiltPseuNormGrpWithTinv₁.Tinv_cond,\n forget_map_eq_coe, yoneda_map_app, CompHausFiltPseuNormGrp.to_Condensed_map,\n Ab.ulift_map_apply],\n simp only [← ulift_functor.map_comp],\n refl\nend\n\nlemma commsq_sigma_proj_ι [∀ (c : ℝ≥0) (n : ℕ), fact (κ₂ c n ≤ κ c n)] :\n commsq (QprimeFP_sigma_proj BD κ₂ M ι) (sigma_map (λ (k : ulift ℕ), ι k)\n (QprimeFP_int.ι BD.data κ₂ κ M)) (𝟙 _) (QprimeFP_sigma_proj BD κ M ι) :=\ncommsq.of_eq begin\n simp only [category.comp_id],\n apply colimit.hom_ext, intro j,\n simp only [QprimeFP_sigma_proj, sigma_map, colimit.ι_desc_assoc, colimit.ι_desc,\n cofan.mk_ι_app, category.assoc, nat_trans.naturality_assoc],\n dsimp only [QprimeFP_incl, QprimeFP_int.ι, whisker_right_app,\n package.eval', functor.comp_map],\n rw [← functor.map_comp],\n refine congr_arg _ _,\n ext n : 2,\n dsimp only [homological_complex.comp_f, data.eval_functor, functor.comp_obj, functor.flip_obj_map,\n homological_complex.functor_eval_map_app_f, data.eval_functor'_obj_X_map, functor.comp_map,\n QprimeFP_nat.ι, whisker_right_app, functor.map_homological_complex_map_f],\n rw [map_FreeAb_comp_map],\n dsimp only [FreeAb.eval, functor.map_FreeAb, FPsystem.res, FP2.res_app, FreeAb.of_functor],\n simp only [free_abelian_group.lift_map, function.comp, function.comp.left_id],\n rw [free_abelian_group.lift.of, ← functor.map_comp],\n refine congr_arg _ _,\n ext1,\n let x := biproduct.is_limit (λ (i : (fin (BD.data.X n))), M.to_Condensed),\n let y := is_limit_of_preserves (Condensed_Ab_to_CondensedSet ⋙ CondensedSet_to_presheaf) x,\n apply y.hom_ext, intro k,\n simp only [Sheaf.hom.comp_val, category.assoc, QprimeFP_incl_aux, y.fac],\n rw [← CondensedSet_to_presheaf_map, ← functor.comp_map],\n ext S : 2,\n dsimp only [nat_trans.comp_app, QprimeFP_incl_aux', functor.comp_map,\n Condensed_Ab_to_CondensedSet_map, CondensedSet_to_presheaf_map,\n Profinite_to_Condensed_map_val, whisker_right_app,\n forget_map_eq_coe, yoneda_map_app, CompHausFiltPseuNormGrp.to_Condensed_map,\n Ab.ulift_map_apply],\n simp only [← ulift_functor.map_comp],\n refl,\nend\n\nend step6\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/pseudo_normed_group/QprimeFP.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.600188359260205, "lm_q2_score": 0.3208213138121609, "lm_q1q2_score": 0.19255321795262417}} {"text": "import Lbar.ext_aux3\nimport Lbar.iota\n\nnoncomputable theory\n\nuniverses v u u'\n\nopen opposite category_theory category_theory.limits category_theory.preadditive\nopen_locale nnreal zero_object\n\nvariables (r r' : ℝ≥0)\nvariables [fact (0 < r)] [fact (0 < r')] [fact (r < r')] [fact (r < 1)] [fact (r' < 1)]\n\nopen bounded_homotopy_category\n\nvariables {r'}\nvariables (BD : breen_deligne.package)\nvariables (κ κ₂ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ (c : ℝ≥0), BD.data.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables [∀ (c : ℝ≥0), BD.data.suitable (κ₂ c)] [∀ n, fact (monotone (function.swap κ₂ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\n\nsection preps\n\nvariables (V : SemiNormedGroup.{u}) [complete_space V] [separated_space V]\nvariables (ι : ulift.{u+1} ℕ → ℝ≥0) (hι : monotone ι)\n\nset_option pp.universes true\n\nlemma homotopy_category.colimit_cofan_bdd {A : Type u} [category.{v} A] [abelian A]\n[has_coproducts.{v} A] {α : Type v} (X : α → bounded_homotopy_category A)\n [uniformly_bounded X] : homotopy_category.is_bounded_above\n (homotopy_category.colimit_cofan $ λ a : α, (X a).val).X :=\nbegin\n obtain ⟨n,hn⟩ := homotopy_category.is_uniformly_bounded_above.cond (val ∘ X),\n use n, intros i hi,\n dsimp [homotopy_category.colimit_cofan],\n let e : (∐ λ (a : α), (X a).val.as).X i ≅\n (∐ λ (a : α), (X a).val.as.X i) := homotopy_category.coproduct_iso _ _,\n refine is_zero_of_iso_of_zero _ e.symm,\n apply category_theory.is_zero_colimit,\n rintros ⟨j⟩,\n apply hn j _ hi,\n end\n\ndef Tinv2_iso_of_bicartesian_aux_1\n (i : ℤ) : commsq.{u+2 u+1}\n (shift_sub_id.{u+1}\n ((QprimeFP.{u} r' BD.data κ₂ M).op ⋙\n (Ext.{u+1 u+2} i).flip.obj ((single.{u+1 u+2} (Condensed.{u u+1 u+2} Ab.{u+1}) 0).obj V.to_Cond))\n ι\n hι)\n (pi_Ext_iso_Ext_sigma.{u} BD κ₂ M V (λ (k : ulift.{u+1 0} ℕ), ι k) i).hom\n (pi_Ext_iso_Ext_sigma.{u} BD κ₂ M V (λ (k : ulift.{u+1 0} ℕ), ι k) i).hom\n (((Ext.{u+1 u+2} i).map\n (of_hom.{u+1 u+2} (QprimeFP.shift_sub_id.{u u+2 u+1} ι hι (QprimeFP_int.{u} r' BD.data κ₂ M))).op).app\n ((single.{u+1 u+2} (Condensed.{u u+1 u+2} Ab.{u+1}) 0).obj (Condensed.of_top_ab.{u} ↥V))) :=\nbegin\n apply commsq.of_eq,\n dsimp only [shift_sub_id, QprimeFP.shift_sub_id],\n simp only [sub_comp, comp_sub, homological_complex.of_hom_sub, category_theory.op_sub,\n functor.map_sub, op_id, category_theory.functor.map_id, of_hom_id,\n nat_trans.app_sub, nat_trans.id_app, category.comp_id, category.id_comp],\n apply congr_arg2 _ _ rfl,\n rw ← iso.eq_comp_inv,\n dsimp only [pi_Ext_iso_Ext_sigma, iso.trans_hom, iso.trans_inv,\n iso.symm_hom, iso.symm_inv, functor.map_iso_hom,\n iso.op_hom, op_comp, functor.flip_obj_map, functor.map_iso_inv],\n simp only [category.assoc, ← nat_trans.comp_app_assoc, ← functor.map_comp_assoc,\n ← functor.map_comp, iso.op_inv, ← op_comp],\n rw cofan_point_iso_colimit_conj_eq_desc,\n rw iso.eq_inv_comp,\n have := Ext_coproduct_iso_naturality_shift _\n (λ (k : ulift ℕ), (QprimeFP r' BD.data κ₂ M).obj (ι k))\n (λ k, (QprimeFP r' BD.data κ₂ M).map (hom_of_le $ hι $\n by exact_mod_cast k.down.le_succ)) i ((single (Condensed Ab) 0).obj V.to_Cond),\n exact this.symm,\n { apply homotopy_category.colimit_cofan_bdd },\nend\n\n@[reassoc]\nlemma Ext_coproduct_iso_π\n (A : Type u) [category.{v} A] [abelian A] [enough_projectives A] [has_coproducts.{v} A] [AB4 A]\n (X : ulift.{v} ℕ → bounded_homotopy_category A) [uniformly_bounded X] (i : ℤ) (Y) (k) :\n (Ext_coproduct_iso X i Y).hom ≫ pi.π _ k =\n ((Ext i).map $ quiver.hom.op $ sigma.ι _ _).app Y :=\nbegin\n dsimp only [Ext_coproduct_iso, iso.trans_hom, pi_iso, preadditive_yoneda_coproduct_iso,\n as_iso_hom, preadditive_yoneda_coproduct_to_product],\n simp only [category.assoc, limit.lift_π, limit.lift_π_assoc, fan.mk_π_app],\n dsimp only [Ext_iso, iso.symm_hom, functor.map_iso_hom, functor.map_iso_inv],\n simp only [← functor.map_comp, iso.op_hom, iso.op_inv, ← op_comp],\n dsimp only [Ext, Ext0, functor.comp_map, whiskering_left_obj_map, whisker_left_app,\n functor.flip_map_app, replacement_iso],\n congr' 2,\n simp only [category.assoc, iso.inv_comp_eq, quiver.hom.unop_op, unop_op, op_unop],\n apply lift_unique,\n simp only [category.assoc, iso.inv_comp_eq, quiver.hom.unop_op, unop_op, op_unop],\n erw lift_lifts,\n simp only [uniform_π, colimit.ι_desc, cofan.mk_ι_app, lift_lifts_assoc],\n refl,\nend\n\nlemma Tinv2_iso_of_bicartesian_aux_2\n [∀ c n, fact (κ₂ c n ≤ r' * κ c n)]\n (j) {e : (homotopy_category.colimit_cofan.{u+1 u+2}\n (λ (a : ulift.{u+1 0} ℕ),\n ((λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ₂ M).obj (ι k)) a).val)).X.is_bounded_above } :\n ((cofan.{u+1 u+2} (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ₂ M).obj (ι k))).ι.app j ≫\n of_hom.{u+1 u+2} (sigma_map.{u u+2 u+1} ι (QprimeFP_int.Tinv.{u} BD.data κ₂ κ M))) ≫\n (cofan_point_iso_colimit.{u} (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k))).hom =\n (QprimeFP.Tinv _ _ _ _).app _ ≫\n sigma.ι (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k)) j.1 :=\nbegin\n rw [← iso.eq_comp_inv], simp only [category.assoc, cofan_point_iso_colimit,\n colimit.comp_cocone_point_unique_up_to_iso_inv],\n dsimp only [bounded_homotopy_category.cofan, cofan.mk_ι_app, of_hom,\n homotopy_category.colimit_cofan, QprimeFP.Tinv, whisker_right_app,\n chain_complex.to_bounded_homotopy_category, functor.comp_map],\n erw [← (homotopy_category.quotient.{u+1 u+2 0} (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ)).map_comp],\n erw [← (homotopy_category.quotient.{u+1 u+2 0} (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ)).map_comp],\n congr' 1,\n dsimp only [sigma_map],\n erw [colimit.ι_desc],\n refl,\nend\n\nlemma Tinv2_iso_of_bicartesian_aux_3\n [∀ c n, fact (κ₂ c n ≤ κ c n)]\n [∀ c n, fact (κ₂ c n ≤ r' * κ c n)]\n (j)\n {e : (homotopy_category.colimit_cofan.{u+1 u+2}\n (λ (a : ulift.{u+1 0} ℕ),\n ((λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ₂ M).obj (ι k)) a).val)).X.is_bounded_above} :\n (cofan.{u+1 u+2} (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ₂ M).obj (ι k))).ι.app j ≫\n of_hom.{u+1 u+2} (sigma_map.{u u+2 u+1} ι (QprimeFP_int.ι.{u} BD.data κ₂ κ M)) ≫\n (cofan_point_iso_colimit.{u} (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k))).hom =\n (QprimeFP.ι _ κ₂ κ M).app _ ≫\n sigma.ι ((λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k))) j.1 :=\nbegin\n simp only [← category.assoc], rw [← iso.eq_comp_inv],\n simp only [category.assoc, cofan_point_iso_colimit, colimit.comp_cocone_point_unique_up_to_iso_inv],\n dsimp only [bounded_homotopy_category.cofan, cofan.mk_ι_app, of_hom,\n homotopy_category.colimit_cofan, QprimeFP.ι, whisker_right_app,\n chain_complex.to_bounded_homotopy_category, functor.comp_map],\n erw [← (homotopy_category.quotient.{u+1 u+2 0} (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ)).map_comp],\n erw [← (homotopy_category.quotient.{u+1 u+2 0} (Condensed.{u u+1 u+2} Ab.{u+1}) (complex_shape.up.{0} ℤ)).map_comp],\n congr' 1,\n dsimp only [sigma_map],\n erw [colimit.ι_desc],\n refl,\nend\n\nlemma Tinv2_iso_of_bicartesian_aux [normed_with_aut r V]\n [∀ c n, fact (κ₂ c n ≤ κ c n)] [∀ c n, fact (κ₂ c n ≤ r' * κ c n)]\n (i : ℤ)\n (H1 : (shift_sub_id.commsq (ExtQprime.Tinv2 r r' BD.data κ κ₂ M V i) ι hι).bicartesian) :\n (Ext_Tinv2_commsq (of_hom (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.Tinv BD.data κ₂ κ M)))\n (of_hom (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.ι BD.data κ₂ κ M)))\n (of_hom (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.Tinv BD.data κ₂ κ M)))\n (of_hom (sigma_map (λ (k : ulift ℕ), ι k) (QprimeFP_int.ι BD.data κ₂ κ M)))\n (of_hom (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ₂ M)))\n (of_hom (QprimeFP.shift_sub_id ι hι (QprimeFP_int r' BD.data κ M)))\n (auux $ commsq_shift_sub_id_Tinv _ _ _ _ _ _)\n (auux $ commsq_shift_sub_id_ι _ _ _ _ _ _)\n ((single _ 0).map (Condensed.of_top_ab_map (normed_add_group_hom.to_add_monoid_hom (normed_with_aut.T.inv : V ⟶ V)) (normed_add_group_hom.continuous _)))\n i).bicartesian :=\nbegin\n have h1 := _, have h2 := _, have h3 := _,\n refine commsq.bicartesian.of_iso\n (pi_Ext_iso_Ext_sigma _ _ _ _ _ _) (pi_Ext_iso_Ext_sigma _ _ _ _ _ _)\n (pi_Ext_iso_Ext_sigma _ _ _ _ _ _) (pi_Ext_iso_Ext_sigma _ _ _ _ _ _)\n h1 h2 h2 h3 H1,\n apply Tinv2_iso_of_bicartesian_aux_1,\n { clear h1, apply commsq.of_eq, rw ← iso.eq_comp_inv,\n apply limit.hom_ext, rintros ⟨j⟩, rw lim_map_π,\n dsimp [pi_Ext_iso_Ext_sigma],\n simp only [category.assoc],\n have := Ext_coproduct_iso_π _\n (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ₂ M).obj (ι k))\n i ((single.{u+1 u+2} (Condensed.{u u+1 u+2} Ab.{u+1}) 0).obj V.to_Cond) j,\n rw [this, ← nat_trans.comp_app, ← functor.map_comp, ← op_comp],\n clear this,\n erw colimit.ι_desc,\n dsimp [Ext_Tinv2, ExtQprime.Tinv2],\n simp only [sub_comp, comp_sub],\n refine congr_arg2 _ _ _,\n { simp only [← nat_trans.comp_app, ← functor.map_comp, ← op_comp],\n rw Tinv2_iso_of_bicartesian_aux_2,\n swap,\n { apply homotopy_category.colimit_cofan_bdd },\n simp only [functor.map_comp, op_comp, nat_trans.comp_app, category.assoc],\n have := Ext_coproduct_iso_π _\n (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k))\n i ((single.{u+1 u+2} (Condensed.{u u+1 u+2} Ab.{u+1}) 0).obj V.to_Cond) j,\n rw ← iso.eq_inv_comp at this,\n rw ← reassoc_of this, refl },\n { simp only [category.assoc, nat_trans.naturality, ← nat_trans.comp_app_assoc,\n ← functor.map_comp_assoc, ← functor.map_comp, ← nat_trans.comp_app, ← op_comp],\n rw Tinv2_iso_of_bicartesian_aux_3,\n simp only [functor.map_comp, op_comp, nat_trans.comp_app, category.assoc],\n have := Ext_coproduct_iso_π _\n (λ (k : ulift.{u+1 0} ℕ), (QprimeFP.{u} r' BD.data κ M).obj (ι k))\n i ((single.{u+1 u+2} (Condensed.{u u+1 u+2} Ab.{u+1}) 0).obj V.to_Cond) j,\n rw ← iso.eq_inv_comp at this,\n rw ← reassoc_of this,\n refl,\n { apply homotopy_category.colimit_cofan_bdd } } },\n apply Tinv2_iso_of_bicartesian_aux_1,\nend\n\nlemma Tinv2_iso_of_bicartesian [normed_with_aut r V]\n [∀ c n, fact (κ₂ c n ≤ κ c n)] [∀ c n, fact (κ₂ c n ≤ r' * κ c n)]\n (hκ : Lbar.sufficiently_increasing κ ι)\n (hκ₂ : Lbar.sufficiently_increasing κ₂ ι)\n (i : ℤ)\n (H1 : (shift_sub_id.commsq (ExtQprime.Tinv2 r r' BD.data κ κ₂ M V i) ι hι).bicartesian)\n (H2 : (shift_sub_id.commsq (ExtQprime.Tinv2 r r' BD.data κ κ₂ M V (i+1)) ι hι).bicartesian) :\n is_iso (((Ext (i+1)).map ((BD.eval freeCond'.{u}).map M.Tinv_cond).op).app\n ((single (Condensed Ab) 0).obj V.to_Cond) -\n ((Ext (i+1)).obj ((BD.eval freeCond').op.obj (op (M.to_Condensed)))).map\n ((single (Condensed Ab) 0).map\n (Condensed.of_top_ab_map\n (normed_add_group_hom.to_add_monoid_hom normed_with_aut.T.inv) (normed_add_group_hom.continuous _)))) :=\nbegin\n let Vc := (single (Condensed Ab) 0).obj V.to_Cond,\n have SES₁ := QprimeFP.short_exact BD κ₂ M ι hι hκ₂,\n have SES₂ := QprimeFP.short_exact BD κ M ι hι hκ,\n have := Ext_iso_of_bicartesian_of_bicartesian SES₁ SES₂\n (sigma_map _ (QprimeFP_int.Tinv BD.data _ _ M))\n (sigma_map _ (QprimeFP_int.Tinv BD.data _ _ M))\n (category_theory.functor.map _ M.Tinv_cond)\n (sigma_map _ (QprimeFP_int.ι BD.data _ _ M))\n (sigma_map _ (QprimeFP_int.ι BD.data _ _ M))\n (commsq_shift_sub_id_Tinv BD.data _ _ M ι hι)\n (commsq_sigma_proj_Tinv BD _ _ M ι)\n (commsq_shift_sub_id_ι BD.data _ _ M ι hι)\n (commsq_sigma_proj_ι BD _ _ M ι)\n Vc ((single _ _).map $ Condensed.of_top_ab_map\n (normed_add_group_hom.to_add_monoid_hom normed_with_aut.T.inv) (normed_add_group_hom.continuous _))\n _\n (Tinv2_iso_of_bicartesian_aux _ _ _ _ _ _ _ _ _ H1)\n (Tinv2_iso_of_bicartesian_aux _ _ _ _ _ _ _ _ _ H2),\n delta Ext_Tinv2 at this,\n simpa only [op_id, category_theory.functor.map_id, category.id_comp, nat_trans.id_app],\nend\n\nlemma Tinv2_iso_of_bicartesian' [normed_with_aut r V]\n [∀ c n, fact (κ₂ c n ≤ κ c n)] [∀ c n, fact (κ₂ c n ≤ r' * κ c n)]\n (H : ∀ i, ∃ (ι) (hι),\n Lbar.sufficiently_increasing κ ι ∧\n Lbar.sufficiently_increasing κ₂ ι ∧\n (shift_sub_id.commsq (ExtQprime.Tinv2 r r' BD.data κ κ₂ M V i) ι hι).bicartesian ∧\n (shift_sub_id.commsq (ExtQprime.Tinv2 r r' BD.data κ κ₂ M V (i+1)) ι hι).bicartesian)\n (i : ℤ) :\n is_iso (((Ext i).map ((BD.eval freeCond'.{u}).map M.Tinv_cond).op).app\n ((single (Condensed Ab) 0).obj V.to_Cond) -\n ((Ext i).obj ((BD.eval freeCond').op.obj (op (M.to_Condensed)))).map\n ((single (Condensed Ab) 0).map\n (Condensed.of_top_ab_map\n (normed_add_group_hom.to_add_monoid_hom normed_with_aut.T.inv) (normed_add_group_hom.continuous _)))) :=\nbegin\n obtain ⟨i, rfl⟩ : ∃ k, k+1 = i := ⟨i-1, sub_add_cancel _ _⟩,\n obtain ⟨ι, hι, hκ, hκ₂, H1, H2⟩ := H i,\n apply Tinv2_iso_of_bicartesian _ _ _ _ _ _ ι hι hκ hκ₂ i H1 H2,\nend\n\nend preps\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/Lbar/ext_aux4.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5156199157230157, "lm_q2_score": 0.3702254064929193, "lm_q1q2_score": 0.19089559289439828}} {"text": "import mcl.defs\nimport mcl.rhl\nimport mcl.lemmas\nimport mcl.compute_list\nimport mcl.ts_updates\nimport syncablep\n\nopen parlang\nopen parlang.thread_state\nopen parlang.state\nopen mcl\nopen mcl.rhl\n\n/-- Copies *var* from tlocal of the nth thread into index n of *m* (forall n). Generally used as an assertion language for Hoare proofs -/\ndef from_tlocal {sig : signature} {n} (var) (s : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig)) (m : memory (parlang_mcl_shared sig)) (h : (((sig.val var).type).dim) = 1) := \n((list.range_fin n).foldl (λ (m : parlang.memory (parlang_mcl_shared sig)) tid, \n m.update ⟨var, eq.mpr (by rw h) v[tid.val]⟩ ((s.threads.nth tid).tlocal.get ⟨var, eq.mpr (by rw h) v[tid.val]⟩))) m\n\nlemma from_tlocal_comm_update {sig : signature} {n} (var₁ var₂) (s : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig))\n(m : memory (parlang_mcl_shared sig)) {h₁} {idx val} :\nfrom_tlocal var₁ s (m.update ⟨var₂, idx⟩ val) h₁ = memory.update (from_tlocal var₁ s m h₁) ⟨var₂, idx⟩ val := begin\n unfold from_tlocal,\n induction n,\n { refl, },\n {\n rw [list.foldl_range_fin_succ],\n sorry, -- complicated with dependent type fin\n }\nend\n\nlemma from_tlocal_comm {sig : signature} {n} (var₁ var₂) (s : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig))\n(s' : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig)) (m : memory (parlang_mcl_shared sig)) {h₁ h₂} :\nfrom_tlocal var₁ s (from_tlocal var₂ s' m h₂) h₁ = from_tlocal var₂ s' (from_tlocal var₁ s m h₁) h₂ := begin\n unfold from_tlocal,\n induction n,\n {\n refl,\n }, {\n rw [list.foldl_range_fin_succ],\n rw [list.foldl_range_fin_succ],\n repeat { rw ← from_tlocal },\n sorry,\n }\nend\n\n--lemma : from_tlocal \"b\" (map_active_threads ac (ts_updates [op.compute_list (... :: coms)]) s = from_tlocal \"b\" (map_active_threads ac (ts_updates [op.compute_list (... :: coms)]) s\n\nlemma from_tlocal_eq {sig : signature} {n}\n{s s' : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig)}\n{m m' : memory (parlang_mcl_shared sig)} {var} {h : ((sig.val var).type).dim = 1} :\n(∀ tid, (s.threads.nth tid).tlocal.get ⟨var, begin rw h, exact v[tid] end⟩ = (s'.threads.nth tid).tlocal.get ⟨var, begin rw h, exact v[tid] end⟩) →\nm = m' →\nfrom_tlocal var s m h = from_tlocal var s' m' h := begin\n intros hveq hmeq,\n subst hmeq,\n unfold from_tlocal,\n induction n,\n { refl, },\n {\n rw list.foldl_range_fin_succ,\n sorry,\n }\nend\n\nlemma syncable'_compute_list_syncable {sig : signature} {n} {ac : vector bool n} {computes} {shole lhole : set $ mcl_address sig}\n{s : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig)}\n{m : memory (parlang_mcl_shared sig)} : \ns.syncable m →\n(∀ tid : fin n, (s.threads.nth tid).stores = ∅) →\n(∀ tid : fin n, (s.threads.nth tid).loads = ∅) →\nsyncable' shole lhole (map_active_threads ac (ts_updates [op.compute_list computes]) s) m := begin\n intros syncable no_stores no_loads,\n unfold syncable' state.syncable,\n split,\n {\n simp only [accesses, compute_list_stores', compute_list_loads', compute_list_shared'],\n exact syncable,\n }, {\n intros i tid,\n simp [no_stores tid, no_loads tid],\n }\nend\n\ninstance deciable_exists_nat (p) : decidable (@Exists ℕ p) := sorry\ninstance deciable_exists_fin (n p) : decidable (@Exists (fin n) p) := sorry\n\n\n/-- Processes a store\nWhich thread accesses which index doesn't matter \n-/\nlemma syncable'_store {sig : signature} {n} {ac : vector bool n} {computes} {shole lhole : set $ mcl_address sig}\n{dim} {idx : vector (expression sig type.int) dim} {var t} {h₁ : type_of (sig.val var) = t} {h₂}\n{updates : list $ op sig}\n{s : state n (memory $ parlang_mcl_tlocal sig) (parlang_mcl_shared sig)}\n{m : memory (parlang_mcl_shared sig)} \n(idx_1 : (((sig.val var).type).dim) = 1) : \n(∀ idx, (⟨var, idx⟩ : mcl_address sig) ∉ shole) →\n(∀ idx, (⟨var, idx⟩ : mcl_address sig) ∉ lhole) →\n(∀ tid₁ tid₂, tid₁ ≠ tid₂ → idx.map (λ ind, eval (s.threads.nth tid₁).tlocal ind) ≠ idx.map (λ ind, eval (s.threads.nth tid₂).tlocal ind)) →\nsyncable' (shole ∪ array_address_range var) (lhole ∪ array_address_range var) (map_active_threads ac (ts_updates $ op.compute_list computes :: updates) s) m →\nsyncable' shole lhole (map_active_threads ac (ts_updates $ op.compute_list computes :: op.store var idx h₁ h₂ :: updates) s) (from_tlocal var (map_active_threads ac (ts_updates [op.compute_list computes]) s) m idx_1)\n| var_not_in_shole var_not_in_lhole distinct_idx (and.intro syncable holes_constraint) := begin\n clear syncable'_store,\n unfold syncable',\n -- proof: syncable\n split, {\n intros i,\n by_cases i_is_var : i.fst = var,\n {\n subst i_is_var,\n specialize var_not_in_shole i.snd,\n specialize var_not_in_lhole i.snd,\n -- cases distinct out-of-bound\n -- by_cases i_is_oob : (∃ (tid : fin n), i.snd = eq.mpr _ (idx.map (λ ind, eval (s.threads.nth tid).tlocal ind))),\n sorry,\n },\n sorry,\n }, {\n -- proof: store hole\n intros i tid,\n have : i ∈ shole ∪ array_address_range var := sorry, --trivial\n \n by_cases i_is_var : i.fst = var,\n {\n -- if i is var we store into hole -> contradiction\n subst i_is_var,\n specialize var_not_in_shole i.snd,\n specialize var_not_in_lhole i.snd,\n cases i,\n split,\n {\n intros i_in_store,\n contradiction,\n }, {\n intros i_in_loads,\n contradiction,\n }\n }, {\n by_cases tid_activeness : ac.nth tid = tt,\n {\n rw map_active_threads_nth_ac tid_activeness,\n specialize holes_constraint i tid,\n \n rw map_active_threads_nth_ac tid_activeness at holes_constraint,\n rw [ts_updates] at holes_constraint,\n /- LARGE PROOF STARTS HERE -/\n clear syncable,\n rw [ts_updates, ts_updates],\n revert holes_constraint,\n generalize eq : compute_list computes (vector.nth (s.threads) tid) = s',\n rw ← list.reverse_reverse updates,\n generalize eq' : list.reverse updates = ups,\n intro holes_constraint,\n -- we do induction on the reverse of the list, such that we \"append\" elements to the end of updates (i.e. later)\n -- afterwards cases on the update (either store or compute)\n induction ups generalizing updates,\n {\n simp [ts_updates, thread_state.tlocal_to_shared, store],\n simp [ts_updates, thread_state.tlocal_to_shared, store] at holes_constraint,\n cases holes_constraint with shole_constraint lhole_constraint,\n split, {\n intros i_in_shole i_in_stores,\n cases i_in_stores, {\n subst i_in_stores,\n apply i_is_var,\n refl,\n }, {\n specialize shole_constraint (or.inl i_in_shole),\n contradiction,\n },\n }, {\n intro i_in_lhole,\n apply lhole_constraint (or.inl i_in_lhole),\n }\n }, {\n rw [ts_update_split],\n simp,\n cases ups_hd,\n {\n simp only [ts_updates],\n simp only [ts_update_split] at holes_constraint,\n simp [ts_updates, -set.mem_union_eq] at holes_constraint,\n specialize @ups_ih _ (list.reverse ups_tl),\n swap,\n {\n split, {\n intro,\n apply store_stores,\n apply holes_constraint.left a,\n }, {\n intro,\n apply store_loads,\n apply holes_constraint.right a,\n },\n },\n simp [thread_state.tlocal_to_shared, store],\n simp [thread_state.tlocal_to_shared, store] at ups_ih,\n split,\n {\n intros i_in_shole,\n rw not_or_distrib,\n split, {\n -- proof that the new store doesn't store in i\n cases holes_constraint with shole_constraint lhole_constraint,\n simp [thread_state.tlocal_to_shared, store] at shole_constraint,\n rw not_or_distrib at shole_constraint,\n cases shole_constraint (or.inl i_in_shole),\n rw ts_updates_tlocal s'.shared s'.loads s'.stores,\n simp,\n have : s' = {tlocal := s'.tlocal, shared := s'.shared, loads := s'.loads, stores := s'.stores} := begin\n cases s',\n simp,\n end,\n rw ← this,\n assumption,\n }, {\n apply ups_ih.left i_in_shole,\n }\n }, {\n intros i_in_lhole,\n apply ups_ih.right i_in_lhole,\n }\n }, {\n -- the head element is compute_list\n simp [ts_updates],\n apply ups_ih,\n swap 3,\n exact list.reverse ups_tl,\n rw [ts_update_split] at holes_constraint,\n simp [ts_updates] at holes_constraint,\n simp,\n exact holes_constraint,\n simp,\n }\n },\n }, {\n specialize holes_constraint i tid,\n rw ← map_active_threads_nth_inac tid_activeness,\n rw ← map_active_threads_nth_inac tid_activeness at holes_constraint,\n simp *,\n intro a,\n apply holes_constraint.right (or.inl a),\n }\n }\n },\nend", "meta": {"author": "fischerman", "repo": "GPU-transformation-verifier", "sha": "75a5016f05382738ff93ce5859c4cfa47ccb63c1", "save_path": "github-repos/lean/fischerman-GPU-transformation-verifier", "path": "github-repos/lean/fischerman-GPU-transformation-verifier/GPU-transformation-verifier-75a5016f05382738ff93ce5859c4cfa47ccb63c1/src/mcl/syncablep.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5039061705290805, "lm_q2_score": 0.37754066879814546, "lm_q1q2_score": 0.1902450726330614}} {"text": "import topology.sheaves.sheaf\nimport algebra.category.Group.abelian\nimport algebra.category.Group.colimits\nimport algebra.category.Group.limits\nimport topology.sheaves.sheaf_condition.sites\nimport group_epi_mono\n\nnoncomputable theory\n\nsection Ab\n\nopen Top category_theory opposite\nopen category_theory.limits\n\nuniverse u\n\nnamespace AddCommGroup\n\ndef range_to_image {A B : Ab} (f : A ⟶ B) : mono_factorisation f :=\n{ I := ⟨f.range⟩, \n m := \n { to_fun := λ y, y.1, \n map_add' := λ _ _, rfl, \n map_zero' := rfl },\n m_mono := { right_cancellation := λ C g h eq1, begin\n ext1 x,\n replace eq1 := add_monoid_hom.congr_fun eq1 x,\n simpa only [comp_apply, add_monoid_hom.coe_mk, set_like.coe_eq_coe, subtype.val_eq_coe] using eq1,\n end },\n e := \n { to_fun := λ a, ⟨f a, ⟨_, rfl⟩⟩,\n map_add' := λ _ _, by { simp only [map_add, subtype.ext_iff_val], refl, },\n map_zero' := by simp only [map_zero, subtype.ext_iff_val, show (0 : f.range).1 = 0, from rfl] } }.\n\nlemma range_is_image {A B : Ab} (f : A ⟶ B) : is_image (range_to_image f) :=\n{ lift := λ F, \n { to_fun := λ x, F.e (classical.some x.2), -- x ∈ f.range so x.2 says that ∃ y, f y = x\n map_zero' := begin\n have h : (0 : B) ∈ f.range := ⟨0, by rw map_zero⟩,\n have eq1 := classical.some_spec h,\n have eq2 := add_monoid_hom.congr_fun F.fac' (classical.some h),\n erw eq1 at eq2,\n have h2 : function.injective F.m,\n { apply add_monoid_hom.inj_of_mono F.m, },\n apply h2,\n rw map_zero,\n convert eq2,\n end,\n map_add' := λ ⟨_, ⟨x, rfl⟩⟩ ⟨_, ⟨y, rfl⟩⟩, begin\n rw ← map_add,\n apply_fun F.m using (add_monoid_hom.inj_of_mono F.m),\n have : ∀ x, F.m (F.e x) = f x := add_monoid_hom.congr_fun F.fac',\n rw [this, this],\n have t1 : ((⟨f x, ⟨x, rfl⟩⟩ : f.range) + (⟨f y, ⟨y, rfl⟩⟩ : f.range)).1 ∈ f.range := ⟨x + y, by simpa only [map_add, subtype.ext_iff_val]⟩,\n change ∃ _, _ at t1,\n have := classical.some_spec t1,\n erw this,\n change f x + f y = _,\n rw map_add,\n have t2 : (⟨f x, ⟨_, rfl⟩⟩ : f.range).1 ∈ f.range := ⟨x, rfl⟩,\n have t3 : (⟨f y, ⟨_, rfl⟩⟩ : f.range).1 ∈ f.range := ⟨y, rfl⟩,\n change ∃ _, _ at t2,\n change ∃ _, _ at t3,\n have := classical.some_spec t2,\n erw this,\n have := classical.some_spec t3,\n erw this,\n end },\n lift_fac' := λ F, begin\n ext,\n change F.m (F.e _) = x.1,\n have eq1 : ∀ y, F.m (F.e y) = f y := add_monoid_hom.congr_fun F.fac',\n rw eq1,\n have t1 : x.1 ∈ f.range := x.2,\n change ∃ _, _ at t1,\n have := classical.some_spec t1,\n erw this,\n end }\n\nend AddCommGroup\n\nend Ab\n\nsection sheaf_has_image\n\nopen Top category_theory opposite\nopen category_theory.limits\n\nuniverse u\n\nvariables {T : Top.{u}}\n\nnamespace Top.presheaf\n\nsection presheaf\n\nopen Top.presheaf\n\ndef presheaf.image' {F G : presheaf Ab T} (f : F ⟶ G) : presheaf Ab T :=\n{ obj := λ U, image (f.app U),\n map := λ U V inc, begin\n refine (is_image.iso_ext (AddCommGroup.range_is_image (f.app U)) (image.is_image (f.app U))).inv ≫ _ ≫\n (is_image.iso_ext (AddCommGroup.range_is_image (f.app V)) (image.is_image (f.app V))).hom,\n refine \n { to_fun := λ x, ⟨f.app V (F.map inc (classical.some x.2)), ⟨_, rfl⟩⟩, \n map_add' := sorry, \n map_zero' := sorry },\n end,\n map_id' := sorry,\n map_comp' := sorry }\n\ndef presheaf.image'_ι {F G : presheaf Ab T} (f : F ⟶ G) : presheaf.image' f ⟶ G :=\n{ app := λ U, image.ι _,\n naturality' := sorry }\n\ndef presheaf.image'_e {F G : presheaf Ab T} (f : F ⟶ G) : F ⟶ presheaf.image' f :=\n{ app := λ U, factor_thru_image (f.app U),\n naturality' := sorry }\n\ndef presheaf.mono_factorisation {F G : presheaf Ab T} (f : F ⟶ G) : mono_factorisation f :=\n{ I := presheaf.image' f,\n m := presheaf.image'_ι f,\n m_mono := sorry,\n e := presheaf.image'_e f,\n fac' := begin\n ext U x,\n simp only [comp_apply, nat_trans.comp_app],\n change (image.ι (f.app U)) (factor_thru_image (f.app U) x) = _,\n erw add_monoid_hom.congr_fun (image.fac (f.app U)) x,\n end }\n\ndef presheaf.image_factorisation {F G : presheaf Ab T} (f : F ⟶ G) : image_factorisation f := \n{ F := presheaf.mono_factorisation f,\n is_image := sorry }\n\ninstance {F G : presheaf Ab T} (f : F ⟶ G) : has_image f := \n{ exists_image := ⟨presheaf.image_factorisation f⟩ }\ninstance : has_images (presheaf Ab T) :=\n{ has_image := λ F G f, by apply_instance }\n\nend presheaf\n\nsection sheaf\n\nopen Top.presheaf category_theory.grothendieck_topology Top topological_space\n\nvariable [Π (X : opens T), preserves_colimits_of_shape ((opens.grothendieck_topology T).cover X)ᵒᵖ (forget Ab.{u})]\n\n-- sheafify `image f`\ndef sheaf.image' {F G : sheaf Ab T} (f : F ⟶ G) : sheaf Ab T :=\nlet f' : (F.1 : presheaf Ab T) ⟶ (G.1 : presheaf Ab T) := f in\n(Sheaf_sites_to_sheaf_spaces Ab T).obj ((presheaf_to_Sheaf (opens.grothendieck_topology T) _).obj (image f'))\n\ndef sheaf.image'_ι {F G : sheaf Ab T} (f : F ⟶ G) : sheaf.image' f ⟶ G := sorry\ndef sheaf.image'_e {F G : sheaf Ab T} (f : F ⟶ G) : F ⟶ sheaf.image' f := sorry\n\ndef sheaf.mono_factorisation {F G : sheaf Ab T} (f : F ⟶ G) : mono_factorisation f :=\nlet f' : (F.1 : presheaf Ab T) ⟶ (G.1 : presheaf Ab T) := f in\n{ I := sheaf.image' f,\n m := sheaf.image'_ι f,\n m_mono := sorry,\n e := sheaf.image'_e f,\n fac' := sorry }\n\n#check Top.presheaf.category_theory.limits.has_image\ndef sheaf.image_factorisation {F G : sheaf Ab T} (f : F ⟶ G) : image_factorisation f :=\n{ F := sheaf.mono_factorisation f,\n is_image := sorry }\n\ninstance sheaf.has_image {F G : sheaf Ab T} (f : F ⟶ G) : has_image f :=\n{ exists_image := ⟨sheaf.image_factorisation f⟩ }\n\ninstance : has_images (sheaf Ab T) :=\n{ has_image := λ F G f, sheaf.has_image f }\n\nend sheaf\nend Top.presheaf\n\nend sheaf_has_image", "meta": {"author": "jjaassoonn", "repo": "quasicoherent", "sha": "d96ccacf00364afd6d0de7958024f1da10e015da", "save_path": "github-repos/lean/jjaassoonn-quasicoherent", "path": "github-repos/lean/jjaassoonn-quasicoherent/quasicoherent-d96ccacf00364afd6d0de7958024f1da10e015da/src/sheaf_has_image.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5312093733737562, "lm_q2_score": 0.35577489351363034, "lm_q1q2_score": 0.1889909582454904}} {"text": "import analysis.inner_product_space.pi_L2\nimport topology.paracompact\n\n\n--OUTPUT 1\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$\n assume A : set (euclidean_space ℝ (fin n)),\n assume hA : is_open_cover A,\n\n -- We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$.\n let C := {s : euclidean_space ℝ (fin n) | ∃ t ∈ A, ∃ m : ℕ, ∃ r : ℝ, s = ball t m r ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ C, ∃ m : ℕ, ball s m 1 ⊂ ball x m 1}},\n\n -- First, we define a collection of pen balls\n have h1 : {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} = ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m 1} ∩ (euclidean_space ℝ (fin n)) \\ {x | ∃ s ∈ ⋃ r : ℕ, {s : euclidean_space ℝ (fin n) | ∃ m : ℕ,ball s m 1 ⊂ ball 0 m\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) := sorry\n\ntheorem ℝ_paracompact : paracompact_space euclidean : paracompact_space (euclidean_space ℝ (fin 1)) := sorry\n\n/-`theorem`\nTwelve Fold Symmetry of Rhombic Dodecahedron\nLet $\\struct {D, \\mathcal{E}}$ be a rhombic dodecahedron. Then $D$ has a twelve-fold symmetry.\n`proof`\nLet the twelve edges of $D$ be denoted by $\\mathcal{E} = \\anset{E_1, E_2, \\ldots, E_{12}}$. Since every vertex has valence 3, every edge is incident to two vertices. Let $\\mathcal{V}$ denote the set of all vertices of $D$. Then it follows that $\\mathcal{E} \\subseteq \\mathcal{V} \\times \\mathcal{V}$. We now define a binary relation $R$ on $\\mathcal{V}$ such that for all $v, w \\in \\mathcal{V}$:\n\n- $v R w$ if and only if $(v, w) \\in \\mathcal{E}$\n\nLet $p$ be a permutation of $\\anset{E_1, E_2, \\ldots, E_{12}}$. We now define a map $f_p$ on $\\mathcal{V}$ such that for any $v \\in \\mathcal{V}$:\n\n- $f_p(v) = w$ such that $(v, w) \\in \\mathcal{E}$ and $(v, w) \\in p(\\mathcal{E})$\n\nWe now prove $\\mathcal{V}$ has a partition $\\mathcal{V} = \\bigcup_{v \\in \\mathcal{V}} C_v$ such that for every $v \\in \\mathcal{V}$:\n\n- $v \\in C_v$,\n- $C_v \\cap C_w = \\phi$ if $v \\not= w$, and\n- $f_p(x) = y$ for some $x \\in C_v$ and for some $y \\in C_w$ if and only if $x = y$ and $v = w$.\n\nTo prove that $D$ has a twelve-fold symmetry, we will then prove that for every $x \\in \\mathcal{V}$, there exists a $y \\in \\mathcal{V}$ such that $x R y$. ${pf}$\n{{qed}}\n-/\ntheorem rhombic_dodecahedron_12_fold_symmetry : ∃ f : perm (fin 12) → perm (fin 12), ∀ x : fin 12, f x = x := sorry\n\nend\n\n--OUTPUT 3\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$.\n assume A : set (euclidean_space ℝ (fin n)),\n assume h1 : is_open A,\n assume h2 : ∀ x : euclidean_space ℝ (fin n), ∃ U ∈ A, x ∈ U,\n\n -- We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$. \n let C1 : set (euclidean_space ℝ (fin n)) := {B : set (euclidean_space ℝ (fin n)) | ∃ (b : euclidean_space ℝ (fin n)) (m : ℝ), \n is_open B ∧ is_ball ℝ ℝ ((b : euclidean_space ℝ (fin n)).to_fun) m ∧ ⋂ (x : euclidean_space ℝ (fin n)) (h3 : x ∈ B), \n ∃ (U : euclidean_space ℝ (fin n)) (h4 : U ∈ A) (h5 : x ∈ U), B ⊆ U},\n have h3 : ∀ B : set (euclidean_space ℝ (fin n)), ∃ B : set (euclidean_space ℝ (fin n)) (m : ℝ), \n is_open B ∧ is_ball ℝ ℝ (0 : ℝ^(fin n)) m ∧ ⋂ (x : euclidean_space ℝ (fin n)) (h3 : x ∈ B), \n ∃ (U : euclidean_space ℝ (fin n)) (h4 : U ∈ A) (h5 : x ∈ U), B ⊆ U, from by {\n assume B : set (euclidean_space ℝ (fin n)),\n have h4 : ∃ U ∈ A, B ⊆ U, from by {\n have h5 : ∅ ∈ A, from by {\n by_contradiction h6,\n have h7 : ∃ x : euclidean_space ℝ (fin n), x ∉ A, from by {\n let f : ℕ → (euclidean_space ℝ (fin n)), from by {\n assume z : ℕ,\n use (z : ℝ) 0,\n },\n have h8 : ∀ (z : ℕ) (h9 : z ∈ f ⁻¹' A), false, from by {\n assume (z : ℕ) (h9 : z ∈ f ⁻¹' A),\n have h10 : f z ∈ A, from by {\n simp at h9,\n exact h9,\n },\n have h11 : (0 : ℝ) 0 ∈ A, from by {\n simp at h10,\n exact h10,\n },\n have h12 : ∃ U ∈ A, (0 : ℝ) 0 ∈ U, from by {\n have h13 : ∃ U ∈ A, (0 : ℝ) 0 ∈ U, from by {\n assume h14,\n have h15 : (0 : ℝ) 0 ∉ A, from by {\n assume h16,\n have h17 : ∅ ∈ A, from by {\n apply set.subset.subset_singleton,\n assume x : euclidean_space ℝ (fin n),\n assume h18 : x ∈ ∅,\n exact h16,\n },\n show false, from h14 h17,\n },\n show false, from h15 h16,\n },\n show ∃ U ∈ A, (0 : ℝ) 0 ∈ U, from h13,\n },\n rw show (0 : ℝ) 0 = f z, from rfl,\n exact h12,\n },\n have h14 : f '' A = ∅, from by {\n apply set.subset.antisymm,\n {\n assume x : ℕ,\n assume h15 : x ∈ f '' A,\n show false, from h8 x h15,\n },\n {\n assume x : ℕ,\n assume h15 : x ∈ f '' A,\n show false, from h8 x h15,\n },\n },\n have h16 : A ≠ ∅, from by {\n assume h17,\n have h18 : ∅ = f '' A, from by {\n rw show ∅ = f '' A, from eq.symm h17,\n },\n show false, from h14 h18,\n },\n show ∃ x : euclidean_space ℝ (fin n), x ∉ A, from ⟨f 0,h16⟩,\n },\n have h8 : ∅ ∉ A, from by {\n assume h9,\n show false, from h5 h9,\n },\n exact h8,\n },\n have h6 : ∃ (U : euclidean_space ℝ (fin n)) (h7 : U ∈ A), ∅ ⊆ U, from ⟨h5,univ_subset_iff.mpr (λ x, true.intro)⟩,\n exact h6,\n },\n let d : ℝ, from by {\n have h7 : ∃ d : ℝ, ∀ (x : ℝ) (h8 : x ∈ B), d < dist x 0, from by {\n have h9 : ∃ (x : ℝ) (h10 : x ∈ B), d < dist x 0, from by {\n have h11 : ∃ (x : ℝ) (h12 : x ∈ B), d < dist x 0, from by {\n have h13 : ∃ (x : ℝ) (h14 : x ∈ B), dist x 0 < d + 1, from by {\n let f : (euclidean_space ℝ (fin n)) → ℝ, from by {\n assume x : euclidean_space ℝ (fin n),\n use x.to_fun.sum,\n },\n have h16 : ∀ (g : (euclidean_space ℝ (fin n)) → ℝ), ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n assume (g : (euclidean_space ℝ (fin n)) → ℝ),\n have h17 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n have h18 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n have h19 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n have h21 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n have h23 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n have h24 : ∃ (x : ℝ) (h15 : x ∈ B), dist x 0 < d + 1, from by {\n use f 0,\n have h25 : ∃ (U : euclidean_space ℝ (fin n)) (h26 : U ∈ A) (h27 : f 0 ∈ U), B ⊆ U, from by {\n use h4.left,\n use h4.right.left,\n use h4.right.right.left,\n use h4.right.right.right,\n },\n have h28 : f 0 ∈ B, from by {\n simp at h25,\n exact h25,\n },\nend --Needs more than 2000 tokens!\n\n--OUTPUT 4\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n let A := λ x : fin n, Ioo x x,\n let K := λ m : ℕ, { x : fin n | 0 ≤ (fintype.card x).val ∧ (fintype.card x).val < m+1},\n \n have memA_K : ∀ m : ℕ, A (K m) ∈ 𝓝 (0 : fin n), from \n by {\n assume (m : ℕ),\n use (λ x : fin n, x ∈ K m),\n exact ⟨by obviously, by obviously⟩,\n },\n \n have emptyset_in_memA : ∅ ∈ A ∅, from begin\n use (λ x : fin n, x = 0),\n have h1 : (λ x : fin n, x = 0) 0 = tt, from by obviously,\n have h2 : (λ x : fin n, x = 0) 0 ∈ 𝓝 0, from by {\n use (λ x : fin n, x = 0),\n show ∀ x, x = 0 → x ∈ 𝓝 0, from id,\n exact ⟨by obviously, by obviously⟩,\n },\n exact ⟨h1, h2⟩,\n end,\n \n have set_emptyset_in_memA_in_Km : ∀ m : ℕ, (A ∅) ∩ K m = ∅, from by {\n assume (m : ℕ),\n show (A ∅) ∩ K m = ∅, from begin\n rw set.inter_eq_self_of_subset_left,\n rw set.inter_eq_self_of_subset_left,\n intro x,\n exact ⟨assume h1, fintype.card_pos_iff.mpr h1.right.left, assume h2, h2.elim $ by {unfold_coes ∅, apply empty_ne_univ}⟩,\n end \n },\n\n have memA_Km_in_Km : ∀ m : ℕ, A (K m) ∈ A (K m), from by {\n assume m,\n show A (K m) ∈ A (K m), from begin\n use (λ x : fin n, x ∈ K m),\n have h1 : (λ x : fin n, x ∈ K m) ∈ 𝓝 (K m), from by {\n use (λ x : fin n, x ∈ K m),\n show ∀ x, x ∈ K m → x ∈ 𝓝 (K m), from by assume x h1, from memA_K m,\n exact ⟨by obviously, by obviously⟩\n },\n exact ⟨by obviously, h1⟩\n end \n },\n \n show paracompact_space (euclidean_space ℝ (fin n)), from paracompact_space.intro ⟨emptyset_in_memA, set_emptyset_in_memA_in_Km, memA_Km_in_Km⟩,\nend\n\n--OUTPUT 5\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n\n/-\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$. \n assume 𝒜 : opens (euclidean_space ℝ (fin n)), \n -- We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$.\n have h1 : ∃ 𝒞 : opens (euclidean_space ℝ (fin n)), euclidean_space ℝ (fin n).is_open_cover 𝒞 ∧\n -- refinement\n euclidean_space ℝ (fin n).is_open_refinement 𝒜 𝒞 ∧\n -- locally finite\n locally_finite_family 𝒞 ∧\n -- covers $\\mathbb{R}^n$\n euclidean_space ℝ (fin n).is_open_cover 𝒞,\n from\n begin\n have h2 : ∃! (B₀ : opens (euclidean_space ℝ (fin n))), B₀ = ∅, from\n by {use (∅ : opens (euclidean_space ℝ (fin n))),\n obviously, obviously,},\n let B₀ := classical.some h2, \n have h3 : B₀ = ∅, from classical.some_spec (exists_unique.exists h2),\n\n -- Given $m$, set $\\Bar{B_m}$ is compact in $\\mathbb{R}^n$ by the Heine-Borel theorem, so choose finitely many elements of $\\mathcal{A}$ that cover $\\Bar{B_m}$ and intersect each one with the open set $\\mathbb{R}^n \\setminus \\Bar{B_{m - 1}}$, and let $\\mathcal{C}_{m}$ denote this collection of open sets (each an open subset of an element of $\\mathcal{A}$).\n have h4 : ∀ (m : ℕ), ∃ ∃ (Cm : opens (euclidean_space ℝ (fin n))),\n have h5 : ∃ ∃ (Cm : opens (euclidean_space ℝ (fin n))),\n euclidean_space ℝ (fin n).is_open_refinement ∅ Cm ∧\n euclidean_space ℝ (fin n).is_open_refinement 𝒜 Cm ∧\n ∃ (m : ℕ), \n comp 𝒜 Cm ∧\n is_compact (euclidean_space ℝ (fin n) ∪ 𝒜 ∪ ∅ ∪ Cm),\n from \n begin\n use B₀, \n obviously, obviously, \n have h6 : 𝒜 = (∅ : opens (euclidean_space ℝ (fin n))), from 𝒜,\n split,\n obviously, obviously, \n obviously, obviously, \n obviously, obviously, \n obviously, obviously, \n obviously, obviously, \n obviously, obviously, \n end,\n end,\n-/\nend\n\n--OUTPUT 6\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$\n assume (h : open_cover (euclidean_space ℝ (fin n))) (U : set (euclidean_space ℝ (fin n))),\n have h1 : ∃ (A : set (fin n → ℝ)), open_cover A, from h,\n have h2 : ∃ (A : set (fin n → ℝ)), is_open A ∧ (∀ (x : fin n → ℝ), x ∈ U → ∃ (a ∈ A), x ∈ a), from h1,\n have h3 : ∃ (A : set (fin n → ℝ)), (∀ (x : fin n → ℝ), x ∈ U → ∃ (a ∈ A), x ∈ a), from h2.left,\n\n -- We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$\n -- First, we define a collection of pen balls.\n -- Let $B_0 = \\phi$, and for each $n \\in \\mathbb{N}$, let $B_m$ denote the ball of radius $m$\n -- centered at 0.\n have h4 : ∀ (m : ℕ), ∃ (Bm : set (fin n → ℝ)), (∀ (x : fin n → ℝ), (∃ (a ∈ Bm), x ∈ a) ↔ ∀ (y : fin n → ℝ), dist x y < m), from\n by {\n assume (m : ℕ),\n use {x | ∀ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m},\n assume (x : fin n → ℝ) (h : (∃ (a ∈ {x | ∀ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m}), x ∈ a) ↔\n ∀ (y : fin n → ℝ), dist x y < m),\n split,\n assume h1 : ∃ (a ∈ {x | ∀ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m}), x ∈ a,\n assume (y : fin n → ℝ),\n --have h2 : ∀ (y : fin n → ℝ), dist x y < m ↔ ∑ i, (x i - y i) ^ 2 = m, from cauchy_swartz_squared,\n have h2 : dist x y < m ↔ ∑ i, (x i - y i) ^ 2 = m, from cauchy_swartz_squared,\n have h3 : dist x y < m ↔ ∑ i, (x i - y i) ^ 2 < m, from by ring,\n have h4 : dist x y < m ↔ ∑ i, (x i - y i) ^ 2 < m ↔ x ∈ {x | ∀ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m},\n from h,\n rw [h4,h1.right],\n assume h1 : ∀ (y : fin n → ℝ), dist x y < m,\n rw h,\n rw h1,\n split,\n exact set.mem_set_of_eq (eq.symm (dist_self x)),\n assume (y : fin n → ℝ),\n rw eq.symm (dist_self x),\n rw h1,\n exact eq.symm (dist_self x),\n },\n\n -- Given $m$, set $\\Bar{B_m}$ is compact in $\\mathbb{R}^n$ by the Heine-Borel theorem, so choose finitely many elements of $\\mathcal{A}$ that cover $\\Bar{B_m}$\n -- and intersect each one with the open set $\\mathbb{R}^n \\setminus \\Bar{B_{m - 1}}$, and let $\\mathcal{C}_{m}$ denote this collection of open sets (each an open subset of an element of $\\mathcal{A}$).\n have h5 : ∀ (m : ℕ), ∃ (Cm : set (fin n → ℝ)), (∀ (x : fin n → ℝ), (∃ (a ∈ Cm), x ∈ a) ↔ ∀ (y : fin n → ℝ), dist x y < m) ∧ (∀ (x : fin n → ℝ), ∃ (z ∈ Cm), x ∈ z ↔ x ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m}),\n from by {\n assume (m : ℕ),\n have h6 : ∃ (Bm : set (fin n → ℝ)), (∀ (x : fin n → ℝ), (∃ (a ∈ Bm), x ∈ a) ↔ ∀ (y : fin n → ℝ), dist x y < m), from h4 m,\n have h7 : ∃ (Bm : set (fin n → ℝ)), (∀ (x : fin n → ℝ), ∃ (z ∈ Bm), x ∈ z ↔ x ∈ {x | ∀ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m}), from by {exact subset_finite_intersection_union (h6.left) (h3.left.left)},\n -- use A ∩ B\n use {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m} ∩ {x | ∀ (y : fin n → ℝ), dist x y < m},\n -- split\n split,\n assume (x : fin n → ℝ) (h : (∃ (a ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m} ∩ {x | ∀ (y : fin n → ℝ), dist x y < m}), x ∈ a) ↔ ∀ (y : fin n → ℝ), dist x y < m),\n by {\n split,\n assume h1 : ∃ (a ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m} ∩ {x | ∀ (y : fin n → ℝ), dist x y < m}), x ∈ a,\n rw h,\n rw h6,\n rw h1.right,\n assume h1 : ∀ (y : fin n → ℝ), dist x y < m,\n rw h,\n rw h6,\n rw h1,\n exact set.mem_set_of_eq (eq.symm (dist_self x)),\n },\n assume (x : fin n → ℝ) (h : ∃ (z ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m} ∩ {x | ∀ (y : fin n → ℝ), dist x y < m}), x ∈ z ↔ x ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m}),\n by {\n split,\n assume h1 : ∃ (z ∈ {x | ∃ (y : fin n → ℝ), ∑ i, (x i - y i) ^ 2 = m} ∩ {x | ∀ (y : fin n → ℝ), dist x y < m}), x ∈ z,\n rw h3,\n rw h,\n rw h1.right,\n rw set.inter_def,\n assume h1 : x ∈ {x | ∃ (y : fin n → ℝ), ∑ i\nend --Needs more than 2000 tokens!\n\n--OUTPUT 7\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) := \nbegin\n assume A : set (euclidean_space ℝ (fin n)),\n assume ha : (is_open_set_cover A),\n\n have h1 : ∀ m : ℕ, ∀ x : ℝ, ∃! n : ℕ, ∀ j : ℕ, n ≤ j → ∥x - 0∥ < j := \n assume m : ℕ, assume x : ℝ, exists_unique.intro m \n (exists_unique.intro (le_of_lt (lt_add_one (abs x))) \n (exists_unique.intro rfl rfl)),\n\n let B_0 := {0 : ℝ^(fin n)}, \n let B_m : ℕ → set (euclidean_space ℝ (fin n)) := assume m : ℕ, \n {x : ℝ^(fin n) | ∃ y : ℝ, ∃ m' : ℕ, ∥y∥ = ∥x∥ ∧ y ∈ B(0,m) ∧ m' = m ∧ m' ≤ m + 1 ∧ ∥y∥ < m'},\n let Bar_B_m_n : set (euclidean_space ℝ (fin n)) := λ m : ℕ, closure (B_m m),\n let Bar_B_m_n_plus_1 : set (euclidean_space ℝ (fin n)) := λ m : ℕ, closure (B_m (m+1)),\n let C_m_n : set (euclidean_space ℝ (fin n)) := λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ Bar_B_m_n_plus_1 m)},\n have h2 : ∀ m : ℕ, ∃ C : set (euclidean_space ℝ (fin n)), is_cover C A ∧ is_locally_finite C := \n assume m : ℕ, let p := closure (B_m (m+1)) in exists.intro (λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ p)}) \n (and.intro (is_cover_of_subcover (λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ p)}) (λ m : ℕ, (λ X : set (euclidean_space ℝ (fin n)), (X ∩ (univ \\ Bar_B_m_n m)) ∈ A ∧ (X ∩ (univ \\ Bar_B_m_n m)) ⊆ (univ \\ p)) A)) (show is_locally_finite (λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ p)}), from \n (is_locally_finite_inter_compact_open (λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ p)}) (is_locally_finite_of_subcover (λ m : ℕ, {(X ∩ (univ \\ Bar_B_m_n m)) | X ∈ A ∧ X ⊆ (univ \\ p)}) (λ m : ℕ, {X ∈ A | X ⊆ (univ \\ p)}) (is_cover_of_subcover (λ m : ℕ, {X ∈ A | X ⊆ (univ \\ p)}) (λ m : ℕ, {X ∈ A | X ⊆ (univ \\ p)} A)) (λ m : ℕ, is_open_set.inter_open_set (is_open_set.univ) (is_open_set_set.diff (is_open_set.univ) (B_m (m+1))))) (show is_compact_set (λ m : ℕ, closure (B_m (m+1))), from \n is_compact_set_union (is_compact_set (closure (B_m 0))) (show is_compact_set (λ m : ℕ, closure (B_m (m + 1))), from \n @is_compact_iff_closed_of_heine_borel_is_closed_of_uniform_continuity_of_order_is_compact_of_iota_nat_is_order (λ m : ℕ, closure (B_m (m + 1))) (is_compact_set (closure (B_m 0)))) (is_closed_set_closure (B_m 0)) (show ∀ m : ℕ, is_closed_set (closure (B_m (m + 1))), from \n assume m : ℕ, is_closed_set_closure (B_m (m+1))) (show ∀ m : ℕ, continuous (λ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1)) x, from \n assume m : ℕ, continuous_at_continuous_on_of_continuous_on_subset (by {apply continuous_closure_of_ball_at_point,} ) (show continuous_on (B_m (m + 1)) (λ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1)), from \n continuous_on_const)) (show uniform_continuity_on (λ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1)) (closure (B_m 0)), from \n uniform_continuity_on_of_uniform_continuity_of_subset_of_subset (show uniform_continuity (λ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1)), from \n (uniform_continuous_on.const (λ m : ℕ, closure (B_m m))).comp (uniform_continuous_on.fst (by {apply uniform_continuous_on_nat,}) (show uniform_continuous_on (λ n : ℕ, closure (B_m (n + 1))) (λ n : ℕ, n + 1), from \n continuous_on.comp (uniform_continuous_on.id (univ)) (show continuous_on (univ) (λ x : ℕ, x + 1), from \n continuous_on_add_one)))) (show (λ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1)) '' closure (B_m 0) ⊆ closure (B_m 0), from by {apply image_subset_closure,} ) (show ∀ x : ℝ^(fin n), (λ m : ℕ, closure (B_m m)) (m + 1) x ∈ closure (B_m 0), from \n assume x : ℝ^(fin n), by {apply closure_mono, rw iota_succ, apply set.mem_union_left,} )) (is_order_nat (λ m : ℕ, closure (B_m m))))) (is_order_nat (λ m : ℕ, B_m (m + 1))) (show ∀ n x : ℕ, B_m (n + 1) x ⟶ B_m (n + 1) x, from \n assume n x : ℕ, trivial) (show ∀ n x : ℕ, classically (∀ m : ℕ, (λ m : ℕ, closure (B_m m)) m x ⟶ (λ m : ℕ, closure (B_m m)) (m + 1) x), from \n assume n x :\nend --Needs more than 2000 tokens!\n\n--OUTPUT 8\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$.\n assume (U : set (euclidean_space ℝ (fin n))),\n assume (hU : is_open_cover U),\n\n -- We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$. \n show ∃ (W : set (euclidean_space ℝ (fin n))), is_open_cover W ∧ is_locally_finite W, from\n begin \n let W := set.univ,\n have hW : is_open_cover W, by obviously,\n have hW' : is_locally_finite W, by {sorry},\n have hW'' : W ⊆ U, by obviously,\n have hW_is_refinement : is_refinement W U, from is_refinement_intro hW'' hW,\n\n have hW'_is_refinement : is_refinement W U ∧ is_locally_finite W, from ⟨hW_is_refinement,hW'⟩,\n show is_locally_finite W ∧ ∃ V : set (euclidean_space ℝ (fin n)), is_open_cover V ∧ is_refinement W V, from hW'_is_refinement,\n end,\nend\n\n--OUTPUT 9\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) := \nbegin\n /-\n Part 1:\n Goal: For any $x \\in \\mathbb{R}^n$, construct a ball around it.\n -/\n -- Let $x$ be a variable we chose from $\\mathbb{R}^n$\n variable x : euclidean_space ℝ (fin n),\n -- Let $B_0$ be empty set\n def B_0 := ∅,\n -- Construct a ball centered at 0 with radius $m$\n def B_m : set (euclidean_space ℝ (fin n)) := {y : euclidean_space ℝ (fin n) | ∥y - 0∥ ≤ (↑m : ℝ) },\n -- Let $B_m$ be compact in $\\mathbb{R}^n$, by Heine-Borel Theorem\n def Bar_B_m : compact_space (euclidean_space ℝ (fin n)) := by apply_instance,\n -- Let $\\{B_m\\}$ be the collection of all balls centered at 0 with radius $m \\in \\mathbb{N}$ \n def f : ℕ → set (euclidean_space ℝ (fin n)) := λ (m : ℕ), B_m,\n\n /-\n Part 2:\n Goal: construct a nested collection of sets.\n Let $B_0 = \\phi$ be empty set\n -/\n have h1 : B_0 ∪ (B_1 \\ B_0) = B_1, from by obviously,\n have h2 : B_1 ∪ (B_2 \\ B_1) = B_2, from by obviously,\n have h3 : B_2 ∪ (B_3 \\ B_2) = B_3, from by obviously,\n have h4 : B_3 ∪ (B_4 \\ B_3) = B_4, from by obviously, \n have h5 : B_4 ∪ (B_5 \\ B_4) = B_5, from by obviously, \n -- ... and for any other $B_m, m \\in \\mathbb{N}$, we have this sequence\n have h6 : B_m ∪ (B_{m+1} \\ B_m) = B_{m+1}, from by obviously,\n -- Let $C_0$ be empty set\n def C_0 := ∅,\n /-\n Construct all $C_m$ as follows.\n We have $C_m$ to be the ball centered at 0 with radius $m$ and an open set in $\\mathbb{R}^n$\n -/\n def C_m : set (euclidean_space ℝ (fin n)) := {y : euclidean_space ℝ (fin n) | (∥y - 0∥ ≤ (m : ℝ)) ∧ (y ∈ set.univ)}, \n -- Let $\\{C_m\\}$ be the collection of all $C_m$ for any $m \\in \\mathbb{N}$ \n def g : ℕ → set (euclidean_space ℝ (fin n)) := λ (m : ℕ), C_m,\n -- Hence we have a nested sequence of open sets.\n have h7 : B_0 ⊂ B_1, from by rw [set.subset_empty_iff],\n have h8 : B_1 ⊂ B_2, from by rw [set.subset_empty_iff],\n have h9 : B_2 ⊂ B_3, from by rw [set.subset_empty_iff],\n have h10 : B_3 ⊂ B_4, from by rw [set.subset_empty_iff],\n have h11 : B_4 ⊂ B_5, from by rw [set.subset_empty_iff],\n -- ... and for any other $B_m, m \\in \\mathbb{N}$, we have this sequence\n have h12 : B_m ⊂ B_{m+1}, from by rw [set.subset_empty_iff],\n\n /-\n Part 3:\n Goal: Give the open cover $\\mathcal{A}$, and construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$.\n Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$\n -/\n variable A : set (set (euclidean_space ℝ (fin n))),\n -- $\\mathcal{A}$ is an open covering of $\\mathbb{R}^n$\n assume hA : is_open_cover (euclidean_space ℝ (fin n)) A,\n -- By Heine-Borel theorem, $\\Bar{B_m}$ is compact in $\\mathbb{R}^n$\n -- Hence we pick finitely many elements of $\\mathcal{A}$ that cover $\\Bar{B_m}$\n have h13 : ∃ (F : set (set (euclidean_space ℝ (fin n)))), (F ⊆ A) ∧ is_open_cover (euclidean_space ℝ (fin n)) F ∧ compact_space.compact (euclidean_space ℝ (fin n)) F,\n from compact_space.exists_finite_open_cover Bar_B_m (by {apply_instance}),\n -- and intersect each one with the open set $\\mathbb{R}^n \\setminus \\Bar{B_{m - 1}}$\n -- Let $C_m$ denote this collection of open sets (each an open subset of an element of $\\mathcal{A}$)\n have h14 : ∃ (C_m : set (set (euclidean_space ℝ (fin n)))), (C_m ⊆ A) ∧ is_open_cover (euclidean_space ℝ (fin n)) C_m ∧ (∀ (x : euclidean_space ℝ (fin n)), x ∈ ⋃₀ C_m → (x ∈ B_m) → (x ∉ Bar_B_m)) ∧ (∀ (x : euclidean_space ℝ (fin n)), x ∈ ⋃₀ C_m → (x ∉ B_m) → (x ∈ Bar_B_m)), \n from exists.elim h13\n (assume (F : set (set (euclidean_space ℝ (fin n)))),\n assume (h15 : (F ⊆ A) ∧ is_open_cover (euclidean_space ℝ (fin n)) F ∧ compact_space.compact (euclidean_space ℝ (fin n)) F),\n assume (h16 : (∀ (x : euclidean_space ℝ (fin n)), x ∈ ⋃₀ F → (∃ (A : set (euclidean_space ℝ (fin n))), (A ∈ F) ∧ (x ∈ A)))),\n use {U : set (euclidean_space ℝ (fin n)) | (U ∈ F) ∧ (U ⊆ B_m)},\n show (∃ (C_m : set (set (euclidean_space ℝ (fin n)))), (C_m ⊆ A) ∧ is_open_cover (euclidean_space ℝ (fin n)) C_m ∧ (∀ (x : euclidean_space ℝ (fin n)), x ∈ ⋃₀ C_m → (x ∈ B_m) → (x ∉ Bar_B_m)) ∧ (∀ (x : euclidean_space ℝ (fin n)), x ∈ ⋃₀ C_m → (x ∉ B_m) → (x ∈ Bar_B_m))), from\n and.intro \n (and.intro (by obviously) \n (and.intro (by {rw [set.forall_mem_iff],\n intros j jmem,\n simp [set.mem_\nend --Needs more than 2000 tokens!\n\n--OUTPUT 10\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nbegin\n -- Let $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$. We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$. First, we define a collection of pen balls. Let $B_0 = \\phi$, and for each $n \\in \\mathbb{N}$, let $B_m$ denote the ball of radius $m$\n -- centered at 0. \n fix (A : set (euclidean_space ℝ (fin n))) (hA : is_open A) (hA_cover : ∀ p ∈ 𝕜, ∃ U ∈ A, p ∈ U),\n\n let Bm := ball n 0 m,\n let j : ℕ → set (euclidean_space ℝ (fin n)) := λ i, Bm ⊓ A,\n let Πm := (∀ U ∈ j m, ∀ V ∈ j m, V ≠ U → V ∩ U ≠ ∅ → ∃ W ∈ A, W ⊆ U ∩ V),\n let ⟨U, hU⟩ := exists_is_open_ball 0 m,\n\n have h1 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) < m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n by {\n unfold U Bm T,\n unfold ball,\n simp,\n assume hmx,\n exact lt_add_of_pos_of_le (show 0 < m, from nat.pos_of_ne_zero H) hmx,\n }\n end,\n\n have h2 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → x ∈ U, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n show x ∈ U, by {\n unfold U Bm T,\n unfold ball,\n simp,\n assume hmx,\n exact le_add_of_nonneg_of_le hmx (show 0 ≤ m, from nat.zero_le _),\n },\n end,\n\n have h3 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → x ∈ Bm, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n have h4 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) < m, from h1 x hx,\n have h5 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) ≤ m, from le_of_lt (h1 x hx),\n end,\n have h6 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) = m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) = m, from eq_of_le_of_ge (h5 x hx) (h5 x hx),\n end,\n have h7 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n unfold Bm T,\n unfold ball,\n simp,\n assume hmx,\n exact le_add_of_nonneg_of_le hmx (show 0 ≤ m, from nat.zero_le _),\n end,\n have h8 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → T(x) = m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n show T(x) = m, from eq_of_le_of_ge (h7 x hx) (h7 x hx),\n end,\n have h9 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) ≤ m, from eq.symm (h6 x hx) ▸ (h7 x hx) ,\n end,\n have h10 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) = m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) = m, from eq_of_le_of_ge (h9 x hx) (h9 x hx),\n end,\n show x ∈ Bm, from begin\n unfold Bm T,\n unfold ball,\n simp,\n assume hmx,\n exact eq.symm (h10 x hx) ▸ hmx,\n end,\n end,\n\n have h4 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → x ∈ U, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n have h5 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) < m, from h1 x hx,\n have h6 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) ≤ m, from le_of_lt (h1 x hx),\n end,\n have h7 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) = m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) = m, from eq_of_le_of_ge (h6 x hx) (h6 x hx),\n end,\n have h8 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n unfold Bm T,\n unfold ball,\n simp,\n assume hmx,\n exact le_add_of_nonneg_of_le hmx (show 0 ≤ m, from nat.zero_le _),\n end,\n have h9 : ∀ x : euclidean_space ℝ (fin n), x ∈ Bm → T(x) = m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ Bm),\n show T(x) = m, from eq_of_le_of_ge (h8 x hx) (h8 x hx),\n end,\n have h10 : ∀ x : euclidean_space ℝ (fin n), x ∈ U → T(x) ≤ m, from begin\n assume (x : euclidean_space ℝ (fin n)) (hx : x ∈ U),\n show T(x) ≤ m, from eq.symm (h7 x hx) ▸ (h8 x hx),\n end,\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n -- $A$ and $B$ are sets. $A$ and $B$ belong to power set of $S$\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n -- Then $A ⊆ S$ and $B ⊆ S$, by power set definition\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB},\n -- Then $(A ∩ B) ⊆ A$, by intersection of set is a subset\n have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left,\n -- Then $(A ∩ B) ⊆ S$, by subset relation is transitive \n have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left},\n -- Hence $(A ∩ B) ∈ 𝒫 S$, by power set definition\n show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3},\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n -- expand the power\n calc (x + y)^2 = (x+y)*(x+y) : by rw sq\n -- distributive property of multiplication over addition gives:\n ... = x*(x+y) + y*(x+y) : by rw add_mul\n -- applying the above property further gives:\n ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring}\n -- rearranging the terms using commutativity and adding gives:\n ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring}\nend\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n -- Group has Latin Square Property\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by {\n assume a b : G, use a⁻¹ * b, obviously, },\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by {\n assume a b : G, use b * a⁻¹, obviously, }, \n\n -- Setting $b = a$, this becomes:\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from \n assume a : G, h1 a a,\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from\n assume a : G, h2 a a,\n\n -- These $x$ and $y$ are both $(1 : G)$, by definition of identity element\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G,\n exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a)))\n (mul_one a),\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G,\n exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), \n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {\n use (1 : G),\n have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {\n assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a),\n have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G),\n exists_unique.unique (h3 a) (hident a).right\n (classical.some_spec (exists_unique.exists (h3 a))), \n have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G),\n exists_unique.unique (h4 a) (hident a).left\n (classical.some_spec (exists_unique.exists (h4 a))),\n show e = (1 : G), from eq.trans (h9 e) (h6 _), \n },\n exact ⟨by obviously, h7⟩,\n }\nend\n\n/--`theorem`\n\\mathbb{R}^n is paracompact\n$\\mathbb{R}^n$ is paracompact for all $n$.\n`proof`\nLet $\\mathcal{A}$ be an open covering of $\\mathbb{R}^n$. We now construct a locally finite open refinement $\\mathcal{C}$ of $\\mathcal{A}$ that covers $\\mathbb{R}^n$. First, we define a collection of pen balls. Let $B_0 = \\phi$, and for each $n \\in \\mathbb{N}$, let $B_m$ denote the ball of radius $m$\ncentered at 0. Given $m$, set $\\Bar{B_m}$ is compact in $\\mathbb{R}^n$ by the Heine-Borel theorem, so choose finitely many elements of $\\mathcal{A}$ that cover $\\Bar{B_m}$ and intersect each one with the open set $\\mathbb{R}^n \\setminus \\Bar{B_{m - 1}}$, and let $\\mathcal{C}_{m}$ denote this collection of open sets (each an open subset of an element of $\\mathcal{A}$). So $\\mathcal{C} = \\bigcup_{m = 0}^{\\infty} \\mathcal{C}_m$ is an open refinement of $\\mathcal{A}$. Note that $\\mathcal{C}$ covers $\\mathbb{R}^n$ since for any $x \\in \\mathbb{R}^n$, there is a smallest $m \\in \\mathbb{N}$ such that $x \\in \\Bar{B_{m}}$ (namely, some $m$ where $\\rVert x \\lVert \\leq m \\leq \\rVert x \\lVert + 1$), and so $x$ is an element of $\\mathcal{C}_m$. Now collection $\\mathcal{C}$ is locally finite since for given $x \\in \\mathbb{R}^n$, neighborhood $B_m$ intersects only finitely many elements of $\\mathcal{C}$, namely those elements in collection $\\mathcal{C}_1 \\cup \\mathcal{C}_2 \\cup \\cdots \\mathcal{C}_m$. So $\\mathcal{C}$ is a locally finite open refinement of $\\mathcal{A}$ that covers $\\mathbb{R}^n$, hence $\\mathbb{R}^n$ is paracompact.\n\nQED\n-/\ntheorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof_with_comments-Natural-Language-Proof-Translation/Correct_statement-lean_proof_with_comments-3_few_shot_temperature_0.8_max_tokens_2000_n_10/clean_files/Rn is paracompact.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5195213219520929, "lm_q2_score": 0.36296921930155557, "lm_q1q2_score": 0.18857024863946326}} {"text": "import for_mathlib.short_complex_projections\nimport for_mathlib.homological_complex_abelian\nimport for_mathlib.homology_map_datum\nimport for_mathlib.abelian_sheaves.functor_category\nimport for_mathlib.short_complex_functor_category\n\nnoncomputable theory\n\nopen category_theory category_theory.category category_theory.limits\nopen_locale zero_object\n\nuniverses v\n\nnamespace short_complex\n\nsection construction\n\nvariables {C : Type*} [category C] [has_zero_morphisms C]\nvariables {J : Type*} [category J] (F : J ⥤ short_complex C)\n [has_colimit (F ⋙ π₁)] [has_colimit (F ⋙ π₂)] [has_colimit (F ⋙ π₃)]\n\n@[simps]\ndef colimit_cocone.cocone : cocone F :=\n{ X := mk (colim_map (𝟙 F ◫ φ₁₂)) (colim_map (𝟙 F ◫ φ₂₃)) begin\n ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app, π₂_map,\n ι_colim_map, φ₂₃_app, π₃_map, assoc, comp_zero],\n erw [composable_morphisms.id_τ₂, id_comp, (F.obj j).zero_assoc, zero_comp],\n end,\n ι :=\n { app := λ j, begin\n refine ⟨colimit.ι (F ⋙ π₁) j, colimit.ι (F ⋙ π₂) j, colimit.ι (F ⋙ π₃) j, _, _⟩,\n { dsimp,\n simp only [ι_colim_map, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app, π₂_map,\n assoc],\n erw [composable_morphisms.id_τ₂, id_comp], },\n { dsimp,\n simp only [ι_colim_map, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app, π₃_map,\n assoc],\n erw [composable_morphisms.id_τ₃, id_comp], },\n end,\n naturality' := λ i j f, begin\n ext,\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₁) f, },\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₂) f, },\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₃) f, },\n end }, }\n\ndef colimit_cocone : colimit_cocone F :=\n{ cocone := colimit_cocone.cocone F,\n is_colimit :=\n { desc := λ s, begin\n refine ⟨colimit.desc (F ⋙ π₁) (π₁.map_cocone s),\n colimit.desc (F ⋙ π₂) (π₂.map_cocone s),\n colimit.desc (F ⋙ π₃) (π₃.map_cocone s), _, _⟩,\n { ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app,\n π₂_map, colimit.ι_desc, functor.map_cocone_ι_app, assoc, colimit.ι_desc_assoc, π₁_map],\n erw [composable_morphisms.id_τ₂, id_comp],\n exact (s.ι.app j).comm₁₂, },\n { ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app,\n π₃_map, colimit.ι_desc, functor.map_cocone_ι_app, assoc, colimit.ι_desc_assoc, π₂_map],\n erw [composable_morphisms.id_τ₃, id_comp],\n exact (s.ι.app j).comm₂₃, },\n end,\n fac' := λ s j, begin\n ext,\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₁_map], },\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₂_map], },\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₃_map], },\n end,\n uniq' := λ s m hm, begin\n have h₁ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₁.map φ) (hm j),\n have h₂ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₂.map φ) (hm j),\n have h₃ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₃.map φ) (hm j),\n dsimp at h₁ h₂ h₃,\n ext,\n { dsimp, simp only [h₁, colimit.ι_desc, functor.map_cocone_ι_app, π₁_map], },\n { dsimp, simp only [h₂, colimit.ι_desc, functor.map_cocone_ι_app, π₂_map], },\n { dsimp, simp only [h₃, colimit.ι_desc, functor.map_cocone_ι_app, π₃_map], },\n end, }, }\n\ninstance : has_colimit F := ⟨nonempty.intro (colimit_cocone F)⟩\n\ndef π₁_preserves_colimit : preserves_colimit F (π₁ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₁)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\ndef π₂_preserves_colimit : preserves_colimit F (π₂ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₂)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\ndef π₃_preserves_colimit : preserves_colimit F (π₃ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₃)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\nend construction\n\nsection preserves\n\nvariables {C : Type*} [category C] [has_zero_morphisms C]\nvariables {J D : Type*} [category J] [category D]\n\ndef π₁₂₃_reflects_colimits {F : J ⥤ short_complex C} (s : cocone F)\n (h₁ : is_colimit (π₁.map_cocone s)) (h₂ : is_colimit (π₂.map_cocone s))\n (h₃ : is_colimit (π₃.map_cocone s)) :\n is_colimit s :=\nbegin\n haveI : has_colimit (F ⋙ π₁) := ⟨nonempty.intro ⟨_, h₁⟩⟩,\n haveI : has_colimit (F ⋙ π₂) := ⟨nonempty.intro ⟨_, h₂⟩⟩,\n haveI : has_colimit (F ⋙ π₃) := ⟨nonempty.intro ⟨_, h₃⟩⟩,\n refine is_colimit.of_iso_colimit (colimit_cocone F).is_colimit (cocones.ext _ _),\n { suffices : is_iso ((colimit_cocone F).is_colimit.desc s),\n { haveI := this,\n exact as_iso ((colimit_cocone F).is_colimit.desc s), },\n apply is_iso_of_is_isos,\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso (colimit.is_colimit _) h₁), },\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso (colimit.is_colimit _) h₂), },\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso\n (colimit.is_colimit _) h₃), }, },\n { intro j,\n simp only [as_iso_hom, is_colimit.fac], },\nend\n\ndef π₁₂₃_reflect_preserves_colimits (G : J ⥤ D) (F : D ⥤ short_complex C)\n (h₁ : preserves_colimit G (F ⋙ π₁)) (h₂ : preserves_colimit G (F ⋙ π₂))\n (h₃ : preserves_colimit G (F ⋙ π₃)) : preserves_colimit G F :=\n⟨λ s hs, π₁₂₃_reflects_colimits _\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₁) _ hs _)\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₂) _ hs _)\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₃) _ hs _)⟩\n\nvariable (J)\n\ndef preserves_colimits_of_shape_of_projections (F : D ⥤ short_complex C)\n (h₁ : preserves_colimits_of_shape J (F ⋙ π₁))\n (h₂ : preserves_colimits_of_shape J (F ⋙ π₂))\n (h₃ : preserves_colimits_of_shape J (F ⋙ π₃)) :\n preserves_colimits_of_shape J F :=\n⟨by { intro G, apply π₁₂₃_reflect_preserves_colimits; apply_instance, }⟩\n\nend preserves\n\nsection functor_homological_complex\n\nvariables {C : Type*} [category C] [abelian C]\nvariables {M : Type*} {c : complex_shape M}\nvariables {J : Type*} [category J]\n\ninstance zero_preserves_colimits_of_shape {D : Type*} [category D]:\n preserves_colimits_of_shape J (0 : D ⥤ C) :=\n⟨λ F, ⟨λ s hs,\n{ desc := λ t, 0,\n fac' := λ t j, begin\n dsimp,\n apply is_zero.eq_of_src,\n apply is_zero.obj,\n apply is_zero_zero,\n end,\n uniq' := λ t m j, begin\n dsimp,\n apply is_zero.eq_of_src,\n apply is_zero.obj,\n apply is_zero_zero,\n end, }⟩⟩\n\nlemma functor_homological_complex_π₁_iso_eval (i j : M) (hij : c.rel j i) :\n functor_homological_complex C c i ⋙ π₁ ≅ homological_complex.eval C c j :=\nnat_iso.of_components (λ X, X.X_prev_iso hij)\n(λ X Y f, begin\n dsimp,\n simp only [homological_complex.hom.prev_eq f hij, assoc, iso.inv_hom_id, comp_id],\nend)\n\nlemma functor_homological_complex_π₃_iso_eval (i j : M) (hij : c.rel i j) :\n functor_homological_complex C c i ⋙ π₃ ≅ homological_complex.eval C c j :=\nnat_iso.of_components (λ X, X.X_next_iso hij)\n(λ X Y f, begin\n dsimp,\n simp only [homological_complex.hom.next_eq f hij, assoc, iso.inv_hom_id, comp_id],\nend)\n\ninstance (i : M) [has_colimits_of_shape J C] :\n preserves_colimits_of_shape J (short_complex.functor_homological_complex C c i) :=\nbegin\n apply preserves_colimits_of_shape_of_projections;\n { exact (infer_instance : preserves_colimits_of_shape J (homological_complex.eval C c _)), },\nend\n\nend functor_homological_complex\n\nsection functor_homology\n\nvariables {C : Type*} [category.{v} C] [abelian C]\nvariables {M : Type*} {c : complex_shape M}\n {J : Type v} [small_category J] [is_filtered J]\n [has_colimits_of_shape J C]\n [preserves_finite_limits (limits.colim : (J ⥤ C) ⥤ C)]\n [preserves_finite_colimits (limits.colim : (J ⥤ C) ⥤ C)]\n\nnamespace homology_functor_preserves_colimit\n\nvariable (F : short_complex (J ⥤ C))\n\ndef iso_datum := homology_iso_datum.tautological' F.1.f F.1.g F.2\n\ninstance (j : J) : preserves_finite_limits ((evaluation J C).obj j) :=\n⟨by { intro F, introI, introI, apply_instance, }⟩\ninstance (j : J) : preserves_finite_colimits ((evaluation J C).obj j) :=\n⟨by { intro F, introI, introI, apply_instance, }⟩\ninstance (j : J) : functor.additive ((evaluation J C).obj j) := { }\ninstance colim_additive : functor.additive (colim : (J ⥤ C) ⥤ C) := { }\n\n@[simps]\ndef nat_trans_ι (j : J) : (evaluation J C).obj j ⟶ (colim : (J ⥤ C) ⥤ C) :=\n{ app := λ F, colimit.ι F j,\n naturality' := λ F₁ F₂ φ, by { dsimp, simp only [colimit.ι_map], }, }\n\ndef iso_datum₁ := (iso_datum F).apply_exact_functor (colim : (J ⥤ C) ⥤ C)\n\ndef F₀ := functor_category_equivalence.functor.obj F\n\ndef e₁ : (F₀ F) ⋙ homology_functor ≅ (iso_datum F).H :=\nnat_iso.of_components\n (λ j, ((iso_datum F).apply_exact_functor ((evaluation J C).obj j)).iso.symm)\n (λ i j f, begin\n simp only [functor.comp_map, iso.symm_hom],\n erw ((iso_datum F).map_nat_trans ((evaluation J C).map f)).homology_map_eq,\n simpa only [evaluation_map_app, assoc, iso.hom_inv_id, comp_id,\n iso.cancel_iso_inv_left],\n end)\n\ndef e₂ : colim.map_short_complex.obj F ≅ (colimit_cocone.cocone (F₀ F)).X :=\nbegin\n refine iso_mk _ _ _ _ _,\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { ext, dsimp, simp only [colimit.ι_map_assoc, colimit.ι_map, nat_iso.of_components_hom_app,\n iso.refl_hom, id_comp, ι_colim_map, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app,\n π₂_map, assoc], erw id_comp, refl, },\n { ext, dsimp, simp only [colimit.ι_map_assoc, colimit.ι_map, nat_iso.of_components_hom_app,\n iso.refl_hom, id_comp, ι_colim_map, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app,\n π₃_map, assoc], erw id_comp, refl, },\nend\n\ndef e₃ : colimit (F₀ F ⋙ homology_functor) ≅ (colim.map_short_complex.obj F).homology :=\ncolim.map_iso (e₁ F) ≪≫ (iso_datum₁ F).iso\n\ndef e₄ : colimit (F₀ F ⋙ homology_functor) ≅ (colimit_cocone.cocone (F₀ F)).X.homology :=\ne₃ F ≪≫ homology_functor.map_iso (e₂ F)\n\nlemma compatibility (j : J) : (colimit.cocone (F₀ F ⋙ homology_functor)).ι.app j ≫\n (e₃ F).hom = homology_functor.map ((nat_trans_ι j).map_short_complex.app F) :=\nbegin\n rw ((iso_datum F).map_nat_trans (nat_trans_ι j)).homology_map_eq,\n dsimp only [e₁, e₃, iso_datum₁, nat_iso.of_components],\n simpa only [colimit.cocone_ι, iso.trans_hom, functor.map_iso_hom, colimit.ι_map_assoc,\n iso.symm_hom, nat_trans_ι_app, iso.cancel_iso_hom_right_assoc, iso.cancel_iso_inv_left],\nend\n\nlemma preserves : preserves_colimit (F₀ F) short_complex.homology_functor :=\n⟨λ s hs, begin\n have e₁ : s ≅ colimit_cocone.cocone (F₀ F),\n { refine is_initial.unique_up_to_iso _ _,\n all_goals { equiv_rw (cocone.is_colimit_equiv_is_initial _).symm, },\n exacts [hs, (colimit_cocone (F₀ F)).is_colimit], },\n suffices : is_colimit (homology_functor.map_cocone (colimit_cocone.cocone (F₀ F))),\n { exact is_colimit.of_iso_colimit this\n ((cocones.functoriality _ homology_functor).map_iso e₁.symm), },\n clear e₁ hs s,\n refine is_colimit.of_iso_colimit (colimit.is_colimit (F₀ F ⋙ homology_functor))\n (cocones.ext (e₄ F) _),\n intro j,\n dsimp only [functor.map_cocone, cocones.functoriality, e₄, iso.trans, functor.map_iso],\n rw [← assoc, compatibility, ← homology_functor.map_comp],\n congr' 1,\n ext1,\n all_goals\n { dsimp [e₂], simp only [colimit.ι_map, nat_iso.of_components_hom_app,\n iso.refl_hom, id_comp], },\nend⟩\n\nend homology_functor_preserves_colimit\n\ninstance (F₀ : J ⥤ short_complex C) : preserves_colimit F₀ short_complex.homology_functor :=\nbegin\n let F := functor_category_equivalence.inverse.obj F₀,\n haveI : preserves_colimit (homology_functor_preserves_colimit.F₀ F) homology_functor\n := homology_functor_preserves_colimit.preserves F,\n have h : homology_functor_preserves_colimit.F₀ F ≅ F₀ :=\n functor_category_equivalence.counit_iso.app F₀,\n exact preserves_colimit_of_iso_diagram short_complex.homology_functor h,\nend\n\ninstance : preserves_colimits_of_shape J\n (short_complex.homology_functor : short_complex C ⥤ C) := ⟨λ F, infer_instance⟩\n\nend functor_homology\n\nend short_complex\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/for_mathlib/short_complex_colimits.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.519521321952093, "lm_q2_score": 0.3629692055196168, "lm_q1q2_score": 0.18857024147945226}} {"text": "import Lean.Meta\n\nsyntax (name := stx_rfl) \"stx_rfl\" : tactic\n\nopen Lean.Elab.Tactic Lean Meta in\n@[tactic stx_rfl] def syntacticRefl : Tactic := fun _ => do\n let goal ← getMainGoal\n let goalType ← goal.getType\n match goalType.app3? ``Eq with\n | none => throwTacticEx `stx_rfl goal m!\"equality expected\"\n | some (_,lhs,rhs) => \n\n let lhs ← instantiateMVars lhs\n let rhs ← instantiateMVars rhs\n\n -- This is a very crude test and maybe too strict\n -- In my use case I wand defEq witout zeta reduction\n if lhs == rhs then\n goal.applyRefl\n else\n throwTacticEx `stx_rfl goal m!\"{← Lean.Meta.ppExpr lhs} and {← Lean.Meta.ppExpr rhs} are not syntactically equal!\" \n\nexample : 0 = 0 := \nby\n stx_rfl\n", "meta": {"author": "lecopivo", "repo": "SciLean", "sha": "e4fe5962c862f9854a6c88a4082eb01bc1147086", "save_path": "github-repos/lean/lecopivo-SciLean", "path": "github-repos/lean/lecopivo-SciLean/SciLean-e4fe5962c862f9854a6c88a4082eb01bc1147086/SciLean/Tactic/SyntacticRefl.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5039061705290805, "lm_q2_score": 0.3738758227716966, "lm_q1q2_score": 0.18839833410629483}} {"text": "import for_mathlib.derived.les_facts\nimport liquid\nimport Lbar.functor\nimport condensed.projective_resolution\nimport condensed.condensify\nimport condensed.bd_lemma\nimport breen_deligne.eg\n\nimport for_mathlib.derived.ext_coproducts\nimport condensed.ab4\nimport Lbar.squares\nimport pseudo_normed_group.QprimeFP\nimport for_mathlib.acyclic\nimport free_pfpng.acyclic\nimport for_mathlib.SemiNormedGroup_ulift\nimport for_mathlib.bicartesian4\nimport for_mathlib.has_homology_aux\n\nimport for_mathlib.derived.Ext_lemmas\n\nnoncomputable theory\n\nuniverses u\n\nopen opposite category_theory category_theory.limits\nopen_locale nnreal zero_object\n\n\nvariables (r r' : ℝ≥0)\nvariables [fact (0 < r)] [fact (0 < r')] [fact (r < r')] [fact (r < 1)] [fact (r' < 1)]\n\nabbreviation SemiNormedGroup.to_Cond (V : SemiNormedGroup.{u}) := Condensed.of_top_ab V\n\nsection\n\nopen bounded_homotopy_category\n\nvariables (BD : breen_deligne.data)\nvariables (κ κ₂ : ℝ≥0 → ℕ → ℝ≥0)\nvariables [∀ (c : ℝ≥0), BD.suitable (κ c)] [∀ n, fact (monotone (function.swap κ n))]\nvariables [∀ (c : ℝ≥0), BD.suitable (κ₂ c)] [∀ n, fact (monotone (function.swap κ₂ n))]\nvariables (M : ProFiltPseuNormGrpWithTinv₁.{u} r')\nvariables (V : SemiNormedGroup.{u}) [complete_space V] [separated_space V]\n\nlemma ExtQprime_iso_aux_system_aux (c : ℝ≥0) (k i : ℤ) (hi : i > 0) :\n is_zero (((Ext' i).obj (op (((homological_complex.embed complex_shape.embedding.nat_down_int_up).obj\n ((QprimeFP_nat.{u} r' BD κ M).obj c)).X k))).obj V.to_Cond) :=\nbegin\n rcases k with (_|_)|_,\n { apply free_acyclic.{u} _ V i hi },\n { apply bounded_derived_category.Ext'_zero_left_is_zero, refine (is_zero_zero _).op },\n { apply free_acyclic.{u} _ V i hi },\nend\n\ndef embed_unop {𝓐 : Type*} [category 𝓐] [abelian 𝓐] :\n (homological_complex.embed complex_shape.embedding.nat_down_int_up).op ⋙\n @homological_complex.unop_functor 𝓐 _ _ _ _ ≅\n homological_complex.unop_functor ⋙\n homological_complex.embed complex_shape.embedding.nat_up_int_down :=\nbegin\n refine nat_iso.of_components _ _,\n { intro X, refine homological_complex.hom.iso_of_components _ _,\n { rintro ((_|n)|n),\n { exact iso.refl _ },\n { refine is_zero.iso (is_zero_zero _).unop (is_zero_zero _), },\n { exact iso.refl _ }, },\n { rintro i (j|(_|j)) (rfl : _ = _),\n { apply is_zero.eq_of_src, exact (is_zero_zero _).unop },\n { dsimp only [iso.refl_hom], erw [category.id_comp, category.comp_id], refl },\n { dsimp only [iso.refl_hom], erw [category.id_comp, category.comp_id], refl }, } },\n { intros X Y f, ext ((_|n)|n),\n { dsimp only [homological_complex.comp_f, homological_complex.hom.iso_of_components_hom_f, iso.refl_hom],\n erw [category.id_comp, category.comp_id], refl },\n { apply is_zero.eq_of_tgt, exact is_zero_zero _ },\n { dsimp only [homological_complex.comp_f, homological_complex.hom.iso_of_components_hom_f, iso.refl_hom],\n erw [category.id_comp, category.comp_id], refl } }\nend\n.\n\n-- move me\nlemma nat_up_int_down_c_iff : complex_shape.embedding.nat_up_int_down.c_iff :=\nλ i j, complex_shape.embedding.nat_down_int_up_c_iff j i\n\ndef forget₂_unop :\n ((forget₂ SemiNormedGroup Ab).op.map_homological_complex (complex_shape.down ℕ)).op ⋙\n homological_complex.unop_functor ≅\n homological_complex.unop_functor ⋙\n (forget₂ SemiNormedGroup Ab).map_homological_complex (complex_shape.down ℕ).symm :=\nbegin\n refine nat_iso.of_components _ _,\n { intro X, refine homological_complex.hom.iso_of_components _ _,\n { intro n, exact iso.refl _ },\n { rintro i j (rfl : _ = _), dsimp only [iso.refl_hom],\n rw [category.id_comp, category.comp_id], refl } },\n { intros X Y f, ext n,\n dsimp only [homological_complex.comp_f, homological_complex.hom.iso_of_components_hom_f, iso.refl_hom],\n rw [category.id_comp, category.comp_id], refl }\nend\n.\n\ndef preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab\n (M : Condensed.{u} Ab.{u+1}) (X : Profinite) :\n (preadditive_yoneda.obj M).obj (op $ CondensedSet_to_Condensed_Ab.obj (Profinite_to_Condensed.obj X)) ≅\n M.val.obj (op X) :=\nlet e := Condensed_Ab_CondensedSet_adjunction.hom_equiv X.to_Condensed M in\nadd_equiv.to_AddCommGroup_iso $\n{ to_fun := λ t, yoneda'_equiv _ _ (e t).val,\n inv_fun := λ t, e.symm $ ⟨(yoneda'_equiv _ _).symm $ by apply t⟩,\n left_inv := λ t, begin\n dsimp only,\n apply_fun e, rw equiv.apply_symm_apply, ext1,\n dsimp only, erw equiv.apply_symm_apply,\n end,\n right_inv := λ t, begin\n dsimp only,\n rw equiv.apply_symm_apply,\n rw equiv.apply_symm_apply,\n end,\n map_add' := begin\n intros x y,\n refl,\n end }\n\n@[reassoc]\nlemma preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab_natural\n {M₁ M₂ : Condensed.{u} Ab.{u+1}} (f : M₁ ⟶ M₂) (X : Profinite) :\n (preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab M₁ X).hom ≫ f.val.app _ =\n (preadditive_yoneda.map f).app _ ≫\n (preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab M₂ X).hom :=\nby { ext, refl }\n\n@[reassoc]\nlemma preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab_natural'\n (M : Condensed.{u} Ab.{u+1}) {X Y : Profinite.{u}} (f : X ⟶ Y) :\n (preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab M Y).hom ≫ M.val.map f.op =\n (preadditive_yoneda.obj M).map (CondensedSet_to_Condensed_Ab.map $\n Profinite_to_Condensed.map f).op ≫\n (preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab M X).hom :=\nbegin\n ext t,\n rw comp_apply,\n rw comp_apply,\n dsimp [preadditive_yoneda_obj_obj_CondensedSet_to_Condensed_Ab, adjunction.whisker_right],\n simp only [← nat_trans.comp_app],\n rw ← grothendieck_topology.to_sheafify_naturality_assoc,\n dsimp [functor.right_unitor],\n simp only [← comp_apply, category.assoc, ← nat_trans.comp_app, ← nat_trans.comp_app_assoc],\n simp only [← nat_trans.naturality, functor.comp_map, category.assoc],\n refl,\nend\n\nend\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/Lbar/ext_preamble.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5039061705290805, "lm_q2_score": 0.373875808818685, "lm_q1q2_score": 0.18839832707528617}} {"text": "class L1 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n\ninstance L1.toAdd [inst : L1 α] : Add α := { inst with }\n\nclass L2 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n\ninstance L2.toL1 [inst : L2 α] : L1 α := { inst with }\n\nclass L3 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n\ninstance L3.toL2 [inst : L3 α] : L2 α := { inst with }\n\nclass L4 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n\ninstance L4.toL3 [inst : L4 α] : L3 α := { inst with }\n\nclass L5 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n\ninstance L5.toL4 [inst : L5 α] : L4 α := { inst with }\n\nclass L6 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n\ninstance L6.toL5 [inst : L6 α] : L5 α := { inst with }\n\nclass L7 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n\ninstance L7.toL6 [inst : L7 α] : L6 α := { inst with }\n\nclass L8 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n\ninstance L8.toL7 [inst : L8 α] : L7 α := { inst with }\n\nclass L9 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\ninstance L9.toL8 [inst : L9 α] : L8 α := { inst with }\n\nclass T1 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\n-- slow\ninstance T1.toL9 [inst : T1 α] : L9 α := { inst with }\n\nclass T2 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @Add.add α ⟨add⟩ x y = @Add.add α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) x y = @Add.add α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @Add.add α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\n-- slow\ninstance T2.toL9 [inst : T2 α] : L9 α := { inst with }\n\n\nset_option pp.all true in\n-- #print T2.toL9\n\naxiom C : Type\naxiom C.add : C → C → C\n\nnoncomputable instance C.T1 : T1 C := ⟨add, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry⟩\nnoncomputable instance C.T2 : T2 C := ⟨add, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry⟩\n\n-- slow\nexample : @T1.toL9 _ C.T1 = @T2.toL9 _ C.T2 := rfl\n", "meta": {"author": "leanprover", "repo": "lean4", "sha": "742d053a97bdd109a41a921facd1cd6a55e89bc7", "save_path": "github-repos/lean/leanprover-lean4", "path": "github-repos/lean/leanprover-lean4/lean4-742d053a97bdd109a41a921facd1cd6a55e89bc7/tests/lean/run/tryHeuristicPerfIssue.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.519521321952093, "lm_q2_score": 0.35936413143782797, "lm_q1q2_score": 0.1866973286267461}} {"text": "import for_mathlib.algebra.homology.k_projective\nimport for_mathlib.category_theory.localization.derived_functor_triangulated\nimport category_theory.abelian.injective\nimport for_mathlib.algebra.homology.cochain_complex_opposites\n\nnoncomputable theory\n\nopen category_theory category_theory.category category_theory.limits\n category_theory.pretriangulated\nopen_locale zero_object\n\ninstance inverse_image_multiplicative {C D : Type*} [category C] [category D]\n (F : C ⥤ D) (W : morphism_property D)\n [W.multiplicative] : (W.inverse_image F).multiplicative :=\n{ contains_identities := ⟨λ X, begin\n change W _,\n rw F.map_id,\n apply morphism_property.contains_identities.id W,\n end⟩,\n comp := (morphism_property.multiplicative.comp W).inverse_image F, }\n\nvariables {C : Type*} [category C] [abelian C]\n\nnamespace homological_complex\n\nvariables {ι : Type*} {c : complex_shape ι} (K L : homological_complex C c)\n\nclass is_K_injective : Prop :=\n(null_homotopic : ∀ ⦃X : homological_complex C c⦄ (f : X ⟶ K)\n (hX : acyclic X), nonempty (homotopy f 0))\n\nvariables {K L}\n\nlemma is_K_injective.of_homotopy_equiv [K.is_K_injective] (e : homotopy_equiv K L) :\n L.is_K_injective :=\n⟨λ X f hX, begin\n obtain ⟨h⟩ := is_K_injective.null_homotopic (f ≫ e.inv) hX,\n refine ⟨(homotopy.of_eq (comp_id f)).symm.trans\n (((e.homotopy_inv_hom_id.symm.comp_left f).trans\n (homotopy.of_eq (assoc _ _ _).symm)).trans\n ((h.comp_right e.hom).trans (homotopy.of_eq zero_comp)))⟩,\nend⟩\n\nlemma is_K_injective.of_iso [K.is_K_injective] (e : K ≅ L) : L.is_K_injective :=\nis_K_injective.of_homotopy_equiv (homotopy_equiv.of_iso e)\n\nlemma is_K_injective.iff_of_iso (e : K ≅ L) :\n K.is_K_injective ↔ L.is_K_injective :=\nbegin\n split,\n { introI, exact is_K_injective.of_iso e, },\n { introI, exact is_K_injective.of_iso e.symm, },\nend\n\nlemma is_K_injective.of_is_zero (h : is_zero K) : K.is_K_injective :=\n⟨λ X f hX, begin\n rw h.eq_of_tgt f 0,\n exact ⟨homotopy.refl _⟩\nend⟩\n\ninstance zero_is_K_injective : is_K_injective (0 : homological_complex C c) :=\nis_K_injective.of_is_zero (limits.is_zero_zero _)\n\nend homological_complex\n\nnamespace cochain_complex\n\nopen homological_complex\n\nvariables (K : cochain_complex C ℤ)\n\nlemma is_K_injective_iff : is_K_injective K ↔\n (homotopy_category.quotient _ _).obj K\n ∈ triangulated.right_orthogonal (homotopy_category.acyclic C) :=\nbegin\n split,\n { introI,\n rintros ⟨X⟩ f hX,\n obtain ⟨f, rfl⟩ := (homotopy_category.quotient _ _).map_surjective f,\n rw ← (homotopy_category.quotient C (complex_shape.up ℤ)).map_zero,\n refine homotopy_category.eq_of_homotopy _ _ (is_K_injective.null_homotopic _ _).some,\n erw homotopy_category.quotient_obj_mem_acyclic_iff at hX,\n exact hX, },\n { intro hK,\n refine ⟨λ X f hX, ⟨homotopy_category.homotopy_of_eq _ _ _⟩⟩,\n simp only [functor.map_zero],\n apply hK,\n simpa only [homotopy_category.quotient_obj_mem_acyclic_iff] using hX, },\nend\n\nlemma shift_is_K_injective_iff (K : cochain_complex C ℤ) (r : ℤ) :\n is_K_injective (K⟦r⟧) ↔ is_K_injective K :=\nbegin\n simp only [is_K_injective_iff],\n erw [set.respects_iso.mem_iff_of_iso (triangulated.right_orthogonal (homotopy_category.acyclic C))\n (((homotopy_category.quotient C (complex_shape.up ℤ)).comm_shift_iso r).app K),\n ← triangulated.is_triangulated_subcategory.shift_iff],\nend\n\nlemma is_K_injective_of_op (K : cochain_complex C ℤ)\n (hK : (op_equivalence.op_obj K).is_K_projective) :\n is_K_injective K :=\n⟨λ (L : cochain_complex C ℤ) f hL, ⟨begin\n apply cochain_complex.unop_homotopy,\n let f' : op_equivalence.op_obj K ⟶ _ :=\n (cochain_complex.op_equivalence.functor C).map f.op,\n exact (is_K_projective.null_homotopic f' (cochain_complex.acyclic_op hL)).some,\nend⟩⟩\n\nlemma is_K_injective_of_bounded_below_of_injective\n (K : cochain_complex C ℤ) (n : ℤ) [K.is_strictly_ge n]\n [∀ (n : ℤ), injective (K.X n)] : is_K_injective K :=\nbegin\n haveI : K.is_strictly_ge (-(-n)),\n { simp only [neg_neg], apply_instance, },\n haveI : (op_equivalence.op_obj K).is_strictly_le (-n) := op_obj_is_strictly_le K (-n),\n haveI : ∀ (n : ℤ), projective ((op_equivalence.op_obj K).X n),\n { intro n,\n dsimp,\n apply_instance, },\n exact is_K_injective_of_op _ (is_K_projective_of_bounded_above_of_projective _ (-n)),\nend\n\nend cochain_complex\n\nnamespace homotopy_category\n\nvariables {C} {ι : Type*} {c : complex_shape ι}\n\nclass is_K_injective (K : homotopy_category C c) : Prop :=\n(K_injective : K.as.is_K_injective)\n\nlemma is_K_injective_iff' (K : homotopy_category C c) :\n K.is_K_injective ↔ K.as.is_K_injective :=\nbegin\n split,\n { exact λ h, h.K_injective, },\n { exact λ h, ⟨h⟩, },\nend\n\nlemma is_K_injective_iff (K : homotopy_category C (complex_shape.up ℤ)) : is_K_injective K ↔\n K ∈ triangulated.right_orthogonal (homotopy_category.acyclic C) :=\nbegin\n rw K.is_K_injective_iff',\n cases K,\n dsimp,\n apply cochain_complex.is_K_injective_iff,\nend\n\nvariables (C c)\n\ninstance zero_is_K_injective :\n (0 : homotopy_category C c).is_K_injective :=\n⟨⟨λ X f hf, ⟨begin\n have e : ∀ (X : homotopy_category C c), ((quotient C c).obj X.1 ≅ X),\n { rintro ⟨X⟩, exact (iso.refl _), },\n refine homotopy_of_eq _ _ (is_zero.eq_of_tgt (is_zero.of_iso (is_zero_zero _) (e _)) _ _),\nend⟩⟩⟩\n\nabbreviation K_injective := full_subcategory (λ (K : homotopy_category C c), K.is_K_injective)\n\ninstance is_K_injective_is_triangulated_subcategory :\n triangulated.is_triangulated_subcategory\n (λ (K : homotopy_category C (complex_shape.up ℤ)), K.is_K_injective) :=\nbegin\n convert (infer_instance : triangulated.is_triangulated_subcategory\n (triangulated.right_orthogonal (homotopy_category.acyclic C))),\n ext,\n exact is_K_injective_iff _,\nend\n\ninstance K_injective_is_K_injective (K : K_injective C c) : K.obj.is_K_injective := K.2\n\n--instance : pretriangulated (K_injective C (complex_shape.up ℤ)) := infer_instance\n\nabbreviation K_injective.ι : K_injective C c ⥤ homotopy_category C c :=\nfull_subcategory_inclusion _\n\nend homotopy_category\n\nnamespace derived_category\n\nlemma Qh_map_bijective_of_is_K_injective\n (K L : homotopy_category C (complex_shape.up ℤ)) [L.is_K_injective] :\n function.bijective (λ (f : K ⟶ L), Qh.map f) :=\n(triangulated.subcategory.right_orthogonal_bijective_Q_map\n (homotopy_category.acyclic C) _ _\n (by { rw ← L.is_K_injective_iff, apply_instance, }))\n\nlemma Qh_map_bijective_of_is_K_injective'\n (K L : cochain_complex C ℤ) [L.is_K_injective] :\n function.bijective (λ (f : ((homotopy_category.quotient _ _).obj K ⟶\n (homotopy_category.quotient _ _).obj L)), Qh.map f) :=\n(triangulated.subcategory.right_orthogonal_bijective_Q_map\n (homotopy_category.acyclic C) _ _\n ((cochain_complex.is_K_injective_iff L).1 infer_instance))\n\nlemma Q_map_surjective_of_is_K_injective\n (K L : cochain_complex C ℤ) [L.is_K_injective] :\n function.surjective (λ (f : K ⟶ L), Q.map f) :=\nλ f, begin\n obtain ⟨g, hg⟩ := (Qh_map_bijective_of_is_K_injective' K L).2 f,\n dsimp at hg,\n obtain ⟨g, rfl⟩ := (homotopy_category.quotient _ _).map_surjective g,\n exact ⟨g, hg⟩,\nend\n\ndef homotopy_of_eq_Qh_map_eq_of_is_K_injective\n {K L : cochain_complex C ℤ} [L.is_K_injective] (f₁ f₂ : K ⟶ L)\n (h : Q.map f₁ = Q.map f₂) : homotopy f₁ f₂ :=\nhomotopy_category.homotopy_of_eq _ _ ((Qh_map_bijective_of_is_K_injective' K L).1 h)\n\nend derived_category\n\nnamespace homotopy_category\n\nvariable (C)\n\nnamespace K_injective\n\ndef W : morphism_property (homotopy_category.K_injective C (complex_shape.up ℤ)) :=\n(triangulated.subcategory.W (homotopy_category.acyclic C)).inverse_image (K_injective.ι _ _)\n\ninstance W_multiplicative : (W C).multiplicative :=\nby { dsimp [W], apply_instance, }\n\nvariable {C}\n\ndef Φ : localizor_morphism (W C) (triangulated.subcategory.W (homotopy_category.acyclic C)) :=\n{ functor := K_injective.ι _ _,\n mapW := λ X Y f hf, hf, }\n\ninstance Φ_functor_has_comm_shift :\n (Φ : localizor_morphism (W C) _).functor.has_comm_shift ℤ :=\nby { dsimp only [Φ], apply_instance, }\n\ninstance Φ_functor_is_triangulated :\n (Φ : localizor_morphism (W C) _).functor.is_triangulated :=\nby { dsimp only [Φ], apply_instance, }\n\nend K_injective\n\nend homotopy_category\n\nnamespace category_theory\n\nvariable (C)\n\ninclude C\n\nclass has_enough_K_injectives : Prop :=\n(condition : ∀ (K : homotopy_category C (complex_shape.up ℤ)),\n nonempty (homotopy_category.K_injective.Φ.right_resolution K))\n\nend category_theory\n\nopen category_theory\n\nnamespace homotopy_category\n\nnamespace K_injective\n\nvariable {C}\n\ndef Qh : K_injective C (complex_shape.up ℤ) ⥤ derived_category C :=\nK_injective.ι _ _ ⋙ derived_category.Qh\n\ninstance full_Qh : full (Qh : _ ⥤ derived_category C) :=\nfunctor.full_of_surjective _ (λ K L, (derived_category.Qh_map_bijective_of_is_K_injective _ _).2)\n\ninstance faithful_Qh : faithful (Qh : _ ⥤ derived_category C) :=\n⟨λ K L, (derived_category.Qh_map_bijective_of_is_K_injective _ _).1⟩\n\nvariable (C)\n\nlemma W_eq_isomorphisms : W C = morphism_property.isomorphisms _ :=\nbegin\n ext K L f,\n split,\n { intro hf,\n haveI : is_iso (Qh.map f) := (triangulated.subcategory.is_iso_map_iff\n (acyclic C) derived_category.Qh f).2 hf,\n exact is_iso_of_reflects_iso f Qh, },\n { rintro (h : is_iso _),\n haveI := h,\n exact (triangulated.subcategory.is_iso_map_iff (acyclic C) derived_category.Qh ((ι _ _).map f)).1\n infer_instance, },\nend\n\nvariable {C}\n\nlemma W_inverts {D : Type*} [category D]\n (G : K_injective C (complex_shape.up ℤ) ⥤ D) :\n (W C).is_inverted_by G :=\nbegin\n intros X Y f hf,\n haveI : is_iso f := by simpa only [W_eq_isomorphisms] using hf,\n apply_instance,\nend\n\nvariables [has_enough_K_injectives C]\n\ninstance (Y : homotopy_category C (complex_shape.up ℤ)) :\n nonempty (Φ.right_resolution Y) :=\nhas_enough_K_injectives.condition Y\n\ninstance (Y : homotopy_category C (complex_shape.up ℤ)) (X : Φ.right_resolution Y) :\n is_iso (derived_category.Qh.map X.hom.f) :=\nby simpa only [triangulated.subcategory.is_iso_map_iff (homotopy_category.acyclic C)\n derived_category.Qh] using X.hom.hf\n\ninstance ess_surj_Qh : ess_surj (Qh : _ ⥤ derived_category C) :=\n⟨λ Z, begin\n have e := derived_category.Qh.obj_obj_preimage_iso Z,\n let Y := derived_category.Qh.obj_preimage Z,\n let X := (has_enough_K_injectives.condition Y).some,\n exact ⟨X.right.obj, ⟨(as_iso (derived_category.Qh.map X.hom.f)).symm ≪≫\n derived_category.Qh.obj_obj_preimage_iso Z⟩⟩,\nend⟩\n\ninstance : is_equivalence (Qh : _ ⥤ derived_category C) :=\nequivalence.of_fully_faithfully_ess_surj _\n\ninstance Qh_is_localization : Qh.is_localization (W C) :=\nbegin\n haveI : (𝟭 _).is_localization (W C),\n { refine functor.is_localization.for_id _ _,\n rw W_eq_isomorphisms, },\n exact functor.is_localization.of_equivalence_target (𝟭 _) (W C) Qh\n (functor.as_equivalence Qh) (functor.left_unitor _),\nend\n\ninstance Φ_induced_functor_obj_is_K_injective (Y : homotopy_category C (complex_shape.up ℤ))\n (X : Φ.right_resolution Y) : (Φ.induced_functor.obj X.right).obj.is_K_injective :=\nX.right.obj.2\n\ninstance Φ_induced_functor_obj_is_K_injective' (Y : homotopy_category C (complex_shape.up ℤ))\n (X : Φ.right_resolution Y) : (Φ.functor.obj X.right.obj).is_K_injective :=\nX.right.obj.2\n\nlemma lift_map {Y₁ Y₂ : homotopy_category C (complex_shape.up ℤ)} (f : Y₁ ⟶ Y₂)\n (X₁ : Φ.right_resolution Y₁) (X₂ : Φ.right_resolution Y₂) :\n ∃ (f' : X₁.right.obj ⟶ X₂.right.obj), X₁.hom.f ≫ Φ.functor.map f' = f ≫ X₂.hom.f :=\nbegin\n let f'' := inv (derived_category.Qh.map (X₁.hom.f)) ≫\n derived_category.Qh.map (f ≫ X₂.hom.f),\n obtain ⟨f', hf'⟩ := (derived_category.Qh_map_bijective_of_is_K_injective _ _).2 f'',\n refine ⟨f', (derived_category.Qh_map_bijective_of_is_K_injective _ _).1 _⟩,\n dsimp [Φ] at hf' ⊢,\n simp only [functor.map_comp, hf', f'', is_iso.hom_inv_id_assoc],\nend\n\ninstance (Y : homotopy_category C (complex_shape.up ℤ)) :\n is_preconnected' (Φ.right_resolution Y) :=\n⟨⟨begin\n rintro ⟨X₁⟩ ⟨X₂⟩,\n obtain ⟨g, hg⟩ := K_injective.lift_map (𝟙 Y) X₁ X₂,\n dsimp at hg,\n rw id_comp at hg,\n refine quot.sound ⟨structured_arrow.hom_mk ⟨g, _⟩ _⟩,\n { change (triangulated.subcategory.W (homotopy_category.acyclic C)) _,\n rw ← triangulated.subcategory.is_iso_map_iff (homotopy_category.acyclic C)\n derived_category.Qh,\n replace hg := derived_category.Qh.congr_map hg,\n rw functor.map_comp at hg,\n exact is_iso.of_is_iso_fac_left hg, },\n { ext, exact hg, },\nend⟩⟩\n\ninstance Φ_is_localization_equivalence : (Φ : localizor_morphism (W C) _).is_localization_equivalence :=\nbegin\n rw localizor_morphism.is_localization_equivalence.iff_is_localization Φ\n (derived_category.Qh : _ ⥤ derived_category C),\n change Qh.is_localization _,\n apply_instance,\nend\n\nlemma right_derivability_structure :\n right_derivability_structure.basic (Φ : localizor_morphism (W C) _) :=\n{ right_resolution_connected := λ Y, { },\n nonempty_arrow_right_resolution := λ Y₁ Y₂ f, begin\n let X₁ := (has_enough_K_injectives.condition Y₁).some,\n let X₂ := (has_enough_K_injectives.condition Y₂).some,\n obtain ⟨f', fac⟩ := K_injective.lift_map f X₁ X₂,\n exact ⟨X₁, X₂, f', fac⟩,\n end, }\n\ninstance Φ_functor_comp_Qh_ess_surj_on_dist_triang : (Φ.functor ⋙\n derived_category.Qh : _ ⥤ derived_category C).ess_surj_on_dist_triang :=\nK_injective.right_derivability_structure.Φ_functor_comp_L_ess_surj_on_dist_triang _\n\nsection\n\nvariables {D : Type*} [category D]\n (F : homotopy_category C (complex_shape.up ℤ) ⥤ D)\n\ninstance existence_right_derived_functor :\n F.has_right_derived_functor (triangulated.subcategory.W (acyclic C)) :=\nright_derivability_structure.basic.existence_derived_functor\n K_injective.right_derivability_structure F (W_inverts _)\n\nlemma is_iso_app (RF : derived_category C ⥤ D)\n (α : F ⟶ derived_category.Qh ⋙ RF)\n [RF.is_right_derived_functor α]\n (K : homotopy_category C (complex_shape.up ℤ)) [K.is_K_injective] :\n is_iso (α.app K) :=\nright_derivability_structure.basic.is_iso_app\n K_injective.right_derivability_structure derived_category.Qh F (W_inverts _)\n RF α ⟨K, infer_instance⟩\n\ninstance (K : homotopy_category C (complex_shape.up ℤ)) [K.is_K_injective] :\n is_iso ((F.right_derived_functor_α derived_category.Qh\n (triangulated.subcategory.W (acyclic C))).app K) :=\nis_iso_app _ _ _ _\n\nsection\n\nvariables [has_zero_object D] [has_shift D ℤ] [preadditive D]\n [∀ (n : ℤ), (shift_functor D n).additive] [pretriangulated D]\n [F.has_comm_shift ℤ] [functor.is_triangulated F]\n\ninstance right_derived_functor_is_triangulated :\n (F.right_derived_functor derived_category.Qh\n (triangulated.subcategory.W (acyclic C))).is_triangulated :=\nright_derivability_structure.basic.derived_functor_is_triangulated'\n K_injective.right_derivability_structure F derived_category.Qh (W_inverts _)\n\nend\n\nend\n\nend K_injective\n\nend homotopy_category\n", "meta": {"author": "joelriou", "repo": "homotopical_algebra", "sha": "697f49d6744b09c5ef463cfd3e35932bdf2c78a3", "save_path": "github-repos/lean/joelriou-homotopical_algebra", "path": "github-repos/lean/joelriou-homotopical_algebra/homotopical_algebra-697f49d6744b09c5ef463cfd3e35932bdf2c78a3/src/for_mathlib/algebra/homology/k_injective.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.523420348936324, "lm_q2_score": 0.35577488668296436, "lm_q1q2_score": 0.18621981533037835}} {"text": "-- Copyright (c) 2017 Scott Morrison. All rights reserved.\n-- Released under Apache 2.0 license as described in the file LICENSE.\n-- Authors: Stephen Morgan, Scott Morrison\nimport .pentagon_in_terms_of_natural_transformations_definitions\nimport tidy.its\n\nopen categories\nopen categories.functor\nopen categories.products\nopen categories.natural_transformation\n\nnamespace categories.monoidal_category\n\nuniverse variables u v\n\nvariables (C : Type u) [𝒞 : monoidal_category.{u v} C]\ninclude 𝒞\n\nlocal attribute [tidy] dsimp_all'\n\n\nset_option trace.check true\n\n-- TODO tidy this up\nlemma pentagon_in_terms_of_natural_transformations :\n pentagon_3step C = pentagon_2step C :=\n begin \n dsimp',\n apply NaturalTransformations_componentwise_equal,\n intros WXYZ,\n induction WXYZ with WXY Z,\n induction WXY with WX Y,\n induction WX with W X,\n {\n tidy,\n -- erw rewrite_tensor_as_otimes, -- FIXME terrifying: equalities between objects are evil, and hence rewriting along them is hard\n have p := monoidal_category.pentagon C W X Y Z,\n -- have p := monoidal_category.pentagon C X_fst_fst_fst X_fst_fst_snd X_fst_snd X_snd,\n obviously, -- FIXME\n },\nend\n\nend categories.monoidal_category\n", "meta": {"author": "semorrison", "repo": "lean-monoidal-categories", "sha": "81f43e1e0d623a96695aa8938951d7422d6d7ba6", "save_path": "github-repos/lean/semorrison-lean-monoidal-categories", "path": "github-repos/lean/semorrison-lean-monoidal-categories/lean-monoidal-categories-81f43e1e0d623a96695aa8938951d7422d6d7ba6/src/monoidal_categories/lemmas/pentagon_in_terms_of_natural_transformations.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5078118642792044, "lm_q2_score": 0.36658975016245987, "lm_q1q2_score": 0.18615862445564654}} {"text": "import for_mathlib.endomorphisms.basic\nimport for_mathlib.exact_functor\n\nuniverse v\n\nnamespace category_theory\n\nnamespace endomorphisms\n\nopen homological_complex category_theory category_theory.limits category\n\nvariables (𝓐 : Type*) [category.{v} 𝓐]\n\n@[simps]\ndef tautological_nat_trans :\n (endomorphisms.forget 𝓐) ⟶ (endomorphisms.forget 𝓐) :=\n{ app := λ X, X.e, }\n\nvariable {𝓐}\n\nvariables [abelian 𝓐]\n [has_coproducts_of_shape (ulift.{v} ℕ) 𝓐] [has_products_of_shape (ulift.{v} ℕ) 𝓐]\nvariables {M : Type*} {c : complex_shape M} (F : endomorphisms 𝓐 ⥤ homological_complex 𝓐 c)\nvariables (Y : homological_complex (endomorphisms 𝓐) c)\n\n@[simps]\ndef _root_.homological_complex.tautological_endomorphism : Y ⟶ Y :=\n{ f := λ i, ⟨(Y.X i).e, rfl⟩, }\n\nlemma homology_functor_obj_e (i : M) :\n ((homology_functor (endomorphisms 𝓐) c i).obj Y).e =\n ((homology_functor (endomorphisms 𝓐) c i).map Y.tautological_endomorphism).f :=\nbegin\n have h₁ := ((endomorphisms.forget 𝓐).homology_functor_iso c i).hom.naturality\n Y.tautological_endomorphism,\n rw [← cancel_mono (((endomorphisms.forget 𝓐).homology_functor_iso c i).inv.app Y),\n assoc] at h₁,\n conv_lhs at h₁ { congr, skip, rw [← nat_trans.comp_app, iso.hom_inv_id, nat_trans.id_app], },\n rw comp_id at h₁,\n conv_lhs at h₁ { dsimp only [functor.comp, endomorphisms.forget], },\n rw h₁,\n clear h₁,\n have h₂ := nat_trans.congr_app (functor.naturality_homology_functor_iso\n (tautological_nat_trans 𝓐) c i) Y,\n dsimp [nat_trans.hcomp] at h₂,\n rw [comp_id, id_comp, ← cancel_mono\n (((endomorphisms.forget 𝓐).homology_functor_iso c i).inv.app Y), assoc] at h₂,\n conv_lhs at h₂ { congr, skip, rw [← nat_trans.comp_app, iso.hom_inv_id, nat_trans.id_app], },\n erw comp_id at h₂,\n exact h₂,\nend\n\nend endomorphisms\n\nend category_theory\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/for_mathlib/endomorphisms/homology.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5660185351961015, "lm_q2_score": 0.32766830738621877, "lm_q1q2_score": 0.18546633537693347}} {"text": "import Yatima.Typechecker.Equal\n\n/-!\n# Yatima typechecker: Infer\n\n## Basic Structure\n\nThis is the third of the three main files that constitute the Yatima typechecker: `Eval`, `Equal`,\nand `Infer`.\n\nTODO: Add a high level overview of Infer in the context of Eval-Equal-Infer.\n\n## Infer\n\nIn this module the two major functions `check` and `infer` are defined.\n* `check` : Checks that a Yatima expression has a prescribed type.\n* `infer` : Determines the type of a given Yatima expression.\n-/\n\nnamespace Yatima.Typechecker\n\nopen IR PP\nopen Lurk (F)\n\n/--\n Gives the correct type information for a lambda based on the information of the body.\n No lambdas can be a proposition, a struct or be elements of the unit type.\n-/\ndef lamInfo : TypeInfo → TypeInfo\n| .proof => .proof\n| _ => .none\n\ndef piInfo (dom img : TypeInfo) : TypecheckM TypeInfo := match dom, img with\n| .sort lvl, .sort lvl' => pure $ .sort $ .reduceIMax lvl lvl'\n| .sort _, _ => throw \"Image is not a type\"\n| _, .sort _ => throw \"Domain is not a type\"\n| _, _ => throw \"Neither image nor domain are types\"\n\ndef eqSortInfo (inferType expectType : SusValue) : TypecheckM Bool := do\n match inferType.info, expectType.info with\n | .sort lvl, .sort lvl' => pure $ lvl.equalUniv lvl'\n | .sort _, e => throw s!\"Expected type {← ppValue expectType.get} {repr e} is not actually a type\"\n | e, .sort _ => throw s!\"Inferred type {← ppValue inferType.get} {repr e} is not actually a type\"\n | e, e' => throw s!\"Neither expected {← ppValue expectType.get} {repr e} nor inferred types {← ppValue inferType.get} {repr e'} are actually types\"\n/--\n Gives the correct type information for a term based on its type.\n-/\ndef infoFromType (typ : SusValue) : TypecheckM TypeInfo :=\n match typ.info with\n | .sort .zero => pure .proof\n | _ =>\n match typ.get with\n | .app (.const f _) _ _ => do match derefConst f (← read).store with\n | .inductiveProj p =>\n let induct ← getIndFromProj p\n if induct.unit then pure .unit else pure .none\n | _ => pure .none\n | .sort lvl => pure (.sort lvl)\n | _ => pure .none\n\nmutual\n\n partial def getStructInfo (v : Value) :\n TypecheckM (F × TypedExpr × List Univ × List SusValue) := do\n match v with\n | .app (.const indF univs) params _ =>\n let .inductiveProj p := derefConst indF (← read).store \n | throw s!\"Expected a structure type, found {← ppValue v}\"\n let ind ← getIndFromProj p\n -- Sanity check\n unless ind.struct && ind.params == params.length do\n throw s!\"Expected a structure type, found {← ppValue v}\"\n withLimitedAxioms $ checkConst indF\n let ctorF := mkConstructorProjF p.block p.idx 0 (← read).quick\n match (← get).typedConsts.find? ctorF with\n | .some (.constructor type _ _) =>\n return (indF, type, univs, params)\n | _ => throw s!\"Implementation broken: ctorF {ctorF} is not a constructor\"\n | v => throw s!\"Expected a structure type, found {← ppValue v}\"\n\n /--\n Checks if `term : IR.Expr` has type `type : SusValue`. Returns the typed IR for `term`\n -/\n partial def check (term : IR.Expr) (type : SusValue) : TypecheckM TypedExpr := do\n let (term, inferType) ← infer term\n if !(← eqSortInfo inferType type) then\n throw s!\"Term: {← ppTypedExpr term}\\nInfo mismatch:\\n{repr inferType.info}\\n\\nnot equal to\\n{repr type.info}\\n\\nExpected type: {← ppValue type.get}\\nInferred type: {← ppValue inferType.get}\"\n if !(← equal (← read).lvl type inferType) then\n throw s!\"Expected type {← ppValue type.get}, found type {← ppValue inferType.get}\"\n pure term\n\n /-- Infers the type of `term : IR.Expr`. Returns the typed IR for `term` along with its inferred type -/\n partial def infer (term : IR.Expr) : TypecheckM (TypedExpr × SusValue) := do\n match term with\n | .var idx lvls =>\n let ctx ← read\n if idx < ctx.lvl then\n -- this is a bound free variable\n if !lvls.isEmpty then\n -- bound free variables should never have universe levels (sanity check)\n throw s!\"found var@{idx} with unexpected universe variables\"\n let types := ctx.types\n let some type := types.get? idx\n | throw s!\"var@{idx} out of environment range (size {types.length})\"\n let term := ⟨← infoFromType type, .var idx⟩\n pure (term, type)\n else\n -- this free variable came from `recrCtx`, and thus represents a mutual reference\n match ctx.mutTypes.find? (idx - ctx.lvl) with\n | some (constF, typeValFn) =>\n if some constF == ctx.recF? then\n throw s!\"Invalid recursion in {(← read).constNames.getF constF}\"\n let type := typeValFn lvls\n let term := ⟨← infoFromType type, .const constF lvls⟩\n pure (term, type)\n | none =>\n throw $ s!\"var@{idx} out of environment range (size {ctx.types.length})\"\n ++ \" and does not represent a mutual constant\"\n | .sort lvl =>\n let univs := (← read).env.univs\n let lvl := Univ.instBulkReduce univs lvl\n let lvl' := lvl.succ\n let typ := .mk (.sort lvl'.succ) ⟨ fun _ => .sort lvl' ⟩\n -- NOTE: we populate `SusTypeInfo.sort` here for consistency but technically it isn't necessary\n -- because `lvl'` can never become `Univ.zero`.\n let term := ⟨.sort lvl', .sort lvl⟩\n return (term, typ)\n | .app fnc' arg =>\n let (fnc, fncType) ← infer fnc'\n match fncType.get with\n | .pi dom img env =>\n let arg ← check arg dom\n let ctx ← read\n let stt ← get\n let typ := suspend img { ctx with env := env.extendWith $ suspend arg ctx stt} stt\n let term := ⟨← infoFromType typ, .app fnc arg⟩\n pure (term, typ)\n | val => throw s!\"Expected a pi type, found {← ppValue val}\"\n | .lam dom bod => do\n let (dom, _) ← isSort dom\n let ctx ← read\n let domVal := suspend dom ctx (← get)\n let var := mkSusVar (← infoFromType domVal) ctx.lvl\n let (bod, imgVal) ← withExtendedCtx var domVal $ infer bod\n let term := ⟨lamInfo bod.info, .lam dom bod⟩\n let typ := .mk (← piInfo domVal.info imgVal.info) $\n Value.pi domVal (← quoteTyped (ctx.lvl+1) ctx.env imgVal.getTyped) ctx.env\n pure (term, typ)\n | .pi dom img =>\n let (dom, domLvl) ← isSort dom\n let ctx ← read\n let domVal := suspend dom ctx (← get)\n let domSusVal := mkSusVar (← infoFromType domVal) ctx.lvl\n withExtendedCtx domSusVal domVal $ do\n let (img, imgLvl) ← isSort img\n let sortLvl := .reduceIMax domLvl imgLvl\n let typ := .mk (.sort sortLvl.succ) ⟨ fun _ => .sort $ sortLvl ⟩\n let term := ⟨← infoFromType typ, .pi dom img⟩\n return (term, typ)\n | .letE expType exp bod =>\n let (expType, _) ← isSort expType\n let ctx ← read\n let expTypeVal := suspend expType ctx (← get)\n let exp ← check exp expTypeVal\n let expVal := suspend exp ctx (← get)\n let (bod, typ) ← withExtendedCtx expVal expTypeVal $ infer bod\n let term := ⟨bod.info, .letE expType exp bod⟩\n return (term, typ)\n | .lit (.natVal v) =>\n let typ := .mk (.sort $ .succ .zero) (mkConst (← primF .nat) [])\n let term := ⟨.none, .lit (.natVal v)⟩\n pure $ (term, typ)\n | .lit (.strVal s) =>\n let typ := .mk (.sort $ .succ .zero) (mkConst (← primF .string) [])\n let term := ⟨.none, .lit (.strVal s)⟩\n pure $ (term, typ)\n | .const k constUnivs =>\n withLimitedAxioms $ checkConst k\n let ctx ← read\n let univs := ctx.env.univs\n let tconst ← derefTypedConst k\n let env := ⟨[], constUnivs.map (Univ.instBulkReduce univs)⟩\n let typ := suspend tconst.type { ctx with env := env } (← get)\n let term := ⟨← infoFromType typ, .const k constUnivs⟩\n pure (term, typ)\n | .proj idx expr =>\n let (expr, exprType) ← infer expr\n let (indF, ctorType, univs, params) ← getStructInfo exprType.get\n let mut ctorType ← applyType (← withEnv ⟨[], univs⟩ $ eval ctorType) params.reverse\n for i in [:idx] do\n match ctorType with\n | .pi dom img piEnv =>\n let info ← infoFromType dom\n let proj := suspend ⟨info, .proj indF i expr⟩ (← read) (← get)\n ctorType ← withNewExtendedEnv piEnv proj $ eval img\n | _ => pure ()\n match ctorType with\n | .pi dom _ _ =>\n match exprType.info, dom.info with\n | .sort .zero, .sort .zero =>\n let term := ⟨← infoFromType dom, .proj indF idx expr⟩\n pure (term, dom)\n | .sort .zero, _ =>\n throw s!\"Projection {← ppTypedExpr expr}.{idx} not allowed\"\n | _, _ =>\n let term := ⟨← infoFromType dom, .proj indF idx expr⟩\n pure (term, dom)\n | _ => throw \"Impossible case. Implementation broken.\"\n\n /--\n Checks if `expr : IR.Expr` is `Sort lvl` for some level `lvl`, and throws `TypecheckerError.notTyp`\n if it is not.\n -/\n partial def isSort (expr : IR.Expr) : TypecheckM (TypedExpr × Univ) := do\n let (expr, typ) ← infer expr\n match typ.get with\n | .sort u =>\n pure (expr, u)\n | val => throw s!\"Expected a sort type, found {← ppValue val}\"\n\n partial def checkIndBlock (indBlockF : F) : TypecheckM Unit := do\n let quick := (← read).quick\n let indBlock ← match derefConst indBlockF (← read).store with\n | .mutIndBlock blk => pure blk\n | _ => throw \"Invalid Const kind. Expected mutIndBlock\"\n\n -- Check all inductives\n let mut mutTypes := .empty\n for (indIdx, ind) in indBlock.enum do\n let f := mkInductiveProjF indBlockF indIdx quick\n let univs := List.range ind.lvls |>.map .var\n let (type, _) ← withEnv ⟨ [], univs ⟩ $ isSort ind.type\n let ctx ← read\n let stt ← get\n let typeSus := (suspend type {ctx with env := .mk ctx.env.exprs ·} stt)\n mutTypes := mutTypes.insert indIdx (f, typeSus)\n modify fun stt => { stt with typedConsts := stt.typedConsts.insert f (.inductive type ind.struct) }\n\n -- Check all constructors\n for (indIdx, ind) in indBlock.enum do\n let start := mutTypes.size\n for (cidx, ctor) in ind.ctors.enum do\n let f := mkConstructorProjF indBlockF indIdx cidx quick\n let univs := List.range ctor.lvls |>.map .var\n let (type, _) ← withEnv ⟨ [], univs ⟩ $ withMutTypes mutTypes $ isSort ctor.type\n let ctx ← read\n let stt ← get\n let typeSus := (suspend type {ctx with env := .mk ctx.env.exprs ·} stt)\n mutTypes := mutTypes.insert (start + cidx) (f, typeSus)\n modify fun stt => { stt with typedConsts := stt.typedConsts.insert f (.constructor type ctor.idx ctor.fields) }\n\n -- Check all recursor types\n for (indIdx, ind) in indBlock.enum do\n let start := mutTypes.size\n for (ridx, recr) in ind.recrs.enum do\n let f := mkRecursorProjF indBlockF indIdx ridx quick\n let univs := List.range recr.lvls |>.map .var\n let (type, _) ← withEnv ⟨ [], univs ⟩ $ withMutTypes mutTypes $ isSort recr.type\n let ctx ← read\n let stt ← get\n let typeSus := (suspend type {ctx with env := .mk ctx.env.exprs ·} stt)\n mutTypes := mutTypes.insert (start + ridx) (f, typeSus)\n\n -- Check all recursor rules\n for (indIdx, ind) in indBlock.enum do\n for (ridx, recr) in ind.recrs.enum do\n -- TODO: do not recompute `f`, `univs` and `type`\n let f := mkRecursorProjF indBlockF indIdx ridx quick\n let univs := List.range recr.lvls |>.map .var\n let (type, _) ← withEnv ⟨ [], univs ⟩ $ withMutTypes mutTypes $ isSort recr.type\n let indProj := ⟨indBlockF, indIdx⟩\n let rules ← recr.rules.mapM fun rule => do\n let (rhs, _) ← withEnv ⟨ [], univs ⟩ $ withMutTypes mutTypes $ infer rule.rhs\n pure (rule.fields, rhs)\n let recrConst := .recursor type recr.params recr.motives recr.minors recr.indices recr.isK indProj ⟨rules⟩\n modify fun stt => { stt with typedConsts := stt.typedConsts.insert f recrConst }\n\n return ()\n\n /-- Typechecks a `Yatima.Const`. The `TypecheckM Unit` computation finishes if the check finishes,\n otherwise a `TypecheckError` is thrown in some other function in the typechecker stack.\n\n Note that inductives, constructors, and recursors are constructed to typecheck, so this function\n only has to check the other `Const` constructors.\n -/\n partial def checkConst (f : F) : TypecheckM Unit := withResetCtx do\n match (← get).typedConsts.find? f with\n | some _ =>\n pure ()\n | none =>\n let c := derefConst f (← read).store\n if c.isMutType then return ()\n let univs := List.range (← c.levels) |>.map .var\n withEnv ⟨ [], univs ⟩ do\n let quick := (← read).quick\n let newConst ← match c with\n | .axiom ax =>\n if (← read).limitAxioms then\n if quick then\n if !(allowedAxiomQuick f) then\n throw s!\"Axiom {(← read).constNames.getF f} is not allowed\"\n else\n if !(allowedAxiom f) then\n throw s!\"Axiom {(← read).constNames.getF f} is not allowed\"\n let (type, _) ← isSort ax.type\n pure $ TypedConst.axiom type\n | .opaque data =>\n let (type, _) ← isSort data.type\n let typeSus := suspend type (← read) (← get)\n let value ← withRecF f $ check data.value typeSus\n pure $ TypedConst.opaque type value\n | .theorem data =>\n let (type, _) ← isSort data.type\n let typeSus := suspend type (← read) (← get)\n let value ← withRecF f $ check data.value typeSus\n pure $ TypedConst.theorem type value\n | .definition data =>\n let (type, _) ← isSort data.type\n let ctx ← read\n let typeSus := suspend type ctx (← get)\n let value ←\n if data.part then\n let mutTypes :=\n let typeSus := (suspend type {ctx with env := .mk ctx.env.exprs ·} (← get))\n (default : RecrCtx).insert 0 (f, typeSus)\n withMutTypes mutTypes $ withRecF f $ check data.value typeSus\n else withRecF f $ check data.value typeSus\n pure $ TypedConst.definition type value data.part\n | .definitionProj p@⟨defBlockF, _⟩ =>\n let data ← getDefFromProj p\n let (type, _) ← isSort data.type\n let ctx ← read\n let defBlock ← match derefConst defBlockF ctx.store with\n | .mutDefBlock blk => pure blk\n | _ => throw \"Invalid Const kind. Expected mutDefBlock\"\n let typeSus := suspend type ctx (← get)\n let value ←\n if data.part then\n -- check order should be the same as `recrCtx` in CA\n let mutTypes ← defBlock.enum.foldlM (init := default) fun acc (i, defn) => do\n let defProjF := mkDefinitionProjF defBlockF i quick\n -- TODO avoid repeated work here\n let (type, _) ← isSort defn.type\n let typeSus := (suspend type {ctx with env := .mk ctx.env.exprs ·} (← get))\n pure $ acc.insert i (defProjF, typeSus)\n withMutTypes mutTypes $ withRecF f $ check data.value typeSus\n else withRecF f $ check data.value typeSus\n pure $ TypedConst.definition type value data.part\n | .inductiveProj ⟨indBlockF, _⟩ =>\n checkIndBlock indBlockF\n return ()\n | .constructorProj ⟨indBlockF, _, _⟩ =>\n checkIndBlock indBlockF\n return ()\n | .recursorProj ⟨indBlockF, _, _⟩ =>\n checkIndBlock indBlockF\n return ()\n | .quotient data =>\n let (type, _) ← isSort (← c.type)\n pure $ .quotient type data.kind\n | _ => throw \"Impossible case. Cannot typecheck a mutual block.\"\n -- TODO is it okay to use the original hash for the `TypedConst`, or should we compute a new one?\n modify fun stt => { stt with typedConsts := stt.typedConsts.insert f newConst }\nend\n\nend Yatima.Typechecker\n", "meta": {"author": "lurk-lab", "repo": "yatima", "sha": "f33b0bf1052d95f9acbbe61681b1b58c0b97121e", "save_path": "github-repos/lean/lurk-lab-yatima", "path": "github-repos/lean/lurk-lab-yatima/yatima-f33b0bf1052d95f9acbbe61681b1b58c0b97121e/Yatima/Typechecker/Infer.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5078118642792044, "lm_q2_score": 0.36296921241058616, "lm_q1q2_score": 0.18432007243017431}} {"text": "import for_mathlib.category_theory.localization.shift\nimport for_mathlib.category_theory.triangulated.triangulated_functor\n\nopen category_theory category_theory.limits\n\nnamespace category_theory\n\nnamespace functor\n\nvariables {C H D : Type*} [category C] [category H] [category D]\n [has_shift C ℤ] [has_shift H ℤ] [has_shift D ℤ]\n [has_zero_object C] [has_zero_object H] [has_zero_object D]\n [preadditive C] [preadditive H] [preadditive D]\n [∀ (n : ℤ), (shift_functor C n).additive]\n [∀ (n : ℤ), (shift_functor H n).additive]\n [∀ (n : ℤ), (shift_functor D n).additive]\n [pretriangulated C] [pretriangulated H] [pretriangulated D]\n (L : C ⥤ H) [L.has_comm_shift ℤ]\n\nclass ess_surj_on_dist_triang :=\n(condition [] : ∀ (T : pretriangulated.triangle H) (hT : T ∈ dist_triang H),\n ∃ (T' : pretriangulated.triangle C) (hT' : T' ∈ dist_triang C),\n nonempty (L.map_triangle.obj T' ≅ T))\n\nvariables {L}\n\nlemma is_triangulated.of_ess_surj_on_dist_triang [L.ess_surj_on_dist_triang]\n {F : C ⥤ D} {G : H ⥤ D} (e : L ⋙ G ≅ F) [G.has_comm_shift ℤ] [F.has_comm_shift ℤ]\n [F.is_triangulated] [e.hom.respects_comm_shift ℤ] : G.is_triangulated :=\n{ map_distinguished' := λ T hT, begin\n obtain ⟨T', hT', ⟨e₁⟩⟩ := ess_surj_on_dist_triang.condition L T hT,\n exact pretriangulated.isomorphic_distinguished _ (F.map_distinguished _ hT') _\n (G.map_triangle.map_iso e₁.symm ≪≫ (map_triangle_comp L G).symm.app T' ≪≫\n (map_triangle_nat_iso e).app T'),\n end }\n\ninstance localization_lift_is_triangulated [L.ess_surj_on_dist_triang]\n (W : morphism_property C) [L.is_localization W]\n (F : C ⥤ D) (hF : W.is_inverted_by F) [F.has_comm_shift ℤ] [F.is_triangulated] :\n (localization.lift F hF L).is_triangulated :=\nis_triangulated.of_ess_surj_on_dist_triang (localization.fac F hF L)\n\nend functor\n\nend category_theory\n", "meta": {"author": "joelriou", "repo": "homotopical_algebra", "sha": "697f49d6744b09c5ef463cfd3e35932bdf2c78a3", "save_path": "github-repos/lean/joelriou-homotopical_algebra", "path": "github-repos/lean/joelriou-homotopical_algebra/homotopical_algebra-697f49d6744b09c5ef463cfd3e35932bdf2c78a3/src/for_mathlib/category_theory/localization/triangulated_functor.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5506073655352404, "lm_q2_score": 0.33458945452352534, "lm_q1q2_score": 0.1842274180910714}} {"text": "/-\nFile: signature_recover_public_key_recover_public_key_soundness.lean\n\nAutogenerated file.\n-/\nimport starkware.cairo.lean.semantics.soundness.hoare\nimport .signature_recover_public_key_code\nimport ..signature_recover_public_key_spec\nimport .signature_recover_public_key_get_generator_point_soundness\nimport .signature_recover_public_key_ec_negate_soundness\nimport .signature_recover_public_key_div_mod_n_soundness\nimport .signature_recover_public_key_get_point_from_x_soundness\nimport .signature_recover_public_key_ec_mul_soundness\nopen tactic\n\nopen starkware.cairo.common.cairo_secp.signature\nopen starkware.cairo.common.math\nopen starkware.cairo.common.cairo_secp.bigint\nopen starkware.cairo.common.cairo_secp.field\nopen starkware.cairo.common.cairo_secp.ec\n\nvariables {F : Type} [field F] [decidable_eq F] [prelude_hyps F]\nvariable mem : F → F\nvariable σ : register_state F\n\n/- starkware.cairo.common.cairo_secp.signature.recover_public_key autogenerated soundness theorem -/\n\ntheorem auto_sound_recover_public_key\n -- arguments\n (range_check_ptr : F) (msg_hash r s : BigInt3 F) (v : F)\n -- code is in memory at σ.pc\n (h_mem : mem_at mem code_recover_public_key σ.pc)\n -- all dependencies are in memory\n (h_mem_0 : mem_at mem code_assert_nn (σ.pc - 817))\n (h_mem_1 : mem_at mem code_assert_le (σ.pc - 813))\n (h_mem_2 : mem_at mem code_assert_nn_le (σ.pc - 808))\n (h_mem_3 : mem_at mem code_bigint_mul (σ.pc - 799))\n (h_mem_4 : mem_at mem code_nondet_bigint3 (σ.pc - 785))\n (h_mem_5 : mem_at mem code_unreduced_mul (σ.pc - 773))\n (h_mem_6 : mem_at mem code_unreduced_sqr (σ.pc - 753))\n (h_mem_7 : mem_at mem code_verify_zero (σ.pc - 737))\n (h_mem_8 : mem_at mem code_is_zero (σ.pc - 714))\n (h_mem_9 : mem_at mem code_reduce (σ.pc - 678))\n (h_mem_10 : mem_at mem code_validate_reduced_field_element (σ.pc - 665))\n (h_mem_11 : mem_at mem code_ec_negate (σ.pc - 625))\n (h_mem_12 : mem_at mem code_compute_doubling_slope (σ.pc - 609))\n (h_mem_13 : mem_at mem code_compute_slope (σ.pc - 565))\n (h_mem_14 : mem_at mem code_ec_double (σ.pc - 541))\n (h_mem_15 : mem_at mem code_fast_ec_add (σ.pc - 468))\n (h_mem_16 : mem_at mem code_ec_add (σ.pc - 381))\n (h_mem_17 : mem_at mem code_ec_mul_inner (σ.pc - 325))\n (h_mem_18 : mem_at mem code_ec_mul (σ.pc - 224))\n (h_mem_19 : mem_at mem code_get_generator_point (σ.pc - 144))\n (h_mem_20 : mem_at mem code_div_mod_n (σ.pc - 131))\n (h_mem_21 : mem_at mem code_get_point_from_x (σ.pc - 66))\n -- input arguments on the stack\n (hin_range_check_ptr : range_check_ptr = mem (σ.fp - 13))\n (hin_msg_hash : msg_hash = cast_BigInt3 mem (σ.fp - 12))\n (hin_r : r = cast_BigInt3 mem (σ.fp - 9))\n (hin_s : s = cast_BigInt3 mem (σ.fp - 6))\n (hin_v : v = mem (σ.fp - 3))\n -- conclusion\n : ensures_ret mem σ (λ κ τ,\n ∃ μ ≤ κ, rc_ensures mem (rc_bound F) μ (mem (σ.fp - 13)) (mem $ τ.ap - 7)\n (spec_recover_public_key mem κ range_check_ptr msg_hash r s v (mem (τ.ap - 7)) (cast_EcPoint mem (τ.ap - 6)))) :=\nbegin\n apply ensures_of_ensuresb, intro νbound,\n have h_mem_rec := h_mem,\n unpack_memory code_recover_public_key at h_mem with ⟨hpc0, hpc1, hpc2, hpc3, hpc4, hpc5, hpc6, hpc7, hpc8, hpc9, hpc10, hpc11, hpc12, hpc13, hpc14, hpc15, hpc16, hpc17, hpc18, hpc19, hpc20, hpc21, hpc22, hpc23, hpc24, hpc25, hpc26, hpc27, hpc28, hpc29, hpc30, hpc31, hpc32, hpc33, hpc34, hpc35, hpc36, hpc37, hpc38, hpc39, hpc40, hpc41, hpc42, hpc43, hpc44, hpc45, hpc46, hpc47, hpc48, hpc49, hpc50, hpc51, hpc52, hpc53, hpc54, hpc55, hpc56, hpc57, hpc58, hpc59, hpc60, hpc61, hpc62, hpc63, hpc64, hpc65, hpc66, hpc67, hpc68, hpc69, hpc70, hpc71, hpc72, hpc73, hpc74, hpc75, hpc76, hpc77, hpc78, hpc79, hpc80, hpc81, hpc82, hpc83, hpc84, hpc85⟩,\n -- ap += 15\n step_advance_ap hpc0 hpc1,\n -- function call\n step_assert_eq hpc2 with arg0,\n step_assert_eq hpc3 with arg1,\n step_assert_eq hpc4 with arg2,\n step_assert_eq hpc5 with arg3,\n step_assert_eq hpc6 with arg4,\n step_sub hpc7 (auto_sound_get_point_from_x mem _ range_check_ptr r v _ _ _ _ _ _ _ _ _ _ _ _ _),\n { rw hpc8, norm_num2, exact h_mem_21 },\n { rw hpc8, norm_num2, exact h_mem_0 },\n { rw hpc8, norm_num2, exact h_mem_1 },\n { rw hpc8, norm_num2, exact h_mem_2 },\n { rw hpc8, norm_num2, exact h_mem_4 },\n { rw hpc8, norm_num2, exact h_mem_5 },\n { rw hpc8, norm_num2, exact h_mem_6 },\n { rw hpc8, norm_num2, exact h_mem_7 },\n { rw hpc8, norm_num2, exact h_mem_9 },\n { rw hpc8, norm_num2, exact h_mem_10 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v] },\n try { dsimp [cast_BigInt3] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v] },\n try { dsimp [cast_BigInt3] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v] },\n try { dsimp [cast_BigInt3] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n intros κ_call9 ap9 h_call9,\n rcases h_call9 with ⟨rc_m9, rc_mle9, hl_range_check_ptr₁, h_call9⟩,\n generalize' hr_rev_range_check_ptr₁: mem (ap9 - 7) = range_check_ptr₁,\n have htv_range_check_ptr₁ := hr_rev_range_check_ptr₁.symm, clear hr_rev_range_check_ptr₁,\n generalize' hr_rev_r_point: cast_EcPoint mem (ap9 - 6) = r_point,\n simp only [hr_rev_r_point] at h_call9,\n have htv_r_point := hr_rev_r_point.symm, clear hr_rev_r_point,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4] at hl_range_check_ptr₁ },\n rw [←htv_range_check_ptr₁, ←hin_range_check_ptr] at hl_range_check_ptr₁,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4] at h_call9 },\n rw [hin_range_check_ptr] at h_call9,\n clear arg0 arg1 arg2 arg3 arg4,\n -- local var\n step_assert_eq hpc9 with temp0,\n step_assert_eq hpc10 with temp1,\n step_assert_eq hpc11 with temp2,\n step_assert_eq hpc12 with temp3,\n step_assert_eq hpc13 with temp4,\n step_assert_eq hpc14 with temp5,\n have lc_r_point: r_point = cast_EcPoint mem σ.fp, {\n try { ext } ; {\n try { simp only [htv_r_point] },\n try { dsimp [cast_EcPoint, cast_BigInt3] },\n try { arith_simps }, try { simp only [temp0, temp1, temp2, temp3, temp4, temp5] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n clear temp0 temp1 temp2 temp3 temp4 temp5,\n -- function call\n step_sub hpc15 (auto_sound_get_generator_point mem _ _),\n { rw hpc16, norm_num2, exact h_mem_19 },\n intros κ_call17 ap17 h_call17,\n rcases h_call17 with ⟨h_call17_ap_offset, h_call17⟩,\n generalize' hr_rev_generator_point: cast_EcPoint mem (ap17 - 6) = generator_point,\n simp only [hr_rev_generator_point] at h_call17,\n have htv_generator_point := hr_rev_generator_point.symm, clear hr_rev_generator_point,\n clear ,\n -- function call\n step_assert_eq hpc17 with arg0,\n step_assert_eq hpc18 with arg1,\n step_assert_eq hpc19 with arg2,\n step_assert_eq hpc20 with arg3,\n step_assert_eq hpc21 with arg4,\n step_assert_eq hpc22 with arg5,\n step_assert_eq hpc23 with arg6,\n step_sub hpc24 (auto_sound_div_mod_n mem _ range_check_ptr₁ msg_hash r _ _ _ _ _ _),\n { rw hpc25, norm_num2, exact h_mem_20 },\n { rw hpc25, norm_num2, exact h_mem_3 },\n { rw hpc25, norm_num2, exact h_mem_4 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call26 ap26 h_call26,\n rcases h_call26 with ⟨h_call26_ap_offset, h_call26⟩,\n rcases h_call26 with ⟨rc_m26, rc_mle26, hl_range_check_ptr₂, h_call26⟩,\n generalize' hr_rev_range_check_ptr₂: mem (ap26 - 4) = range_check_ptr₂,\n have htv_range_check_ptr₂ := hr_rev_range_check_ptr₂.symm, clear hr_rev_range_check_ptr₂,\n generalize' hr_rev_u1: cast_BigInt3 mem (ap26 - 3) = u1,\n simp only [hr_rev_u1] at h_call26,\n have htv_u1 := hr_rev_u1.symm, clear hr_rev_u1,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6] at hl_range_check_ptr₂ },\n try { rw [h_call17_ap_offset] at hl_range_check_ptr₂ }, try { arith_simps at hl_range_check_ptr₂ },\n rw [←htv_range_check_ptr₂, ←htv_range_check_ptr₁] at hl_range_check_ptr₂,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6] at h_call26 },\n try { rw [h_call17_ap_offset] at h_call26 }, try { arith_simps at h_call26 },\n rw [←htv_range_check_ptr₁, hl_range_check_ptr₁, hin_range_check_ptr] at h_call26,\n clear arg0 arg1 arg2 arg3 arg4 arg5 arg6,\n -- function call\n step_assert_eq hpc26 with arg0,\n step_assert_eq hpc27 with arg1,\n step_assert_eq hpc28 with arg2,\n step_assert_eq hpc29 with arg3,\n step_assert_eq hpc30 with arg4,\n step_assert_eq hpc31 with arg5,\n step_assert_eq hpc32 with arg6,\n step_sub hpc33 (auto_sound_div_mod_n mem _ range_check_ptr₂ s r _ _ _ _ _ _),\n { rw hpc34, norm_num2, exact h_mem_20 },\n { rw hpc34, norm_num2, exact h_mem_3 },\n { rw hpc34, norm_num2, exact h_mem_4 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call35 ap35 h_call35,\n rcases h_call35 with ⟨h_call35_ap_offset, h_call35⟩,\n rcases h_call35 with ⟨rc_m35, rc_mle35, hl_range_check_ptr₃, h_call35⟩,\n generalize' hr_rev_range_check_ptr₃: mem (ap35 - 4) = range_check_ptr₃,\n have htv_range_check_ptr₃ := hr_rev_range_check_ptr₃.symm, clear hr_rev_range_check_ptr₃,\n generalize' hr_rev_u2: cast_BigInt3 mem (ap35 - 3) = u2,\n simp only [hr_rev_u2] at h_call35,\n have htv_u2 := hr_rev_u2.symm, clear hr_rev_u2,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6] at hl_range_check_ptr₃ },\n rw [←htv_range_check_ptr₃, ←htv_range_check_ptr₂] at hl_range_check_ptr₃,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6] at h_call35 },\n rw [←htv_range_check_ptr₂, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr] at h_call35,\n clear arg0 arg1 arg2 arg3 arg4 arg5 arg6,\n -- local var\n step_assert_eq hpc35 with temp0,\n step_assert_eq hpc36 with temp1,\n step_assert_eq hpc37 with temp2,\n have lc_u2: u2 = cast_BigInt3 mem (σ.fp + 6), {\n try { ext } ; {\n try { simp only [htv_u2] },\n try { dsimp [cast_BigInt3] },\n try { arith_simps }, try { simp only [temp0, temp1, temp2] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n clear temp0 temp1 temp2,\n -- function call\n step_assert_eq hpc38 with arg0,\n step_assert_eq hpc39 with arg1,\n step_assert_eq hpc40 with arg2,\n step_assert_eq hpc41 with arg3,\n step_assert_eq hpc42 with arg4,\n step_assert_eq hpc43 with arg5,\n step_assert_eq hpc44 with arg6,\n step_assert_eq hpc45 with arg7,\n step_assert_eq hpc46 with arg8,\n step_assert_eq hpc47 with arg9,\n step_sub hpc48 (auto_sound_ec_mul mem _ range_check_ptr₃ generator_point u1 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _),\n { rw hpc49, norm_num2, exact h_mem_18 },\n { rw hpc49, norm_num2, exact h_mem_4 },\n { rw hpc49, norm_num2, exact h_mem_5 },\n { rw hpc49, norm_num2, exact h_mem_6 },\n { rw hpc49, norm_num2, exact h_mem_7 },\n { rw hpc49, norm_num2, exact h_mem_8 },\n { rw hpc49, norm_num2, exact h_mem_12 },\n { rw hpc49, norm_num2, exact h_mem_13 },\n { rw hpc49, norm_num2, exact h_mem_14 },\n { rw hpc49, norm_num2, exact h_mem_15 },\n { rw hpc49, norm_num2, exact h_mem_16 },\n { rw hpc49, norm_num2, exact h_mem_17 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call50 ap50 h_call50,\n rcases h_call50 with ⟨rc_m50, rc_mle50, hl_range_check_ptr₄, h_call50⟩,\n generalize' hr_rev_range_check_ptr₄: mem (ap50 - 7) = range_check_ptr₄,\n have htv_range_check_ptr₄ := hr_rev_range_check_ptr₄.symm, clear hr_rev_range_check_ptr₄,\n generalize' hr_rev_point1: cast_EcPoint mem (ap50 - 6) = point1,\n simp only [hr_rev_point1] at h_call50,\n have htv_point1 := hr_rev_point1.symm, clear hr_rev_point1,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9] at hl_range_check_ptr₄ },\n rw [←htv_range_check_ptr₄, ←htv_range_check_ptr₃] at hl_range_check_ptr₄,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9] at h_call50 },\n rw [←htv_range_check_ptr₃, hl_range_check_ptr₃, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr] at h_call50,\n clear arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9,\n -- function call\n step_sub hpc50 (auto_sound_ec_negate mem _ range_check_ptr₄ point1 _ _ _ _ _),\n { rw hpc51, norm_num2, exact h_mem_11 },\n { rw hpc51, norm_num2, exact h_mem_4 },\n { rw hpc51, norm_num2, exact h_mem_7 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call52 ap52 h_call52,\n rcases h_call52 with ⟨h_call52_ap_offset, h_call52⟩,\n rcases h_call52 with ⟨rc_m52, rc_mle52, hl_range_check_ptr₅, h_call52⟩,\n generalize' hr_rev_range_check_ptr₅: mem (ap52 - 7) = range_check_ptr₅,\n have htv_range_check_ptr₅ := hr_rev_range_check_ptr₅.symm, clear hr_rev_range_check_ptr₅,\n generalize' hr_rev_minus_point1: cast_EcPoint mem (ap52 - 6) = minus_point1,\n simp only [hr_rev_minus_point1] at h_call52,\n have htv_minus_point1 := hr_rev_minus_point1.symm, clear hr_rev_minus_point1,\n rw [←htv_range_check_ptr₅, ←htv_range_check_ptr₄] at hl_range_check_ptr₅,\n rw [←htv_range_check_ptr₄, hl_range_check_ptr₄, hl_range_check_ptr₃, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr] at h_call52,\n clear ,\n -- local var\n step_assert_eq hpc52 with temp0,\n step_assert_eq hpc53 with temp1,\n step_assert_eq hpc54 with temp2,\n step_assert_eq hpc55 with temp3,\n step_assert_eq hpc56 with temp4,\n step_assert_eq hpc57 with temp5,\n have lc_minus_point1: minus_point1 = cast_EcPoint mem (σ.fp + 9), {\n try { ext } ; {\n try { simp only [htv_minus_point1] },\n try { dsimp [cast_EcPoint, cast_BigInt3] },\n try { arith_simps }, try { simp only [temp0, temp1, temp2, temp3, temp4, temp5] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n clear temp0 temp1 temp2 temp3 temp4 temp5,\n -- function call\n step_assert_eq hpc58 with arg0,\n step_assert_eq hpc59 with arg1,\n step_assert_eq hpc60 with arg2,\n step_assert_eq hpc61 with arg3,\n step_assert_eq hpc62 with arg4,\n step_assert_eq hpc63 with arg5,\n step_assert_eq hpc64 with arg6,\n step_assert_eq hpc65 with arg7,\n step_assert_eq hpc66 with arg8,\n step_assert_eq hpc67 with arg9,\n step_sub hpc68 (auto_sound_ec_mul mem _ range_check_ptr₅ r_point u2 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _),\n { rw hpc69, norm_num2, exact h_mem_18 },\n { rw hpc69, norm_num2, exact h_mem_4 },\n { rw hpc69, norm_num2, exact h_mem_5 },\n { rw hpc69, norm_num2, exact h_mem_6 },\n { rw hpc69, norm_num2, exact h_mem_7 },\n { rw hpc69, norm_num2, exact h_mem_8 },\n { rw hpc69, norm_num2, exact h_mem_12 },\n { rw hpc69, norm_num2, exact h_mem_13 },\n { rw hpc69, norm_num2, exact h_mem_14 },\n { rw hpc69, norm_num2, exact h_mem_15 },\n { rw hpc69, norm_num2, exact h_mem_16 },\n { rw hpc69, norm_num2, exact h_mem_17 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call70 ap70 h_call70,\n rcases h_call70 with ⟨rc_m70, rc_mle70, hl_range_check_ptr₆, h_call70⟩,\n generalize' hr_rev_range_check_ptr₆: mem (ap70 - 7) = range_check_ptr₆,\n have htv_range_check_ptr₆ := hr_rev_range_check_ptr₆.symm, clear hr_rev_range_check_ptr₆,\n generalize' hr_rev_point2: cast_EcPoint mem (ap70 - 6) = point2,\n simp only [hr_rev_point2] at h_call70,\n have htv_point2 := hr_rev_point2.symm, clear hr_rev_point2,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9] at hl_range_check_ptr₆ },\n rw [←htv_range_check_ptr₆, ←htv_range_check_ptr₅] at hl_range_check_ptr₆,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9] at h_call70 },\n rw [←htv_range_check_ptr₅, hl_range_check_ptr₅, hl_range_check_ptr₄, hl_range_check_ptr₃, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr] at h_call70,\n clear arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9,\n -- function call\n step_assert_eq hpc70 with arg0,\n step_assert_eq hpc71 with arg1,\n step_assert_eq hpc72 with arg2,\n step_assert_eq hpc73 with arg3,\n step_assert_eq hpc74 with arg4,\n step_assert_eq hpc75 with arg5,\n step_assert_eq hpc76 with arg6,\n step_assert_eq hpc77 with arg7,\n step_assert_eq hpc78 with arg8,\n step_assert_eq hpc79 with arg9,\n step_assert_eq hpc80 with arg10,\n step_assert_eq hpc81 with arg11,\n step_assert_eq hpc82 with arg12,\n step_sub hpc83 (auto_sound_ec_add mem _ range_check_ptr₆ minus_point1 point2 _ _ _ _ _ _ _ _ _ _ _ _ _),\n { rw hpc84, norm_num2, exact h_mem_16 },\n { rw hpc84, norm_num2, exact h_mem_4 },\n { rw hpc84, norm_num2, exact h_mem_5 },\n { rw hpc84, norm_num2, exact h_mem_6 },\n { rw hpc84, norm_num2, exact h_mem_7 },\n { rw hpc84, norm_num2, exact h_mem_8 },\n { rw hpc84, norm_num2, exact h_mem_12 },\n { rw hpc84, norm_num2, exact h_mem_13 },\n { rw hpc84, norm_num2, exact h_mem_14 },\n { rw hpc84, norm_num2, exact h_mem_15 },\n { try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1, htv_range_check_ptr₆, htv_point2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } }, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1, htv_range_check_ptr₆, htv_point2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n { try { ext } ; {\n try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1, htv_range_check_ptr₆, htv_point2] },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { arith_simps }, try { simp only [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },}, },\n intros κ_call85 ap85 h_call85,\n rcases h_call85 with ⟨rc_m85, rc_mle85, hl_range_check_ptr₇, h_call85⟩,\n generalize' hr_rev_range_check_ptr₇: mem (ap85 - 7) = range_check_ptr₇,\n have htv_range_check_ptr₇ := hr_rev_range_check_ptr₇.symm, clear hr_rev_range_check_ptr₇,\n generalize' hr_rev_public_key_point: cast_EcPoint mem (ap85 - 6) = public_key_point,\n simp only [hr_rev_public_key_point] at h_call85,\n have htv_public_key_point := hr_rev_public_key_point.symm, clear hr_rev_public_key_point,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9 ,arg10 ,arg11 ,arg12] at hl_range_check_ptr₇ },\n rw [←htv_range_check_ptr₇, ←htv_range_check_ptr₆] at hl_range_check_ptr₇,\n try { simp only [arg0 ,arg1 ,arg2 ,arg3 ,arg4 ,arg5 ,arg6 ,arg7 ,arg8 ,arg9 ,arg10 ,arg11 ,arg12] at h_call85 },\n rw [←htv_range_check_ptr₆, hl_range_check_ptr₆, hl_range_check_ptr₅, hl_range_check_ptr₄, hl_range_check_ptr₃, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr] at h_call85,\n clear arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12,\n -- return\n step_ret hpc85,\n -- finish\n step_done, use_only [rfl, rfl],\n -- range check condition\n use_only (rc_m9+rc_m26+rc_m35+rc_m50+rc_m52+rc_m70+rc_m85+0+0), split,\n linarith [rc_mle9, rc_mle26, rc_mle35, rc_mle50, rc_mle52, rc_mle70, rc_mle85],\n split,\n { arith_simps,\n rw [←htv_range_check_ptr₇, hl_range_check_ptr₇, hl_range_check_ptr₆, hl_range_check_ptr₅, hl_range_check_ptr₄, hl_range_check_ptr₃, hl_range_check_ptr₂, hl_range_check_ptr₁, hin_range_check_ptr],\n try { arith_simps, refl <|> norm_cast }, try { refl } },\n intro rc_h_range_check_ptr, repeat { rw [add_assoc] at rc_h_range_check_ptr },\n have rc_h_range_check_ptr' := range_checked_add_right rc_h_range_check_ptr,\n -- Final Proof\n -- user-provided reduction\n suffices auto_spec: auto_spec_recover_public_key mem _ range_check_ptr msg_hash r s v _ _,\n { apply sound_recover_public_key, apply auto_spec },\n -- prove the auto generated assertion\n dsimp [auto_spec_recover_public_key],\n try { norm_num1 }, try { arith_simps },\n use_only [κ_call9],\n use_only [range_check_ptr₁],\n use_only [r_point],\n have rc_h_range_check_ptr₁ := range_checked_offset' rc_h_range_check_ptr,\n have rc_h_range_check_ptr₁' := range_checked_add_right rc_h_range_check_ptr₁, try { norm_cast at rc_h_range_check_ptr₁' },\n have spec9 := h_call9 rc_h_range_check_ptr',\n rw [←hin_range_check_ptr, ←htv_range_check_ptr₁] at spec9,\n try { dsimp at spec9, arith_simps at spec9 },\n use_only [spec9],\n use_only [κ_call17],\n use_only [generator_point],\n try { dsimp at h_call17, arith_simps at h_call17 },\n try { use_only [h_call17] },\n use_only [κ_call26],\n use_only [range_check_ptr₂],\n use_only [u1],\n have rc_h_range_check_ptr₂ := range_checked_offset' rc_h_range_check_ptr₁,\n have rc_h_range_check_ptr₂' := range_checked_add_right rc_h_range_check_ptr₂, try { norm_cast at rc_h_range_check_ptr₂' },\n have spec26 := h_call26 rc_h_range_check_ptr₁',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←htv_range_check_ptr₂] at spec26,\n try { dsimp at spec26, arith_simps at spec26 },\n use_only [spec26],\n use_only [κ_call35],\n use_only [range_check_ptr₃],\n use_only [u2],\n have rc_h_range_check_ptr₃ := range_checked_offset' rc_h_range_check_ptr₂,\n have rc_h_range_check_ptr₃' := range_checked_add_right rc_h_range_check_ptr₃, try { norm_cast at rc_h_range_check_ptr₃' },\n have spec35 := h_call35 rc_h_range_check_ptr₂',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←hl_range_check_ptr₂, ←htv_range_check_ptr₃] at spec35,\n try { dsimp at spec35, arith_simps at spec35 },\n use_only [spec35],\n use_only [κ_call50],\n use_only [range_check_ptr₄],\n use_only [point1],\n have rc_h_range_check_ptr₄ := range_checked_offset' rc_h_range_check_ptr₃,\n have rc_h_range_check_ptr₄' := range_checked_add_right rc_h_range_check_ptr₄, try { norm_cast at rc_h_range_check_ptr₄' },\n have spec50 := h_call50 rc_h_range_check_ptr₃',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←hl_range_check_ptr₂, ←hl_range_check_ptr₃, ←htv_range_check_ptr₄] at spec50,\n try { dsimp at spec50, arith_simps at spec50 },\n use_only [spec50],\n use_only [κ_call52],\n use_only [range_check_ptr₅],\n use_only [minus_point1],\n have rc_h_range_check_ptr₅ := range_checked_offset' rc_h_range_check_ptr₄,\n have rc_h_range_check_ptr₅' := range_checked_add_right rc_h_range_check_ptr₅, try { norm_cast at rc_h_range_check_ptr₅' },\n have spec52 := h_call52 rc_h_range_check_ptr₄',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←hl_range_check_ptr₂, ←hl_range_check_ptr₃, ←hl_range_check_ptr₄, ←htv_range_check_ptr₅] at spec52,\n try { dsimp at spec52, arith_simps at spec52 },\n use_only [spec52],\n use_only [κ_call70],\n use_only [range_check_ptr₆],\n use_only [point2],\n have rc_h_range_check_ptr₆ := range_checked_offset' rc_h_range_check_ptr₅,\n have rc_h_range_check_ptr₆' := range_checked_add_right rc_h_range_check_ptr₆, try { norm_cast at rc_h_range_check_ptr₆' },\n have spec70 := h_call70 rc_h_range_check_ptr₅',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←hl_range_check_ptr₂, ←hl_range_check_ptr₃, ←hl_range_check_ptr₄, ←hl_range_check_ptr₅, ←htv_range_check_ptr₆] at spec70,\n try { dsimp at spec70, arith_simps at spec70 },\n use_only [spec70],\n use_only [κ_call85],\n use_only [range_check_ptr₇],\n use_only [public_key_point],\n have rc_h_range_check_ptr₇ := range_checked_offset' rc_h_range_check_ptr₆,\n have rc_h_range_check_ptr₇' := range_checked_add_right rc_h_range_check_ptr₇, try { norm_cast at rc_h_range_check_ptr₇' },\n have spec85 := h_call85 rc_h_range_check_ptr₆',\n rw [←hin_range_check_ptr, ←hl_range_check_ptr₁, ←hl_range_check_ptr₂, ←hl_range_check_ptr₃, ←hl_range_check_ptr₄, ←hl_range_check_ptr₅, ←hl_range_check_ptr₆, ←htv_range_check_ptr₇] at spec85,\n try { dsimp at spec85, arith_simps at spec85 },\n use_only [spec85],\n try { split, linarith },\n try { ensures_simps; try { simp only [add_neg_eq_sub, hin_range_check_ptr, hin_msg_hash, hin_r, hin_s, hin_v, htv_range_check_ptr₁, htv_r_point, lc_r_point, htv_generator_point, htv_range_check_ptr₂, htv_u1, htv_range_check_ptr₃, htv_u2, lc_u2, htv_range_check_ptr₄, htv_point1, htv_range_check_ptr₅, htv_minus_point1, lc_minus_point1, htv_range_check_ptr₆, htv_point2, htv_range_check_ptr₇, htv_public_key_point] }, },\n try { dsimp [cast_BigInt3, cast_EcPoint] },\n try { simp only [h_call17_ap_offset, h_call26_ap_offset, h_call35_ap_offset, h_call52_ap_offset] },\n try { arith_simps; try { split }; triv <|> refl <|> simp <|> abel; try { norm_num } },\nend\n\n", "meta": {"author": "starkware-libs", "repo": "formal-proofs", "sha": "35613c65b6715601bbc0a550d52754f8e7d93e30", "save_path": "github-repos/lean/starkware-libs-formal-proofs", "path": "github-repos/lean/starkware-libs-formal-proofs/formal-proofs-35613c65b6715601bbc0a550d52754f8e7d93e30/src/starkware/cairo/common/cairo_secp/verification/verification/signature_recover_public_key_recover_public_key_soundness.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5389832206876841, "lm_q2_score": 0.341582499438317, "lm_q1q2_score": 0.18410723567781315}} {"text": "import phase2.approximation\n\nopen set\nopen_locale classical\n\nuniverse u\n\nnamespace con_nf\nvariables [params.{u}] (α : Λ) [position_data.{}] [phase_2_assumptions α] {β : type_index}\n (π : near_litter_approx) (A : extended_index β)\n\nnamespace near_litter_approx\n\ndef id_on_flexible : local_perm litter := {\n to_fun := id,\n inv_fun := id,\n domain := {L | flexible α L A} \\ π.litter_perm.domain,\n to_fun_domain' := λ L h, h,\n inv_fun_domain' := λ L h, h,\n left_inv' := λ L h, rfl,\n right_inv' := λ L h, rfl,\n}\n\nlemma id_on_flexible_domain :\n (id_on_flexible α π A).domain = {L | flexible α L A} \\ π.litter_perm.domain := rfl\n\nlemma id_on_flexible_domain_disjoint :\n disjoint π.litter_perm.domain (id_on_flexible α π A).domain :=\nby rw [disjoint_iff_inter_eq_empty, id_on_flexible_domain, inter_diff_self]\n\nnoncomputable def flexible_completion_litter_perm : local_perm litter :=\nlocal_perm.piecewise π.litter_perm (id_on_flexible α π A) (id_on_flexible_domain_disjoint α π A)\n\nlemma flexible_completion_litter_perm_domain' :\n (flexible_completion_litter_perm α π A).domain = π.litter_perm.domain ∪ {L | flexible α L A} :=\nby rw [flexible_completion_litter_perm, local_perm.piecewise_domain,\n id_on_flexible_domain, union_diff_self]\n\nnoncomputable def flexible_completion : near_litter_approx := {\n atom_perm := π.atom_perm,\n litter_perm := flexible_completion_litter_perm α π A,\n domain_small := π.domain_small,\n}\n\nlemma flexible_completion_litter_perm_domain :\n (flexible_completion α π A).litter_perm.domain = π.litter_perm.domain ∪ {L | flexible α L A} :=\nby rw [flexible_completion, flexible_completion_litter_perm_domain']\n\nlemma flexible_completion_litter_perm_domain_free (hπ : π.free α A) :\n (flexible_completion α π A).litter_perm.domain = {L | flexible α L A} :=\nbegin\n rw [flexible_completion_litter_perm_domain, union_eq_right_iff_subset],\n exact λ L hL, hπ L hL,\nend\n\nend near_litter_approx\n\nend con_nf\n", "meta": {"author": "leanprover-community", "repo": "con-nf", "sha": "f0b66bd73ca5d3bd8b744985242c4c0b5464913f", "save_path": "github-repos/lean/leanprover-community-con-nf", "path": "github-repos/lean/leanprover-community-con-nf/con-nf-f0b66bd73ca5d3bd8b744985242c4c0b5464913f/src/phase2/flexible_completion.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.538983220687684, "lm_q2_score": 0.341582499438317, "lm_q1q2_score": 0.1841072356778131}} {"text": "import for_mathlib.algebra.homology.derived_category\n\nnoncomputable theory\n\nopen category_theory category_theory.limits category_theory.category\nopen_locale zero_object\n\nvariables {C : Type*} [category C] [abelian C]\n\nnamespace category_theory\n\nlemma iso.is_iso_app_iff {C D : Type*} [category C] [category D] {X Y : C} (e : X ≅ Y)\n {F G : C ⥤ D} (φ : F ⟶ G) :\n is_iso (φ.app X) ↔ is_iso (φ.app Y) :=\nbegin\n suffices : ∀ ⦃X Y : C⦄ (e : X ≅ Y) (hX : is_iso (φ.app X)), is_iso (φ.app Y),\n { exact ⟨this e, this e.symm⟩, },\n intros X Y e,\n introI,\n refine ⟨⟨G.map e.inv ≫ inv (φ.app X) ≫ F.map e.hom,\n by simp only [← functor.map_comp, nat_iso.naturality_2'_assoc, iso.inv_hom_id, functor.map_id],\n by simp only [← functor.map_comp, assoc, nat_trans.naturality, is_iso.inv_hom_id_assoc,\n iso.inv_hom_id, functor.map_id]⟩⟩,\nend\n\nend category_theory\n\nnamespace category_theory.short_complex\n/-- should be moved... -/\n\nlemma exact.of_is_zero_X₂ {C : Type*} [category C] [has_zero_morphisms C]\n (S : short_complex C) (h : is_zero S.X₂) : S.exact :=\nbegin\n rw (homology_data.of_zeros S (h.eq_of_tgt _ _) (h.eq_of_src _ _)).exact_iff,\n exact h,\nend\n\nlemma quasi_iso.of_cokernel_cofork {C : Type*} [category C] [has_zero_morphisms C]\n {S₁ S₂ : short_complex C} (φ : S₁ ⟶ S₂) [S₁.has_homology] [S₂.has_homology]\n [mono φ.τ₃] (hf₂ : S₂.f = 0) (hτ₂ : is_colimit (cokernel_cofork.of_π φ.τ₂\n (show S₁.f ≫ φ.τ₂ = 0, by rw [← φ.comm₁₂, hf₂, comp_zero]))) :\n short_complex.quasi_iso φ :=\nbegin\n have w : S₁.f ≫ φ.τ₂ = 0 := by rw [← φ.comm₁₂, hf₂, comp_zero],\n let h₁ := S₁.some_right_homology_data,\n let e : S₂.X₂ ≅ h₁.Q := is_colimit.cocone_point_unique_up_to_iso hτ₂ h₁.hp,\n have he : φ.τ₂ ≫ e.hom = h₁.p :=\n is_colimit.comp_cocone_point_unique_up_to_iso_hom hτ₂ h₁.hp walking_parallel_pair.one,\n have wp : S₂.f ≫ e.hom = 0 := by simp only [hf₂, zero_comp],\n let hp : is_colimit (cokernel_cofork.of_π e.hom wp) :=\n cokernel_cofork.is_colimit.of_π _ _ (λ A x hx, e.inv ≫ x)\n (λ A x hx, e.hom_inv_id_assoc _) (λ A x hx b hb, by simp only [←hb, iso.inv_hom_id_assoc]),\n have comm : e.inv ≫ S₂.g = h₁.g' ≫ φ.τ₃,\n { rw [← cancel_epi h₁.p, h₁.p_g'_assoc, ← φ.comm₂₃, ← he, assoc, e.hom_inv_id_assoc], },\n have wι : h₁.ι ≫ e.inv ≫ S₂.g = 0 :=\n by simp only [comm, right_homology_data.ι_g'_assoc, zero_comp],\n have hι : is_limit (kernel_fork.of_ι h₁.ι wι) := kernel_fork.is_limit.of_ι _ _\n (λ A x hx, h₁.hι.lift (kernel_fork.of_ι _\n (show x ≫ h₁.g' = 0, by rw [← cancel_mono φ.τ₃, assoc, ← comm, hx, zero_comp])))\n (λ A x hx, fork.is_limit.lift_ι' _ _)\n (λ A x hx b hb, by { erw [← cancel_mono h₁.ι, hb, fork.is_limit.lift_ι'], refl, }),\n let h₂ : S₂.right_homology_data :=\n { Q := h₁.Q,\n H := h₁.H,\n p := e.hom,\n wp := wp,\n hp := hp,\n ι := h₁.ι,\n wι := wι,\n hι := hι, },\n let hφ : right_homology_map_data φ h₁ h₂ :=\n { φQ := 𝟙 _,\n φH := 𝟙 _,\n commp' := begin\n dsimp [h₂],\n simp only [comp_id, he],\n end, },\n rw hφ.quasi_iso_iff,\n dsimp,\n apply_instance,\nend\n\nend category_theory.short_complex\n\nopen category_theory category_theory.limits category_theory.category\n\nnamespace cochain_complex\n\nvariables (K L : cochain_complex C ℤ)\n\ndef trunc_ge.X (n : ℤ) (i : ℤ) : C :=\nif i < n\n then 0\n else if i = n\n then (homological_complex.short_complex_functor C (complex_shape.up ℤ) i ⋙\n short_complex.cycles_co_functor C).obj K\n else K.X i\n\nlemma trunc_ge.is_zero_X (n : ℤ) (i : ℤ) (hn : i < n) :\n is_zero (trunc_ge.X K n i) :=\nbegin\n dsimp [trunc_ge.X],\n simpa only [if_pos hn] using is_zero_zero C,\nend\n\ndef trunc_ge.X_iso_X (n : ℤ) (i : ℤ) (hn : n < i) :\n trunc_ge.X K n i ≅ K.X i :=\neq_to_iso begin\n dsimp [trunc_ge.X],\n rw [if_neg (show ¬i 0, from nat.pos_of_ne_zero\n (show @fintype.card m mfin ≠ 0, from (mt (fintype.card_eq_zero.1) (λ h7, h4.elim (λ h8, h8.symm ▸ h7)))),\n have h7 : ∀ (y : m), y ≠ x → ∃ (z : m), z ≠ y, from\n assume y : m, assume h8 : y ≠ x, have h9 : @fintype.card m mfin > 1, from (nat.succ_pos (nat.pos_of_ne_zero h6)).symm ▸ h4,\n have h10 : ∃ (z : m), z ≠ y, from (fintype.card_pos_iff.2 h9).elim (λ h11, h11.elim (λ h12, ⟨x, h8⟩) (λ h13, ⟨y, λ h14, h13 (h14.symm ▸ h8)⟩)),\n h10,\n have h8 : ∃ (y : m), y ≠ x ∧ (∀ (z : m), z ≠ x → ∃ (w : m), w ≠ z), from\n let y := classical.some (h7 x),\n have h9 : y ≠ x, from classical.some_spec (h7 x),\n have h10 : ∀ (z : m), z ≠ x → ∃ (w : m), w ≠ z, from\n assume z : m, assume h11 : z ≠ x, have h12 : ∃ (w : m), w ≠ z, from h7 z h11,\n h12,\n ⟨y, h9, h10⟩,\n let y := classical.some (h8 x),\n have h9 : y ≠ x ∧ (∀ (z : m), z ≠ x → ∃ (w : m), w ≠ z), from classical.some_spec (h8 x),\n have h10 : y ≠ x, from h9.left,\n ⟨y, h10⟩,\n have h6 : ∃ (f : m → m), ∀ (x : m), f x ≠ x ∧ ∀ (y : m), f y ≠ x → ∃ (z : m), f z ≠ y, from\n let f := λ (x : m), classical.some (h5 x),\n have h7 : ∀ (x : m), f x ≠ x ∧ ∀ (y : m), f y ≠ x → ∃ (z : m), f z ≠ y, from\n assume x : m,\n have h8 : f x ≠ x ∧ ∀ (y : m), f y ≠ x → ∃ (z : m), f z ≠ y, from classical.some_spec (h5 x),\n h8,\n ⟨f, h7⟩,\n have h7 : ∀ (x y : m), (f x = f y) → (x = y), from\n assume x y : m, assume h8 : f x = f y,\n have h9 : f x ≠ x, from h6.right x,\n have h10 : f y ≠ y, from h6.right y,\n have h11 : f x ≠ f y, from (h6.right x y h10).elim (λ h12, h12.symm ▸ h9),\n (h11 h8).elim,\n have h8 : ∃ (g : m → m), fintype.injective g ∧ fintype.card m ≤ n, from ⟨f, ⟨h7⟩, h4⟩,\n h8,\n have h4 : ∀ (n : ℕ) (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin → F.Model.satisfies (A n) m, from\n assume n : ℕ, assume (m : F.Model), assume mfin : fintype m, assume h5 : n ≤ @fintype.card m mfin,\n have h6 : ∃ (f : m → m), fintype.injective f ∧ fintype.card m ≤ n, from h3 n m mfin h5,\n have h7 : ∃ (f : m → m), fintype.injective f, from h6.elim (λ f, ⟨f, h6.right.left⟩),\n have h8 : ∃ (f : m → m), fintype.injective f, from h6.elim (λ f, ⟨f, h6.right.left⟩),\n have h9 : ∃ (f : m → m), fintype.injective f, from h6.elim (λ f, ⟨f, h6.right.left⟩),\n F.Model.satisfies.rec_on (A n)\n (by {\n assume (a : m → m → Prop),\n assume (h10 : ∀ (i j : m), i ≠ j → a i j),\n have h11 : ∃ (i : m), ∀ (j : m), i ≠ j → a i j, from\n have h12 : ∃ (i : m), ∃ (j : m), i ≠ j ∧ a i j, from\n have h13 : ∃ (i : m), ∃ (j : m), i ≠ j, from h7.elim (λ (f : m → m), \n have h14 : ∃ (i : m), ∃ (j : m), i ≠ j ∧ f i = f j, from\n let i := f (classical.choice (h7.elim (λ (f : m → m), fintype.exists_ne_of_injective f))),\n have h15 : ∃ (j : m), i ≠ j ∧ f i = f j, from \n let j := f (classical.choice (h7.elim (λ (f : m → m), fintype.exists_ne_of_injective f))),\n have h16 : f i ≠ f j, from classical.some_spec (h7.elim (λ (f : m → m), fintype.exists_ne_of_injective f)),\n have h17 : j ≠ i, from h7.elim (λ (f : m → m), fintype.injective.ne_of_injective_of_ne f h16),\n ⟨j, h17, h16⟩,\n \nend --Needs more than 2000 tokens!\n\n--OUTPUT 5\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n let A_n : L.Formula := ∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃' (∃\nend --Needs more than 2000 tokens!\n\n--OUTPUT 6\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n -- set A_n to be the formula:\n -- exists x_1 exists x_2 ... exists x_n : {x_1 != x_2 ∧ x_1 != x_3 ∧ ... ∧ x_{n-1} != x_n}\n let A_n : L.formula := L.formula.exists (L.formula.var 0) (L.formula.exists (L.formula.var 0) \n (L.formula.exists (L.formula.var 0) (L.formula.and (L.formula.ne (L.formula.var 0) (L.formula.var 1))\n (L.formula.and (L.formula.ne (L.formula.var 0) (L.formula.var 2)) (L.formula.and (L.formula.ne (L.formula.var 0)\n (L.formula.var 3)) (L.formula.ne (L.formula.var 1) (L.formula.var 2)))))) n,\n -- set Γ to be the union of F and A_i for i = 1 to infinity\n let Γ : L.Theory := L.Theory.union F (L.Theory.union (L.Theory.singleton (A_n 1)) (L.Theory.union \n (L.Theory.singleton (A_n 2)) (L.Theory.singleton (A_n 3)))),\n -- by the compactness theorem, Γ is satisfiable in some model M\n have h1 : ∃ (M : F.Model), Γ ⊆ M, from by {\n suffices : ∀ (Γ' : L.Theory), (∀ (Γ'' : L.Theory), Γ'' ⊆ Γ' → ∃ (M : F.Model), Γ'' ⊆ M) → ∃ (M : F.Model), Γ' ⊆ M, from by \n {apply this, assume Γ'' h2, have h3 : Γ'' ⊆ Γ, from by {apply set.subset.trans h2, apply set.subset.refl Γ}, \n have h4 : Γ'' ⊆ F, from by {apply set.subset.trans h3, apply set.subset_union_left}, \n have h5 : Γ'' ⊆ A_n 1 ∪ A_n 2 ∪ A_n 3, from by {apply set.subset.trans h3, apply set.subset_union_right, \n apply set.subset_union_left}, \n have h6 : ∀ (e : L.formula), e ∈ Γ'' → e ∈ F ∨ e ∈ A_n 1 ∨ e ∈ A_n 2 ∨ e ∈ A_n 3, from \n by {apply set.mem_or_mem_of_mem_union, apply set.mem_or_mem_of_mem_union}, \n have h7 : ∀ (e : L.formula), e ∈ Γ'' → e ∈ F, from by {assume e h8, apply h6 e h8, from or_iff_not_imp_right.mpr, \n assume h9, apply h6 e h8, from or_iff_not_imp_right.mpr, assume h10, apply h6 e h8, from or_iff_not_imp_right.mpr, \n assume h11, have h12 : e ∈ A_n 1 ∨ e ∈ A_n 2 ∨ e ∈ A_n 3, from or_iff_not_imp_left.mpr h9, apply or.elim h12, \n assume h13, apply h6 e h8, from or_iff_not_imp_right.mpr, assume h14, apply h6 e h8, from or_iff_not_imp_right.mpr, \n assume h15, have h16 : e ∈ A_n 2 ∨ e ∈ A_n 3, from or_iff_not_imp_left.mpr h10, apply or.elim h16, assume h17, \n apply h6 e h8, from or_iff_not_imp_right.mpr, assume h18, have h19 : e ∈ A_n 3, from or_iff_not_imp_left.mpr h11, \n apply h6 e h8, from or_iff_not_imp_right.mpr, }, \n have h8 : (∀ (Γ'' : L.Theory), Γ'' ⊆ F → ∃ (M : F.Model), Γ'' ⊆ M), from by {assume Γ'' h9, \n have h10 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h11 : ∀ (e : L.formula), e ∈ Γ'' → e ∈ F, from by {assume e h12, apply h7 e h12, from or_iff_not_imp_right.mpr, \n assume h13, apply h7 e h12, from or_iff_not_imp_right.mpr, assume h14, apply h7 e h12, from or_iff_not_imp_right.mpr, \n assume h15, have h16 : e ∈ A_n 1 ∨ e ∈ A_n 2 ∨ e ∈ A_n 3, from or_iff_not_imp_left.mpr h13, apply or.elim h16, \n assume h17, apply h7 e h12, from or_iff_not_imp_right.mpr, assume h18, apply h7 e h12, from or_iff_not_imp_right.mpr, \n assume h19, have h20 : e ∈ A_n 2 ∨ e ∈ A_n 3, from or_iff_not_imp_left.mpr h14, apply or.elim h20, assume h21, \n apply h7 e h12, from or_iff_not_imp_right.mpr, assume h22, have h23 : e ∈ A_n 3, from or_iff_not_imp_left.mpr h15, \n apply h7 e h12, from or_iff_not_imp_right.mpr, }, \n have h12 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h13 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h14 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h15 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h16 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h17 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h18 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h19 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h20 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h21 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h22 : ∃ (m : F.Model) [mfin : fintype m], Γ'' ⊆ m, from by {apply h, \n have h23 : ∃ (m : F.Model) [mfin : fintype m],\nend --Needs more than 2000 tokens!\n\n--OUTPUT 7\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n have h1 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), h k,\n have h2 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h1 k),\n have h3 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h2 k),\n have h4 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h3 k),\n have h5 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h4 k),\n have h6 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h5 k),\n have h7 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h6 k),\n have h8 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h7 k),\n have h9 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h8 k),\n have h10 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h9 k),\n have h11 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h10 k),\n have h12 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h11 k),\n have h13 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h12 k),\n have h14 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h13 k),\n have h15 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h14 k),\n have h16 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h15 k),\n have h17 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h16 k),\n have h18 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h17 k),\n have h19 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h18 k),\n have h20 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h19 k),\n have h21 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h20 k),\n have h22 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h21 k),\n have h23 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h22 k),\n have h24 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h23 k),\n have h25 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h24 k),\n have h26 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h25 k),\n have h27 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h26 k),\n have h28 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h27 k),\n have h29 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h28 k),\n have h30 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h29 k),\n have h31 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h30 k),\n have h32 : ∀ (k : ℕ), ∃ (M : F.Model) [mfin : fintype M], k ≤ @fintype.card M mfin, from assume (k : ℕ), classical.some (h31 k),\n have h33 : ∀ (k : ℕ), ∃ (M : F.Model), k ≤ @fintype.card M (fintype.mk M), from assume (k : ℕ), classical.some (h32 k),\n have h34 : ∀ (k : ℕ), ∃ (M : F.Model) [\nend --Needs more than 2000 tokens!\n\n--OUTPUT 8\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n let A : L.Theory, from by {\n have h1 : ∀ n : ℕ, ∃ (A : L.Theory) (hA : A.nonempty), n ≤ @fintype.card (A.Model) hA, from by {\n assume (n : ℕ),\n obtain ⟨m,mfin,h2⟩ : ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h n,\n use m,\n use mfin,\n exact h2,\n },\n have h2 : ∀ n : ℕ, ∃ (A : L.Theory) (hA : A.nonempty), n ≤ @fintype.card (A.Model) hA, from by {\n assume (n : ℕ),\n obtain ⟨m,mfin,h2⟩ : ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h n,\n use m,\n use mfin,\n exact h2,\n },\n use ⟨∀ n : ℕ, ∃ (A : L.Theory) (hA : A.nonempty), n ≤ @fintype.card (A.Model) hA⟩,\n use h2,\n },\n have h1 : ∀ n : ℕ, ∃ (A : L.Theory) (hA : A.nonempty), n ≤ @fintype.card (A.Model) hA, from A.right,\n have h2 : ∀ n : ℕ, ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB⟩ : ∃ (A : L.Theory) (hA : A.nonempty), n ≤ @fintype.card (A.Model) hA, from h1 n,\n use A, use hA, use hA,\n },\n have h3 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h4 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h5 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h6 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h7 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h8 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h9 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h10 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h11 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h12 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty), n ≤ @fintype.card (A.Model) hB, from h2 n,\n use A,\n use hC,\n },\n have h13 : ∀ n : ℕ, ∃ (A : L.Theory), n ≤ @fintype.card (A.Model) A.right, from by {\n assume n : ℕ,\n obtain ⟨A,hA,hB,hC⟩ : ∃ (A : L.Theory) (hA : A.nonempty) (hB : A.nonempty),\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB},\n have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left,\n have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left},\n show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3},\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by rw sq\n ... = x*(x+y) + y*(x+y) : by rw add_mul\n ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring}\n ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring}\nend\n\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by {\n assume a b : G, use a⁻¹ * b, obviously, },\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by {\n assume a b : G, use b * a⁻¹, obviously, }, \n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from \n assume a : G, h1 a a,\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from\n assume a : G, h2 a a,\n\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G,\n exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a)))\n (mul_one a),\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G,\n exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), \n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {\n use (1 : G),\n have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {\n assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a),\n have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G),\n exists_unique.unique (h3 a) (hident a).right\n (classical.some_spec (exists_unique.exists (h3 a))), \n have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G),\n exists_unique.unique (h4 a) (hident a).left\n (classical.some_spec (exists_unique.exists (h4 a))),\n show e = (1 : G), from eq.trans (h9 e) (h6 _), \n },\n exact ⟨by obviously, h7⟩,\n }\nend\n\n/--`theorem`\nOverflow theorem\nLet $F$ be a set of first-order formulas which has finite models of arbitrarily large size. Then $F$ has an infinite model.\n`proof`\nFor each $n$, let $\\mathbf A_n$ be the formula:\n\n$\\exists x_1 \\exists x_2 \\ldots \\exists x_n: \\{x_1 \\ne x_2 \\land x_1 \\ne x_3 \\land \\ldots \\land x_{n - 1} \\ne x_n\\}$\n\nThen $\\mathbf A_i$ is true in a structure $\\AA$ iff $\\AA$ has at least $n$ elements.\n\nTake:\n$$ \\Gamma := F \\cup \\bigcup_{i \\mathop = 1}^\\infty A_i $$\n\nSince $F$ has models of arbitrarily large size, every finite subset of $\\Gamma$ is satisfiable.\n\nFrom the Compactness Theorem, $\\Gamma$ is satisfiable in some model $\\mathbf{M}$.\n\nBut since $\\mathbf{M} \\models A_i$ for each $i$, $\\mathbf{M}$ must be infinite.\n\nSo $F$ has an infinite model.\n\nQED\n-/\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof-Natural-Language-Proof-Translation/Correct_statement-lean_proof-3_few_shot_temperature_0.6_max_tokens_2000_n_8/clean_files/Overflow theorem.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5660185498374789, "lm_q2_score": 0.32082130731838393, "lm_q1q2_score": 0.18159081112531583}} {"text": "import for_mathlib.short_complex_projections\nimport for_mathlib.homological_complex_abelian\nimport for_mathlib.homology_map_datum\nimport for_mathlib.abelian_sheaves.functor_category\nimport for_mathlib.short_complex_functor_category\n\nnoncomputable theory\n\nopen category_theory category_theory.category category_theory.limits\nopen_locale zero_object\n\nuniverses v\n\nnamespace short_complex\n\nsection construction\n\nvariables {C : Type*} [category C] [has_zero_morphisms C]\nvariables {J : Type*} [category J] (F : J ⥤ short_complex C)\n [has_colimit (F ⋙ π₁)] [has_colimit (F ⋙ π₂)] [has_colimit (F ⋙ π₃)]\n\n@[simps]\ndef colimit_cocone.cocone : cocone F :=\n{ X := mk (colim_map (𝟙 F ◫ φ₁₂)) (colim_map (𝟙 F ◫ φ₂₃)) begin\n ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app, π₂_map,\n ι_colim_map, φ₂₃_app, π₃_map, assoc, comp_zero],\n erw [composable_morphisms.id_τ₂, id_comp, (F.obj j).zero_assoc, zero_comp],\n end,\n ι :=\n { app := λ j, begin\n refine ⟨colimit.ι (F ⋙ π₁) j, colimit.ι (F ⋙ π₂) j, colimit.ι (F ⋙ π₃) j, _, _⟩,\n { dsimp,\n simp only [ι_colim_map, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app, π₂_map,\n assoc],\n erw [composable_morphisms.id_τ₂, id_comp],\n refl, },\n { dsimp,\n simp only [ι_colim_map, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app, π₃_map,\n assoc],\n erw [composable_morphisms.id_τ₃, id_comp],\n refl, },\n end,\n naturality' := λ i j f, begin\n ext,\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₁) f, },\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₂) f, },\n { dsimp, simpa only [comp_id] using colimit.w (F ⋙ π₃) f, },\n end }, }\n\ndef colimit_cocone : colimit_cocone F :=\n{ cocone := colimit_cocone.cocone F,\n is_colimit :=\n { desc := λ s, begin\n refine ⟨colimit.desc (F ⋙ π₁) (π₁.map_cocone s),\n colimit.desc (F ⋙ π₂) (π₂.map_cocone s),\n colimit.desc (F ⋙ π₃) (π₃.map_cocone s), _, _⟩,\n { ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app,\n π₂_map, colimit.ι_desc, functor.map_cocone_ι_app, assoc, colimit.ι_desc_assoc, π₁_map],\n erw [composable_morphisms.id_τ₂, id_comp],\n exact (s.ι.app j).comm₁₂, },\n { ext,\n dsimp,\n simp only [ι_colim_map_assoc, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app,\n π₃_map, colimit.ι_desc, functor.map_cocone_ι_app, assoc, colimit.ι_desc_assoc, π₂_map],\n erw [composable_morphisms.id_τ₃, id_comp],\n exact (s.ι.app j).comm₂₃, },\n end,\n fac' := λ s j, begin\n ext,\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₁_map], },\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₂_map], },\n { dsimp, simp only [colimit.ι_desc, functor.map_cocone_ι_app, π₃_map], },\n end,\n uniq' := λ s m hm, begin\n have h₁ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₁.map φ) (hm j),\n have h₂ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₂.map φ) (hm j),\n have h₃ := λ j, congr_arg (λ (φ : F.obj j ⟶ s.X), π₃.map φ) (hm j),\n dsimp at h₁ h₂ h₃,\n ext,\n { dsimp, simp only [h₁, colimit.ι_desc, functor.map_cocone_ι_app, π₁_map], },\n { dsimp, simp only [h₂, colimit.ι_desc, functor.map_cocone_ι_app, π₂_map], },\n { dsimp, simp only [h₃, colimit.ι_desc, functor.map_cocone_ι_app, π₃_map], },\n end, }, }\n\ninstance : has_colimit F := ⟨nonempty.intro (colimit_cocone F)⟩\n\ndef π₁_preserves_colimit : preserves_colimit F (π₁ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₁)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\ndef π₂_preserves_colimit : preserves_colimit F (π₂ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₂)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\ndef π₃_preserves_colimit : preserves_colimit F (π₃ : short_complex C ⥤ C) :=\npreserves_colimit_of_preserves_colimit_cocone (colimit_cocone F).is_colimit\n (is_colimit.of_iso_colimit (get_colimit_cocone (F ⋙ π₃)).is_colimit\n (cocones.ext (iso.refl _) (λ j, comp_id _)))\n\nend construction\n\nsection preserves\n\nvariables {C : Type*} [category C] [has_zero_morphisms C]\nvariables {J D : Type*} [category J] [category D]\n\ndef π₁₂₃_reflects_colimits {F : J ⥤ short_complex C} (s : cocone F)\n (h₁ : is_colimit (π₁.map_cocone s)) (h₂ : is_colimit (π₂.map_cocone s))\n (h₃ : is_colimit (π₃.map_cocone s)) :\n is_colimit s :=\nbegin\n haveI : has_colimit (F ⋙ π₁) := ⟨nonempty.intro ⟨_, h₁⟩⟩,\n haveI : has_colimit (F ⋙ π₂) := ⟨nonempty.intro ⟨_, h₂⟩⟩,\n haveI : has_colimit (F ⋙ π₃) := ⟨nonempty.intro ⟨_, h₃⟩⟩,\n refine is_colimit.of_iso_colimit (colimit_cocone F).is_colimit (cocones.ext _ _),\n { suffices : is_iso ((colimit_cocone F).is_colimit.desc s),\n { haveI := this,\n exact as_iso ((colimit_cocone F).is_colimit.desc s), },\n apply is_iso_of_is_isos,\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso (colimit.is_colimit _) h₁), },\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso (colimit.is_colimit _) h₂), },\n { exact is_iso.of_iso (is_colimit.cocone_point_unique_up_to_iso\n (colimit.is_colimit _) h₃), }, },\n { intro j,\n simp only [as_iso_hom, is_colimit.fac], },\nend\n\ndef π₁₂₃_reflect_preserves_colimits (G : J ⥤ D) (F : D ⥤ short_complex C)\n (h₁ : preserves_colimit G (F ⋙ π₁)) (h₂ : preserves_colimit G (F ⋙ π₂))\n (h₃ : preserves_colimit G (F ⋙ π₃)) : preserves_colimit G F :=\n⟨λ s hs, π₁₂₃_reflects_colimits _\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₁) _ hs _)\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₂) _ hs _)\n (@is_colimit_of_preserves _ _ _ _ _ _ G (F ⋙ π₃) _ hs _)⟩\n\nvariable (J)\n\ndef preserves_colimits_of_shape_of_projections (F : D ⥤ short_complex C)\n (h₁ : preserves_colimits_of_shape J (F ⋙ π₁))\n (h₂ : preserves_colimits_of_shape J (F ⋙ π₂))\n (h₃ : preserves_colimits_of_shape J (F ⋙ π₃)) :\n preserves_colimits_of_shape J F :=\n⟨by { intro G, apply π₁₂₃_reflect_preserves_colimits; apply_instance, }⟩\n\nend preserves\n\nsection functor_homological_complex\n\nvariables {C : Type*} [category C] [abelian C]\nvariables {M : Type*} {c : complex_shape M}\nvariables {J : Type*} [category J]\n\ninstance zero_preserves_colimits_of_shape {D : Type*} [category D]:\n preserves_colimits_of_shape J (0 : D ⥤ C) :=\n⟨λ F, ⟨λ s hs,\n{ desc := λ t, 0,\n fac' := λ t j, begin\n dsimp,\n apply is_zero.eq_of_src,\n apply is_zero.obj,\n apply is_zero_zero,\n end,\n uniq' := λ t m j, begin\n dsimp,\n apply is_zero.eq_of_src,\n apply is_zero.obj,\n apply is_zero_zero,\n end, }⟩⟩\n\nlemma functor_homological_complex_π₁_iso_zero (i : M) (h : c.prev i = none) :\n functor_homological_complex C c i ⋙ π₁ ≅ 0 :=\nbegin\n refine is_zero.iso _ (is_zero_zero _),\n rw is_zero.iff_id_eq_zero,\n ext X,\n apply is_zero.eq_of_src,\n exact is_zero.of_iso (is_zero_zero _) (X.X_prev_iso_zero h),\nend\n\nlemma functor_homological_complex_π₃_iso_zero (i : M) (h : c.next i = none) :\n functor_homological_complex C c i ⋙ π₃ ≅ 0 :=\nbegin\n refine is_zero.iso _ (is_zero_zero _),\n rw is_zero.iff_id_eq_zero,\n ext X,\n apply is_zero.eq_of_src,\n exact is_zero.of_iso (is_zero_zero _) (X.X_next_iso_zero h),\nend\n\nlemma functor_homological_complex_π₁_iso_eval (i j : M) (hij : c.rel j i) :\n functor_homological_complex C c i ⋙ π₁ ≅ homological_complex.eval C c j :=\nnat_iso.of_components (λ X, X.X_prev_iso hij)\n(λ X Y f, begin\n dsimp,\n simp only [homological_complex.hom.prev_eq f hij, assoc, iso.inv_hom_id, comp_id],\nend)\n\nlemma functor_homological_complex_π₃_iso_eval (i j : M) (hij : c.rel i j) :\n functor_homological_complex C c i ⋙ π₃ ≅ homological_complex.eval C c j :=\nnat_iso.of_components (λ X, X.X_next_iso hij)\n(λ X Y f, begin\n dsimp,\n simp only [homological_complex.hom.next_eq f hij, assoc, iso.inv_hom_id, comp_id],\nend)\n\ninstance (i : M) [has_colimits_of_shape J C] :\n preserves_colimits_of_shape J (short_complex.functor_homological_complex C c i) :=\nbegin\n apply preserves_colimits_of_shape_of_projections,\n { rcases h : c.prev i with _ | ⟨j, hij⟩,\n { exact preserves_colimits_of_shape_of_nat_iso\n (functor_homological_complex_π₁_iso_zero i h).symm, },\n { exact preserves_colimits_of_shape_of_nat_iso\n (functor_homological_complex_π₁_iso_eval i j hij).symm, }, },\n { exact (infer_instance : preserves_colimits_of_shape J (homological_complex.eval C c i)), },\n { rcases h : c.next i with _ | ⟨j, hij⟩,\n { exact preserves_colimits_of_shape_of_nat_iso\n (functor_homological_complex_π₃_iso_zero i h).symm, },\n { exact preserves_colimits_of_shape_of_nat_iso\n (functor_homological_complex_π₃_iso_eval i j hij).symm, }, },\nend\n\nend functor_homological_complex\n\nsection functor_homology\n\nvariables {C : Type*} [category.{v} C] [abelian C]\nvariables {M : Type*} {c : complex_shape M}\n {J : Type v} [small_category J] [is_filtered J]\n [has_colimits_of_shape J C]\n [preserves_finite_limits (limits.colim : (J ⥤ C) ⥤ C)]\n [preserves_finite_colimits (limits.colim : (J ⥤ C) ⥤ C)]\n\nnamespace homology_functor_preserves_colimit\n\nvariable (F : short_complex (J ⥤ C))\n\ndef iso_datum := homology_iso_datum.tautological' F.1.f F.1.g F.2\n\ninstance (j : J) : preserves_finite_limits ((evaluation J C).obj j) :=\n⟨by { intro F, introI, introI, apply_instance, }⟩\ninstance (j : J) : preserves_finite_colimits ((evaluation J C).obj j) :=\n⟨by { intro F, introI, introI, apply_instance, }⟩\ninstance (j : J) : functor.additive ((evaluation J C).obj j) := { }\ninstance colim_additive : functor.additive (colim : (J ⥤ C) ⥤ C) := { }\n\n@[simps]\ndef nat_trans_ι (j : J) : (evaluation J C).obj j ⟶ (colim : (J ⥤ C) ⥤ C) :=\n{ app := λ F, colimit.ι F j,\n naturality' := λ F₁ F₂ φ, by { dsimp, simp only [colimit.ι_map], }, }\n\ndef iso_datum₁ := (iso_datum F).apply_exact_functor (colim : (J ⥤ C) ⥤ C)\n\ndef F₀ := functor_category_equivalence.functor.obj F\n\ndef e₁ : (F₀ F) ⋙ homology_functor ≅ (iso_datum F).H :=\nnat_iso.of_components\n (λ j, ((iso_datum F).apply_exact_functor ((evaluation J C).obj j)).iso.symm)\n (λ i j f, begin\n simp only [functor.comp_map, iso.symm_hom],\n erw ((iso_datum F).map_nat_trans ((evaluation J C).map f)).homology_map_eq,\n simpa only [evaluation_map_app, assoc, iso.hom_inv_id, comp_id,\n iso.cancel_iso_inv_left],\n end)\n\ndef e₂ : colim.map_short_complex.obj F ≅ (colimit_cocone.cocone (F₀ F)).X :=\nbegin\n refine iso_mk _ _ _ _ _,\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { refine colim.map_iso (nat_iso.of_components (λ j, iso.refl _) (λ i j f, _)),\n dsimp, erw [id_comp, comp_id], refl, },\n { ext, dsimp, simp only [colimit.ι_map_assoc, colimit.ι_map, nat_iso.of_components.hom_app,\n iso.refl_hom, id_comp, ι_colim_map, nat_trans.hcomp_app, φ₁₂_app, nat_trans.id_app,\n π₂_map, assoc], erw id_comp, refl, },\n { ext, dsimp, simp only [colimit.ι_map_assoc, colimit.ι_map, nat_iso.of_components.hom_app,\n iso.refl_hom, id_comp, ι_colim_map, nat_trans.hcomp_app, φ₂₃_app, nat_trans.id_app,\n π₃_map, assoc], erw id_comp, refl, },\nend\n\ndef e₃ : colimit (F₀ F ⋙ homology_functor) ≅ (colim.map_short_complex.obj F).homology :=\ncolim.map_iso (e₁ F) ≪≫ (iso_datum₁ F).iso\n\ndef e₄ : colimit (F₀ F ⋙ homology_functor) ≅ (colimit_cocone.cocone (F₀ F)).X.homology :=\ne₃ F ≪≫ homology_functor.map_iso (e₂ F)\n\nlemma compatibility (j : J) : (colimit.cocone (F₀ F ⋙ homology_functor)).ι.app j ≫\n (e₃ F).hom = homology_functor.map ((nat_trans_ι j).map_short_complex.app F) :=\nbegin\n rw ((iso_datum F).map_nat_trans (nat_trans_ι j)).homology_map_eq,\n dsimp only [e₁, e₃, iso_datum₁, nat_iso.of_components],\n simpa only [colimit.cocone_ι, iso.trans_hom, functor.map_iso_hom, colimit.ι_map_assoc,\n iso.symm_hom, nat_trans_ι_app, iso.cancel_iso_hom_right_assoc, iso.cancel_iso_inv_left],\nend\n\nlemma preserves : preserves_colimit (F₀ F) short_complex.homology_functor :=\n⟨λ s hs, begin\n have e₁ : s ≅ colimit_cocone.cocone (F₀ F),\n { refine is_initial.unique_up_to_iso _ _,\n all_goals { equiv_rw (cocone.is_colimit_equiv_is_initial _).symm, },\n exacts [hs, (colimit_cocone (F₀ F)).is_colimit], },\n suffices : is_colimit (homology_functor.map_cocone (colimit_cocone.cocone (F₀ F))),\n { exact is_colimit.of_iso_colimit this\n ((cocones.functoriality _ homology_functor).map_iso e₁.symm), },\n clear e₁ hs s,\n refine is_colimit.of_iso_colimit (colimit.is_colimit (F₀ F ⋙ homology_functor))\n (cocones.ext (e₄ F) _),\n intro j,\n dsimp only [functor.map_cocone, cocones.functoriality, e₄, iso.trans, functor.map_iso],\n rw [← assoc, compatibility, ← homology_functor.map_comp],\n congr' 1,\n ext1,\n all_goals\n { dsimp [e₂], simp only [colimit.ι_map, nat_iso.of_components.hom_app,\n iso.refl_hom, id_comp], },\nend⟩\n\nend homology_functor_preserves_colimit\n\ninstance (F₀ : J ⥤ short_complex C) : preserves_colimit F₀ short_complex.homology_functor :=\nbegin\n let F := functor_category_equivalence.inverse.obj F₀,\n haveI : preserves_colimit (homology_functor_preserves_colimit.F₀ F) homology_functor\n := homology_functor_preserves_colimit.preserves F,\n have h : homology_functor_preserves_colimit.F₀ F ≅ F₀ :=\n functor_category_equivalence.counit_iso.app F₀,\n exact preserves_colimit_of_iso_diagram short_complex.homology_functor h,\nend\n\ninstance : preserves_colimits_of_shape J\n (short_complex.homology_functor : short_complex C ⥤ C) := ⟨λ F, infer_instance⟩\n\nend functor_homology\n\nend short_complex\n", "meta": {"author": "bentoner", "repo": "debug", "sha": "b8a75381caa90aa9942c20e08a44e45d0ae60d18", "save_path": "github-repos/lean/bentoner-debug", "path": "github-repos/lean/bentoner-debug/debug-b8a75381caa90aa9942c20e08a44e45d0ae60d18/src/for_mathlib/short_complex_colimits.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5039061705290805, "lm_q2_score": 0.35936415888237616, "lm_q1q2_score": 0.1810858171278222}} {"text": "import data.cpi.semantics.space tactic.abel\n\nnamespace cpi\n\nvariables {ℂ ℍ : Type} {ω : context} {M : affinity ℍ} {conc : ℍ ↪ ℂ} [half_ring ℂ] [decidable_eq ℂ]\n\n/-- The main body of the interaction tensor. Split out into a separate function\n to make unfolding possible. -/\nprivate def interaction_tensor_worker [cpi_equiv ℍ ω] (conc : ℍ ↪ ℂ)\n : ( prime_species' ℍ ω (context.extend M.arity context.nil)\n × (Σ (b y), concretion' ℍ ω (context.extend M.arity context.nil) b y)\n × name (context.extend M.arity context.nil))\n → ( prime_species' ℍ ω (context.extend M.arity context.nil)\n × (Σ (b y), concretion' ℍ ω (context.extend M.arity context.nil) b y)\n × name (context.extend M.arity context.nil))\n → process_space ℂ ℍ ω (context.extend M.arity context.nil)\n| ⟨ A, ⟨ bF, yF, F ⟩, x ⟩ ⟨ B, ⟨ bG, yG, G ⟩, y ⟩ :=\n option.cases_on (M.f x.to_idx y.to_idx) 0 (λ aff,\n if h : bF = yG ∧ yF = bG then begin\n rcases h with ⟨ ⟨ _ ⟩, ⟨ _ ⟩ ⟩,\n from conc aff • ( to_process_space (cpi_equiv.pseudo_apply F G)\n - fin_fn.single A 1 - fin_fn.single B (1 : ℂ)),\n end else 0)\n\n/-- Show that the interaction tensor worker is commutitive. -/\nprivate lemma interaction_tensor_worker.comm [cpi_equiv_prop ℍ ω]\n : ∀ (A B : prime_species' ℍ ω (context.extend M.arity context.nil)\n × (Σ (b y), concretion' ℍ ω (context.extend M.arity context.nil) b y)\n × name (context.extend M.arity context.nil))\n , interaction_tensor_worker conc A B = interaction_tensor_worker conc B A\n| ⟨ A, ⟨ bF, yF, F ⟩, a ⟩ ⟨ B, ⟨ bG, yG, G ⟩, b ⟩ := begin\n simp only [interaction_tensor_worker],\n rw M.symm a.to_idx b.to_idx,\n\n cases M.f (name.to_idx b) (name.to_idx a),\n case option.none { from rfl },\n case option.some {\n simp only [],\n by_cases this : (bF = yG ∧ yF = bG),\n {\n rcases this with ⟨ ⟨ _ ⟩, ⟨ _ ⟩ ⟩,\n let h : bF = bF ∧ yF = yF := ⟨ rfl, rfl ⟩,\n let g : yF = yF ∧ bF = bF := ⟨ rfl, rfl ⟩,\n simp only [dif_pos h, dif_pos g, cpi_equiv_prop.pseudo_apply_symm],\n simp only [sub_eq_add_neg, add_comm, add_left_comm],\n },\n {\n have h : ¬ (bG = yF ∧ yG = bF),\n { rintros ⟨ ⟨ _ ⟩, ⟨ _ ⟩ ⟩, from this ⟨ rfl, rfl ⟩ },\n simp only [dif_neg this, dif_neg h],\n }\n }\nend\n\n/-- Compute the interaction tensor between two elements in the interaction\n space. -/\ndef interaction_tensor [cpi_equiv ℍ ω] (conc: ℍ ↪ ℂ)\n : interaction_space ℂ ℍ ω (context.extend M.arity context.nil)\n → interaction_space ℂ ℍ ω (context.extend M.arity context.nil)\n → process_space ℂ ℍ ω (context.extend M.arity context.nil)\n| x y := fin_fn.bind₂ x y (interaction_tensor_worker conc)\n\ninfix ` ⊘ `:73 := interaction_tensor _\nnotation x ` ⊘[`:73 conc `] ` y:73 := interaction_tensor conc x y\n\n@[simp]\nlemma interaction_tensor.zero_left [cpi_equiv ℍ ω]\n : ∀ (A : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n , A ⊘[conc] 0 = 0\n| A := fin_fn.bind₂_zero_left A _\n\n@[simp]\nlemma interaction_tensor.zero_right [cpi_equiv ℍ ω]\n : ∀ (A : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n , 0 ⊘[conc] A = 0\n| A := fin_fn.bind₂_zero_right A _\n\nlemma interaction_tensor.comm [cpi_equiv_prop ℍ ω]\n (A B : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n : A ⊘[conc] B = B ⊘[conc] A := begin\n suffices : (λ x y, interaction_tensor_worker conc x y)\n = (λ x y, interaction_tensor_worker conc y x),\n { show fin_fn.bind₂ A B (interaction_tensor_worker conc)\n = fin_fn.bind₂ B A (λ x y, interaction_tensor_worker conc x y),\n -- Sneaky use of η-expanding one function to make sure the rewrite applies.\n rw this,\n from fin_fn.bind₂_swap A B (interaction_tensor_worker conc) },\n\n from funext (λ x, funext (interaction_tensor_worker.comm x)),\nend\n\n@[simp]\nlemma interaction_tensor.left_distrib [cpi_equiv ℍ ω]\n (A B C : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n : (A + B) ⊘[conc] C = A ⊘[conc] C + B ⊘[conc] C\n := by simp only [interaction_tensor, fin_fn.bind₂, fin_fn.bind_distrib]\n\n@[simp]\nlemma interaction_tensor.right_distrib [cpi_equiv_prop ℍ ω]\n (A B C : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n : A ⊘[conc] (B + C) = A ⊘[conc] B + A ⊘[conc] C\n := calc A ⊘ (B + C)\n = (B + C) ⊘ A : interaction_tensor.comm A _\n ... = B ⊘ A + C ⊘ A : interaction_tensor.left_distrib B C A\n ... = A ⊘ B + A ⊘ C : by rw [interaction_tensor.comm B, interaction_tensor.comm C]\n\ninstance interaction_tensor.monoid_hom_left [cpi_equiv_prop ℍ ω]\n (ξ : interaction_space ℂ ℍ ω (context.extend M.arity context.nil))\n : is_add_monoid_hom (interaction_tensor conc ξ)\n := { map_add := interaction_tensor.right_distrib ξ,\n map_zero := interaction_tensor.zero_left ξ }\n\nend cpi\n\n#lint-\n", "meta": {"author": "continuouspi", "repo": "lean-cpi", "sha": "443bf2cb236feadc45a01387099c236ab2b78237", "save_path": "github-repos/lean/continuouspi-lean-cpi", "path": "github-repos/lean/continuouspi-lean-cpi/lean-cpi-443bf2cb236feadc45a01387099c236ab2b78237/src/data/cpi/semantics/interaction_tensor.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5506073802837477, "lm_q2_score": 0.32766829425520916, "lm_q1q2_score": 0.1804165811019049}} {"text": "/-\nCopyright (c) 2022 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n\nimport category_theory.idempotents.karoubi\nimport algebra.homology.homological_complex\n\nnoncomputable theory\n\nopen category_theory.category\nopen category_theory.preadditive\nopen category_theory.limits\nopen_locale big_operators\n\nnamespace category_theory\n\nvariables {C : Type*} [category C]\n\nnamespace idempotents\n\nnamespace karoubi\n\n--@[simp]\n--lemma zsmul_hom [preadditive C] {P Q : karoubi C} (f : P ⟶ Q) (n : ℤ) :\n-- (n • f).f = n • f.f :=\n--map_zsmul (inclusion_hom P Q) n f\n\nend karoubi\n\nvariable (C)\n\n@[simps functor inverse]\ndef to_karoubi_equivalence [is_idempotent_complete C] : C ≌ karoubi C :=\nbegin\n haveI := to_karoubi_is_equivalence C,\n exact functor.as_equivalence (to_karoubi C),\nend\n\n\n--instance [preadditive C] [is_idempotent_complete C] :\n-- is_idempotent_complete (chain_complex C ℕ) := sorry\n\nend idempotents\n\nend category_theory\n", "meta": {"author": "joelriou", "repo": "dold-kan", "sha": "a083fe264275774ac49ac520caf25f2ee29debb1", "save_path": "github-repos/lean/joelriou-dold-kan", "path": "github-repos/lean/joelriou-dold-kan/dold-kan-a083fe264275774ac49ac520caf25f2ee29debb1/src/for_mathlib/idempotents/karoubi_misc.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5851011542032312, "lm_q2_score": 0.30404168757891037, "lm_q1q2_score": 0.17789514232831866}} {"text": "def myAdd [Add α] (x y : α) := x + y\n\nclass L1 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n\ninstance L1.toAdd [inst : L1 α] : Add α := { inst with }\n\nclass L2 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n\ninstance L2.toL1 [inst : L2 α] : L1 α := { inst with }\n\nclass L3 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n\ninstance L3.toL2 [inst : L3 α] : L2 α := { inst with }\n\nclass L4 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n\ninstance L4.toL3 [inst : L4 α] : L3 α := { inst with }\n\nclass L5 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n\ninstance L5.toL4 [inst : L5 α] : L4 α := { inst with }\n\nclass L6 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n\ninstance L6.toL5 [inst : L6 α] : L5 α := { inst with }\n\nclass L7 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n\ninstance L7.toL6 [inst : L7 α] : L6 α := { inst with }\n\nclass L8 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n\ninstance L8.toL7 [inst : L8 α] : L7 α := { inst with }\n\nclass L9 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\ninstance L9.toL8 [inst : L9 α] : L8 α := { inst with }\n\nclass T1 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\n-- slow\ninstance T1_toL9 {α : Type u} [inst : T1 α] : L9 α := { inst with }\n\nclass T2 (α : Type u) where\n add : α → α → α\n addc1 : ∀ (x y : α), @myAdd α ⟨add⟩ x y = @myAdd α ⟨add⟩ y x\n addc2 : ∀ (x y : α), @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) x y = @myAdd α (@L1.toAdd _ ⟨add, addc1⟩) y x\n addc3 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ ⟨add, addc1, addc2⟩)) y x\n addc4 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ ⟨add, addc1, addc2, addc3⟩))) y x\n addc5 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ ⟨add, addc1, addc2, addc3, addc4⟩)))) y x\n addc6 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ ⟨add, addc1, addc2, addc3, addc4, addc5⟩))))) y x\n addc7 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6⟩)))))) y x\n addc8 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7⟩))))))) y x\n addc9 : ∀ (x y : α), @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) x y = @myAdd α (@L1.toAdd _ (@L2.toL1 _ (@L3.toL2 _ (@L4.toL3 _ (@L5.toL4 _ (@L6.toL5 _ (@L7.toL6 _ (@L8.toL7 _ ⟨add, addc1, addc2, addc3, addc4, addc5, addc6, addc7, addc8⟩)))))))) y x\n\n-- slow\ninstance T2_toL9 {α : Type u} [inst : T2 α] : L9 α := { inst with }\n\n\nset_option pp.all true in\n-- #print T2.toL9\n\naxiom C : Type\naxiom C.add : C → C → C\n\nnoncomputable instance C.T1 : T1 C := ⟨add, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry⟩\nnoncomputable instance C.T2 : T2 C := ⟨add, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry⟩\n\n-- slow\ntheorem ex : @T1_toL9 _ C.T1 = @T2_toL9 _ C.T2 := rfl\n", "meta": {"author": "leanprover", "repo": "lean4", "sha": "742d053a97bdd109a41a921facd1cd6a55e89bc7", "save_path": "github-repos/lean/leanprover-lean4", "path": "github-repos/lean/leanprover-lean4/lean4-742d053a97bdd109a41a921facd1cd6a55e89bc7/tests/lean/run/tryHeuristicPerfIssue2.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5698526514141571, "lm_q2_score": 0.3073580105206753, "lm_q1q2_score": 0.1751487772285872}} {"text": "universe u\nvariables {α : Type u} [decidable_linear_order α]\n\nlemma right_le {a b c : α} (h :(max a b) ≤ c) : b ≤ c := \nhave h0 : ¬b > c, from \n (assume h1: b > c,\n have h2: (max a b ) ≥ b, from (le_max_right a b),\n have h3: c < b, from h1,\n have h4: b ≤ (max a b), from h2,\n have h5: c < (max a b), from lt_of_lt_of_le h3 h4,\n have h6: (max a b) > c, from h5,\n have h7: ¬((max a b) ≤ c), from not_le_of_gt h6,\n show false, from (h7 h)),\nshow b≤c, from le_of_not_gt h0\n\nlemma left_le {a b c : α} (h :(max a b) ≤ c) : a ≤ c := \nhave h0: (max b a) ≤ c, from (max_comm a b) ▸ h,\nshow a ≤ c, from right_le h0\n\nnamespace nat\ndef test (k : set nat) (a: ℕ) : ℕ := a\ndef kk : ℕ := 9\n#reduce kk.test {} \n\n\nend nat", "meta": {"author": "johoelzl", "repo": "mason-stother", "sha": "573ecfaada288176462c03c87b80ad05bdab4644", "save_path": "github-repos/lean/johoelzl-mason-stother", "path": "github-repos/lean/johoelzl-mason-stother/mason-stother-573ecfaada288176462c03c87b80ad05bdab4644/auxiliary.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.6688802471698041, "lm_q2_score": 0.2598256379609837, "lm_q1q2_score": 0.1737922369403948}} {"text": "import for_mathlib.algebra.homology.derivability_structure_injective\nimport for_mathlib.category_theory.abelian.extensions_derived_category\n\nnoncomputable theory\n\nopen category_theory category_theory.category category_theory.limits\n\nnamespace category_theory\n\nnamespace short_complex\n\nvariables {C : Type*} [category C] [preadditive C] [balanced C]\n\nlemma five_lemma.is_iso_τ₁ {S₁ S₂ : short_complex C} (f : S₁ ⟶ S₂)\n (ex₁ : S₁.exact) [is_iso f.τ₂] [mono f.τ₃] [mono S₁.f] [mono S₂.f] :\n is_iso f.τ₁ :=\nbegin\n refine ⟨⟨short_complex.exact.lift ex₁ (S₂.f ≫ inv f.τ₂) _, _, _⟩⟩,\n { rw [← cancel_mono f.τ₃, assoc, assoc, ← f.comm₂₃, is_iso.inv_hom_id_assoc,\n S₂.zero, zero_comp], },\n { rw [← cancel_mono (S₁.f), assoc, short_complex.exact.lift_f, f.comm₁₂_assoc,\n is_iso.hom_inv_id, comp_id, id_comp], },\n { rw [← cancel_mono (S₂.f), assoc, f.comm₁₂, short_complex.exact.lift_f_assoc, assoc,\n is_iso.inv_hom_id, comp_id, id_comp], },\nend\n\nend short_complex\n\nvariables {C D : Type*} [category C] [category D] [abelian C] [abelian D]\n (F : C ⥤ D) [functor.additive F]\n\nnamespace injective_embedding\n\nvariables [enough_injectives C] (X : C)\n\ndef short_complex : short_complex C :=\nshort_complex.mk (injective.ι X) (cokernel.π (injective.ι X)) (by simp)\n\ninstance injective_short_complex_X₂ : injective (short_complex X).X₂ :=\nby { dsimp [short_complex], apply_instance, }\n\ninstance : mono (short_complex X).f :=\nby { dsimp [short_complex], apply_instance, }\n\ninstance : epi (short_complex X).g :=\nby { dsimp [short_complex], apply_instance, }\n\nlemma short_exact : (short_complex X).short_exact :=\nshort_complex.short_exact.of_g_is_cokernel (cokernel_is_cokernel _)\n\nend injective_embedding\n\nnamespace functor\n\nsection\n\nvariables {ι : Type*} (c : complex_shape ι) (n : ι)\n\ndef single_comp_map_homological_complex_app [decidable_eq ι] (X : C) :\n (F.map_homological_complex c).obj ((homological_complex.single C c n).obj X) ≅\n (homological_complex.single D c n).obj (F.obj X) :=\nhomological_complex.hom.iso_of_components\n(λ i, begin\n by_cases i = n,\n { exact eq_to_iso (by { dsimp, simp only [if_pos h], }), },\n { dsimp,\n simp only [if_neg h],\n exact F.map_zero_object, },\nend)\n(λ i j hij, begin\n dsimp,\n simp only [F.map_zero, zero_comp, comp_zero],\nend)\n\ndef single_comp_map_homological_complex [decidable_eq ι] :\n homological_complex.single C c n ⋙ F.map_homological_complex c ≅\n F ⋙ homological_complex.single D c n :=\nnat_iso.of_components (F.single_comp_map_homological_complex_app c n)\n(λ X Y f, begin\n ext i,\n dsimp [single_comp_map_homological_complex_app],\n by_cases i = n,\n { simp only [dif_pos h, map_comp, eq_to_iso.hom, assoc, eq_to_hom_trans_assoc,\n eq_to_hom_map, eq_to_hom_trans], },\n { simp only [dif_neg h, F.map_zero, zero_comp, comp_zero], },\nend)\n\nvariable {c}\n\nlemma _root_.homotopy_category_quotient_map_functor_map_homological_complex\n {K L : homological_complex C c} (f : K ⟶ L) (F : C ⥤ D) [F.additive] :\n (homotopy_category.quotient D c).map ((F.map_homological_complex c).map f) =\n (map_homotopy_category c F).map ((homotopy_category.quotient C c).map f) :=\nbegin\n apply homotopy_category.eq_of_homotopy,\n apply F.map_homotopy,\n apply homotopy_category.homotopy_of_eq,\n simp only [homotopy_category.quotient_map_out],\nend\n\nend\n\ninstance map_is_strictly_ge (X : cochain_complex C ℤ) (n : ℤ) [X.is_strictly_ge n] :\n cochain_complex.is_strictly_ge ((F.map_homological_complex _ ).obj X) n :=\n⟨λ i hi, is_zero.of_iso (is_zero_zero D)\n (F.map_iso (cochain_complex.is_strictly_ge.is_zero X n i hi).iso_zero ≪≫ F.map_zero_object)⟩\n\nlemma _root_.cochain_complex.is_plus.map {X : cochain_complex C ℤ} (h : X.is_plus)\n (F : C ⥤ D) [functor.additive F] :\n cochain_complex.is_plus ((map_homological_complex F (complex_shape.up ℤ)).obj X) :=\nbegin\n obtain ⟨n, hn⟩ := h,\n haveI := hn,\n exact ⟨n, infer_instance⟩,\nend\n\ndef map_homotopy_category_factors :\n homotopy_category.quotient _ _ ⋙ map_homotopy_category (complex_shape.up ℤ) F ≅\n F.map_homological_complex _ ⋙ homotopy_category.quotient _ _ :=\nnat_iso.of_components (λ K, iso.refl _)\n(λ K L f, begin\n dsimp only [iso.refl, functor.comp_map],\n rw [id_comp, comp_id],\n apply homotopy_category.eq_of_homotopy,\n apply F.map_homotopy,\n apply homotopy_category.homotopy_of_eq,\n simp only [homotopy_category.quotient_map_out],\nend)\n\ninstance map_homotopy_category_has_comm_shift :\n (functor.map_homotopy_category (complex_shape.up ℤ) F).has_comm_shift ℤ :=\n@quotient.has_comm_shift _ _ _ _ _ _ _ F.map_homotopy_category_factors ℤ\n _ _ _ (infer_instance : has_shift (homotopy_category C (complex_shape.up ℤ)) ℤ)\n (infer_instance : (homotopy_category.quotient _ _).has_comm_shift ℤ) _\n\ninstance : nat_trans.respects_comm_shift F.map_homotopy_category_factors.hom ℤ :=\n⟨λ n, begin\n ext K,\n dsimp only [map_homotopy_category_factors, nat_iso.of_components, whisker_right,\n nat_trans.comp_app, iso.refl, whisker_left],\n erw [functor.map_id, comp_id, id_comp],\n apply homotopy_category.eq_of_homotopy,\n erw [id_comp, id_comp, id_comp, id_comp, id_comp, id_comp, id_comp, id_comp,\n comp_id, comp_id, comp_id],\n apply homotopy_category.homotopy_of_eq,\n simp only [functor.map_comp, homotopy_category.quotient_map_out,\n homotopy_category_quotient_map_functor_map_homological_complex, iso.symm_hom,\n ← functor.map_comp_assoc],\n erw [← functor.map_comp, iso.hom_inv_id_app, functor.map_id, id_comp],\nend⟩\n\ndef map_homotopy_category_plus : homotopy_category.plus C ⥤ homotopy_category.plus D :=\nfull_subcategory.lift _ (homotopy_category.plus.ι ⋙ functor.map_homotopy_category _ F)\n (λ K, cochain_complex.is_plus.map K.2 F)\n\ndef map_homotopy_category_plus_factors :\n F.map_homotopy_category_plus ⋙ homotopy_category.plus.ι ≅\n homotopy_category.plus.ι ⋙ functor.map_homotopy_category _ F :=\nfull_subcategory.lift_comp_inclusion _ _ _\n\n\ninstance map_homotopy_category_is_triangulated :\n (map_homotopy_category (complex_shape.up ℤ) F).is_triangulated :=\n⟨λ T hT, begin\n rw homotopy_category.triangle_distinguished_iff at hT ⊢,\n obtain ⟨K, L, f, ⟨e⟩⟩ := hT,\n exact ⟨_, _, (F.map_homological_complex _).map f,\n ⟨(map_homotopy_category (complex_shape.up ℤ) F).map_triangle.map_iso e ≪≫\n (map_triangle_comp (homotopy_category.quotient C (complex_shape.up ℤ))\n (map_homotopy_category (complex_shape.up ℤ) F)).symm.app _ ≪≫\n (map_triangle_nat_iso F.map_homotopy_category_factors).app _ ≪≫\n (map_triangle_comp (F.map_homological_complex (complex_shape.up ℤ))\n (homotopy_category.quotient D (complex_shape.up ℤ))).app _ ≪≫\n (homotopy_category.quotient D (complex_shape.up ℤ)).map_triangle.map_iso\n (cochain_complex.mapping_cone.triangle_map_iso f F)⟩⟩,\nend⟩\n\ninstance map_homotopy_category_plus_has_comm_shift :\n (functor.map_homotopy_category_plus F).has_comm_shift ℤ :=\nby { dsimp only [map_homotopy_category_plus], apply_instance, }\n\ninstance map_homotopy_category_plus_is_triangulated :\n (functor.map_homotopy_category_plus F).is_triangulated :=\nby { dsimp only [map_homotopy_category_plus], apply_instance, }\n\nvariable [hF : (functor.map_homotopy_category_plus F ⋙\n derived_category.plus.Qh).has_right_derived_functor\n (triangulated.subcategory.W (homotopy_category.plus.acyclic C))]\n\ninclude hF\n\nabbreviation right_derived_functor_plus : derived_category.plus C ⥤ derived_category.plus D :=\n (functor.map_homotopy_category_plus F ⋙\n derived_category.plus.Qh).right_derived_functor derived_category.plus.Qh\n (triangulated.subcategory.W (homotopy_category.plus.acyclic C))\n\ndef right_derived_functor_plus_αh :\n functor.map_homotopy_category_plus F ⋙\n derived_category.plus.Qh ⟶ derived_category.plus.Qh ⋙\n right_derived_functor_plus F :=\nfunctor.right_derived_functor_α _ _ _\n\ndef abelian_right_derived_functor (n : ℕ) : C ⥤ D :=\nderived_category.plus.single_functor C 0 ⋙ right_derived_functor_plus F ⋙\n derived_category.plus.homology_functor D (n : ℤ)\n\ninstance abelian_right_derived_functor_additive (n : ℕ)\n [F.right_derived_functor_plus.is_triangulated] :\n (F.abelian_right_derived_functor n).additive :=\nby { dsimp only [abelian_right_derived_functor], apply_instance, }\n\nomit hF\n\ninstance single_functor_is_termwise_injective (X : C) (n : ℤ) [injective X] :\n ((homotopy_category.plus.single_functor C n).obj X).obj.as.is_termwise_injective :=\nbegin\n change ((homological_complex.single C (complex_shape.up ℤ) n).obj X).is_termwise_injective,\n apply_instance,\nend\n\ninstance (X : homotopy_category.plus C) [X.obj.as.is_termwise_injective]\n [enough_injectives C] :\n is_iso (F.right_derived_functor_plus_αh.app X) :=\nby { dsimp only [right_derived_functor_plus_αh], apply_instance, }\n\ndef map_homotopy_plus_single_functor_homology_iso_zero :\n F ≅ homotopy_category.plus.single_functor C 0 ⋙ F.map_homotopy_category_plus ⋙\n derived_category.plus.Qh ⋙ derived_category.plus.homology_functor D 0 :=\nbegin\n change F ≅ homotopy_category.plus.single_functor C 0 ⋙ F.map_homotopy_category_plus ⋙\n derived_category.plus.Qh ⋙ derived_category.plus.ι ⋙ derived_category.homology_functor D 0,\n refine F.right_unitor.symm ≪≫\n iso_whisker_left F (homological_complex.single_homology_functor_iso D (complex_shape.up ℤ) 0).symm ≪≫\n (functor.associator _ _ _).symm ≪≫\n iso_whisker_right (F.single_comp_map_homological_complex (complex_shape.up ℤ) 0).symm\n (homology_functor D (complex_shape.up ℤ) 0) ≪≫\n functor.associator _ _ _ ≪≫ iso_whisker_left _ _ ≪≫ (functor.associator _ _ _).symm ≪≫\n iso_whisker_right (homotopy_category.plus.single_functor_factors C 0).symm _ ≪≫\n functor.associator _ _ _ ≪≫ iso_whisker_left _ (functor.associator _ _ _).symm ≪≫\n iso_whisker_left _ (iso_whisker_right (F.map_homotopy_category_plus_factors).symm _\n ≪≫ functor.associator _ _ _ ≪≫ iso_whisker_left _ (functor.associator _ _ _).symm) ≪≫\n iso_whisker_left _ (iso_whisker_left _\n (iso_whisker_right (derived_category.plus.Qh_comp_ι_iso D).symm\n (derived_category.homology_functor D 0) ≪≫ functor.associator _ _ _)),\n refine iso_whisker_left _ _ ≪≫ (functor.associator _ _ _).symm ≪≫\n iso_whisker_right F.map_homotopy_category_factors.symm _ ≪≫\n functor.associator _ _ _,\n refine (homotopy_category.homology_factors D (complex_shape.up ℤ) 0).symm ≪≫\n iso_whisker_left _ (derived_category.homology_functor_factors_Qh D 0).symm,\nend\n\ninstance derived_category_plus_single_functor_obj_obj_is_ge (X : C) (n : ℤ) :\n ((derived_category.plus.single_functor C n).obj X).obj.is_ge n :=\nbegin\n change ((derived_category.single_functor C n).obj X).is_ge n,\n apply_instance,\nend\n\ninclude hF\n\ninstance right_derived_functor_plus_obj_is_ge [enough_injectives C]\n (K : derived_category.plus C) (n : ℤ) [K.obj.is_ge n] :\n (F.right_derived_functor_plus.obj K).obj.is_ge n :=\nbegin\n obtain ⟨K', hK', ⟨e⟩⟩ := derived_category.exists_iso_Q_obj_of_ge K.obj n,\n haveI := hK',\n obtain ⟨Z, hZ, f, hf, hZ'⟩ := homotopy_category.plus.termwise_injective.right_resolution_exists K' n,\n let Z' : homotopy_category.plus C :=\n ⟨(homotopy_category.quotient _ _).obj Z, ⟨n, hZ⟩⟩,\n haveI : Z'.obj.as.is_termwise_injective := hZ',\n let e' : K ≅ derived_category.plus.Qh.obj Z' :=\n derived_category.plus.ι.preimage_iso (e ≪≫ as_iso (derived_category.Q.map f)),\n have e'' := (derived_category.Qh.map_iso ((map_homotopy_category_factors F).app Z)).symm ≪≫\n (derived_category.Qh.map_iso (F.map_homotopy_category_plus_factors.app Z')).symm ≪≫\n (derived_category.plus.Qh_comp_ι_iso D).symm.app\n (F.map_homotopy_category_plus.obj Z') ≪≫ derived_category.plus.ι.map_iso\n (as_iso (F.right_derived_functor_plus_αh.app Z')) ≪≫\n ((F.right_derived_functor_plus ⋙ derived_category.plus.ι).map_iso e'.symm),\n erw ← derived_category.is_ge.iff_of_iso e'' n,\n change (derived_category.Q.obj _).is_ge n,\n apply_instance,\nend\n\ndef abelian_right_derived_functor_α : F ⟶ F.abelian_right_derived_functor 0 :=\nbegin\n refine _ ≫ whisker_right (whisker_left (homotopy_category.plus.single_functor C 0)\n F.right_derived_functor_plus_αh) (derived_category.plus.homology_functor D 0) ≫ 𝟙 _,\n { exact F.map_homotopy_plus_single_functor_homology_iso_zero.hom, },\nend\n\nlemma abelian_right_derived_functor_α_app (X : C) :\n F.abelian_right_derived_functor_α.app X =\n F.map_homotopy_plus_single_functor_homology_iso_zero.hom.app X ≫\n (derived_category.plus.homology_functor D 0).map\n (F.right_derived_functor_plus_αh.app ((homotopy_category.plus.single_functor C 0).obj X)) :=\nbegin\n dsimp only [abelian_right_derived_functor_α, whisker_right, whisker_left,\n nat_trans.comp_app, nat_trans.id_app],\n rw comp_id,\nend\n\ninstance is_iso_abelian_right_derived_functor_plus_α_app (X : C) [injective X] [enough_injectives C] :\n is_iso (F.abelian_right_derived_functor_α.app X) :=\nbegin\n rw abelian_right_derived_functor_α_app,\n apply_instance,\nend\n\nlemma abelian_right_derived_functor_obj_is_zero_of_injective'\n (X : C) [injective X] [enough_injectives C] (n : ℕ) (hn : 1 ≤ n) :\n limits.is_zero ((F.abelian_right_derived_functor n).obj X) :=\nbegin\n refine is_zero.of_iso _ (((derived_category.plus.homology_functor D n).map_iso\n (as_iso (F.right_derived_functor_plus_αh.app\n ((homotopy_category.plus.single_functor C 0).obj X)))).symm),\n have h : limits.is_zero ((derived_category.homology_functor D n).obj\n ((derived_category.single_functor D 0).obj (F.obj X))),\n { apply derived_category.is_le.is_zero _ 0,\n rw ← int.coe_nat_le_coe_nat_iff at hn,\n rw [algebra_map.coe_one] at hn,\n linarith, },\n refine is_zero.of_iso h ((derived_category.homology_functor D ↑n).map_iso _),\n let e : homotopy_category.plus.single_functor C 0 ⋙ F.map_homotopy_category_plus ⋙\n derived_category.plus.Qh ⋙ derived_category.plus.ι ≅ F ⋙ derived_category.single_functor D 0,\n { refine iso_whisker_left _ (iso_whisker_left _ (derived_category.plus.Qh_comp_ι_iso D)) ≪≫\n iso_whisker_left _ ((functor.associator _ _ _).symm ≪≫\n iso_whisker_right F.map_homotopy_category_plus_factors derived_category.Qh) ≪≫\n iso_whisker_left _ (functor.associator _ _ _) ≪≫\n (functor.associator _ _ _).symm ≪≫\n iso_whisker_right (homotopy_category.plus.single_functor_factors C 0)\n (map_homotopy_category (complex_shape.up ℤ) F ⋙ derived_category.Qh) ≪≫\n functor.associator _ _ _ ≪≫\n iso_whisker_left _ ((functor.associator _ _ _).symm ≪≫\n iso_whisker_right F.map_homotopy_category_factors _) ≪≫\n iso_whisker_left _ (functor.associator _ _ _) ≪≫\n (functor.associator _ _ _).symm ≪≫\n iso_whisker_right (F.single_comp_map_homological_complex (complex_shape.up ℤ) 0) derived_category.Q, },\n exact e.app _,\nend\n\nlemma abelian_right_derived_functor_obj_is_zero_of_injective (X : C)\n [injective X] [enough_injectives C] (n : ℕ) :\n limits.is_zero ((F.abelian_right_derived_functor (n+1)).obj X) :=\nabelian_right_derived_functor_obj_is_zero_of_injective' _ _ _ (by linarith)\n\nnamespace abelian_right_derived_functor_homology_sequence\n\nvariables {S : short_complex C} (ex : S.short_exact) (n : ℕ )\n\ndef triangle : pretriangulated.triangle (derived_category.plus D) :=\nF.right_derived_functor_plus.map_triangle.obj (derived_category.plus.triangle_of_ses\n (short_complex.short_exact.map_of_exact ex (homological_complex.single C (complex_shape.up ℤ) 0))\n (by { dsimp, exact ⟨0, infer_instance⟩, })\n (by { dsimp, exact ⟨0, infer_instance⟩, })\n (by { dsimp, exact ⟨0, infer_instance⟩, }))\n\ndef triangle' : pretriangulated.triangle (derived_category D) :=\nderived_category.plus.ι.map_triangle.obj (triangle F ex)\n\nvariable [hF' : F.right_derived_functor_plus.is_triangulated]\n\ninclude hF'\n\nlemma triangle_mem : (triangle F ex).distinguished :=\nF.right_derived_functor_plus.map_distinguished _\n (derived_category.plus.triangle_of_ses_dist _ _ _ _)\n\nlemma triangle'_mem : (triangle' F ex).distinguished :=\nderived_category.plus.ι.map_distinguished _ (triangle_mem F ex)\n\nlemma ex₂ (n : ℕ) :\n (short_complex.mk ((F.abelian_right_derived_functor n).map S.f)\n ((F.abelian_right_derived_functor n).map S.g)\n (by { rw [← functor.map_comp, S.zero, functor.map_zero], })).exact :=\nderived_category.homology_sequence.ex₂ (triangle'_mem F ex) n\n\ndef δ (n₀ n₁ : ℕ) (h : n₁ = n₀+1) :\n (F.abelian_right_derived_functor n₀).obj S.X₃ ⟶ (F.abelian_right_derived_functor n₁).obj S.X₁ :=\nderived_category.homology_sequence.δ (triangle'_mem F ex) n₀ n₁ (by simp [h])\n\n@[simp, reassoc]\nlemma δ_comp (n₀ n₁ : ℕ) (h : n₁ = n₀+1) :\n δ F ex n₀ n₁ h ≫ (F.abelian_right_derived_functor n₁).map S.f = 0 :=\nderived_category.homology_sequence.δ_comp (triangle'_mem F ex) n₀ n₁ (by simp [h])\n\n@[simp, reassoc]\nlemma comp_δ (n₀ n₁ : ℕ) (h : n₁ = n₀+1) :\n (F.abelian_right_derived_functor n₀).map S.g ≫ δ F ex n₀ n₁ h = 0 :=\nderived_category.homology_sequence.comp_δ (triangle'_mem F ex) n₀ n₁ (by simp [h])\n\nlemma ex₃ (n₀ n₁ : ℕ) (h : n₁ = n₀+1) :\n (short_complex.mk ((F.abelian_right_derived_functor n₀).map S.g) (δ F ex n₀ n₁ h)\n (by simp)).exact :=\nderived_category.homology_sequence.ex₃ (triangle'_mem F ex) n₀ n₁ (by simp [h])\n\nlemma ex₁ (n₀ n₁ : ℕ) (h : n₁ = n₀+1) :\n (short_complex.mk (δ F ex n₀ n₁ h) ((F.abelian_right_derived_functor n₁).map S.f)\n (by simp)).exact :=\nderived_category.homology_sequence.ex₁ (triangle'_mem F ex) n₀ n₁ (by simp [h])\n\ninclude ex\n\nlemma ex₀\n [(F.right_derived_functor_plus.obj\n ((derived_category.plus.single_functor C 0).obj S.X₃)).obj.is_ge 0] :\n mono ((F.abelian_right_derived_functor 0).map S.f) :=\nbegin\n refine (short_complex.exact_iff_mono _ (is_zero.eq_of_src _ _ _)).1\n (derived_category.homology_sequence.ex₁ (triangle'_mem F ex) (-1) 0 (neg_add_self 1).symm),\n have h := derived_category.is_ge.is_zero ((F.right_derived_functor_plus.obj\n ((derived_category.plus.single_functor C 0).obj S.X₃)).obj) 0 (-1) (by simp),\n exact h,\nend\n\nomit ex\nomit hF'\n\ninstance (X : C) [F.preserves_monomorphisms] [enough_injectives C]:\n mono (F.abelian_right_derived_functor_α.app X) :=\nbegin\n suffices : mono (F.abelian_right_derived_functor_α.app X ≫\n (F.abelian_right_derived_functor 0).map (injective.ι X)),\n { haveI := this,\n exact mono_of_mono _ ((F.abelian_right_derived_functor 0).map (injective.ι X)), },\n rw ← nat_trans.naturality,\n apply_instance,\nend\n\ninstance (X : C) [preserves_finite_limits F] [enough_injectives C] :\n is_iso (F.abelian_right_derived_functor_α.app X) :=\nbegin\n haveI : mono ((injective_embedding.short_complex X).map (F.abelian_right_derived_functor 0)).f :=\n ex₀ F (injective_embedding.short_exact X),\n haveI : mono ((injective_embedding.short_complex X).map F).f,\n { dsimp, apply_instance, },\n let f := short_complex.map_nat_trans (injective_embedding.short_complex X)\n F.abelian_right_derived_functor_α,\n haveI : mono f.τ₃ := (infer_instance : mono (F.abelian_right_derived_functor_α.app _)),\n haveI : is_iso f.τ₂ := (infer_instance : is_iso (F.abelian_right_derived_functor_α.app _)),\n refine short_complex.five_lemma.is_iso_τ₁ f _,\n apply short_complex.exact.of_f_is_kernel,\n let e : parallel_pair (injective_embedding.short_complex X).g 0 ⋙ F ≅\n parallel_pair (F.map (injective_embedding.short_complex X).g) 0 :=\n parallel_pair.ext (iso.refl _) (iso.refl _) (by tidy) (by tidy),\n equiv_rw (limits.is_limit.postcompose_inv_equiv e _).symm,\n refine limits.is_limit.of_iso_limit\n (is_limit_of_preserves F ((injective_embedding.short_exact X).exact.f_is_kernel))\n (cones.ext (iso.refl _) _),\n rintro (_|_),\n { tidy, },\n { dsimp,\n simp only [short_complex.zero, functor.map_zero, comp_id, id_comp,\n ← F.map_comp], },\nend\n\ninstance [preserves_finite_limits F] [enough_injectives C] :\n is_iso F.abelian_right_derived_functor_α :=\nnat_iso.is_iso_of_is_iso_app _\n\nend abelian_right_derived_functor_homology_sequence\n\nend functor\n\nend category_theory\n", "meta": {"author": "joelriou", "repo": "homotopical_algebra", "sha": "697f49d6744b09c5ef463cfd3e35932bdf2c78a3", "save_path": "github-repos/lean/joelriou-homotopical_algebra", "path": "github-repos/lean/joelriou-homotopical_algebra/homotopical_algebra-697f49d6744b09c5ef463cfd3e35932bdf2c78a3/src/for_mathlib/algebra/homology/right_derived_functor.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5774953651858117, "lm_q2_score": 0.30074557894124154, "lm_q1q2_score": 0.17367917793869064}} {"text": "\nimport data.finset.basic\nimport data.nat.basic\nimport init.data.fin.ops\nimport init.data.option.basic\n\nimport .yul_cmd\n\nnamespace YulSemantics\n\nopen YulCommands\nopen YulCommands.TermType\nopen YulCommands.IsInFunc\nopen YulCommands.IsInFor\nopen YulCommands.YulTerm\n\nvariable τ : Type\nvariable Γ : FTContext\n\ninductive Mode : IsInFor → IsInFunc → Type\n | NormMode : ∀ {b : IsInFor} {b' : IsInFunc}, Mode b b'\n | BreakMode : ∀ {b' : IsInFunc}, Mode NestedInFor b' \n | ContinueMode : ∀ {b' : IsInFunc}, Mode NestedInFor b'\n | LeaveMode : ∀ {b : IsInFor}, Mode b InFunc\n | TermMode : ∀ {b : IsInFor} {b' : IsInFunc}, Mode b b'\n\nopen Mode\n\ndef liftMode : \n ∀ {b : IsInFor} {b' : IsInFunc}, \n Mode NotNestedInFor NotInFunc → Mode b b' \n| _ _ NormMode := NormMode\n| _ _ TermMode := TermMode\n\ndef mode_eq : ∀ {b : IsInFor} {b' : IsInFunc}, Mode b b' -> Mode b b' -> Prop \n| _ _ NormMode NormMode := true\n| _ _ BreakMode BreakMode := true\n| _ _ ContinueMode ContinueMode := true\n| _ _ LeaveMode LeaveMode := true\n| _ _ TermMode TermMode := true\n| _ _ BreakMode NormMode := false\n| _ _ ContinueMode NormMode := false\n| _ _ LeaveMode NormMode := false\n| _ _ TermMode NormMode := false\n| _ _ NormMode BreakMode := false\n| _ _ ContinueMode BreakMode := false\n| _ _ LeaveMode BreakMode := false\n| _ _ TermMode BreakMode := false\n| _ _ NormMode ContinueMode := false\n| _ _ BreakMode ContinueMode := false\n| _ _ LeaveMode ContinueMode := false\n| _ _ TermMode ContinueMode := false\n| _ _ NormMode LeaveMode := false\n| _ _ BreakMode LeaveMode := false\n| _ _ ContinueMode LeaveMode := false\n| _ _ TermMode LeaveMode := false\n| _ _ NormMode TermMode := false\n| _ _ BreakMode TermMode := false\n| _ _ ContinueMode TermMode := false\n| _ _ LeaveMode TermMode := false\n\n\ninstance (b : IsInFor) (b' : IsInFunc) (a : Mode b b') (b : Mode b b') : decidable (mode_eq a b) :=\n begin\n cases a,\n repeat {\n cases b,\n repeat {\n rw mode_eq,\n apply decidable.is_false,\n intro f,\n exact f,\n },\n rw mode_eq,\n apply decidable.is_true,\n trivial,\n },\n end\n\ndef cast_not_in_for_mode : ∀ {b : IsInFor} {b' : IsInFunc}, Mode NotNestedInFor b' → Mode b b' :=\n begin\n intros b b' mode,\n cases mode,\n exact NormMode,\n exact LeaveMode,\n exact TermMode,\n end\n\ndef cast_not_in_func_mode : ∀ {b : IsInFor} {b' : IsInFunc}, Mode b NotInFunc → Mode b b' :=\n begin\n intros b b' mode,\n cases mode,\n exact NormMode,\n exact BreakMode,\n exact ContinueMode,\n exact TermMode,\n end\n\n\ndef FDef (n : ℕ) (m : ℕ) := \n Σ (arg_ids : vector Identifier n) (ret_args : vector Identifier m) (fin_args : finset Identifier), \n YulTerm Γ \n (BlockList \n (tofinset' arg_ids ∪ tofinset' ret_args) \n (fin_args ∪ tofinset' ret_args) \n NotNestedInFor\n InFunc\n )\n\n/- \n FPrim n m primState is the type of state transformers which\n can fail over primState with arity n and returning m values.\n-/\n\ndef FPrim (n : ℕ) (m : ℕ) :=\n vector Literal n → τ → option (τ × vector Literal m × Mode NotNestedInFor NotInFunc)\n\ndef FImpl (Γ : FTContext) := \n ∀ i : Identifier, ∀ {n m : ℕ}, Γ i = some (n,m) → FDef Γ n m ⊕ FPrim τ n m\n\ndef YulState (Γ : FTContext) (vars : finset Identifier) := \n VarStore vars × FImpl τ Γ × τ\n\ndef merge_scopes : ∀ {vars_outer vars_inner : finset Identifier},\n VarStore vars_outer → VarStore vars_inner → VarStore (vars_inner ∪ vars_outer)\n| vars_outer vars_inner vso vsi i i_in_vo_u_vi := \n dite (i ∈ vars_inner)\n (λ i_in_inner, vsi i i_in_inner)\n (λi_n_in_inner, \n dite (i ∈ vars_outer)\n (λi_in_outer, vso i i_in_outer)\n (λi_n_in_outer, \n let i_n_in_vo_u_vi : ¬ (i ∈ vars_inner ∪ vars_outer) := \n begin\n intro i_in_vo_u_vi,\n cases finset.mem_union.1 i_in_vo_u_vi with h,\n exact (i_n_in_inner h),\n exact (i_n_in_outer h),\n end\n in absurd i_in_vo_u_vi i_n_in_vo_u_vi\n )\n )\n\ndef split_scope : ∀ {vars_inner vars_outer : finset Identifier}, \n VarStore vars_outer → VarStore (vars_outer ∪ vars_inner) → \n (VarStore vars_outer × VarStore vars_inner)\n| vars_inner vars_outer outer_σ merged_σ' :=\n let outer_σ' : VarStore vars_outer :=\n λ i i_in_o, \n let i_in_o_u_i : i ∈ vars_outer ∪ vars_inner :=\n begin\n apply finset.mem_union.2,\n exact (or.inl i_in_o),\n end\n in merged_σ' i i_in_o_u_i,\n inner_σ' : VarStore vars_inner :=\n λ i i_in_i, \n let i_in_o_u_i : i ∈ vars_outer ∪ vars_inner :=\n begin\n apply finset.mem_union.2,\n exact (or.inr i_in_i),\n end\n in merged_σ' i i_in_o_u_i\n in (outer_σ', inner_σ')\n\ndef extend_var_store : \n ∀ {vars : finset Identifier} {n : ℕ} (arg_ids : vector Identifier n) (arg_vals : vector Literal n), \n VarStore vars → VarStore (vars ∪ tofinset' arg_ids)\n | vars 0 _ _ σ i i_in_vars_u_ids := \n σ i \n begin\n rw tofinset' at i_in_vars_u_ids,\n rw finset.union_empty at i_in_vars_u_ids,\n exact i_in_vars_u_ids,\n end\n | vars (nat.succ n) arg_ids arg_vals σ i i_in_vars_u_ids :=\n dite (i = arg_ids.head)\n (λ_, arg_vals.head)\n (λarg_id_neq_i, \n let i_in_vars_u_ids' : i ∈ vars ∪ tofinset' (arg_ids.tail) :=\n begin\n rw finset.mem_union at i_in_vars_u_ids,\n cases i_in_vars_u_ids,\n apply finset.mem_union.2,\n exact (or.inl i_in_vars_u_ids),\n rw tofinset' at i_in_vars_u_ids,\n rw finset.mem_union at i_in_vars_u_ids,\n cases i_in_vars_u_ids,\n apply finset.mem_union.2,\n exact (or.inr i_in_vars_u_ids),\n exfalso,\n exact arg_id_neq_i (finset.mem_singleton.1 i_in_vars_u_ids),\n end\n in @extend_var_store vars n arg_ids.tail arg_vals.tail σ i i_in_vars_u_ids')\n\ndef extract_vars : \n ∀ {n : ℕ} {vars : finset Identifier}, \n VarStore vars → ∀ (vec : vector Identifier n),\n tofinset' vec ⊆ vars → vector Literal n \n | 0 _ _ _ _ := vector.nil\n | (nat.succ n) vars σ vec vec_finset_ss_vars :=\n let head_in_vars : vec.head ∈ vars :=\n by {\n exact finset.mem_of_subset \n vec_finset_ss_vars \n (vec_head_in_finset vec),\n },\n tail_ss_vars : tofinset' vec.tail ⊆ vars :=\n by {\n exact finset.subset.trans \n (tl_finset_subset_vec_finset vec) \n vec_finset_ss_vars,\n }\n in vector.cons (σ vec.head head_in_vars) \n (@extract_vars n vars σ vec.tail tail_ss_vars)\n\ndef termSize : ∀ {t : TermType}, YulTerm Γ t → ℕ\n| _ EmpCBlock := 0\n| t blklst@(SeqCBlock _ cstmnt blklst') := 1 + termSize cstmnt\n| _ (NestedScope _ _ _ blklst) := 1 + termSize blklst\n\n| _ (CCase _ cblk swtchbody) := 1 + termSize swtchbody\n| _ (CDefault cblk) := 0\n| _ CNone := 0\n\n| _ (CFunctionCall _ n _ arg_exprs) := 1 + list.sum (list.of_fn (λ i : fin n, 1 + termSize (arg_exprs i)))\n| _ (CId _ _) := 0\n| _ (CLit _) := 0\n| _ (Scope _ _ _ _ cstmnt) := 1 + termSize cstmnt\n| _ (Result _) := 0\n\n| _ (CBlock cblk) := 1 + termSize cblk\n| _ (CVariableDeclarationAss _ _ cexpr) := 1 + termSize cexpr\n| _ (CVariableDeclaration n new_vars) := 0\n| _ (CAssignment _ _ _ cexpr) := 1 + termSize cexpr \n| _ (CIf cexpr cblk) := 1 + termSize cexpr\n| _ (CExpressionStatement cexpr) := 1 + termSize cexpr \n| _ (CSwitch cexpr swtchbody) := 1 + termSize cexpr \n| _ (CFor _ _ _ init cond body post) := 0\n| _ CBreak := 0\n| _ CContinue := 0\n| _ CLeave := 0\n| _ (ForExecInit _ _ _ _ _ _ _ _ eval_init) := 1 + termSize eval_init\n| _ (ForCheckCond _ _ _ _ _ _ _ eval_cond) := 1 + termSize eval_cond \n| _ (ForExecBody _ _ _ _ _ _ _ _ _ eval_loop) := 1 + termSize eval_loop\n| _ (ForExecPost _ _ _ _ _ _ _ _ eval_post) := 1 + termSize eval_post\n| _ Skip := 0\n\ndef evalMetric :\n (psum\n (Σ' {vars vars'' : finset Identifier} {b : IsInFor} {b' : IsInFunc}\n (blklst : YulTerm Γ (BlockList vars vars'' b b')) (ᾰ : ¬is_empcblock Γ blklst),\n YulState τ Γ vars)\n (psum\n (Σ' {vars : finset Identifier} {b : IsInFor} {b' : IsInFunc} (blk : YulTerm Γ (CBlock vars b b'))\n (ᾰ : ¬is_empblock Γ blk),\n YulState τ Γ vars)\n (psum\n (Σ' {vars : finset Identifier} {n : ℕ} (cexprs : vector (YulTerm Γ (CExpr vars 1)) n)\n (ᾰ : ¬are_args_reduced Γ cexprs),\n YulState τ Γ vars)\n (psum\n (Σ' {vars : finset Identifier} {n : ℕ} (cexpr : YulTerm Γ (CExpr vars n))\n (ᾰ : ¬is_result Γ cexpr),\n YulState τ Γ vars)\n (Σ' {vars vars'' : finset Identifier} {b : IsInFor} {b' : IsInFunc}\n (cstmnt : YulTerm Γ (CStatement vars vars'' b b')) (ᾰ : ¬is_skip Γ cstmnt),\n YulState τ Γ vars))))) → ℕ\n| (psum.inl ⟨_, _, _, _, blklst, _, _⟩) := termSize Γ blklst\n| (psum.inr (psum.inl ⟨_, _, _, blk, _, _⟩)) := termSize Γ blk\n| (psum.inr (psum.inr (psum.inl ⟨_, n, cexprs, _, _⟩))) := list.sum (list.of_fn (λ i : fin n, 1 + termSize Γ (cexprs.nth i)))\n| (psum.inr (psum.inr (psum.inr (psum.inl ⟨_, _, cexpr, _, _⟩)))) := termSize Γ cexpr\n| (psum.inr (psum.inr (psum.inr (psum.inr ⟨_, _, _, _, cstmnt, _, _⟩)))) := termSize Γ cstmnt\n\nmutual def evalBlockList, evalCBlock, reduce_last, evalCExpr, evalCStatement\n\nwith evalBlockList : \n ∀ {vars vars'' : finset Identifier} {b : IsInFor} {b' : IsInFunc} \n (blklst : YulTerm Γ (BlockList vars vars'' b b')),\n ¬is_empcblock Γ blklst → YulState τ Γ vars →\n option \n Σ vars' : finset Identifier,\n pprod \n (vars ⊆ vars') \n (YulState τ Γ vars' × YulTerm Γ (BlockList vars' vars'' b b') × Mode b b')\n \n| _ _ _ _ blklst@(EmpCBlock) n_is_empcblock _ :=\n let is_empcblock : is_empcblock Γ blklst :=\n begin\n rw is_empcblock,\n trivial,\n end\n in absurd is_empcblock n_is_empcblock\n| vars vars'' b b' blklst@(SeqCBlock vars' cstmnt cblklst') n_is_empcblock st :=\n have termSize Γ cstmnt < termSize Γ blklst,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_skip Γ cstmnt)\n (λcstmnt_is_skip,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (\n st, \n eq.rec cblklst' (is_skip_imp_vars_eq_vars' Γ cstmnt_is_skip), \n Mode.NormMode\n )\n ⟩\n )\n (λcstmnt_n_is_skip,\n do\n (sigma.mk vars'₁ ⟨p, (st', cstmnt', mode)⟩) ← evalCStatement cstmnt cstmnt_n_is_skip st,\n pure $\n sigma.mk vars'₁\n ⟨\n p,\n (st', SeqCBlock vars' cstmnt' cblklst', mode)\n ⟩\n )\n\nwith evalCBlock : \n ∀ {vars : finset Identifier} {b : IsInFor} {b' : IsInFunc} \n (blk : YulTerm Γ (CBlock vars b b')),\n ¬is_empblock Γ blk → YulState τ Γ vars →\n option (YulState τ Γ vars × YulTerm Γ (CBlock vars b b') × Mode b b') \n| vars b b' cblk@(NestedScope inner_vars inner_vars'' inner_σ blklst) n_is_empblock st :=\n have termSize Γ blklst < termSize Γ cblk,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n }, do\n let inner_st : YulState τ Γ (inner_vars ∪ vars) := \n (merge_scopes st.1 inner_σ, st.2),\n let blklst_n_is_empcblock : ¬ is_empcblock Γ blklst :=\n by {\n rw is_empblock at n_is_empblock,\n exact n_is_empblock,\n },\n (sigma.mk all_vars' ⟨p, (inner_st', blklst', mode)⟩) ← \n evalBlockList blklst blklst_n_is_empcblock inner_st,\n let inner_vars' := all_vars' \\ vars,\n let p' : vars ⊆ all_vars' := by {exact finset.union_subset_right p},\n let all_vars'_cast_p : all_vars' = vars ∪ (all_vars' \\ vars) :=\n by {\n apply eq.symm,\n exact finset.union_sdiff_of_subset p',\n },\n let cast_all_vars' : VarStore (vars ∪ (all_vars' \\ vars)) := \n eq.rec inner_st'.1 all_vars'_cast_p,\n let (outer_σ', inner_σ') := split_scope st.1 cast_all_vars',\n let st' := (outer_σ', inner_st'.2),\n let blklst'_cast_p : all_vars' = all_vars' \\ vars ∪ vars :=\n by {\n apply eq.symm,\n exact finset.sdiff_union_of_subset p',\n },\n let cast_blklst' : YulTerm Γ (BlockList (all_vars' \\ vars ∪ vars) (inner_vars'' ∪ vars) b b') :=\n eq.rec blklst' blklst'_cast_p,\n pure (st', NestedScope (all_vars' \\ vars) inner_vars'' inner_σ' cast_blklst', mode)\n\nwith reduce_last : \n ∀ {vars : finset Identifier} {n : ℕ} \n (cexprs : vector (YulTerm Γ (CExpr vars 1)) n), \n ¬(are_args_reduced Γ cexprs) → YulState τ Γ vars → \n option (YulState τ Γ vars × vector (YulTerm Γ (CExpr vars 1)) n × Mode NotNestedInFor NotInFunc)\n| vars 0 _ p _ := absurd (@nil_reduced Γ vars) p\n| vars (nat.succ n) cexprs n_is_red st :=\n let cexpr' : vector (YulTerm Γ (CExpr vars 1)) n := cexprs.tail in\n have termSize Γ cexprs.head < list.sum (list.of_fn (λ i : fin (nat.succ n), 1 + termSize Γ (cexprs.nth i))),\n by {\n rw list.sum,\n rw (list.foldl_eq_foldr nat.comm_semiring.add_comm \n nat.comm_semiring.add_assoc 0 \n (list.of_fn (λ (i : fin n.succ), 1 + termSize Γ (cexprs.nth i)))),\n rw list.of_fn_succ _,\n rw list.foldr,\n rw vector.nth_zero cexprs,\n linarith,\n },\n have list.sum (list.of_fn (λ i : fin n, 1 + termSize Γ (cexprs.tail.nth i))) \n < list.sum (list.of_fn (λ i : fin (nat.succ n), 1 + termSize Γ (cexprs.nth i))),\n by {\n rw list.sum,\n rw list.of_fn_succ _,\n rw (list.foldl_eq_foldr nat.comm_semiring.add_comm \n nat.comm_semiring.add_assoc 0 \n ((1 + termSize Γ (cexprs.nth 0)) :: list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.nth i.succ)))),\n rw list.foldr,\n apply (ord_lem (termSize Γ (cexprs.nth 0))),\n rw ←(list.foldl_eq_foldr nat.comm_semiring.add_comm \n nat.comm_semiring.add_assoc 0 \n (list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.nth i.succ)))),\n change list.foldl has_add.add 0 (list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.tail.nth i))) ≤\n list.foldl has_add.add 0 (list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.nth i.succ))),\n apply nat.le_of_eq,\n apply (@congr_arg (list ℕ) ℕ\n (list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.tail.nth i)))\n (list.of_fn (λ (i : fin n), 1 + termSize Γ (cexprs.nth i.succ)))\n (list.foldl has_add.add 0)),\n apply (of_fn_lemma _ _),\n intro i,\n rw vector.nth_tail_succ cexprs i,\n },\n let arg_vec' : vector (YulTerm Γ (CExpr vars 1)) n := cexprs.tail\n in dite (are_args_reduced Γ cexprs.tail)\n (λtl_red, do\n let res : ¬is_result Γ cexprs.head :=\n begin\n rw ←(vector.cons_head_tail cexprs) at n_is_red,\n exact reduced_and_n_tail_reduced_imp_n_lit \n Γ cexprs.head cexprs.tail n_is_red tl_red,\n end,\n (st', arg', mode) ← evalCExpr cexprs.head res st,\n pure (st', vector.cons arg' arg_vec', mode)\n )\n (λn_tl_red, do\n (st', ⟨args', p⟩, mode) ← @reduce_last vars n cexpr' n_tl_red st,\n pure \n (\n st', \n ⟨ \n cexprs.head :: args', \n (by {\n rw list.length,\n rw p,\n } : (cexprs.head :: args').length = nat.succ n) \n ⟩, \n mode\n )\n )\n\nwith evalCExpr : \n ∀ {vars : finset Identifier} {n : ℕ} (cexpr : YulTerm Γ (CExpr vars n)),\n ¬is_result Γ cexpr → YulState τ Γ vars → \n option (YulState τ Γ vars × YulTerm Γ (CExpr vars n) × Mode NotNestedInFor NotInFunc)\n | _ _ cexpr@(Result _) n_is_res _ := \n let is_res : is_result Γ cexpr :=\n begin\n rw is_result,\n trivial,\n end\n in absurd is_res n_is_res\n | _ 1 cexpr@(CLit l) _ st := \n pure \n (\n st, \n Result\n ⟨ \n [l], \n by {\n repeat {\n rw list.length,\n },\n }\n ⟩, \n Mode.NormMode\n )\n| _ 1 (CId i i_in_vars) _ st :=\n let l := st.1 i i_in_vars\n in pure (st, CLit l, Mode.NormMode)\n| _ _ cexpr@(CFunctionCall f_id n ar_match arg_map) _ st :=\n let arg_vec := (vector.of_fn arg_map)\n in \n have list.sum (list.of_fn (λ i : fin n, 1 + termSize Γ ((vector.of_fn arg_map).nth i))) < termSize Γ cexpr,\n by {\n rw termSize,\n apply (ord_lem 0),\n apply @nat.le.intro _ _ 0,\n rw (nat_add_zero _),\n apply congr_arg list.sum,\n apply (of_fn_lemma _ _),\n intros i,\n rw vector.nth_of_fn arg_map i,\n },\n dite (are_args_reduced Γ (vector.of_fn arg_map))\n (λ is_red, \n let arg_vals := get_lits Γ (vector.of_fn arg_map) is_red,\n σ := st.1,\n fimpl := st.2.1,\n μ := st.2.2\n in \n let f_impl := fimpl f_id ar_match\n in match f_impl with\n | sum.inl (sigma.mk arg_ids (sigma.mk ret_args (sigma.mk fin_args fbody))) := \n let inner_σ : VarStore (tofinset' arg_ids ∪ tofinset' ret_args):= \n extend_var_store ret_args (default_vals literal_zero)\n (eq.rec (extend_var_store arg_ids arg_vals empStore)\n (finset.empty_union $ tofinset' arg_ids))\n in pure \n (st, Scope (tofinset' arg_ids) fin_args ret_args inner_σ fbody, Mode.NormMode)\n | sum.inr prim_def := do\n (μ', res_vec, mode) ← prim_def arg_vals μ,\n let st' := (σ, fimpl, μ'),\n pure (st', Result res_vec, mode)\n end\n )\n (λ np, do\n (st', arg_vec', mode) ← reduce_last (vector.of_fn arg_map) np st,\n pure (st', CFunctionCall f_id n ar_match arg_vec'.nth, mode)\n )\n| _ _ cexpr@(Scope vars_inner vars_fin ret_ids inner_σ blklst) _ st :=\n have termSize Γ blklst < termSize Γ cexpr,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_empcblock Γ blklst)\n (λ_, let res_vec := extract_vars inner_σ ret_ids\n (by {\n intros i i_in_finset,\n apply finset.mem_union.2,\n exact or.inr i_in_finset,\n })\n in pure (st, Result res_vec, Mode.NormMode)\n )\n (λcstmnt_n_is_empcblock, do\n let inner_st := (inner_σ, st.2),\n (sigma.mk vars_inner' ⟨p, (inner_st', blklst', mode)⟩) ← \n evalBlockList blklst cstmnt_n_is_empcblock inner_st,\n let st' := (st.1, inner_st'.2),\n let inner_σ' := inner_st'.1,\n let inner_σ'_cast_p : vars_inner' = vars_inner' ∪ tofinset' ret_ids :=\n begin\n apply finset.ext_iff.2,\n intro a,\n apply\n (iff_iff_implies_and_implies \n (a ∈ vars_inner')\n (a ∈ vars_inner' ∪ tofinset' ret_ids)).2,\n split,\n intro a_in_vars_inner',\n apply finset.mem_union.2,\n exact or.inl a_in_vars_inner',\n intro a_in_vars_inner'_u_ret_ids,\n cases finset.mem_union.1 a_in_vars_inner'_u_ret_ids,\n exact h,\n exact (finset.union_subset_iff.1 p).2 h,\n end,\n let cast_inner_σ' : VarStore (vars_inner' ∪ tofinset' ret_ids) := \n eq.rec inner_σ' inner_σ'_cast_p,\n let cast_blklst' : \n YulTerm Γ (BlockList (vars_inner' ∪ tofinset' ret_ids) (vars_fin ∪ tofinset' ret_ids) NotNestedInFor InFunc) := \n eq.rec blklst' inner_σ'_cast_p,\n pure $\n begin\n cases mode,\n exact (st', Scope vars_inner' vars_fin ret_ids cast_inner_σ' cast_blklst', NormMode),\n exact (st', Scope vars_inner' vars_inner' ret_ids cast_inner_σ' EmpCBlock, NormMode),\n exact (st', Scope vars_inner' vars_fin ret_ids cast_inner_σ' cast_blklst', TermMode),\n end\n )\n\nwith evalCStatement : \n ∀ {vars vars'' : finset Identifier} {b : IsInFor} {b' : IsInFunc}\n (cstmnt : YulTerm Γ (CStatement vars vars'' b b')),\n ¬ is_skip Γ cstmnt → YulState τ Γ vars →\n option\n Σ vars' : finset Identifier,\n pprod\n (vars ⊆ vars')\n (YulState τ Γ vars' × YulTerm Γ (CStatement vars' vars'' b b') × Mode b b')\n| _ _ _ _ cstmnt@Skip cstmnt_n_is_skip _ :=\n let cstmnt_is_skip : is_skip Γ cstmnt :=\n begin\n rw is_skip,\n trivial,\n end\n in absurd cstmnt_is_skip cstmnt_n_is_skip\n| vars _ _ _ cstmnt@(CBlock blk) _ st :=\n have termSize Γ blk < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_empblock Γ blk)\n (λ_, pure $\n sigma.mk vars \n ⟨finset.subset.refl vars, (st, Skip, Mode.NormMode)⟩\n )\n (λblk_is_empblock, do\n (st', blk', mode) ← evalCBlock blk blk_is_empblock st,\n pure $\n sigma.mk vars \n ⟨finset.subset.refl vars, (st', CBlock blk', mode)⟩\n )\n| vars _ _ _ cstmnt@(CVariableDeclarationAss n new_vars cexpr) _ st :=\n have termSize Γ cexpr < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ cexpr)\n (λcexpr_is_result, \n pure $\n sigma.mk (vars ∪ tofinset new_vars)\n ⟨\n by {\n intros var var_in_vars,\n apply finset.mem_union.2,\n exact or.inl var_in_vars,\n }, \n (\n by {\n cases cexpr,\n repeat {\n exfalso,\n rw is_result at cexpr_is_result,\n exact cexpr_is_result,\n },\n rw tofinset,\n exact (extend_var_store (vector.of_fn new_vars) cexpr_ᾰ st.1, st.2),\n }, \n Skip, \n Mode.NormMode\n )\n ⟩\n )\n (λcexpr_n_is_result, do\n (st', cexpr', mode) ← evalCExpr cexpr cexpr_n_is_result st,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars, \n (st', CVariableDeclarationAss n new_vars cexpr', liftMode mode)\n ⟩\n )\n| vars _ _ _ cstmnt@(CVariableDeclaration n new_vars) _ st :=\n pure $ \n sigma.mk (vars ∪ tofinset new_vars)\n ⟨\n by {\n intros var var_in_vars,\n apply finset.mem_union.2,\n exact or.inl var_in_vars,\n },\n (\n (extend_var_store (vector.of_fn new_vars) (default_vals literal_zero) st.1, st.2), \n Skip, \n Mode.NormMode\n )\n ⟩\n| vars _ _ _ cstmnt@(CAssignment n ids p cexpr) _ st :=\n have termSize Γ cexpr < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ cexpr)\n (λcexpr_is_result, do\n let vars_eq_vars_u_ids : vars = vars ∪ tofinset' (vector.of_fn ids) :=\n begin\n rw tofinset at p,\n exact finset.left_eq_union_iff_subset.2 p,\n end,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars, \n (\n by {\n cases cexpr,\n repeat {\n exfalso,\n rw is_result at cexpr_is_result,\n exact cexpr_is_result,\n },\n have σ' := extend_var_store (vector.of_fn ids) cexpr_ᾰ st.1,\n rw ← vars_eq_vars_u_ids at σ',\n exact (σ', st.2),\n }, \n Skip, \n Mode.NormMode\n )\n ⟩\n )\n (λcexpr_n_is_result, do\n (st', cexpr', mode) ← evalCExpr cexpr cexpr_n_is_result st,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars, \n (st', CAssignment n ids p cexpr', liftMode mode)\n ⟩\n )\n| vars _ _ _ cstmnt@(CIf cond body) _ st :=\n have termSize Γ cond < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ cond)\n (λcond_is_result,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (\n st, \n by {\n cases cond,\n repeat {\n exfalso,\n rw is_result at cond_is_result,\n exact cond_is_result,\n },\n cases cond_ᾰ.head,\n cases val,\n exact Skip,\n exact CBlock body,\n }, \n Mode.NormMode\n )\n ⟩\n )\n (λcond_n_is_result, do\n (st', cond', mode) ← evalCExpr cond cond_n_is_result st,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (st', CIf cond' body, liftMode mode)\n ⟩\n )\n| vars _ _ _ cstmnt@(CExpressionStatement cexpr) _ st :=\n have termSize Γ cexpr < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ cexpr)\n (λ_, pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (st, Skip, Mode.NormMode)\n ⟩\n )\n (λcexpr_n_is_result, do\n (st', cexpr', mode) ← evalCExpr cexpr cexpr_n_is_result st,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars, \n (st', CExpressionStatement cexpr', liftMode mode)\n ⟩\n )\n| vars _ _ _ cstmnt@(CSwitch cexpr swtchbody) _ st :=\n have termSize Γ cexpr < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ cexpr)\n (λcexpr_is_result,\n let lit : Literal := (to_literal Γ cexpr cexpr_is_result).head,\n cblk := getCase Γ lit swtchbody\n in pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (st, CBlock cblk, NormMode)\n ⟩\n )\n (λcexpr_n_is_result, do\n (st', cexpr', mode) ← evalCExpr cexpr cexpr_n_is_result st,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars, \n (st', CSwitch cexpr' swtchbody, liftMode mode)\n ⟩\n )\n| vars _ b b' (CFor inner_vars inner_vars' inner_vars'' init cond loop post) _ st :=\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n let eq_vars : vars = vars ∪ ∅ := eq.symm (finset.union_empty vars),\n init_cast : YulTerm Γ (BlockList (vars ∪ ∅) (vars ∪ inner_vars) NotNestedInFor b') := \n @eq.rec (finset Identifier) vars \n (λvs, YulTerm Γ (BlockList vs (vars ∪ inner_vars) NotNestedInFor b')) init (vars ∪ ∅)\n eq_vars,\n cstmnt' : YulTerm Γ (CStatement vars vars b b') := \n ForExecInit ∅ inner_vars inner_vars' inner_vars'' empStore cond loop post init_cast\n in (st, cstmnt', NormMode)\n ⟩\n| vars _ _ b' CBreak _ st :=\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (st, Skip, BreakMode)\n ⟩\n| vars _ _ b' CContinue _ st :=\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (st, Skip, ContinueMode)\n ⟩\n| vars _ b _ CLeave _ st :=\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (st, Skip, LeaveMode)\n ⟩\n| vars _ b b' cstmnt@(ForExecInit curr_inner_vars inner_vars inner_vars' inner_vars'' σ cond loop post eval_init) _ st :=\n have termSize Γ eval_init < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_empcblock Γ eval_init)\n (λeval_init_is_empcblock, do\n let vars_eq_vars' := eq.symm $ is_empcblock_imp_vars_eq_vars' Γ eval_init_is_empcblock,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (\n eq.rec st vars_eq_vars', \n ForCheckCond curr_inner_vars inner_vars' inner_vars'' σ \n (eq.rec cond vars_eq_vars') (eq.rec loop vars_eq_vars') post (eq.rec cond vars_eq_vars'), \n NormMode\n )\n ⟩\n )\n (λeval_init_n_is_empcblock, do\n let inner_st : YulState τ Γ (vars ∪ curr_inner_vars) := \n (merge_scopes σ st.1, st.2),\n (sigma.mk all_vars' ⟨p, (inner_st', eval_init', mode)⟩) ← evalBlockList eval_init eval_init_n_is_empcblock inner_st,\n let p' : vars ⊆ all_vars' := by {exact finset.union_subset_left p},\n let all_vars'_cast_p : all_vars' = vars ∪ (all_vars' \\ vars) :=\n by {\n apply eq.symm,\n exact finset.union_sdiff_of_subset p',\n },\n let cast_all_vars' : VarStore (vars ∪ (all_vars' \\ vars)) := \n eq.rec inner_st'.1 all_vars'_cast_p,\n let (outer_σ', inner_σ') := split_scope st.1 cast_all_vars',\n let st' := (outer_σ', inner_st'.2),\n let cast_eval_init' : YulTerm Γ (BlockList (vars ∪ (all_vars' \\ vars)) (vars ∪ inner_vars) NotNestedInFor b') :=\n eq.rec eval_init' all_vars'_cast_p,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (\n st', \n ForExecInit (all_vars' \\ vars) inner_vars inner_vars' inner_vars'' inner_σ' cond loop post cast_eval_init', \n cast_not_in_for_mode mode\n )\n ⟩\n )\n| vars _ _ _ cstmnt@(ForCheckCond inner_vars inner_vars' inner_vars'' σ cond body post eval_cond) _ st :=\n have termSize Γ eval_cond < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_result Γ eval_cond)\n (λeval_cond_is_result,\n let lit : Literal := (to_literal Γ eval_cond eval_cond_is_result).head\n in pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (\n st,\n if lit ≠ literal_zero\n then ForExecBody inner_vars inner_vars inner_vars' inner_vars'' σ \n (finset.subset.refl (vars ∪ inner_vars)) cond body post body\n else Skip,\n NormMode\n )\n ⟩\n )\n (λeval_cond_n_is_result, do\n let inner_st : YulState τ Γ (vars ∪ inner_vars) := \n (merge_scopes σ st.1, st.2),\n (inner_st', eval_cond', mode) ← evalCExpr eval_cond eval_cond_n_is_result inner_st,\n let (outer_σ', inner_σ') := split_scope st.1 inner_st'.1,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (\n (outer_σ', inner_st'.2), \n ForCheckCond inner_vars inner_vars' inner_vars'' σ cond body post eval_cond', \n cast_not_in_func_mode (cast_not_in_for_mode mode)\n )\n ⟩\n )\n| vars _ b b' cstmnt@(ForExecBody curr_inner_vars inner_vars inner_vars' inner_vars'' σ ss_p cond body post eval_body) _ st :=\n have termSize Γ eval_body < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_empcblock Γ eval_body)\n (λeval_body_is_empcblock, do\n let vars_eq_vars' := eq.symm $ is_empcblock_imp_vars_eq_vars' Γ eval_body_is_empcblock,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (\n eq.rec st vars_eq_vars', \n ForExecPost curr_inner_vars inner_vars inner_vars' inner_vars'' σ \n (eq.rec cond vars_eq_vars') (eq.rec body vars_eq_vars') post (eq.rec post vars_eq_vars'), \n NormMode\n )\n ⟩\n )\n (λeval_body_n_is_empcblock, do\n let inner_st : YulState τ Γ (vars ∪ curr_inner_vars) := \n (merge_scopes σ st.1, st.2),\n (sigma.mk all_vars' ⟨p, (inner_st', eval_body', mode)⟩) ← evalBlockList eval_body eval_body_n_is_empcblock inner_st,\n let p' : vars ⊆ all_vars' := by {exact finset.union_subset_left p},\n let all_vars'_cast_p : all_vars' = vars ∪ (all_vars' \\ vars) :=\n by {\n apply eq.symm,\n exact finset.union_sdiff_of_subset p',\n },\n let cast_all_vars' : VarStore (vars ∪ (all_vars' \\ vars)) := \n eq.rec inner_st'.1 all_vars'_cast_p,\n let (outer_σ', inner_σ') := split_scope st.1 cast_all_vars',\n let st' := (outer_σ', inner_st'.2),\n let cast_eval_body' : YulTerm Γ (BlockList (vars ∪ (all_vars' \\ vars)) (vars ∪ inner_vars') NestedInFor b') :=\n eq.rec eval_body' all_vars'_cast_p,\n let ss_p' : vars ∪ inner_vars ⊆ vars ∪ (all_vars' \\ vars) := \n begin\n apply (finset.subset.trans ss_p),\n rw ←all_vars'_cast_p,\n exact p,\n end,\n begin\n apply some,\n apply sigma.mk vars,\n apply (⟨finset.subset.refl vars, _⟩ : \n pprod (vars ⊆ vars) (YulState τ Γ vars × YulTerm Γ (CStatement vars vars b b') × Mode b b')),\n apply (st', _),\n clear _do_match _let_match,\n cases mode,\n exact (\n ForExecBody (all_vars' \\ vars) inner_vars inner_vars' inner_vars'' \n inner_σ' ss_p' cond body post cast_eval_body',\n NormMode\n ),\n exact (Skip, NormMode),\n apply (ForCheckCond (all_vars' \\ vars) inner_vars' inner_vars'' inner_σ' _ _ _ _, NormMode),\n have cond_framed := frame Γ (vars ∪ (all_vars' \\ vars)) cond,\n rw frame_TermType at cond_framed,\n rw finset.right_eq_union_iff_subset.2 ss_p',\n exact cond_framed,\n have body_framed := frame Γ (vars ∪ (all_vars' \\ vars)) body,\n rw frame_TermType at body_framed,\n rw finset.right_eq_union_iff_subset.2 ss_p',\n rw finset.left_eq_union_iff_subset.2\n (term_scope_monotonic Γ eval_body' \n all_vars' \n (vars ∪ inner_vars') _),\n rw ←all_vars'_cast_p at body_framed,\n rw ←all_vars'_cast_p,\n exact body_framed,\n rw getVariableUpdate,\n exact post,\n have cond_framed := frame Γ (vars ∪ (all_vars' \\ vars)) cond,\n rw frame_TermType at cond_framed,\n rw finset.right_eq_union_iff_subset.2 ss_p',\n exact cond_framed,\n exact (\n ForExecBody (all_vars' \\ vars) inner_vars inner_vars' inner_vars'' \n inner_σ' ss_p' cond body post cast_eval_body',\n LeaveMode\n ),\n exact (\n ForExecBody (all_vars' \\ vars) inner_vars inner_vars' inner_vars'' \n inner_σ' ss_p' cond body post cast_eval_body',\n TermMode\n ),\n end\n )\n| vars _ _ b' cstmnt@(ForExecPost curr_inner_vars inner_vars inner_vars' inner_vars'' σ cond body post eval_post) _ st := \n have termSize Γ eval_post < termSize Γ cstmnt,\n by {\n repeat {\n rw termSize,\n },\n linarith,\n },\n dite (is_empcblock Γ eval_post)\n (λeval_post_is_empcblock, do\n let vars_eq_vars' := eq.symm $ is_empcblock_imp_vars_eq_vars' Γ eval_post_is_empcblock,\n pure $\n sigma.mk vars\n ⟨\n finset.subset.refl vars,\n (\n eq.rec st vars_eq_vars', \n (begin\n apply (ForCheckCond curr_inner_vars curr_inner_vars curr_inner_vars σ),\n have cond_framed := frame Γ (vars ∪ inner_vars'') cond,\n rw ←vars_eq_vars',\n rw frame_TermType at cond_framed,\n rw (finset.right_eq_union_iff_subset.2 $\n finset.subset.trans\n (term_scope_monotonic Γ body\n (vars ∪ inner_vars)\n (vars ∪ inner_vars') _)\n (term_scope_monotonic Γ post\n (vars ∪ inner_vars')\n (vars ∪ inner_vars'') _)),\n exact cond_framed,\n repeat {\n rw getVariableUpdate,\n },\n have body_framed := frame Γ (vars ∪ inner_vars'') body,\n rw ←vars_eq_vars',\n rw frame_TermType at body_framed,\n rw ←(finset.right_eq_union_iff_subset.2 $\n finset.subset.trans\n (term_scope_monotonic Γ body\n (vars ∪ inner_vars)\n (vars ∪ inner_vars') \n _\n )\n (term_scope_monotonic Γ post\n (vars ∪ inner_vars')\n (vars ∪ inner_vars'') \n _\n )\n ) at body_framed,\n rw ←(finset.right_eq_union_iff_subset.2 $\n (term_scope_monotonic Γ post\n (vars ∪ inner_vars')\n (vars ∪ inner_vars'') \n _\n )\n ) at body_framed,\n exact body_framed,\n repeat {\n rw getVariableUpdate,\n },\n have post_framed := frame Γ (vars ∪ inner_vars'') post,\n rw ←vars_eq_vars',\n rw frame_TermType at post_framed,\n rw ←(finset.right_eq_union_iff_subset.2 $\n (term_scope_monotonic Γ post\n (vars ∪ inner_vars')\n (vars ∪ inner_vars'') \n _\n )\n ) at post_framed,\n rw finset.union_self (vars ∪ inner_vars'') at post_framed,\n exact post_framed,\n repeat {\n rw getVariableUpdate,\n },\n have cond_eval_framed := frame Γ (vars ∪ inner_vars'') cond,\n rw ←vars_eq_vars',\n rw frame_TermType at cond_eval_framed,\n rw (finset.right_eq_union_iff_subset.2 $\n finset.subset.trans\n (term_scope_monotonic Γ body\n (vars ∪ inner_vars)\n (vars ∪ inner_vars') _)\n (term_scope_monotonic Γ post\n (vars ∪ inner_vars')\n (vars ∪ inner_vars'') _)),\n exact cond_eval_framed,\n repeat {\n rw getVariableUpdate,\n },\n end),\n NormMode\n )\n ⟩\n )\n (λeval_post_n_is_empcblock, do\n let inner_st : YulState τ Γ (vars ∪ curr_inner_vars) := \n (merge_scopes σ st.1, st.2),\n (sigma.mk all_vars' ⟨p, (inner_st', eval_post', mode)⟩) ← \n evalBlockList eval_post eval_post_n_is_empcblock inner_st,\n let p' : vars ⊆ all_vars' := by {exact finset.union_subset_left p},\n let all_vars'_cast_p : all_vars' = vars ∪ (all_vars' \\ vars) :=\n by {\n apply eq.symm,\n exact finset.union_sdiff_of_subset p',\n },\n let cast_all_vars' : VarStore (vars ∪ (all_vars' \\ vars)) := \n eq.rec inner_st'.1 all_vars'_cast_p,\n let (outer_σ', inner_σ') := split_scope st.1 cast_all_vars',\n let st' := (outer_σ', inner_st'.2),\n let cast_eval_post' : YulTerm Γ (BlockList (vars ∪ (all_vars' \\ vars)) (vars ∪ inner_vars'') NotNestedInFor b') :=\n eq.rec eval_post' all_vars'_cast_p,\n pure $\n sigma.mk vars \n ⟨\n finset.subset.refl vars,\n (\n st', \n ForExecPost (all_vars' \\ vars) inner_vars inner_vars' inner_vars'' inner_σ' cond body post cast_eval_post', \n cast_not_in_for_mode mode\n )\n ⟩\n )\n \nusing_well_founded {\n rel_tac := λ _ _, `[exact ⟨_, measure_wf (evalMetric τ Γ)⟩],\n dec_tac := `[assumption] }\n \nend YulSemantics", "meta": {"author": "NethermindEth", "repo": "Yul-Specification", "sha": "35b8620b920758684f13810859ec48c55544a8fe", "save_path": "github-repos/lean/NethermindEth-Yul-Specification", "path": "github-repos/lean/NethermindEth-Yul-Specification/Yul-Specification-35b8620b920758684f13810859ec48c55544a8fe/yul_sem.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5926666143433998, "lm_q2_score": 0.2877678218692626, "lm_q1q2_score": 0.17055038070423043}} {"text": "import ReactorModel.Objects\nimport Mathlib.Data.Finset.Lattice\n\nnoncomputable section\nopen Classical\nopen ReactorType Updatable Indexable\n\ndef Action.schedule (a : Action) (t : Time) (v : Value) : Action :=\n match a.tags.filter (·.time = t) |>.max with\n | ⊥ => a.insert ⟨t, 0⟩ v\n | some ⟨_, m⟩ => a.insert ⟨t, m + 1⟩ v\n\nnamespace ReactorType\nnamespace Updatable\n\nvariable [Updatable α] \n\ndef apply (rtr : α) : Change → α \n | .prt k i v => update rtr (.prt k) i (fun _ => v)\n | .stv i v => update rtr .stv i (fun _ => v)\n | .act i t v => update rtr .act i (·.schedule t v)\n | .mut .. => rtr -- Mutations are currently no-ops.\n\ndef apply' (rtr : α) (cs : List Change) : α :=\n cs.foldl apply rtr\n\nend Updatable\n\nnamespace Indexable\n\nvariable [Indexable α] \n\ndef dependencies (rtr : α) (rcn : ID) : Set ID := \n { rcn' | rcn' <[rtr] rcn }\n\ntheorem equiv_eq_dependencies {rtr₁ : α} (e : rtr₁ ≈ rtr₂) : \n dependencies rtr₁ = dependencies rtr₂ := by\n ext i j\n exact ⟨.equiv $ .symm e, .equiv e⟩ \n\ndef scheduledTags (rtr : α) : Set Time.Tag := \n { g | ∃ i a, (rtr[.act][i] = some a) ∧ (g ∈ a.keys) }\n\n-- TODO?: Make this handle tag names better.\nscoped macro \"change_cases \" change:term : tactic => \n `(tactic| cases $change:term <;> try cases ‹Change.Normal›; cases ‹Reactor.Component.Valued›)\n\ntheorem apply_equiv (rtr : α) (c : Change) : (apply rtr c) ≈ rtr := by\n change_cases c <;> first | rfl | apply LawfulUpdatable.equiv\n\ntheorem apply_preserves_unchanged {c : Change} (rtr : α) (h : ¬c.Targets cpt i) :\n (apply rtr c)[cpt][i] = rtr[cpt][i] := by\n change_cases c <;> first | rfl | exact LawfulUpdatable.obj?_preserved (Change.Targets.norm_not h)\n\nvariable {rtr : α}\n\ntheorem apply_port_change (h : i ∈ rtr[.prt k]) : (apply rtr $ .prt k i v)[.prt k][i] = some v := by\n simp [apply, LawfulUpdatable.obj?_updated]\n exact h\n\ntheorem apply_state_change (h : i ∈ rtr[.stv]) : (apply rtr $ .stv i v)[.stv][i] = some v := by\n simp [apply, LawfulUpdatable.obj?_updated]\n exact h\n\ntheorem apply_action_change (h : rtr[.act][i] = some a) : \n (apply rtr $ .act i t v)[.act][i] = some (a.schedule t v) := by\n simp [apply, LawfulUpdatable.obj?_updated]\n exact ⟨_, ⟨h, rfl⟩⟩ \n\ntheorem apply'_equiv (rtr : α) : (cs : List Change) → (apply' rtr cs) ≈ rtr \n | .nil => .refl\n | .cons hd tl => Equivalent.trans (apply'_equiv (apply rtr hd) tl) (apply_equiv rtr hd)\n\ntheorem apply'_preserves_unchanged {cs : List Change} {cpt : Reactor.Component.Valued} {i}\n (h : cs.All₂ (¬·.Targets cpt i)) : (apply' rtr cs)[cpt][i] = rtr[cpt][i] := by\n induction cs generalizing rtr <;> try rfl\n case cons hd tl hi => \n have ⟨hh, ht⟩ := List.all₂_cons _ _ _ |>.mp h\n exact apply_preserves_unchanged rtr hh ▸ hi ht \n\ntheorem apply'_normal_disjoint_comm \n (h : List.Disjoint (cs₁.filter (·.IsNormal)) (cs₂.filter (·.IsNormal))) : \n apply' (apply' rtr cs₁) cs₂ = apply' (apply' rtr cs₂) cs₁ :=\n sorry\n\nend Indexable\nend ReactorType", "meta": {"author": "marcusrossel", "repo": "reactor-model", "sha": "f82fffb489b4352a0cc6bee964d44a142fee18ce", "save_path": "github-repos/lean/marcusrossel-reactor-model", "path": "github-repos/lean/marcusrossel-reactor-model/reactor-model-f82fffb489b4352a0cc6bee964d44a142fee18ce/src/ReactorModel/Execution/Reactor.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5350984137988772, "lm_q2_score": 0.31405055141190724, "lm_q1q2_score": 0.16804795191317431}} {"text": "import math.alexandroff_space math.notation\nopen set topological_space classical\nset_option pp.generalized_field_notation true\nlocal attribute [instance] prop_decidable\nnoncomputable theory\nuniverse u\n\n/-! \n# A topological formal ontology and foundation of philosophy\n\n The purpose of this work is to implement in the Lean Theorem Prover an \n upper level ontology that minimizes the number of primitive concepts and axioms,\n while maximizing explanatory power with regards to the interpretability of \n philosophical concepts in the theory. We seek to give to the whole of philosophy the same sort\n of rigorous foundation that set/type theory gave to mathematics, without having to rely\n on the introduction of a primitive concept for almost every new concept of philosophy. \n The most basic version of our theory admits of only two primitives: possible worlds and existential events,\n everything else being defined in terms of those, in much the same way that everything in mathematics can be\n defined in terms of the primitive notions of set and set-membership. \n We name our theory simply as the **Topological Ontology**.\n\n Among other things, we seek to precisely define in our theory the concepts of: substance, simple substance, \n composite substance, physical substance, metaphysical substance, accident, property, positive property,\n essence and existence, causality, parthood, God, theism,\n atheism, physicalism, monism, pantheism, eleaticism, platonism, modal realism, etc...\n We also seek to formalize theories of: causality, counterfactuals, mereology,\n epistemology, ethics, philosophy of nature, metaphysics and natural theology. \n\n And in a higher order extension of our theory, we also seek to define: concept/abstract object, \n the process of abstraction, universal, matter, form, the categories of being, the post-predicaments, etc...\n\n All of it based on the foundation of possible worlds and existential events. Pretty audacious, ain't it?\n\n## Ontologies and Events\n\n The fundamental concept upon which all of our work is based, is the concept of an *ontology of possible worlds*.\n Which is to be comprised of a Type of possible worlds equipped with some fundamental topological structure, \n the philosophical significance of which shall be made clear shortly.\n\n The notion of possible world is of course a primitive one, and you may interpret it as you will. \n We take a possible world in our theory to be a point in the phase space of the whole of possible reality,\n a fully qualified description of a possible state of existence, \n an outcome of the most general random experiment one could possible think of, etc... \n\n For simplicity, we will also consider that possible worlds are *atomic truth-indexers*. This is to say that \n they are truth-indexers, i.e. things with respect to which propositions are said to be true or false \n (*tertium non datur*) but which cannot be thought to be composed of further things which have this property. \n In particular, our possible worlds will not have any intrinsic temporal or spatial structure, so it will simply\n *not make sense* at first to say that some event like \"Socrates is sitting\" will occur in \n the future of a possible world `w`, it will not make sense to claim \"Socrates will sit in the future\" is true at `w`,\n at least initially. Later on, by equipping our topological space of possible worlds with additional temporal structure,\n we *will* be able to make sense of these claims by defining timelines in terms of continuous paths of possible worlds.\n In this manner we can think of possible worlds as being possible spatio-temporal locations in possible space-times\n rather than as being space-times themselves; since if they were space-times they could be thought to be composed \n of points which would themselves be truth-indexers, and so our possible worlds would not be atomic truth-indexers. \n This seems to be a much simpler foundation to build upon than assuming that, somehow,\n possible worlds should have some intrinsic temporal structure, which would be very hard \n to define right from the start. \n\n Perhaps more importantly, given this primitive notion we can readily define the notion of an ontological \n **Event** as simply a set of possible worlds; the notion should be familiar to those acquainted \n with probability theory (probability spaces). An (not necessarily \"random\") event is something that \"happens\" or \"occurs\", \n precisely in the possible worlds which are its elements, i.e. an event is the set of all possible worlds in which\n the event occurs. We would like to talk a little bit about events before delving into the mathematical definitions.\n\n Another way to see an event is as the semantic content of a proposition. \n Not all events are necessarily propositions because,\n perhaps, we could have uncountably many events, but countably many propositions.\n However every proposition is to be associated with an event: \n the set of all possible worlds in which the proposition is true.\n For instance the proposition \"Socrates exists\" corresponds to the event {w : world | Socrates exists in w}.\n\n Now, it is quite clear that some propositions \"talk about\" or postulate one or more things existing, while others do not. \n \"Socrates exists\" clearly postulates the existence of Socrates, just as \"Humans exist\" postulates the existence of \n Human beings, and \"Socrates and Plato exist\" postulates the existence of both Plato and Socrates, etc... \n On the other hand, \"Unicorns do not exist\", does not seem to postulate or \"talk about\" \n the existence of anything, but merely about the *absence* of an existence. \n So there is quite clearly a primitive notion of which propositions \n talk about existence and which do not. I would not want to reduce this notion\n to merely \"using an existential quantifier in formal language X\" because I do \n not want to assume anything about the syntactical makeup of propositions in the first\n place.\n\n For the sake of generality, simplicity, and removing from our formal system the unnecessary concept of what a \n \"proposition\" is supposed to be, we can take this notion to apply to all events regardless\n of whether they are propositions or not, and stop talking about propositions altogether.\n So an event will be **existential** or **open** \n precisely when its occurrence postulates that one or more entities from a set of entities must exist,\n which is to say that the event can only occur in a possible world if those entities it postulates \n do exist in that possible world.\n\n Now, as we have already exemplified, we should expect that arbitrary set unions of existential \n events be existential events, since the event \"(Some)Humans exist\" is the union of all events of the form\n \"X exists\" for any possible human X. The same should apply for intersections, since \"All possible humans exist\" \n is the intersection of \"X exists\" for any possible human X. And generally speaking, regardless of the \n particular notion of \"existential event\" that we adopt, we should expect the set of all existential events to be \n closed by arbitrary unions and intersections. \n\n However, although plausible,\n this amounts to assuming more than what we actually need to develop our theory. \n For the purposes of our theory, we will only really be committed to the claim that \n *finite* intersections of existential events are existential events, rather than\n claiming that this works for *arbitrarily large* intersections. \n This latter assumption we will denominate, for very sound mathematical reasons, the **Alexandroff Postulate**,\n and we will neither affirm nor deny it, though we might occasionally derive some conclusions from its assumption.\n\n Furthermore, we should also assume that both the set of all possible worlds, i.e. the **necessary event**\n and the empty set of worlds, i.e. the **impossible event**, are both\n existential events. There are many ways to argue this point, the simplest one seems to consist in the\n consideration that the proposition \"Something (whatsoever) exists\" should be associated to the necessary event,\n and that the proposition \"A squared-circle exists\" should be associated to the impossible event. In that case,\n it is clear that these events postulate the existence of some things.\n\n It is however clear that we need not assume that the set complements of existential events are existential for, as we \n have previously exemplified, \"Unicorns do not exist\" is not existential, even though it is the complement, or negation, of \n \"Unicorns exist\", which is clearly existential.\n\n We are also going to assume, as the only real axiom in our theory, that there is an extensionality\n principle for possible worlds: possible worlds worlds in which exactly the same existential events occur\n are equal. This will allow us to think of possible worlds as the sets of possible entities which exist\n in that particular world, so that if two worlds are to be distinct, at least one entity would have to exist in one\n which does not exist in the other. This can be seen as the \"identity of indiscernibles\" principle\n applied to possible worlds. It might turn out however that for many applications we won't even need this axiom,\n so we might consider turning it into a postulate if the need arises, but as of now it looks like such a simple\n assumption that it makes sense to include it as an axiom.\n\n Now, we shall not explain here the mathematics involved, but \n a competent mathematician should already be able to conclude that what\n we are assuming is that existential events constitute a T₀-topology of \n possible worlds. \n \n This leads us to the very first formal definitions of our theory:\n\n-/\n\n/-- An `ontology` is a nonempty T₀ topological space\nof possible worlds. -/\nstructure ontology :=\n (world : Type u)\n [wne : nonempty world]\n [t : topological_space world]\n -- identity of indiscernibles for possible worlds\n [axiom₀ : @t0_space world t]\n\n/-- identity of indiscernibles for possible worlds. -/\nadd_decl_doc ontology.axiom₀\n\ninstance ontology_top (ω : ontology) : topological_space ω.world := ω.t\ninstance ontology_ne (ω : ontology) : nonempty ω.world := ω.wne\ninstance ontology_t0 (ω : ontology) : t0_space ω.world := ω.axiom₀\n\n/-- **Events** in an ontology are simply sets of possible worlds.\n Events are said to **occur** at their element worlds. -/\n@[reducible]\ndef ontology.event (ω : ontology) := set ω.world\n\n/-- **Existential** `events` in an ontology are open sets of possible worlds. -/\n@[reducible, simp]\ndef ontology.event.existential {ω : ontology} (e : ω.event) := is_open e\n\n-- We will start developing the most basic conclusions of the theory:\nnamespace ontology\n\nvariable {ω : ontology}\n\n-- We develop further the notion of events. \nsection events\n \n variable (e : ω.event)\n\n @[reducible, simp]\n def event.occurs (w : ω.world) := w ∈ e\n\n -- We define the related topological notions for events:\n\n @[reducible, simp]\n def event.closure : ω.event := closure e\n @[reducible, simp]\n def event.dense : Prop := closure e = univ\n @[reducible, simp]\n def event.exterior : ω.event := interior (-e)\n @[reducible, simp]\n def event.regular : Prop := e = e.exterior.exterior\n /-- also called `boundary` -/\n @[reducible, simp]\n def event.frontier : ω.event := frontier e\n /-- also called `frontier` -/\n @[reducible, simp, alias]\n def event.boundary : ω.event := e.frontier\n @[reducible, simp]\n def event.connected : Prop := is_connected e\n @[reducible, simp]\n def event.irreducible : Prop := is_irreducible e\n @[reducible, simp]\n def event.clopen : Prop := is_clopen e\n @[reducible, simp]\n def event.closed : Prop := is_closed e\n @[reducible, simp]\n def event.nnegative : Prop := ¬ is_closed e\n /-- **Not Purely Negative** events -/\n @[reducible, simp]\n def event.npnegative : Prop := ¬ is_closed e ∨ is_clopen e\n @[reducible, simp]\n def event.compact : Prop := compact e\n\n -- necessity, possibility, impossibility, contingency\n @[reducible, simp]\n def event.necessary := e = univ\n @[reducible, simp]\n def event.possible := e.nonempty\n @[reducible, simp]\n def event.impossible := ¬e.possible\n @[reducible, simp]\n def event.contingent := e.possible ∧ ¬e.necessary\n\n /-- The **ground**, or *ontological counterpart* of an `event e` is its interior, \n i.e. the largest existential event below `e`.\n This will be the event of some entity existing whose\n existence necessitates the ocurrence of `e`. -/\n @[reducible, simp]\n def event.ground : ω.event := interior e\n\n /-- An `event` is **groundable** if its ground is `possible`. -/\n @[reducible, simp]\n def event.groundable := e.ground.possible\n\n /-- An `event` is **ungroundable** if it is not groundable. -/\n @[reducible, simp]\n def event.ungroundable := ¬e.groundable\n\n -- Setting up notation:\n\n /-- Use `□e` for \"`e` is necessary\" -/\n @[reducible, simp]\n instance has_box_event : has_box ω.event := ⟨event.necessary⟩\n\n /-- Use `◾e` for \"the ground of `e`\" -/\n @[reducible, simp]\n instance has_black_box_event : has_black_box ω.event := ⟨event.ground⟩\n\n /-- Use `⋄e` for \"`e` is possible\" -/\n @[reducible, simp]\n instance has_diamond_event : has_diamond ω.event := ⟨event.possible⟩\n\n /-- Use `✦e` for \"the event of nothing precluding `e` from happening\", or `-◾-e` -/\n @[reducible, simp]\n instance has_black_diamond_event : has_black_diamond ω.event := ⟨event.closure⟩\n\n /-- Use `~e` for \"the exterior of `e`\" -/\n @[reducible, simp]\n instance has_tilde_event : has_tilde ω.event := ⟨event.exterior⟩\n\n /-- Use `e₁ ⇒ e₂` instead of `e₁ ⊆ e₂`, replace with `⇒'` for `⊂`.\n Use `e₁ ⇏ e₂` instead of `¬ e₁ ⇒ e₂`.\n Use `e₁ ≡ e₂` instead of `e₁ ⇒ e₂ ∨ e₂ ⇒ e₁`. \n Use `e₁ ≢ e₂` instead of `¬ e₁ ≡ e₂`.\n -/\n @[reducible, simp]\n instance has_entailment_event : has_entailment ω.event := ⟨set.subset⟩\n\n /-- Use `e₁ ⟶ e₂` instead of `-e₁ ∪ e₂`.\n Use `e₁ !⟶ e₂` instead of `-(e₁ ⟶ e₂)`.\n Use `e₁ ⟷ e₂` instead of `(e₁ ⟶ e₂) ∩ (e₂ ⟶ e₁)`. \n Use `e₁ !⟷ e₂` instead of `-(e₁ ⟷ e₂)`. \n -/\n @[reducible, simp]\n instance has_local_entailment_event : has_local_entailment ω.event := ⟨λ e₁ e₂, -e₁ ∪ e₂⟩\n\n --tests:\n -- variables (e₁ e₂ : ω.event)\n -- #check □e\n -- #check ◾e\n -- #check ⋄e\n -- #check ✦e\n -- #check ~e\n -- #check e₁ ⇒ e₂\n -- #check e₁ ⇒' e₂\n -- #check e₁ ⇏ e₂\n -- #check e₁ ≡ e₂\n -- #check e₁ ≢ e₂\n -- #check e₁ ⟶ e₂\n -- #check e₁ ⟷ e₂\n -- #check e₁ !⟶ e₂\n -- #check e₁ !⟷ e₂\n -- example : e.groundable ↔ ⋄◾e := by simp\n\nend events\n\n-- And we prove some simple useful lemmas about them \nsection event_lemmas\n\n variable {e : ω.event} \n lemma event_union_exterior_open : e.existential → (e ∪ ~e).existential :=\n by intro h; apply is_open_union h; simp\n\n -- For some reason in the standard library there is a lemma\n -- like this for finsets but not one for sets.\n lemma event_possible_of_ne_empty : e ≠ ∅ → ⋄e :=\n begin\n intro h,\n simp [set.nonempty],\n by_contradiction h₂,\n push_neg at h₂,\n replace h₂ := eq_empty_iff_forall_not_mem.2 h₂,\n contradiction,\n end\n\n lemma event_union_exterior_possible : ⋄(e ∪ ~e) :=\n begin\n apply event_possible_of_ne_empty,\n intro h,\n simp at h,\n obtain ⟨h₁, h₂⟩ := h,\n rw h₁ at h₂,\n simp at h₂,\n have c := ω.wne,\n contradiction,\n end\n\n @[simp]\n lemma existential_iff_ground_eq : e.existential ↔ e = e.ground := \n begin \n simp, \n symmetry, \n constructor; intros h,\n symmetry' at h,\n exact interior_eq_iff_open.mp h,\n symmetry,\n exact interior_eq_iff_open.2 h,\n end\n\nend event_lemmas\n\n-- We define (extensional) possible entities to be particular kinds of events, so\n-- that existence is a special case of occurrence. \n-- We defer full philosophical explanation to the \"Intensionality and Extensionality\" section.\nsection entities\n \n /-- The (possible, extensional) `entities` in the ontology are nonempty open sets of possible worlds.\n An entity is said to **exist** precisely at the worlds which are its elements. -/\n structure entity (ω : ontology) :=\n -- the event of the entity existing (\"exists\" is a reserved word)\n («exists» : ω.event)\n (existential : exists.existential)\n (possible : ⋄«exists»)\n\n /-- the event of the `entity` existing -/\n add_decl_doc entity.exists\n\n /-- Any groundable event `e` can be cast to an entity, \n the existence of which is the ground of `e`. -/\n def event.entity (e : ω.event) (h : ⋄◾e) : ω.entity := ⟨◾e, is_open_interior, h⟩\n /-- An event is entitative if it is both existential and possible. -/\n def event.entitative (e : ω.event) : Prop := e.existential ∧ ⋄e\n\n @[simp]\n lemma entity.entitative (e : ω.entity) : e.exists.entitative := ⟨e.existential, e.possible⟩\n @[reducible]\n lemma event.entitative.entity {e : ω.event} (h : e.entitative) : ω.entity := ⟨e, h.1, h.2⟩\n\n /-- main extensionality lemma for entities. -/\n @[ext]\n lemma entity_ext {e₁ e₂ : ω.entity} (h : e₁.exists = e₂.exists) : e₁ = e₂ := \n by casesm* ω.entity; simp at h; simpa\n\n @[simp]\n lemma entity_ext_iff (e₁ e₂ : ω.entity) : e₁ = e₂ ↔ e₁.exists = e₂.exists := \n ⟨(λ h, by rw h), entity_ext⟩\n\n variables (e e₁ e₂ : ω.entity)\n\n lemma entity_exists_inj : function.injective (@entity.exists ω) :=\n λ e₁ e₂, @entity_ext ω e₁ e₂\n\n /-- Two entities are said to be `contrary` if there is no possible world\n in which both exist together.\n they are otherwise said to be `compatible`. -/\n @[reducible, simp]\n def entity.contrary := e₁.exists ∩ e₂.exists = ∅\n /-- Negation of `entity.contrary`. -/\n @[reducible, simp]\n def entity.compatible := ⋄(e₁.exists ∩ e₂.exists)\n\n -- Some very important entities have no contraries\n @[reducible, simp]\n def entity.nocontrary := ¬ ∃ y, e.contrary y\n\n /-- Entity e₁ is said to existentially entail entity e₂,\n or to existentially depend on e₂,\n if in every possible world in which e₁ exists, e₂ exists.\n For this relation we use the ` ⇒ ` notation.\n This is defined via coercion to events and \n the `cross_entailment` typeclass instances. -/\n @[reducible, simp]\n instance has_coe_entity : has_coe ω.entity ω.event := ⟨entity.exists⟩\n\n -- tests:\n -- #reduce λ (e₁ : ω.entity) (e₂ : ω.entity), e₁ ⇒ e₂\n -- #reduce λ (e₁ : ω.entity) (e₂ : ω.event), e₁ ⇒ e₂\n -- #reduce λ (e₁ : ω.entity) (e₂ : ω.event), e₂ ⇒ e₁\n\n /-- An entity is said to be a **truthmaker** for any event its existence entails. -/\n def entity.truthmaker (e : ω.entity) (ev : ω.event) : Prop := e ⇒ ev\n\n /-- The event of an entity being \"removed\" from a possible world. -/\n def entity.removed (w : ω.world) : ω.event := \n {w' | e.exists w ∧ w' < w ∧ ¬ e.exists w'}\n /-- The event of an entity being \"added\" to a possible world. -/\n def entity.added (w : ω.world) : ω.event := \n {w' | ¬e.exists w ∧ w < w' ∧ e.exists w'}\n /-- The set of all possible worlds from which an entity can be \"removed\". -/\n def entity.removable : ω.event := \n {w | ⋄e.removed w}\n /-- The set of all possible worlds to which an entity can be \"added\". -/\n def entity.addable : ω.event := \n {w | ⋄e.added w}\n\n /-- The necessary being (entity) is the entity which exists in\n every possible world. -/\n def nbe (ω : ontology) : ω.entity := ⟨univ, is_open_univ, by simp [empty_ne_univ]⟩\n instance entity_inhabited : inhabited ω.entity := ⟨ω.nbe⟩\n\n /-- An entity is `contingent` if it is not the necessary being. -/\n @[reducible, simp]\n def entity.contingent := e ≠ ω.nbe\n /-- An entity is `necessary` if it is the necessary being. -/\n @[reducible, simp]\n def entity.necessary := e = ω.nbe\n\n @[reducible, simp]\n def entity.compact := e.exists.compact\n\n /-- Use `□e` for \"`e` is necessary\" -/\n @[reducible, simp]\n instance has_box_entity : has_box ω.entity := ⟨entity.necessary⟩\n\n lemma nbe_unique : ∃! e : ω.entity, □e := by use ω.nbe; simp\n\n /-- A contingent entity is said to be **complemented** if \n its existence is a clopen set.\n Complemented entities `e` are such that the event\n of their non-existence `-e.exists` is itself\n just as much of an entity as `e`.\n It can be proven that the possibility\n of the existence of complemented\n entities is logically equivalent to atheism. -/\n def entity.complemented : Prop := e.contingent ∧ e.exists.clopen\n\n -- Here are some definitions which look more like lemmas:\n\n -- Arbitrary nonempty unions of entities are entities.\n def entity_Sup (s : set ω.entity) (h : s.nonempty) : ω.entity :=\n begin\n fsplit,\n exact ⋃ i ∈ s, entity.exists i,\n apply is_open_bUnion,\n intros i H,\n exact i.existential,\n simp [set.nonempty],\n\n let i := h.some,\n let w := i.possible.some,\n existsi w,\n existsi i,\n constructor,\n exact h.some_mem,\n exact i.possible.some_mem,\n end\n\n -- so are pairwise unions, obviously\n def entity_sup (e₁ e₂ : ω.entity) : ω.entity := \n begin\n fconstructor,\n exact e₁.exists ∪ e₂.exists,\n apply is_open_union,\n exact e₁.existential,\n exact e₂.existential,\n simp, left,\n exact e₁.possible,\n end\n\n -- @[reducible, simp]\n instance has_Sup_entity : has_Sup ω.entity := \n ⟨λ s, if h : s.nonempty then entity_Sup s h else ω.nbe⟩\n\n -- @[reducible, simp]\n instance has_sup_entity : has_sup ω.entity := ⟨entity_sup⟩\n\n @[simp]\n lemma Sup_sup (e₁ e₂ : ω.entity) : Sup {e₁, e₂} = e₁ ⊔ e₂ :=\n begin\n have c : ({e₁, e₂} : set ω.entity).nonempty, \n use e₁, simp,\n simp [Sup, has_Sup.Sup, entity_Sup, entity_sup, c],\n exact sup_comm,\n end\n\n /-- Intersections of compatible entities are entities.\n If `h` is a proof of the compatibility of the entities\n `e₁` and `e₂`, then `h.inter` is the intersection of\n `e₁` and `e₂`. -/\n def entity.compatible.inter {e₁ e₂ : ω.entity} (h : e₁.compatible e₂) : ω.entity :=\n ⟨ e₁.exists ∩ e₂.exists\n , is_open_inter e₁.existential e₂.existential\n , h\n ⟩\n\n /-- possibly_not_exists_of_contingent -/\n lemma pnexists_of_contingent {e : ω.entity} : e.contingent → ⋄-e.exists :=\n begin\n intro h,\n simp [nbe, entity_ext_iff] at h,\n by_contradiction c,\n simp [has_neg.neg, compl, set.nonempty] at c,\n replace c := eq_univ_of_forall c,\n contradiction,\n end\n \n def entity.complement (h : e.complemented) : ω.entity :=\n ⟨ -e.exists\n , h.2.2\n , pnexists_of_contingent h.1 \n ⟩\n\nend entities\n\n-- We discuss some properties of possible worlds\nsection worlds\n\n variables (w w₁ w₂ : ω.world)\n\n -- We can also talk about an entity existing in a world\n -- as belonging to it, so we can use the notation e ∈ w.\n @[reducible, simp]\n instance world.has_mem : has_mem ω.entity ω.world := ⟨λe w, w ∈ e.exists⟩\n @[reducible, simp]\n def world.entities := {e : ω.entity | e ∈ w}\n\n -- extensionality principle for possible worlds\n @[ext]\n lemma world.ext {w₁ w₂ : ω.world} (h : w₁.entities = w₂.entities) : w₁ = w₂ :=\n begin\n by_contradiction contra,\n have c₀ := ω.axiom₀.t0,\n obtain ⟨U, U_open, ⟨hU₁, hU₂⟩|⟨hU₁, hU₂⟩⟩ := c₀ w₁ w₂ contra;\n clear c₀;\n have ne := nonempty_of_mem hU₁;\n let e : ω.entity := ⟨U, U_open, ne⟩,\n replace h : w₁.entities ⊆ w₂.entities, finish,\n swap,\n replace h : w₂.entities ⊆ w₁.entities, finish,\n all_goals {\n simp [world.entities, entity.exists] at h,\n specialize h e,\n simp [e, hU₁, hU₂] at h,\n contradiction,\n },\n end\n\n @[reducible, simp]\n def world.ideal : ω.event := {w' | w' ≤ w}\n def world.filter : ω.event := {w' | w ≤ w'}\n def world.nonactuality : ω.event := {w' | w' ≠ w}\n\n variable (ω)\n\n def nonparmenidean : ω.event := {w | ∃ e : ω.entity, e.contingent ∧ e.exists w}\n def parmenidean : ω.event := {w | ∀ e : ω.entity, e ∈ w → □ e}\n\n @[reducible, simp]\n def weakly_parmenidean : Prop := ⋄ω.parmenidean\n @[reducible, simp]\n def strongly_parmenidean : Prop := □ω.parmenidean\n /-- A modal collapsing ontology is an ontology with a single possible world -/\n def mcollapse : Prop := ∀ w₁ w₂ : ω.world, w₁ = w₂\n\n def Parmenides : ontology := { world := unit }\n def Sierpinski : ontology := { world := Prop }\n\n lemma mcollapse_iff_str_parme : ω.mcollapse ↔ ω.strongly_parmenidean :=\n begin\n constructor; intro h;\n simp [strongly_parmenidean, nbe, ext_iff, parmenidean] at *,\n intros w₁ e he w₂,\n specialize h w₁ w₂,\n rwa h at he,\n intros w₁ w₂,\n ext e, constructor; intro h₀,\n exact h w₁ e h₀ w₂,\n exact h w₂ e h₀ w₁,\n end\n\n -- #reduce Sierpinski.t.is_open {false}\n -- lemma weakly_parme_weaker : ∃ ω₀ : ontology.{0}, ω₀.weakly_parmenidean ∧ ¬ ω₀.mcollapse :=\n -- begin\n -- use Sierpinski, constructor,\n -- use false, simp [parmenidean],\n -- intros e h, \n -- by_cases hyp : e.exists = {false, true};\n -- simp [nbe, hyp, ext_iff],\n -- exact em,\n -- have c := e.existential,\n -- change (generate_open (λ (b : Prop → Prop), (b = λ (b : Prop), b = true ∨ false) ∨ false) e.exists) at c,\n -- simp at c,\n -- intro w,\n -- apply generate_open.cases_on c,\n -- -- simp at d,\n -- -- induction c; try {simp},\n -- -- change (c_s = λ (b : Prop), b) at c_H,\n -- -- rw c_H at h,\n -- -- change (false) at h, \n -- -- contradiction,\n \n -- simp [set_of, set.mem] at c_H,\n --; simp [nbe],\n -- simp [sierpinski_space.is_open] at c,\n -- end\n\n\nend worlds\n\n-- Here we discuss basic general properties of ontologies themselves.\nsection ontology\n \n variable (ω)\n\n /-- The least we should assume for an ontology to be worthy of consideration as being\n the true ontology is that we can add or remove entities from its worlds.\n A `viable` ontology is one satisfying this postulate. -/\n class viable : Prop :=\n (postulate₁ : ∀ w : ω.world, ∃ w', w < w' ∨ w' < w)\n\n -- common (sensical) ontologies\n class common extends viable ω : Prop :=\n (postulate₂ : uncountable ω.world)\n\n def alexandroff_discrete := alexandroff_space ω.world\n\n class alexandroff extends common ω : Prop :=\n (postulate₃ : ω.alexandroff_discrete)\n\n /-- A complemented ontology supports complemented entities. -/\n def complemented := ∃ e : ω.entity, e.complemented\n\n /-- The **Principle of Non-Negative Nonactual Existence** claims\n that the nonactual (a.k.a. merely possible) existence of any entity is a non-negative event. -/\n def pnnnae : Prop := ∀ (w : ω.world) (e : ω.entity), (↑e ∩ w.nonactuality).nnegative\n\nend ontology\n\n\n/- We introduce a custom notion of subbasis in an ontology. -/\nsection subbasis\n\n def {v} is_subbasis {ω : ontology.{v}} (B : set ω.event) : Prop :=\n (∀ ev : ω.event, ev ∈ B → ev.entitative) ∧\n ∀ e : ω.entity, ∃ (I : Type v) (ne : nonempty I) (S : I → set ω.event),\n (∀ i, (S i).finite ∧ (S i).nonempty ∧ (S i) ⊆ B) ∧\n (⋃ i, ⋂₀ S i) = e\n\n def is_subbasis' (B : set ω.entity) : Prop := is_subbasis $ entity.exists '' B\n\n variable {B : set ω.event}\n\n lemma is_subbasis.ne : is_subbasis B → B.nonempty :=\n begin\n intro h,\n by_contradiction contra,\n replace contra := not_nonempty_iff_eq_empty.mp contra,\n simp [is_subbasis, contra] at h,\n specialize h ω.nbe,\n obtain ⟨I, ne, S, h⟩ := h,\n replace h := (h.1 ne).2,\n obtain ⟨h₁, h₂⟩ := h,\n replace h₁ := h₁.not_subset_empty,\n contradiction,\n end\n \n lemma is_subbasis.ne_of_mem : is_subbasis B → ∀ {b : ω.event}, b ∈ B → ⋄b :=\n λ h b hb, (h.1 b hb).2\n\n lemma is_subbasis.existential_of_mem : is_subbasis B → ∀ {b : ω.event}, b ∈ B → b.existential :=\n λ h b hb, (h.1 b hb).1\n \n lemma is_subbasis.sUnion_necessary : is_subbasis B → □ ⋃₀ B :=\n begin\n intro h,\n replace h := h.2 ω.nbe,\n obtain ⟨I, ne, S, ⟨h₁, h₂⟩⟩ := h,\n unfold_coes at h₂,\n simp [nbe, Union, ext_iff] at h₂,\n simp [sUnion, ext_iff],\n intro w, specialize h₂ w,\n obtain ⟨i, hi⟩ := h₂,\n specialize h₁ i,\n obtain ⟨h₁, ⟨e,he⟩, h₃⟩ := h₁,\n specialize hi e he,\n specialize h₃ he,\n exact ⟨e, h₃, hi⟩,\n end\n\n lemma {v} default_subbasis (ω : ontology.{v}) : @is_subbasis ω event.entitative := \n begin\n refine ⟨λ_,id, _⟩,\n intro e,\n refine ⟨(punit.{v+1} : Type v), ⟨punit.star⟩,(λ_,{e.exists}), _⟩,\n unfold_coes, simp,\n refine ⟨⟨e.existential, e.possible⟩,_⟩,\n simp [Union],\n end\n\nend subbasis\n\n/-! ## Intensionality and Extensionality\n\n A fundamental question in any ontological theory is that of\n whether the basic entities that the theory postulates have a clearly\n defined identity criteria or whether their identity should be assumed \n to be a primitive relation. This amounts to asking whether the entities\n in the theory admit an *extensionality* principle, such as the\n one admitted for sets, or whether no such extensionality principle is admitted.\n We can readily call the basic entities in an extensional ontological theory \n *extensional* entities, and likewise name the entities in an intensional theory\n *intensional* entities.\n\n As can be seen from the previous section, it is easy to turn our ontology into an extensional theory\n by identifying non-empty existential events to be possible extensional entities. Their\n extensionality principle is then naturally deduced from the extensionality\n principle for sets. We will indeed be primarily focusing on these entities for much of our work,\n but to demonstrate the generality of our theory we must \n also discuss shortly the introduction of primitive intensional entities via \n an intensional extension to our theory.\n\n It might indeed look somewhat controversial, to some,\n that we so readily move from existential events to \"entities\". \n It may look like we are saying that entities, or at least our particular kind of\n \"extensional\" entities, are *nothing but* sets of possible worlds, or that nothing but\n sets of possible worlds are supposed to \"exist\" in our theory. This of course seems implausible\n among other reasons because sets are abstract mathematical objects, not concretely existing \"things\".\n This objection can however be resolved by understanding that, this being a mathematical theory,\n we are not really claiming that possible entities *are* nothing other than sets of possible worlds, \n but only that these entities can be *represented* as the sets of possible worlds in which they exist.\n We are also not really committed to claiming that existence really just *is* a particular special case\n of the occurrence of events, but only that for all mathematical intents and purposes it can be so *represented*.\n We will look shortly into a way to make this representation formal by showing that any intensional ontological theory\n of possible entities naturally gives rise to our extensional topological theory in a mathematically well understood way.\n\n-/\n\n/-- An **Intensional ontology** is an ontology generated by a mapping of intensional entities to existential events -/\nstructure iontology (ω : ontology.{u}) :=\n (ientity : Type u)\n [iene : nonempty ientity]\n («exists» : ientity → ω.event)\n (axiom₁ : is_subbasis $ range «exists»)\n\nnamespace iontology\n\n section ientity\n\n variables {Ω : ω.iontology} (ie : Ω.ientity)\n\n /-- the `event` of an intensional entity existing -/\n def ientity.exists := Ω.exists ie\n\n /-! **...**\n\n As can be seen, we can define an intensional ontology as a particular kind of ontology whose \n topological structure was generated as the least topology containing the image of a map from some\n type of intensional entities to events. These events will provably be extensional entities, as we\n show bellow:\n\n -/\n \n lemma ientity.possible : ie.exists.possible := \n Ω.axiom₁.ne_of_mem \n (by simp [ientity.exists]; use ie)\n\n lemma ientity.existential : ie.exists.existential :=\n Ω.axiom₁.existential_of_mem\n (by simp [ientity.exists]; use ie)\n\n -- \"up\" is used for informal inheritance here\n /-- cast from `ientity` to `entity` -/\n def ientity.up : ω.entity := ⟨ie.exists, ie.existential, ie.possible⟩\n\n instance ientity_coe : has_coe Ω.ientity ω.entity := ⟨ientity.up⟩\n\n -- #check ie ⇒ ie\n\n end ientity\n \nend iontology\n\n-- We discuss whether extensional entities, and other Lean types, are real or mere abstracta. \nsection realism\n\n variables (e : ω.entity) (Ω : ω.iontology)\n\n /-! ## Real and Virtual Entities\n \n Some philosophers might furthermore be skeptical with the prospect that, for example,\n the existential event \"human beings exist\" \n corresponds to some particular, unique, \"extensional entity\"\n which may possibly exist concretely in the world;\n i.e. the (not necessarily Platonic) universal of \"Man\", or Humanity.\n We make a concession to this sort of skepticism in order to make our\n system more general, and we will admit that some such extensional entities might be,\n in some sense, abstracta, figures of speech, concoctions of language, etc...\n and these we will call **virtual** entities; all other entities we shall call **real** entities. \n Formally what will make a non-empty existential event a real entity is its belonging \n to the image of the representation function which maps intensional possible entities to \n their extensional representations.\n\n -/\n\n /-- An `entity` `e` is real with respect to an iontology `Ω` if there is an `Ω.ientity`\n which exists in the same possible worlds as `e`. -/\n def entity.real : Prop := ∃ ie : Ω.ientity, ie.up = e\n /-- An `entity` is virtual with respect to an iontology `Ω` if its is not real with respect to `Ω`. -/\n @[reducible]\n def entity.virtual : Prop := ¬ e.real Ω\n\n /-! **Example**\n \n To give an example, the extensional entity \"Socrates\"\n defined as the existential event \"(the set of all possible worlds in which) Socrates exists\"\n is real because there is some possible intensional entity Socrates such that the event of \n this Socrates existing is precisely the same event which defines the extensional \"Socrates\".\n However one could consistently hold that the event \"Humans exist\" does not represent some\n distinct intensional entity over and above the individual intensional human beings from whose\n representations it is constructed. In this case, the associated extensional entity, \"Humanity\",\n would be a virtual entity. This is compatible with doctrines of mereological nihilism and such.\n\n We assume that talk of \"virtual entities\" is just a figure of speech for talk about \n existential events which talk about the existence of more than a single intensional entity,\n and as such we can conclude that the jump from existential events to extensional entities\n does not indeed commits us to any novel metaphysical thesis, nor to anything which could possibly\n be controversial.\n\n -/\n\n /-! In what follows, we speak of \"realizations\" instead of \"instances\" whenever we, informally, take the \n type in question to be a kind of proof-relevant \"proposition\". -/\n\n -- Specific Forms of realism:\n\n /-- An intensional ontology is realist about a class `C` of entities, if every entity in `C` is real. -/\n def iontology.realist (C : set ω.entity) := ∀ e : ω.entity, e ∈ C → e.real Ω\n\n /-- A *realization* of a position of **realism about instances of type `α`**, \n relative to a mapping `«exists»` of the `α`s to their extensional representations,\n consists in an injective map associating every `x : α` to some intensional entity, `map x`,\n such that `(map x).exists = «exists» x`. The default view is that all instances of `α`\n are necessary, such that (e.g.) `Ω.realism ℕ` correspond to the default view of realism about natural numbers \n which take them to be necessary entities. -/\n structure iontology.realism (Ω : ω.iontology) (α : Type u) («exists» : α → ω.entity := λ_, ω.nbe) :=\n (map : α → Ω.ientity)\n (h₀ : function.injective map)\n (h₁ : ∀ x, Ω.exists (map x) = «exists» x)\n\n /-- A *realization* of a position of **simplified realism about instances of type `α`**, \n consists in an injective map associating every `x : α` to some intensional entity, `map x`. -/\n structure iontology.srealism (Ω : ω.iontology) (α : Type u) :=\n (map : α → Ω.ientity)\n (h₀ : function.injective map)\n\n -- simplified realism can be cast to regular realism:\n def iontology.srealism.to_realism {Ω : ω.iontology} {α} (h : Ω.srealism α) : Ω.realism α (iontology.ientity.up ∘ h.map) :=\n by refine ⟨h.map, h.h₀, _⟩; unfold_coes; simp [iontology.ientity.up, iontology.ientity.exists]\n\n /-- A *realization* of the position of **extensional realism** is a realization of `Ω.realism ω.entity id`.\n In other words, it consists of an injective map taking extensional entities to intensional entities\n which exist in the same possible worlds. It can be seem as associating to every equivalence class of intensional \n entities a canonical representative which reifies the class itself and/or \n the extensional entity corresponding to the class. The existence of a realization implies algebraic realism. -/\n def iontology.erealism := Ω.realism ω.entity id\n\n /-- A *realization* of the position of **restricted extensional realism** for some class of entities `C`, \n is a realization of `Ω.realism (subtype C) subtype.val`.\n In other words, it consists of an injective map, defined in `C`, \n taking extensional entities to intensional entities\n which exist in the same possible worlds. It can be seem as associating to every equivalence class of intensional \n entities represented by entities in `C`, a canonical representative which reifies \n the class itself and/or the extensional entity corresponding to the class. \n The existence of a realization implies realism about the `C`s. -/\n def iontology.rerealism (C : set ω.entity):= Ω.realism (subtype C) subtype.val\n\n /-! Now, if a map of this sort is not injective, we can take the position in question to be a realization\n of a position of **grounding** rather than a position of realism. Since however a position of grounding \n is just a (possibly partial) function, we do not define a new structure for it. -/\n\n /-! **Absolutely Real Entities**\n \n One important notion that will arise out of intensionality will be the property \n of an entity being absolutely real, i.e. real regardless of the underlying intensional ontology used\n to generate the ontological structure. This will allow us to think about intensional ontologies much \n in the same way that geometers think about a choice of \"basis\", or \"chart\", so that we --like them-- \n shall be most interested in proving only the results which do not depend on an arbitrary choice of\n intensional ontology.\n\n -/\n\n /-- An `entity` is absolutely real if it is real regardless of the choice of iontology -/\n def entity.absolutely_real : Prop := ∀ Ω : ω.iontology, e.real Ω\n\nend realism\n\nsection algebraic_realism\n\n variables (Ω : ω.iontology)\n\n /-! **Algebraic Realism**\n\n We shall name the theory which claims that all extensional entities are real **algebraic realism**,\n and we can also prove that both this theory and its denial are logically consistent. \n The theory is to be so called because it is realistic about the set theoretic constructions\n of extensional entities (unions and intersections), which are algebraic constructions \n in a complete Heyting algebra, or topological frame. \n Because we are not committed to algebraic realism from the outset,\n we intend our identification of existential events with extensional entities to be metaphysically neutral.\n\n -/\n\n /-- **Algebraic realism** for intensional ontologies claims that all \n extensional entities are real. \n It is realist about the algebraic operations of topological frames. -/\n class iontology.arealist : Prop :=\n (postulate₀ : ∀ e : ω.entity, e.real Ω)\n \n /-! We prove below that every ontology admits a canonical algebraic realist iontology. \n In order to do so, we first show that it is possible to construct an iontology out of\n any subbasis, then we prove that for the default subbasis the generated iontology is\n indeed `arealist`.\n -/\n \n /-- The `iontology` generated by events in a subbasis. -/\n def is_subbasis.intensionalize {B : set ω.event} : is_subbasis B → ω.iontology :=\n λ h, { ientity := subtype B\n , iene := let ⟨b, hb⟩ := h.ne in ⟨⟨b, hb⟩⟩\n , «exists» := subtype.val\n , axiom₁ := by simpa [range, subtype.val] \n }\n\n lemma natural_arealism : ω.default_subbasis.intensionalize.arealist :=\n begin\n constructor, intro e,\n use e; unfold_coes; simp [iontology.ientity.up],\n change (e.exists = e.exists), refl,\n end\n\nend algebraic_realism\n\n/-! **Final remarks about Intensionality**\n\n Even though we are not assuming algebraic realism, our general intention is indeed to avoid talking about \n intensional entities as most as possible. If we completely abstract away talk of intensional entities from\n our system, we will be left simply with a topological space of possible worlds from which the distinction \n between real and virtual entities cannot be defined. In order to define it we would at the very least have \n to equip the space with an additional sub-basis to stand in for the events which are used to represent the\n intensional entities we intend to abstract, and then claim that an entity is real only if it belong to the sub-basis.\n As such, in order to make the distinction we would need to introduce this sub-basis as a new unwanted and \n unneeded primitive concept to which our system would have to be committed. \n In order to eschew this primitive, we must say that the distinction between real and virtual entities is,\n for the most part, not really useful in our system, and we have introduced it,\n along with the discussion of intensional entities, only in order to anticipate some \n objections which might be leveled against our theory \n (e.g. that it is committed to algebraic realism, or to an universal extensionality principle for the most \n basic sort of possible entities). Because of this, in what follows we will simply be talking about \n extensional entities and will pay no attention to whether they are real or virtual unless \n it becomes important (and in general it won't be).\n\n-/\n\n-- additional auxiliary lemmas involving compact events and entities\nsection compact\n -- It is annoying that mathlib doesn't export this\n -- sort of lemma using sets of sets instead of set families.\n lemma event.compact.elim {e : ω.event} : e.compact → (∀ (S : set ω.event), \n (∀ i ∈ S, is_open i) →\n e ⇒ ⋃₀ S →\n ∃ s : set ω.event, s ⊆ S ∧ finite s ∧ e ⇒ ⋃₀ s)\n :=\n begin\n intros h S hS he,\n have c := @compact.elim_finite_subcover_image _ _ _ e S id h hS,\n specialize c _, swap,\n intros w hw,\n simp,\n specialize he hw,\n simp at he,\n exact he,\n simp at c,\n obtain ⟨s, h₁, h₂, h₃⟩ := c,\n refine ⟨s, h₁, h₂, _⟩,\n intros w hw,\n specialize h₃ hw,\n simp at h₃,\n simp,\n exact h₃,\n end\n\n lemma entity.compact.elim {e : ω.entity} : e.compact → (∀ {S : set ω.entity}, S.nonempty →\n e ⇒ Sup S →\n ∃ s : set ω.entity, s.nonempty ∧ s ⊆ S ∧ finite s ∧ e ⇒ Sup s)\n :=\n begin\n intros h S hS he,\n simp [Sup, has_Sup.Sup, hS, entity_Sup, has_entailment.entails] at he,\n have c := h.elim (entity.exists '' S),\n specialize c _, swap,\n intros i hi,\n simp at hi,\n obtain ⟨x, _, hx⟩ := hi,\n rw ←hx, exact x.existential,\n specialize c _, swap,\n simp [has_entailment.entails],\n exact he,\n obtain ⟨s, hs₁, hs₂, hs₃⟩ := c,\n have sne : s.nonempty,\n simp [sUnion, set.subset] at hs₃,\n obtain ⟨w, hw⟩ := e.possible,\n obtain ⟨ev, hev,_⟩ := hs₃ hw,\n exact ⟨ev, hev⟩,\n replace sne : {e : ω.entity | e.exists ∈ s}.nonempty,\n obtain ⟨ev, hev⟩ := sne,\n have c := hs₁ hev, simp [image] at c,\n obtain ⟨e',_, he'⟩ := c,\n rw ←he' at hev,\n exact ⟨e', hev⟩,\n refine ⟨{e | e.exists ∈ s}, sne, _⟩,\n constructor,\n intros e' he', simp at he',\n have c := hs₁ he', simp [image] at c,\n obtain ⟨e'', goal, eq⟩ := c,\n replace eq := (entity_ext_iff e'' e').2 eq,\n rwa ←eq,\n constructor,\n set S' := {e : ω.entity | e.exists ∈ s},\n have c : entity.exists '' S' = s,\n simp [image],\n ext, constructor; intro hyp,\n simp at hyp,\n obtain ⟨_, _, hyp⟩ := hyp,\n rwa ←hyp,\n simp,\n have c := hs₁ hyp, simp [image] at c,\n obtain ⟨e', _, eq⟩ := c,\n rw ←eq at hyp,\n exact ⟨e', hyp, eq⟩,\n have c₁ := entity_exists_inj.inj_on S',\n apply finite_of_finite_image c₁,\n rwa c,\n simp [Sup, has_Sup.Sup, sne, entity_Sup, has_entailment.entails, set.subset],\n simp [has_entailment.entails, sUnion, set.subset] at hs₃,\n intros w hw,\n obtain ⟨ev, hev₁,hev₂⟩ := hs₃ hw,\n specialize hs₁ hev₁, simp [image] at hs₁,\n obtain ⟨e', aux, he'⟩ := hs₁, clear aux,\n rw ←he' at hev₁, \n rw ←he' at hev₂,\n exact ⟨e', hev₁, hev₂⟩,\n end\n\nend compact\n\nend ontology\n\n", "meta": {"author": "maxd13", "repo": "topological_ontology", "sha": "68d21c9a00024fba3aed301e16c31e05733c1786", "save_path": "github-repos/lean/maxd13-topological_ontology", "path": "github-repos/lean/maxd13-topological_ontology/topological_ontology-68d21c9a00024fba3aed301e16c31e05733c1786/src/ontology.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5389832206876841, "lm_q2_score": 0.3073580105206753, "lm_q1q2_score": 0.16566081041459266}} {"text": "import for_mathlib.short_exact_sequence\n\nnoncomputable theory\n\nopen category_theory\nopen category_theory.limits\n\nuniverses v u\n\nnamespace category_theory\nvariables (𝒞 : Type u) [category.{v} 𝒞]\nvariables {C : Type u} [category.{v} C] {D : Type*} [category D]\nvariables [has_images C] [has_zero_morphisms C] [has_kernels C]\nvariables [has_images D] [has_zero_morphisms D] [has_kernels D]\n\n/-- Cohomological covariant delta functor. -/\nclass delta_functor (F : ℕ → C ⥤ D) :=\n(δ : Π (n : ℕ), short_exact_sequence.Trd C ⋙ (F n) ⟶ short_exact_sequence.Fst C ⋙ (F (n+1)))\n(mono : ∀ (A : short_exact_sequence C), mono ((F 0).map A.f))\n(exact' : ∀ (n : ℕ) (A : short_exact_sequence C), exact ((F n).map A.f) ((F n).map A.g))\n(exact_δ : ∀ (n : ℕ) (A : short_exact_sequence C), exact ((F n).map A.g) ((δ n).app A))\n(δ_exact : ∀ (n : ℕ) (A : short_exact_sequence C), exact ((δ n).app A) ((F (n+1)).map A.f))\n\nnamespace delta_functor\n\nvariables {𝒜 : Type*} [category 𝒜] [abelian 𝒜]\nvariables (F : ℕ → C ⥤ 𝒜) [delta_functor F]\n\nexample (A : short_exact_sequence C)\n (hA₂ : ∀ i, 0 < i → is_zero ((F i).obj A.2)) (hA₃ : ∀ i, 0 < i → is_zero ((F i).obj A.3))\n (i : ℕ) (hi : 1 < i) :\n is_zero ((F i).obj A.1) :=\nbegin\n obtain ⟨i, rfl⟩ : ∃ k, i = k + 2, { simpa only [add_comm] using nat.exists_eq_add_of_le hi },\n refine is_zero_of_exact_zero_zero' _ _ (delta_functor.δ_exact (i+1) A) _ _,\n { exact (hA₃ (i+1) i.succ_pos).eq_of_src _ _ },\n { refine (hA₂ (i+2) _).eq_of_tgt _ _, exact pos_of_gt hi }\nend\n\nend delta_functor\n\nend category_theory\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/backup/delta_functor.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.519521321952093, "lm_q2_score": 0.3174262785020255, "lm_q1q2_score": 0.1649097198297055}} {"text": "import doubleround\nimport littleendian\n\nimport category_theory.category.basic\nimport category_theory.core\n\nopen doubleround\nopen littleendian\nopen operations\nopen params\nopen utils\n\nopen category_theory\n\nnamespace core\n\nvariable [category (bitvec word_len)]\n\n/-!\n # Core\n\n - The `doubleround10` function and its inverse.\n - The `hash` and `core` functions, the non existing inverse.\n-/\n\n/-- Apply double round 10 times to a reduced input. -/\n@[simp] def doubleround_10 (X : matrixType): matrixType :=\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n doubleround_salsa20 $\n X\n\n/-- Inverse of `doubleround_10`. -/\n@[simp] def doubleround_10_inv (X : matrixType): matrixType :=\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n doubleround_salsa20_inv $\n X\n\n/- Just some notation for inverses. -/\nlocal notation `doubleround_10⁻¹` := doubleround_10_inv\n\n/-- The `doubleround` function is invertible. -/\nlemma doubleround_is_inv (I : doubleround_10 ≅ doubleround_10⁻¹) : I.hom ≫ I.inv = 𝟙 doubleround_10 :=\n by rw [iso.hom_inv_id]\n\n/-!\n## Core and hash definitions\n\n - There is no isomorphism (≅) between `core` and any `core⁻¹`.\n - There is no isomorphism (≅) between `hash` and any `hash⁻¹` because the use of `core` and `core⁻¹`.\n-/\n\n/-- Do addition modulo 2^32 of the reduced input and the doubleround of the reduced input. -/\n@[simp] def core (X : matrixType) : matrixType := mod_matrix (doubleround_10 X) X\n\n/-- Do the hash. -/\ndef hash (X : matrix64Type) : matrix64Type := aument (core (reduce X))\n\n\nend core\n", "meta": {"author": "oxarbitrage", "repo": "salsa20", "sha": "12d0ebb3c27801931e61d470fb2ed548a5562578", "save_path": "github-repos/lean/oxarbitrage-salsa20", "path": "github-repos/lean/oxarbitrage-salsa20/salsa20-12d0ebb3c27801931e61d470fb2ed548a5562578/src/core.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5273165085228825, "lm_q2_score": 0.3106943895971202, "lm_q1q2_score": 0.16383428074000161}} {"text": "import data.real.irrational\nimport topology.basic\nimport algebra.order.floor\n\n\n--OUTPUT 1\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : (∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j)), from sorry,\n have h2 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1)), from sorry,\n have h3 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 0), from sorry,\n have h4 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 1), from sorry,\n have h5 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ ({0} ∪ {1})), from sorry,\n have h6 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ ({0} ∪ {1})), from sorry,\n have h7 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -1) ∪ (1, ∞)), from sorry,\n have h8 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -1), from sorry,\n have h9 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 2), from sorry,\n have h10 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ ({-1} ∪ {2})), from sorry,\n have h11 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ ({-1} ∪ {2})), from sorry,\n have h12 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -2) ∪ (2, ∞)), from sorry,\n have h13 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -2), from sorry,\n have h14 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 3), from sorry,\n have h15 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ ({-2} ∪ {3})), from sorry,\n have h16 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ ({-2} ∪ {3})), from sorry,\n have h17 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -3) ∪ (3, ∞)), from sorry,\n have h18 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -3), from sorry,\n have h19 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 4), from sorry,\n have h20 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ ({-3} ∪ {4})), from sorry,\n have h21 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ ({-3} ∪ {4})), from sorry,\n have h22 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -4) ∪ (4, ∞)), from sorry,\n have h23 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -4), from sorry,\n have h24 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ 5), from sorry,\n have h25 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ ({-4} ∪ {5})), from sorry,\n have h26 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ ({-4} ∪ {5})), from sorry,\n have h27 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -5) ∪ (5, ∞)), from sorry,\n have h28 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -5), from sorry,\n have h29 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-5}), from sorry,\n have h30 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ {-5}), from sorry,\n have h31 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -5) ∪ (5, ∞)), from sorry,\n have h32 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -6), from sorry,\n have h33 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-6}), from sorry,\n have h34 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ {-6}), from sorry,\n have h35 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -6) ∪ (6, ∞)), from sorry,\n have h36 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -7), from sorry,\n have h37 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-7}), from sorry,\n have h38 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ {-7}), from sorry,\n have h39 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -7) ∪ (7, ∞)), from sorry,\n have h40 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -8), from sorry,\n have h41 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-8}), from sorry,\n have h42 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ {-8}), from sorry,\n have h43 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -8) ∪ (8, ∞)), from sorry,\n have h44 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -9), from sorry,\n have h45 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-9}), from sorry,\n have h46 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (set.Icc 0 1) \\ {-9}), from sorry,\n have h47 : (∀ (i : ℤ), int.fract (α * ↑i) ∈ (-∞, -9) ∪ (9, ∞)), from sorry,\n have h48 : (∀ (i : ℤ), int.fract (α * ↑i) ≠ -10), from sorry,\n have h49 : (∀ (i : ℤ), int.fract (α * ↑i) ∉ {-10}), from sorry,\n have h50 : (∀ (i : ℤ), int.fract\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n sorry\nend\n\n--OUTPUT 3\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), \n from sorry, \n \n have S := {x : ℝ | ∃ (i : ℤ), x = int.fract (α * ↑i)},\n have h2 : S ⊆ set.Icc 0 1, \n from sorry,\n have h3 : ∀ (x : ℝ), x ∈ S → x ∈ closure S, from sorry,\n have h4 : S ⊆ closure S, from sorry,\n \n have h5 : closure S ⊆ set.Icc 0 1, from sorry,\n \n have h6 : set.Icc 0 1 ⊆ closure S, from \n assume x,\n assume h6 : x ∈ set.Icc 0 1,\n assume ε : ℝ,\n assume h7 : ε > 0,\n cases set.mem_Icc.mp h6 with h6 h6,\n let x := (λ (m : ℤ), int.fract (α * ↑m)),\n \n \n \n \n cases set.mem_Icc.mp h6 with h6 h6,\n \n \n \n \n \n \n \n \n \n \n \n \nend\n\n--OUTPUT 4\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : (∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from begin\n assume (i j : ℤ),\n assume h1 : (i ≠ j),\n assume h2 : int.fract (α * ↑i) = int.fract (α * ↑j),\n calc α = (↑(int.fract (α * ↑i)) + ↑(int.floor (α * ↑i))) * 1 : by sorry\n ... = (int.fract (α * ↑i) + int.floor (α * ↑i)) * (1 : ℝ) : by sorry\n ... = int.fract (α * ↑i) + int.floor (α * ↑i) : by rw mul_one\n ... = int.fract (α * ↑i) + int.floor (α * ↑j) : by rw h2\n ... = int.fract (α * ↑i) + int.fract (α * ↑j) + int.floor (α * ↑j) - int.fract (α * ↑j) : by rw nat.add_sub_cancel -- this is not a valid line\n ... = int.fract (α * ↑i) + int.fract (α * ↑j) + (α * ↑j) - int.fract (α * ↑j) : by rw int.floor_eq\n ... = int.fract (α * ↑i) + int.fract (α * ↑j) + (α * ↑j) - int.fract (α * ↑i) : by rw h2\n ... = int.fract (α * ↑i) + (1 : ℝ) * (α * ↑j) - int.fract (α * ↑i) : by rw int.fract_eq\n ... = int.fract (α * ↑i) + α * ↑j - int.fract (α * ↑i) : by rw mul_one\n ... = α * ↑j + int.fract (α * ↑i) - int.fract (α * ↑i) : by rw add_comm\n ... = α * ↑j : by rw nat.add_sub_cancel\n ... = ↑j * α : by rw mul_comm\n ... = ↑j * (α : ℝ) : by rw mul_comm\n ... = ↑j * ↑i : by rw int.fract_eq\n ... = ↑i * ↑j : by rw mul_comm\n ... = ↑i * α : by rw h2\n ... = (α : ℝ) * ↑i : by rw mul_comm\n ... = α : by rw int.fract_eq\n ... ∈ ℚ : by sorry,\n show false, from sorry,\n end,\n\n have set_S : (set.univ : set ℤ) = set.Iio 0, \n from sorry, --this is no a valid line\n\n have h2 : (λ m : ℤ, (int.fract (α * m))) '' (set.Iio 0) = (λ m : ℤ, int.fract (α * ↑m)) '' (set.univ : set ℤ),\n from sorry, --this is no a valid line\n\n have h3 : (λ m : ℤ, int.fract (α * ↑m)) '' (set.univ : set ℤ) = (λ m : ℤ, int.fract (α * ↑m)) '' set.univ,\n from sorry, --this is no a valid line\n\n have h4 : ∀ (i : ℕ), ∃ (x : ℝ), x ∈ (λ m : ℤ, int.fract (α * ↑m)) '' (set.univ : set ℤ),\n from sorry, --this is no a valid line\n\n have h5 : ∀ (i : ℕ), ∃ (x : ℝ), x ∈ (λ m : ℤ, int.fract (α * ↑m)) '' set.univ,\n from sorry, --this is no a valid line\n\n have h6 : ∀ (i : ℕ), ∃ m, m ∈ set.univ ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h7 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h8 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h9 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h10 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h11 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h12 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h13 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h14 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h15 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h16 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h17 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h18 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h19 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h20 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h21 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h22 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h23 : ∀ i : ℕ, ∃ m, m ∈ set.Iio 0 ∧ (int.fract (α * ↑m) = i),\n from sorry, --this is no a valid line\n\n have h24 :\nend --Needs more than 2000 tokens!\n\n--OUTPUT 5\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, i ≠ j → (λ (m : ℤ), int.fract (α * ↑m)) i ≠ (λ (m : ℤ), int.fract (α * ↑m)) j,\n {\n intros i j h12,\n assume h13 : (λ (m : ℤ), int.fract (α * ↑m)) i = (λ (m : ℤ), int.fract (α * ↑m)) j,\n have h14 : (α * ↑i) - (int.floor (α * ↑i)) = int.fract (α * ↑i), \n from sorry,\n have h15 : (α * ↑j) - (int.floor (α * ↑j)) = int.fract (α * ↑i), \n from sorry,\n have h16 : (α * ↑i) = α * ↑i - (int.floor (α * ↑i)) + (int.floor (α * ↑i)), \n from sorry,\n have h17 : (α * ↑j) = α * ↑j - (int.floor (α * ↑j)) + (int.floor (α * ↑j)), \n from sorry,\n have h18 : α = (int.floor (α * ↑i) - (int.floor (α * ↑j)))/(i - j), \n begin\n calc α = (α * ↑i - (int.floor (α * ↑i)))/(i - j) : by sorry\n ... = ((α * ↑i) - (int.floor (α * ↑i)) + (int.floor (α * ↑i)))/(i - j) : by sorry\n ... = ((α * ↑i) + (int.floor (α * ↑i)) - (int.floor (α * ↑i)))/(i - j) : by sorry\n ... = ((α * ↑i) + (int.floor (α * ↑i)) - (int.floor (α * ↑j)) - (int.floor (α * ↑i)) + (int.floor (α * ↑j)))/(i - j) : by sorry\n ... = ((α * ↑i) + (int.floor (α * ↑j)) - (int.floor (α * ↑i)) + (int.floor (α * ↑j)) - (int.floor (α * ↑i)))/(i - j) : by sorry\n ... = ((α * ↑j) + (int.floor (α * ↑j)) - (int.floor (α * ↑i)))/(i - j) : sorry\n ... = ((α * ↑j) - (int.floor (α * ↑j)) + (int.floor (α * ↑j)))/(i - j) : by sorry\n ... = (α * ↑j - (int.floor (α * ↑j)))/(i - j) : by sorry\n ... = α : sorry,\n end,\n show false, from hα_irrat h18,\n },\n \n have h2 : ∀ i j : ℤ, ((λ (m : ℤ), int.fract (α * ↑m)) i = (λ (m : ℤ), int.fract (α * ↑m)) j) ↔ (i = j), \n from sorry,\n \n have h3 : ∀ i j : ℤ, i ≠ j → ((λ (m : ℤ), int.fract (α * ↑m)) i ≠ (λ (m : ℤ), int.fract (α * ↑m)) j) ↔ (i ≠ j),\n from sorry,\n \n have h4 : ∀ i j : ℤ, ((λ (m : ℤ), int.fract (α * ↑m)) i = (λ (m : ℤ), int.fract (α * ↑m)) j) ↔ (i = j) ↔ ((λ (m : ℤ), int.fract (α * ↑m)) i ≠ (λ (m : ℤ), int.fract (α * ↑m)) j) ↔ (i ≠ j), \n from sorry,\n \n have h5 : equiv.set ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h6 : inj ((λ (m : ℤ), int.fract (α * ↑m)) : ℤ → (λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h7 : ∀ i j : ℤ, ((λ (m : ℤ), int.fract (α * ↑m)) i = (λ (m : ℤ), int.fract (α * ↑m)) j) ↔ (i = j),\n from sorry,\n \n have h8 : setoid ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h9 : ∀ i j : ℤ, pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) i ↔ pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) j → i = j,\n from sorry,\n \n have h10 : ∀ i j : ℤ, pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) i ↔ pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) j ↔ i = j,\n from sorry,\n \n have h11 : decidable_eq ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h12 : fintype ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h13 : unique ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) := sorry,\n \n have h14 : ¬(∃ i : ℤ, (∀ (j : ℤ), pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) i ↔ pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) j)) := \n begin\n assume h14,\n have h15 : ∀ j : ℤ, pfinset.finset.mem (@set.univ ℤ) j ↔ pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m : ℤ), int.fract (α * ↑m)) j,\n from sorry,\n \n have h16 : ∀ j : ℤ, j ∈ (@set.univ ℤ) ↔ pfinset.finset.mem ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) (λ (m :\nend --Needs more than 2000 tokens!\n\n--OUTPUT 6\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * i) ≠ int.fract (α * j)), from sorry,\n have h2 : ∀ i j : ℤ, (i ≠ j) → (α * i ≠ α * j), from sorry,\n \n have h3 : ∀ i j : ℤ, (i ≠ j) → (i * α ≠ j * α),\n from sorry,\n\n have h4 : ∀ i j : ℤ, (i ≠ j) → (i * α - (i * α).floor ≠ j * α - (j * α).floor), \n from sorry,\n\n have h5 : ∀ i j : ℤ, (i ≠ j) → (i * α - (i * α).floor ≠ j * α - (j * α).floor), \n from sorry,\n\n have h6 : ∀ i j : ℤ, (i ≠ j) → (i * α - (i * α).floor ≠ j * α - (j * α).floor), \n from sorry,\n\n have h7 : ∀ i : ℤ, (i * α - (i * α).floor) ≠ 0, \n from sorry,\n \n have h8 : ∀ i : ℤ, (i * α - (i * α).floor) > 0, \n from sorry,\n \n have h9 : ∀ i : ℤ, (i * α - (i * α).floor) < 1, \n from sorry,\n \n have h10 : ∀ i : ℤ, i * α ≠ 0, \n from sorry,\n \n have h11 : ∀ i : ℤ, i * α ≠ 1, \n from sorry,\n \n have h12 : ∀ i : ℤ, i * α - (i * α).floor ≠ 0, \n from sorry,\n \n have h13 : ∀ i : ℤ, i * α - (i * α).floor ≠ 1, \n from sorry,\n \n have h14 : ∀ i : ℤ, i * α ≠ 0, \n from sorry,\n \n have h15 : ∀ i : ℤ, i * α ≠ 1, \n from sorry,\n\n have h16 : ∀ i : ℤ, (i * α - (i * α).floor) ≠ 0, \n from sorry,\n \n have h17 : ∀ i : ℤ, (i * α - (i * α).floor) ≠ 1, \n from sorry,\n \n have h18 : ∀ i : ℤ, (i * α - (i * α).floor) ≠ 0, \n from sorry,\n \n have h19 : ∀ i : ℤ, (i * α - (i * α).floor) ≠ 1, \n from sorry,\n \n have h20 : ∀ x : ℤ, (∀ i : ℤ, i * α - (i * α).floor ≠ x) → (x < 0) ∨ (x > 1)\n := assume (x : ℤ) (h20 : ∀ i : ℤ, i * α - (i * α).floor ≠ x), \n begin\n have h21 : ∀ i : ℤ, ((i * α - (i * α).floor ≠ x) ∧ (i * α - (i * α).floor ≠ 0))\n := assume (i : ℤ), ⟨h20 i, h18 i⟩,\n have h22 : ∀ i : ℤ, ((i * α - (i * α).floor ≠ x) ∧ (i * α - (i * α).floor ≠ 1))\n := assume (i : ℤ), ⟨h20 i, h17 i⟩,\n\n have h23 : ∀ i : ℤ, ((i * α - (i * α).floor ≠ x) ∧ (i * α - (i * α).floor ≠ 0) ∧ (i * α - (i * α).floor ≠ 1))\n := assume (i : ℤ), and.intro (h21 i) (h22 i),\n\n have h24 : ∀ i : ℤ, (x < i * α - (i * α).floor) ∨ (x > i * α - (i * α).floor)\n := assume (i : ℤ), lt_or_gt_of_ne (h20 i),\n\n have h25 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h26 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h27 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h28 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h29 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h30 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n \n have h31 : ((x < 0) ∨ (0 < x))\n := sorry,\n\n have h32 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h33 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h34 : ((x < 0) ∨ (0 < x))\n := sorry,\n\n have h35 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h36 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h37 : ((x < 0) ∨ (0 < x))\n := sorry,\n\n have h38 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h39 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h40 : ((x < 0) ∨ (0 < x))\n := sorry,\n\n have h41 : ∀ i : ℤ, ((x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x))\n := assume (i : ℤ), sorry,\n\n have h42 : ∀ i : ℤ, ((x < 0) ∨ (0 < x))\n := assume (i : ℤ), sorry,\n\n have h43 : ((x < 0) ∨ (0 < x))\n := sorry,\n\n have h44 : ∀ i : ℤ, (x < i * α - (i * α).floor) ∨ (i * α - (i * α).floor < x)\n := assume (i : ℤ), sorry,\n\n have h45 : ∀ i : ℤ, (x < 0) ∨ (0 < x)\n := assume (i\nend --Needs more than 2000 tokens!\n\n--OUTPUT 7\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 := begin\n have h2 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from \n begin\n assume (i j : ℤ) (h3 : i ≠ j),\n assume (h4 : int.fract (α * ↑i) = int.fract (α * ↑j)),\n have h5 : α = (int.fract (α * ↑i) - int.fract (α * ↑j))/(i - j), by simp [h4],\n exact hα_irrat h5,\n end,\n\n let S : set ℝ := {int.fract (α * ↑i) | i : ℤ},\n\n have h6 : irrational α, from hα_irrat,\n have h7 : S.finite = ff, from set.finite_iff.mpr sorry,\n \n have h8 : ∀ x : ℝ, (∃ (x' : S), x' ≤ x) ∨ (∃ (x' : S), x ≤ x') := \n begin\n assume (x : ℝ),\n --split\n cases classical.em (∃ (x' : S), x' ≤ x) with hh hh,\n {left,\n exact hh\n },\n {right,\n exact show ∃ (x' : S), x ≤ x',\n from sorry,\n },\n end,\n\n have h9 : (∀ (x : S), ∀ (n : ℕ), 0 < n → int.fract (↑n * x) < 1)\n ∧ (∀ (x : S), ∀ (n : ℕ), n < 0 → 0 < int.fract (↑n * x)) := sorry,\n \n set_option trace.class_instances true,\n have h10 : S.finite = ff, from set.finite_iff.mpr (sorry),\n have h11 : ¬ (S.finite ∧ ¬ ∃ x : S, ∀ y : S, ¬ x ≤ y ∧ ¬ y ≤ x), from sorry,\n set_option trace.class_instances false,\n\n have h12 : ¬ ∃ x : S, ∀ y : S, ¬ x ≤ y ∧ ¬ y ≤ x, from sorry,\n have h13 : ∃ x : S, ∀ y : S, y < x ∨ x < y, from sorry,\n\n have h14 : ∃ y : S, ∀ x : S, y < x ∨ x < y, from sorry,\n\n let y := classical.some h14, let m := classical.some sorry,\n\n have h15 : (∀ x : S, x < y ∨ y < x) ∧ ∃ m, y = classical.some (sorry), from sorry,\n \n have h16 : ∀ (m n : ℕ), int.fract (m * ↑y) < int.fract (n * ↑y) ∨ int.fract (n * ↑y) < int.fract (m * ↑y), \n from sorry,\n\n have h17 : ∃ m, ∀ n, ∃ p, m ≤ p ∧ p ≤ n ∧ (int.fract (p * ↑y) ≤ 1/2) ∧ (Π y, int.fract (p * ↑y) ≤ 1/2 → n ≤ p),\n from sorry,\n\n have h18 : ∃ m, ∀ n, ∃ p, m ≤ p ∧ p ≤ n ∧ (int.fract (p * ↑y) ≤ 1/2) \n ∧ (Π y, int.fract (p * ↑y) ≤ 1/2 → p ≤ n), from sorry,\n\n have h19 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h20 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → p ≤ m ∧ m ≤ p,\n from sorry,\n \n have h21 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ p ≤ m,\n from sorry,\n\n have h22 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ p ≤ n ∧ m ≤ p,\n from sorry,\n\n have h23 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h24 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h25 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h26 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h27 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h28 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h29 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h30 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from sorry,\n\n have h31 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int.fract (p * ↑y) ≤ 1/2 → m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ m ≤ p ∧ p ≤ n,\n from h30,\n \n have h32 : ∃ m, ∀ n, ∃ p, int.fract (p * ↑y) ≤ 1/2 ∧ int\nend --Needs more than 2000 tokens!\n\n--OUTPUT 8\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : (∃ m : ℤ, 0 < m) → (∃ m : ℤ, m < 0), from sorry,\n have h2 : irrational α → ∀ m : ℤ, ∀ n : ℤ, m ≠ n → int.fract (α * ↑m) ≠ int.fract (α * ↑n), from sorry,\n have h3 : ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) ∈ closure (λ (m : ℤ), int.fract (α * ↑m) '' (@set.univ ℤ)), from sorry,\n have h4 : closure (λ (m : ℤ), int.fract (α * ↑m) '' (@set.univ ℤ)) ⊆ closure (set.Icc 0 1), from sorry,\n have h5 : closure (set.Icc 0 1) ⊆ closure (λ (m : ℤ), int.fract (α * ↑m) '' (@set.univ ℤ)), from sorry,\n show closure (λ (m : ℤ), int.fract (α * ↑m) '' (@set.univ ℤ)) = set.Icc 0 1, from sorry,\nend\n\n--OUTPUT 9\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 := \nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → \n int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from sorry,\n\n have h2 : ∀ i, i ∈ @set.univ ℤ → int.fract (α * ↑i) ∈ set.Icc 0 1,\n from sorry,\n\n show closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1,\n from sorry,\nend\n\n--OUTPUT 10\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h0 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), {\n assume i j h1,\n have h2 : (α * ↑i - (α * ↑i).floor) = (α * ↑j - (α * ↑j).floor), {\n rw int.fract_eq_sub_floor,\n },\n have h3 : α = ((((α * ↑i).floor : ℝ) - ((α * ↑j).floor : ℝ)) / (i - j)), {\n rw h2,\n field_simp,\n },\n have h4 : irrational α, {\n exact hα_irrat,\n },\n have h5 : irrational (((((α * ↑i).floor) - ((α * ↑j).floor)) / (i - j)) : ℝ), {\n rw ← h3,\n exact h4,\n },\n have h6 : (((((α * ↑i).floor) - ((α * ↑j).floor)) / (i - j)) : ℝ) ∉ (@set.univ ℚ), {\n have h7 : ℚ ∉ {r : ℝ | irrational r}, {\n exact (irrational_of_rat_of_irrational_of_ne_bot ℚ),\n },\n assumption,\n },\n have h8 : (((((α * ↑i).floor) - ((α * ↑j).floor)) / (i - j)) : ℝ) ∉ set.univ, {\n rw ← (@set.mem_univ ℝ _),\n exact h6,\n },\n have h9 : (((((α * ↑i).floor) - ((α * ↑j).floor)) / (i - j)) : ℝ) ∉ set.range ((λ (m : ℤ), (α * ↑m) - (α * ↑m).floor) : ℤ → ℝ), {\n sorry,\n },\n have h10 : (((((α * ↑i).floor) - ((α * ↑j).floor)) / (i - j)) : ℝ) ∉ set.univ, {\n rw ← (@set.mem_univ ℝ _),\n exact h9,\n },\n exact h10,\n },\n have h1 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ∉ (λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ), {\n assume i j h2,\n have h3 : {m : ℤ | (int.fract (α * ↑m)) = (int.fract (α * ↑i))} ⊆ {m : ℤ | m = i}, { \n assume x h4,\n have h5 : int.fract (α * ↑x) = int.fract (α * ↑i), {\n exact h4,\n },\n have h6 : (int.fract (α * ↑x - α * ↑i)) = 0, {\n rw ← h5,\n field_simp,\n },\n rw int.fract_eq_sub_floor at h6,\n have h7 : int.fract (α * ↑x) = int.fract (α * ↑x - α * ↑i), {\n exact h6,\n },\n rw h7 at h5,\n have h8 : (int.fract (↑x * α - ↑i * α)) = (int.fract (α * ↑x - α * ↑i)), {\n have h9 : int.fract (↑x * α) = int.fract (α * ↑x),\n begin\n field_simp,\n end,\n have h10 : int.fract (↑i * α) = int.fract (α * ↑i), {\n field_simp,\n },\n rw h9 at h5,\n rw h10 at h5,\n exact h5,\n },\n have h11 : (int.fract (↑x * α - ↑i * α)) = 0, {\n exact h8,\n },\n have h12 : (int.fract (↑x * α - ↑i * α)) ∈ {r : ℝ | r = 0}, {\n exact h11,\n },\n have h13 : int.fract (↑x * α - ↑i * α) = 0, {\n have h14 : int.fract (↑x * α - ↑i * α) ∈ {r : ℝ | r = 0}, {\n exact h11,\n },\n rw ← (@set.mem_univ ℝ _),\n assumption,\n },\n rw h13 at h4,\n have h15 : ↑x * α - ↑i * α = 0, {\n field_simp,\n },\n have h16 : ↑x = ↑i, {\n rw ← @set.mem_univ ℤ _ at h4,\n have h17 : ↑x * α - ↑i * α = (↑x - ↑i) * α, {\n ring,\n },\n rw h17 at h15,\n have h18 : (↑x - ↑i) * α = 0, {\n exact h15,\n },\n have h19 : ↑x - ↑i = 0, {\n have h20 : α ≠ 0, {\n have h21 : ¬ (α = 0), {\n have h22 : irrational α, {\n exact hα_irrat,\n },\n have h23 : ¬ (α = 0), {\n have h24 : α ∈ (@set.univ ℝ), {\n exact set.mem_univ α,\n },\n have h25 : α ∉ ({r : ℝ | rational r}), {\n rw set.mem_compl,\n exact h22,\n },\n exact h25,\n },\n exact h23,\n },\n exact h21,\n },\n field_simp,\n },\n exact h19,\n },\n have h17 : x = i, {\n exact h16,\n },\n exact h17,\n },\n have h18 : {m : ℤ | (int.fract (α * ↑m)) = (int.fract (α * ↑i))} ⊆ {i}, {\n have h19 : {m : ℤ | (int.fract (α * ↑m)) = (int.fract (α * ↑i))} ⊆ {m : ℤ | m = i}, {\n exact h3,\n },\n exact h19,\n },\n have h20 : {m : ℤ | (int.fract (α * ↑m)) = (int.fract (α * ↑i))} ⊆ {i}, {\n have h21 : {m : ℤ | (int.fract (α * ↑m)) = (int.fract (α * ↑i))} ⊆ {i}, {\n exact h3,\n },\n exact h21,\n },\n have h22 : {m : ℤ | m = i} ⊆ (λ (m : ℤ), (int.fract (α * ↑m))), {\n assume x h23,\n have h24 : x = i, {\n exact h23,\n },\n have h25 : int.fract (α * ↑x) = int.fract (α * ↑i), {\n have h26 : α ≠ 0, {\n have h27 : α ∈ @set.univ ℝ, {\n exact set.mem_univ α,\n },\n have h28 : α ∉ ({r : ℝ | rational r} : set ℝ), {\n rw set.mem_compl,\n exact hα_irrat,\n },\n exact h28,\n },\n have h29 : int.fract (α * ↑x - α * ↑i) = 0\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from sorry,\n have h2 : (A ∩ B) ⊆ A, from sorry,\n have h3 : (A ∩ B) ⊆ S, from sorry,\n show (A ∩ B) ∈ 𝒫 S, from sorry,\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by sorry\n ... = x*(x+y) + y*(x+y) : by sorry\n ... = x*x + x*y + y*x + y*y : by sorry\n ... = x^2 + 2*x*y + y^2 : by sorry,\nend\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from sorry,\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from sorry,\n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from sorry,\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from sorry,\n\n have h5 : ∀ a : G, classical.some (h3 a) = (1 : G), from sorry,\n have h6 : ∀ a : G, classical.some (h4 a) = (1 : G), from sorry,\n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {\n use (1 : G),\n have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {\n assume (e : G) (h7 : ∀ a : G, e * a = a ∧ a * e = a),\n have h8 : ∀ a : G, e = classical.some (h3 a), from sorry,\n have h9 : ∀ a : G, e = classical.some (h4 a), from sorry,\n show e = (1 : G), from sorry, \n },\n sorry,\n }\nend\n\n/--`theorem`\nSqueeze Theorem for Real Numbers\nLet $\\sequence {x_n}$, $\\sequence {y_n}$ and $\\sequence {z_n}$ be sequences in $\\R$.\n\nLet $\\sequence {y_n}$ and $\\sequence {z_n}$ both be convergent to the following limit:\n:$\\ds \\lim_{n \\mathop \\to \\infty} y_n = l, \\lim_{n \\mathop \\to \\infty} z_n = l$\n\nSuppose that:\n:$\\forall n \\in \\N: y_n \\le x_n \\le z_n$\n\n\nThen:\n:$x_n \\to l$ as $n \\to \\infty$\nthat is:\n:$\\ds \\lim_{n \\mathop \\to \\infty} x_n = l$\n\n`proof`\nFrom Negative of Absolute Value:\n:$\\size {x - l} < \\epsilon \\iff l - \\epsilon < x < l + \\epsilon$\n\nLet $\\epsilon > 0$.\n\nWe need to prove that:\n:$\\exists N: \\forall n > N: \\size {x_n - l} < \\epsilon$\n\nAs $\\ds \\lim_{n \\mathop \\to \\infty} y_n = l$ we know that:\n:$\\exists N_1: \\forall n > N_1: \\size {y_n - l} < \\epsilon$\n\nAs $\\ds \\lim_{n \\mathop \\to \\infty} z_n = l$ we know that:\n:$\\exists N_2: \\forall n > N_2: \\size {z_n - l} < \\epsilon$\n\n\nLet $N = \\max \\set {N_1, N_2}$.\n\nThen if $n > N$, it follows that $n > N_1$ and $n > N_2$.\n\nSo:\n:$\\forall n > N: l - \\epsilon < y_n < l + \\epsilon$\n:$\\forall n > N: l - \\epsilon < z_n < l + \\epsilon$\n\nBut:\n:$\\forall n \\in \\N: y_n \\le x_n \\le z_n$\n\nSo:\n:$\\forall n > N: l - \\epsilon < y_n \\le x_n \\le z_n < l + \\epsilon$\n\nand so:\n:$\\forall n > N: l - \\epsilon < x_n < l + \\epsilon$\n\nSo:\n:$\\forall n > N: \\size {x_n - l} < \\epsilon$\n\nHence the result.\n{{qed}}\n\n-/\ntheorem squeeze_theorem_real_numbers (x y z : ℕ → ℝ) (l : ℝ) : \nlet seq_limit : (ℕ → ℝ) → ℝ → Prop := λ (u : ℕ → ℝ) (l : ℝ), ∀ ε > 0, ∃ N, ∀ n > N, |u n - l| < ε in\n seq_limit y l → seq_limit z l → (∀ n : ℕ, (y n) ≤ (x n) ∧ (x n) ≤ (z n)) → seq_limit x l :=\nbegin\n assume seq_limit (h2 : seq_limit y l) (h3 : seq_limit z l) (h4 : ∀ (n : ℕ), y n ≤ x n ∧ x n ≤ z n) (ε), \n\n have h5 : ∀ x, |x - l| < ε ↔ (((l - ε) < x) ∧ (x < (l + ε))), \n from sorry,\n \n assume (h7 : ε > 0),\n cases h2 ε h7 with N1 h8,\n cases h3 ε h7 with N2 h9,\n let N := max N1 N2,\n use N,\n\n have h10 : ∀ n > N, n > N1 ∧ n > N2 := sorry,\n have h11 : ∀ n > N, (((l - ε) < (y n)) ∧ ((y n) ≤ (x n))) ∧ (((x n) ≤ (z n)) ∧ ((z n) < l+ε)), \n from sorry,\n\n have h15 : ∀ n > N, ((l - ε) < (x n)) ∧ ((x n) < (l+ε)), \n from sorry,\n\n show ∀ (n : ℕ), n > N → |x n - l| < ε, \n from sorry,\nend\n\n/--`theorem`\nDensity of irrational orbit\nThe fractional parts of the integer multiples of an irrational number form a dense subset of the unit interval\n`proof`\nLet $\\alpha$ be an irrational number. Then for distinct $i, j \\in \\mathbb{Z}$, we must have $\\{i \\alpha\\} \\neq\\{j \\alpha\\}$. If this were not true, then\n$$\ni \\alpha-\\lfloor i \\alpha\\rfloor=\\{i \\alpha\\}=\\{j \\alpha\\}=j \\alpha-\\lfloor j \\alpha\\rfloor,\n$$\nwhich yields the false statement $\\alpha=\\frac{\\lfloor i \\alpha\\rfloor-\\lfloor j \\alpha\\rfloor}{i-j} \\in \\mathbb{Q}$. Hence,\n$$\nS:=\\{\\{i \\alpha\\} \\mid i \\in \\mathbb{Z}\\}\n$$\nis an infinite subset of $\\left[0,1\\right]$.\n\nBy the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. One can thus find pairs of elements of $S$ that are arbitrarily close. Since (the absolute value of) the difference of any two elements of $S$ is also an element of $S$, it follows that $0$ is a limit point of $S$.\n\nTo show that $S$ is dense in $[0, 1]$, consider $y \\in[0,1]$, and $\\epsilon>0$. Then by selecting $x \\in S$ such that $\\{x\\}<\\epsilon$ (which exists as $0$ is a limit point), and $N$ such that $N \\cdot\\{x\\} \\leq y<(N+1) \\cdot\\{x\\}$, we get: $|y-\\{N x\\}|<\\epsilon$.\n\nQED\n-/\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof_outline-Natural-Language-Proof-Translation/Correct_statement-lean_proof_outline-4_few_shot_temperature_0.8_max_tokens_2000_n_10/clean_files/Density of irrational orbit.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.7217432062975979, "lm_q2_score": 0.22541661063147309, "lm_q1q2_score": 0.16269290730989658}} {"text": "import data.real.irrational\nimport topology.basic\nimport algebra.order.floor\n\n\n--OUTPUT 1\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h2 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h3 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h4 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h5 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h6 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h7 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h8 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h9 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h10 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h11 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h12 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h13 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h14 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h15 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h16 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h17 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h18 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h19 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h20 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h21 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h22 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h23 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h24 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h25 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h26 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h27 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h28 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h29 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h30 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_mul, int.fract_eq_of_eq],\n have h31 : ∀ (i j : ℤ), i\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from assume (i j : ℤ) (h1 : i ≠ j),\n have h2 : (α * ↑i) - (int.floor (α * ↑i)) = (int.fract (α * ↑i)),\n from by auto [int.fract_eq_iff_eq_or_eq_add_one],\n have h3 : (α * ↑j) - (int.floor (α * ↑j)) = (int.fract (α * ↑j)),\n from by auto [int.fract_eq_iff_eq_or_eq_add_one],\n have h4 : (α * ↑i) - (int.floor (α * ↑i)) = (α * ↑j) - (int.floor (α * ↑j)),\n from by auto [h2, h3],\n have h5 : (α * ↑i) - (int.floor (α * ↑i)) = (α * ↑j) - (int.floor (α * ↑j)),\n from by auto [h4],\n have h6 : α = (int.floor (α * ↑i) - int.floor (α * ↑j)) / (i - j),\n from by auto [h5, mul_sub, mul_comm, mul_assoc, mul_left_comm, mul_div_cancel'],\n have h7 : α ∈ ℚ,\n from by auto [h6],\n have h8 : irrational α,\n from by auto [hα_irrat],\n have h9 : false,\n from by auto [h8, h7],\n show (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h9],\n\n have h10 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h1],\n\n have h11 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h10],\n\n have h12 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h11],\n\n have h13 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h12],\n\n have h14 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h13],\n\n have h15 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h14],\n\n have h16 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h15],\n\n have h17 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h16],\n\n have h18 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h17],\n\n have h19 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h18],\n\n have h20 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h19],\n\n have h21 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h20],\n\n have h22 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h21],\n\n have h23 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h22],\n\n have h24 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h23],\n\n have h25 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h24],\n\n have h26 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h25],\n\n have h27 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h26],\n\n have h28 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h27],\n\n have h29 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h28],\n\n have h30 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h29],\n\n have h31 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h30],\n\n have h32 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h31],\n\n have h33 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h32],\n\n have h34 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h33],\n\n have h35 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h34],\n\n have h36 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h35],\n\n have h37 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h36],\n\n have h38 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)),\n from by auto [h37],\n\n have h39\nend --Needs more than 2000 tokens!\n\n--OUTPUT 3\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from \n begin\n assume (i j : ℤ) (h1 : i ≠ j),\n have h2 : i * α - ↑(floor (i * α)) = int.fract (α * ↑i), from by auto [int.fract],\n have h3 : j * α - ↑(floor (j * α)) = int.fract (α * ↑j), from by auto [int.fract],\n have h4 : int.fract (α * ↑i) = int.fract (α * ↑j), from by auto [h2, h3],\n have h5 : α = (floor (i * α) - floor (j * α)) / (i - j), from by auto [h4, int.fract_eq_iff_eq_or_eq_add_one],\n have h6 : α ∈ ℚ, from by auto [h5],\n have h7 : irrational α, from hα_irrat,\n show int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [h6, h7],\n end,\n\n have h2 : (λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ) ⊆ set.Icc 0 1, from by auto [int.fract_nonneg, int.fract_lt_one],\n\n have h3 : ∀ (x : ℝ), x ∈ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) → x ∈ set.Icc 0 1, from \n begin\n assume (x : ℝ) (h3 : x ∈ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ))),\n have h4 : ∀ (ε : ℝ), ε > 0 → ∃ (m : ℤ), abs (x - int.fract (α * ↑m)) < ε, from by auto [h3, closure_iff_nhds],\n have h5 : ∃ (m : ℤ), x < int.fract (α * ↑m) + 1, from by auto [int.fract_lt_one],\n have h6 : ∃ (m : ℤ), int.fract (α * ↑m) < x, from by auto [int.fract_nonneg],\n have h7 : ∃ (m : ℤ), abs (x - int.fract (α * ↑m)) < 1, from by auto [h4, h5, h6],\n cases h7 with m h7,\n have h8 : int.fract (α * ↑m) < x + 1, from by auto [h7],\n have h9 : int.fract (α * ↑m) < 1, from by auto [h8],\n have h10 : int.fract (α * ↑m) ≥ 0, from by auto [int.fract_nonneg],\n have h11 : x ∈ set.Icc 0 1, from by auto [h10, h9],\n show x ∈ set.Icc 0 1, from h11,\n end,\n\n have h4 : set.Icc 0 1 ⊆ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)), from \n begin\n have h4 : ∀ (x : ℝ), x ∈ set.Icc 0 1 → x ∈ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)), from \n begin\n assume (x : ℝ) (h4 : x ∈ set.Icc 0 1),\n have h5 : ∀ (ε : ℝ), ε > 0 → ∃ (m : ℤ), abs (x - int.fract (α * ↑m)) < ε, from \n begin\n assume (ε : ℝ) (h5 : ε > 0),\n have h6 : ∃ (N : ℤ), x < N + 1, from by auto [h4, lt_add_one],\n have h7 : ∃ (N : ℤ), N < x, from by auto [h4, lt_add_one],\n cases h6 with N h6,\n cases h7 with M h7,\n have h8 : abs (x - int.fract (α * ↑M)) < 1, from by auto [h7, int.fract_nonneg],\n have h9 : abs (x - int.fract (α * ↑N)) < 1, from by auto [h6, int.fract_lt_one],\n have h10 : abs (x - int.fract (α * ↑M)) < ε ∨ abs (x - int.fract (α * ↑N)) < ε, from by auto [h5, h8, h9],\n cases h10 with h10 h10,\n show ∃ (m : ℤ), abs (x - int.fract (α * ↑m)) < ε, from by auto [h10],\n show ∃ (m : ℤ), abs (x - int.fract (α * ↑m)) < ε, from by auto [h10],\n end,\n have h6 : x ∈ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)), from by auto [h5, closure_iff_nhds],\n show x ∈ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)), from h6,\n end,\n show set.Icc 0 1 ⊆ closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)), from by auto [h4],\n end,\n\n show closure ((λ (m : ℤ), int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1, from by auto [h2, h3, h4, set.subset.antisymm],\nend\n\n--OUTPUT 4\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ m n : ℤ, (m ≠ n) → (int.fract (α * ↑m) ≠ int.fract (α * ↑n)),\n from assume (m n : ℤ) (h2 : m ≠ n),\n have h3 : α * ↑m - int.floor (α * ↑m) = int.fract (α * ↑m),\n from by auto [int.fract_eq_of_nat_floor],\n have h4 : α * ↑n - int.floor (α * ↑n) = int.fract (α * ↑n),\n from by auto [int.fract_eq_of_nat_floor],\n have h5 : (α * ↑m - int.floor (α * ↑m)) = (α * ↑n - int.floor (α * ↑n)),\n from by auto [h3, h4, eq_of_sub_eq_zero],\n have h6 : α = ((int.floor (α * ↑m) - int.floor (α * ↑n)) / ↑(m - n)),\n from by auto [h5, div_eq_iff_mul_eq],\n have h7 : (m - n) ≠ 0,\n from by auto [h2, sub_eq_zero],\n have h8 : α ∈ ℚ,\n from by auto [h6, h7, int.coe_nat_dvd, dvd_iff_mod_eq_zero, int.mod_eq_of_lt, int.coe_nat_lt],\n have h9 : ¬ (irrational α),\n from by auto [h8],\n show ¬ (int.fract (α * ↑m) = int.fract (α * ↑n)),\n from by auto [h9],\n\n let S : set ℤ := @set.univ ℤ,\n let f : ℤ → ℝ := λ (m : ℤ), int.fract (α * ↑m),\n let g : ℤ → ℝ := λ (m : ℤ), int.fract (α * ↑m),\n have h10 : ∀ x, f x = g x, from by auto [funext, f, g],\n have h11 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h1, f, g],\n have h12 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h1, f, g],\n have h13 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h14 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h15 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h16 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h17 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h18 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h19 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h20 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h21 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h22 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h23 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h24 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h25 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h26 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h27 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h28 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h29 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h30 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h31 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h32 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h33 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h34 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h35 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h36 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h37 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h38 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h39 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h40 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by auto [h11, h12],\n have h41 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ g n), \n from by auto [h11, h12],\n have h42 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ f n), \n from by auto [h11, h12],\n have h43 : ∀ m n : ℤ, (m ≠ n) → (f m ≠ f n), \n from by auto [h11, h12],\n have h44 : ∀ m n : ℤ, (m ≠ n) → (g m ≠ g n), \n from by\nend --Needs more than 2000 tokens!\n\n--OUTPUT 5\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → ((int.fract (α * ↑i)) ≠ (int.fract (α * ↑j))), from by auto [int.fract_eq_iff, hα_irrat],\n have h2 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [h1],\n have h3 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) < int.fract (α * ↑j) ∨ int.fract (α * ↑j) < int.fract (α * ↑i), from by auto [h2],\n have h4 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h3],\n have h5 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h4],\n\n have h6 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h5],\n have h7 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h6],\n have h8 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h7],\n have h9 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h8],\n have h10 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h9],\n have h11 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h10],\n have h12 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h11],\n have h13 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h12],\n have h14 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h13],\n have h15 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h14],\n have h16 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h15],\n have h17 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h16],\n have h18 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h17],\n have h19 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h18],\n have h20 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h19],\n have h21 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h20],\n have h22 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h21],\n have h23 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h22],\n have h24 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h23],\n have h25 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h24],\n have h26 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract (α * ↑i)), from by auto [h25],\n have h27 : ∀ (i j : ℤ), i ≠ j → (int.fract (α * ↑i)) < (int.fract (α * ↑j)) ∨ (int.fract (α * ↑j)) < (int.fract\nend --Needs more than 2000 tokens!\n\n--OUTPUT 6\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h2 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h3 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h4 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h5 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h6 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h7 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h8 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h9 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h10 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h11 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h12 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h13 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h14 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h15 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h16 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h17 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h18 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h19 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h20 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h21 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h22 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h23 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h24 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_eq_iff, irrational_iff_not_int_mul_eq_int] using [hα_irrat],\n\n have h25 : ∀ (i j : ℤ), i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j),\n from by auto [int.fract_\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by auto [set.subset_of_mem_powerset, set.subset_of_mem_powerset],\n have h2 : (A ∩ B) ⊆ A, from by auto [set.inter_subset_left],\n have h3 : (A ∩ B) ⊆ S, from by auto [set.subset.trans],\n show (A ∩ B) ∈ 𝒫 S, from by auto [set.mem_powerset],\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by auto [sq]\n ... = x*(x+y) + y*(x+y) : by auto [add_mul]\n ... = x*x + x*y + y*x + y*y : by auto [mul_comm, add_mul] using [ring]\n ... = x^2 + 2*x*y + y^2 : by auto [sq, mul_comm] using [ring]\nend\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by auto using [use (a⁻¹ * b)],\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by auto using [use b * a⁻¹], \n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from by auto [h1],\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from by auto [h2],\n\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from by auto [exists_unique.unique, h3, classical.some_spec, exists_unique.exists, mul_one],\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from by auto [exists_unique.unique, h4, classical.some_spec, exists_unique.exists, one_mul],\n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by auto [h3, h4, exists_unique.unique, classical.some_spec, exists_unique.exists] using [use (1 : G)],\nend\n\n/--`theorem`\nSqueeze Theorem for Real Numbers\nLet $\\sequence {x_n}$, $\\sequence {y_n}$ and $\\sequence {z_n}$ be sequences in $\\R$.\n\nLet $\\sequence {y_n}$ and $\\sequence {z_n}$ both be convergent to the following limit:\n:$\\ds \\lim_{n \\mathop \\to \\infty} y_n = l, \\lim_{n \\mathop \\to \\infty} z_n = l$\n\nSuppose that:\n:$\\forall n \\in \\N: y_n \\le x_n \\le z_n$\n\n\nThen:\n:$x_n \\to l$ as $n \\to \\infty$\nthat is:\n:$\\ds \\lim_{n \\mathop \\to \\infty} x_n = l$\n\n`proof`\nFrom Negative of Absolute Value:\n:$\\size {x - l} < \\epsilon \\iff l - \\epsilon < x < l + \\epsilon$\n\nLet $\\epsilon > 0$.\n\nWe need to prove that:\n:$\\exists N: \\forall n > N: \\size {x_n - l} < \\epsilon$\n\nAs $\\ds \\lim_{n \\mathop \\to \\infty} y_n = l$ we know that:\n:$\\exists N_1: \\forall n > N_1: \\size {y_n - l} < \\epsilon$\n\nAs $\\ds \\lim_{n \\mathop \\to \\infty} z_n = l$ we know that:\n:$\\exists N_2: \\forall n > N_2: \\size {z_n - l} < \\epsilon$\n\n\nLet $N = \\max \\set {N_1, N_2}$.\n\nThen if $n > N$, it follows that $n > N_1$ and $n > N_2$.\n\nSo:\n:$\\forall n > N: l - \\epsilon < y_n < l + \\epsilon$\n:$\\forall n > N: l - \\epsilon < z_n < l + \\epsilon$\n\nBut:\n:$\\forall n \\in \\N: y_n \\le x_n \\le z_n$\n\nSo:\n:$\\forall n > N: l - \\epsilon < y_n \\le x_n \\le z_n < l + \\epsilon$\n\nand so:\n:$\\forall n > N: l - \\epsilon < x_n < l + \\epsilon$\n\nSo:\n:$\\forall n > N: \\size {x_n - l} < \\epsilon$\n\nHence the result.\n{{qed}}\n\n-/\ntheorem squeeze_theorem_real_numbers (x y z : ℕ → ℝ) (l : ℝ) : \nlet seq_limit : (ℕ → ℝ) → ℝ → Prop := λ (u : ℕ → ℝ) (l : ℝ), ∀ ε > 0, ∃ N, ∀ n > N, |u n - l| < ε in\n seq_limit y l → seq_limit z l → (∀ n : ℕ, (y n) ≤ (x n) ∧ (x n) ≤ (z n)) → seq_limit x l :=\nbegin\n assume seq_limit (h2 : seq_limit y l) (h3 : seq_limit z l) (h4 : ∀ (n : ℕ), y n ≤ x n ∧ x n ≤ z n) (ε), \n\n have h5 : ∀ x, |x - l| < ε ↔ (((l - ε) < x) ∧ (x < (l + ε))), \n from by auto [abs_sub_lt_iff] using [linarith],\n \n assume (h7 : ε > 0),\n\n cases h2 ε h7 with N1 h8,\n cases h3 ε h7 with N2 h9,\n let N := max N1 N2,\n use N,\n\n have h10 : ∀ n > N, n > N1 ∧ n > N2 := by auto [lt_of_le_of_lt, le_max_left, le_max_right],\n \n have h11 : ∀ n > N, (((l - ε) < (y n)) ∧ ((y n) ≤ (x n))) ∧ (((x n) ≤ (z n)) ∧ ((z n) < l+ε)), \n from by auto [h8, h10, h5, h9],\n\n have h15 : ∀ n > N, ((l - ε) < (x n)) ∧ ((x n) < (l+ε)), \n from by auto [h11] using [linarith],\n\n show ∀ (n : ℕ), n > N → |x n - l| < ε, \n from by auto [h5, h15], \n\nend\n\n/--`theorem`\nDensity of irrational orbit\nThe fractional parts of the integer multiples of an irrational number form a dense subset of the unit interval\n`proof`\nLet $\\alpha$ be an irrational number. Then for distinct $i, j \\in \\mathbb{Z}$, we must have $\\{i \\alpha\\} \\neq\\{j \\alpha\\}$. If this were not true, then\n$$\ni \\alpha-\\lfloor i \\alpha\\rfloor=\\{i \\alpha\\}=\\{j \\alpha\\}=j \\alpha-\\lfloor j \\alpha\\rfloor,\n$$\nwhich yields the false statement $\\alpha=\\frac{\\lfloor i \\alpha\\rfloor-\\lfloor j \\alpha\\rfloor}{i-j} \\in \\mathbb{Q}$. Hence,\n$$\nS:=\\{\\{i \\alpha\\} \\mid i \\in \\mathbb{Z}\\}\n$$\nis an infinite subset of $\\left[0,1\\right]$.\n\nBy the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. One can thus find pairs of elements of $S$ that are arbitrarily close. Since (the absolute value of) the difference of any two elements of $S$ is also an element of $S$, it follows that $0$ is a limit point of $S$.\n\nTo show that $S$ is dense in $[0, 1]$, consider $y \\in[0,1]$, and $\\epsilon>0$. Then by selecting $x \\in S$ such that $\\{x\\}<\\epsilon$ (which exists as $0$ is a limit point), and $N$ such that $N \\cdot\\{x\\} \\leq y<(N+1) \\cdot\\{x\\}$, we get: $|y-\\{N x\\}|<\\epsilon$.\n\nQED\n-/\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof_auto-Natural-Language-Proof-Translation/Correct_statement-lean_proof_auto-4_few_shot_temperature_0.4_max_tokens_2000_n_6/clean_files/Density of irrational orbit.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5851011397337391, "lm_q2_score": 0.27512971787959795, "lm_q1q2_score": 0.16097871150597487}} {"text": "import data.real.irrational\nimport topology.basic\nimport algebra.order.floor\n\n\n--OUTPUT 1\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)), from by auto [int.fract_eq_iff],\n have h2 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff, int.fract_add_int, int.fract_mul, int.fract_eq_zero_iff, hα_irrat, int.fract_add_int],\n have h3 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff, int.fract_add_int, int.fract_mul, int.fract_eq_zero_iff, hα_irrat, int.fract_add_int],\n have h4 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h5 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h6 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h7 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h8 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h9 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h10 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h11 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h12 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [h1, h2, h3],\n have h13 : ∀ i j : ℤ, (i ≠ j) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0) → (int.fract (\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n let S := (λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ),\n have h1 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from\n begin\n assume (i j : ℤ) (hij : i ≠ j),\n have h1 : i * α - (i * α).floor ≠ j * α - (j * α).floor, from\n begin\n assume h2 : i * α - (i * α).floor = j * α - (j * α).floor,\n have h3 : α = ((i * α).floor - (j * α).floor) / (i - j), from by auto [mul_div_cancel, mul_eq_iff_eq_one_mul, one_mul],\n have h4 : α ∈ ℚ, from by auto [h3],\n have h5 : irrational α, from hα_irrat,\n have h6 : false, from by auto [h4, h5],\n show false, from h6,\n end,\n have h2 : int.fract (α * ↑i) = i * α - (i * α).floor, from by auto [int.fract_def, int.fract_lt_one],\n have h3 : int.fract (α * ↑j) = j * α - (j * α).floor, from by auto [int.fract_def, int.fract_lt_one],\n have h4 : int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [h1, h2, h3],\n show int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h4,\n end,\n have h2 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h1,\n have h3 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from h2,\n have h4 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h3,\n have h5 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h4,\n have h6 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h5,\n have h7 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h6,\n have h8 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h7,\n have h9 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h8,\n have h10 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h9,\n have h11 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h10,\n have h12 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h11,\n have h13 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h12,\n have h14 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h13,\n have h15 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h14,\n have h16 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h15,\n have h17 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h16,\n have h18 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h17,\n have h19 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h18,\n have h20 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h19,\n have h21 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h20,\n have h22 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h21,\n have h23 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h22,\n have h24 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h23,\n have h25 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h24,\n have h26 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h25,\n have h27 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h26,\n have h28 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h27,\n have h29 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h28,\n have h30 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h29,\n have h31 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h30,\n have h32 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h31,\n have h33 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h32,\n have h34 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from h33,\n have h35 : ∀ i j : ℤ, i ≠ j → int.f\nend --Needs more than 2000 tokens!\n\n--OUTPUT 3\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from\n begin\n assume i j h1,\n assume h2 : int.fract (α * ↑i) = int.fract (α * ↑j),\n have h3 : (α * ↑i) - (int.floor (α * ↑i)) = int.fract (α * ↑i), from by auto [int.fract_def],\n have h4 : (α * ↑j) - (int.floor (α * ↑j)) = int.fract (α * ↑j), from by auto [int.fract_def],\n have h5 : (α * ↑i) - (int.floor (α * ↑i)) = (α * ↑j) - (int.floor (α * ↑j)), from by auto [h2, h3, h4],\n have h6 : (α * ↑i) - (int.floor (α * ↑i)) = (α * ↑j) - (int.floor (α * ↑j)), from by auto [h2, h3, h4],\n have h7 : α = (int.floor (α * ↑i) - int.floor (α * ↑j)) / (i - j), from by auto [int.sub_eq_iff_eq_add, h5, mul_sub, mul_add, mul_comm, mul_assoc, mul_left_comm, mul_sub, add_sub_cancel, int.sub_eq_iff_eq_add, h6, mul_sub, mul_add, mul_comm, mul_assoc, mul_left_comm, mul_sub, add_sub_cancel] using [field],\n have h8 : α ∈ ℚ, from by auto [h7],\n have h9 : irrational α, from by auto [hα_irrat],\n show false, from by auto [h8, h9],\n end,\n have h2 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h1],\n have h3 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [int.fract_range],\n have h4 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h2],\n have h5 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h3],\n have h6 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h4],\n have h7 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h5],\n have h8 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h6],\n have h9 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h7],\n have h10 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h8],\n have h11 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h9],\n have h12 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h10],\n have h13 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h11],\n have h14 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h12],\n have h15 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h13],\n have h16 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h14],\n have h17 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h15],\n have h18 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h16],\n have h19 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h17],\n have h20 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h18],\n have h21 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h19],\n have h22 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h20],\n have h23 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h21],\n have h24 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h22],\n have h25 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h23],\n have h26 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h24],\n have h27 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h25],\n have h28 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h26],\n have h29 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h27],\n have h30 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h28],\n have h31 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h29],\n have h32 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h30],\n have h33 : ∀ i : ℤ, int.fract (α * ↑i) ∈ set.Icc 0 1, from by auto [h31],\n have h34 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i)) ≠ (int.fract (α * ↑j)), from by auto [h32],\n have h35 : ∀\nend --Needs more than 2000 tokens!\n\n--OUTPUT 4\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 := \nbegin\n have h1 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h2 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h3 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h4 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h5 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h6 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h7 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h8 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h9 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h10 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h11 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h12 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h13 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h14 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h15 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h16 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h17 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h18 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h19 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h20 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h21 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h22 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h23 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h24 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h25 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h26 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h27 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h28 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h29 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h30 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h31 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h32 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto [int.fract_eq_iff, hα_irrat],\n have h33 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from by auto\nend --Needs more than 2000 tokens!\n\n--OUTPUT 5\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, i ≠ j → int.fract (α * ↑i) ≠ int.fract (α * ↑j), from \n begin\n assume i j hi_ne_j,\n assume h2 : int.fract (α * ↑i) = int.fract (α * ↑j),\n have h3 : int.fract (α * ↑i) = α * ↑i - int.nat_abs (α * ↑i), from by auto [int.fract],\n have h4 : int.fract (α * ↑j) = α * ↑j - int.nat_abs (α * ↑j), from by auto [int.fract],\n have h5 : α * ↑i - int.nat_abs (α * ↑i) = α * ↑j - int.nat_abs (α * ↑j), from by auto [h2],\n have h6 : α = (int.nat_abs (α * ↑i) - int.nat_abs (α * ↑j)) / (i - j), from by auto [int.nat_abs, int.coe_nat_sub, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat_lt_coe_nat_iff, int.coe_nat\nend --Needs more than 2000 tokens!\n\n--OUTPUT 6\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nbegin\n have h1 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) ≠ int.fract (α * ↑j)), from by auto [hα_irrat, int.fract_eq_iff_eq_int_mul_sub_int_mul],\n have h2 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h3 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h4 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h5 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h6 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h7 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h8 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h9 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h10 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h11 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h12 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h13 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h14 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h15 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h16 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h17 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h18 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h19 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h20 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h21 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h22 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h23 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h24 : ∀ i j : ℤ, i ≠ j → (int.fract (α * ↑i) - int.fract (α * ↑j) ≠ 0), from by auto [int.fract_eq_iff_eq_int_mul_sub_int_mul, sub_eq_zero_iff_eq],\n have h25 : ∀ i j :\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by auto [set.subset_of_mem_powerset, set.subset_of_mem_powerset],\n have h2 : (A ∩ B) ⊆ A, from by auto [set.inter_subset_left],\n have h3 : (A ∩ B) ⊆ S, from by auto [set.subset.trans],\n show (A ∩ B) ∈ 𝒫 S, from by auto [set.mem_powerset],\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by auto [sq]\n ... = x*(x+y) + y*(x+y) : by auto [add_mul]\n ... = x*x + x*y + y*x + y*y : by auto [mul_comm, add_mul] using [ring]\n ... = x^2 + 2*x*y + y^2 : by auto [sq, mul_comm] using [ring]\nend\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by auto using [use (a⁻¹ * b)],\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by auto using [use b * a⁻¹], \n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from by auto [h1],\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from by auto [h2],\n\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from by auto [exists_unique.unique, h3, classical.some_spec, exists_unique.exists, mul_one],\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from by auto [exists_unique.unique, h4, classical.some_spec, exists_unique.exists, one_mul],\n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by auto [h3, h4, exists_unique.unique, classical.some_spec, exists_unique.exists] using [use (1 : G)],\nend\n\n/--`theorem`\nDensity of irrational orbit\nThe fractional parts of the integer multiples of an irrational number form a dense subset of the unit interval\n`proof`\nLet $\\alpha$ be an irrational number. Then for distinct $i, j \\in \\mathbb{Z}$, we must have $\\{i \\alpha\\} \\neq\\{j \\alpha\\}$. If this were not true, then\n$$\ni \\alpha-\\lfloor i \\alpha\\rfloor=\\{i \\alpha\\}=\\{j \\alpha\\}=j \\alpha-\\lfloor j \\alpha\\rfloor,\n$$\nwhich yields the false statement $\\alpha=\\frac{\\lfloor i \\alpha\\rfloor-\\lfloor j \\alpha\\rfloor}{i-j} \\in \\mathbb{Q}$. Hence,\n$$\nS:=\\{\\{i \\alpha\\} \\mid i \\in \\mathbb{Z}\\}\n$$\nis an infinite subset of $\\left[0,1\\right]$.\n\nBy the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. One can thus find pairs of elements of $S$ that are arbitrarily close. Since (the absolute value of) the difference of any two elements of $S$ is also an element of $S$, it follows that $0$ is a limit point of $S$.\n\nTo show that $S$ is dense in $[0, 1]$, consider $y \\in[0,1]$, and $\\epsilon>0$. Then by selecting $x \\in S$ such that $\\{x\\}<\\epsilon$ (which exists as $0$ is a limit point), and $N$ such that $N \\cdot\\{x\\} \\leq y<(N+1) \\cdot\\{x\\}$, we get: $|y-\\{N x\\}|<\\epsilon$.\n\nQED\n-/\ntheorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof_auto-Natural-Language-Proof-Translation/Correct_statement-lean_proof_auto-3_few_shot_temperature_0.4_max_tokens_2000_n_6/clean_files/Density of irrational orbit.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.6187804337438501, "lm_q2_score": 0.2538610126142736, "lm_q1q2_score": 0.1570842274961132}} {"text": "import model_theory.substructures\nimport model_theory.bundled\n\n\n--OUTPUT 1\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n let A : L.Theory,\n have h1 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h2 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h3 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h4 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h5 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h6 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h7 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h8 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h9 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h10 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h11 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h12 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h13 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h14 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h15 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h16 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h17 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h18 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h19 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h20 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h21 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h22 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h23 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h24 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h25 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h26 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h27 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h28 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h29 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h30 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h31 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h32 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h33 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h34 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h35 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h36 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h37 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h38 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h39 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h40 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h41 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h42 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h43 : ∀ n : ℕ,\nend --Needs more than 2000 tokens!\n\n--OUTPUT 2\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n have h1 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h,\n have h2 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h1,\n have h3 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h2,\n have h4 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h3,\n have h5 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h4,\n have h6 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h5,\n have h7 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h6,\n have h8 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h7,\n have h9 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h8,\n have h10 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h9,\n have h11 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h10,\n have h12 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h11,\n have h13 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h12,\n have h14 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h13,\n have h15 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h14,\n have h16 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h15,\n have h17 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h16,\n have h18 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h17,\n have h19 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h18,\n have h20 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h19,\n have h21 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h20,\n have h22 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h21,\n have h23 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h22,\n have h24 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h23,\n have h25 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h24,\n have h26 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h25,\n have h27 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h26,\n have h28 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h27,\n have h29 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h28,\n have h30 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h29,\n have h31 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h30,\n have h32 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h31,\n have h33 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h32,\n have h34 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h33,\n have h35 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h34,\n have h36 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h35,\n have h37 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h36,\n have h38 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h37,\n have h39 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h38,\n have h40 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h39,\n have h41 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin, from h40,\n have h42 : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m\nend --Needs more than 2000 tokens!\n\n--OUTPUT 3\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nbegin\n let A := λ (n : ℕ), ∃ (x₁ x₂ : F.Model), x₁ ≠ x₂,\n let A' := λ (n : ℕ), ∃ (x₁ x₂ x₃ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃,\n let A'' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄,\n let A''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅,\n let A'''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ x₆ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅ ∧ x₁ ≠ x₆ ∧ x₂ ≠ x₆ ∧ x₃ ≠ x₆ ∧ x₄ ≠ x₆ ∧ x₅ ≠ x₆,\n let A''''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ x₆ x₇ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅ ∧ x₁ ≠ x₆ ∧ x₂ ≠ x₆ ∧ x₃ ≠ x₆ ∧ x₄ ≠ x₆ ∧ x₅ ≠ x₆ ∧ x₁ ≠ x₇ ∧ x₂ ≠ x₇ ∧ x₃ ≠ x₇ ∧ x₄ ≠ x₇ ∧ x₅ ≠ x₇ ∧ x₆ ≠ x₇,\n let A'''''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅ ∧ x₁ ≠ x₆ ∧ x₂ ≠ x₆ ∧ x₃ ≠ x₆ ∧ x₄ ≠ x₆ ∧ x₅ ≠ x₆ ∧ x₁ ≠ x₇ ∧ x₂ ≠ x₇ ∧ x₃ ≠ x₇ ∧ x₄ ≠ x₇ ∧ x₅ ≠ x₇ ∧ x₆ ≠ x₇ ∧ x₁ ≠ x₈ ∧ x₂ ≠ x₈ ∧ x₃ ≠ x₈ ∧ x₄ ≠ x₈ ∧ x₅ ≠ x₈ ∧ x₆ ≠ x₈ ∧ x₇ ≠ x₈,\n let A''''''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅ ∧ x₁ ≠ x₆ ∧ x₂ ≠ x₆ ∧ x₃ ≠ x₆ ∧ x₄ ≠ x₆ ∧ x₅ ≠ x₆ ∧ x₁ ≠ x₇ ∧ x₂ ≠ x₇ ∧ x₃ ≠ x₇ ∧ x₄ ≠ x₇ ∧ x₅ ≠ x₇ ∧ x₆ ≠ x₇ ∧ x₁ ≠ x₈ ∧ x₂ ≠ x₈ ∧ x₃ ≠ x₈ ∧ x₄ ≠ x₈ ∧ x₅ ≠ x₈ ∧ x₆ ≠ x₈ ∧ x₇ ≠ x₈ ∧ x₁ ≠ x₉ ∧ x₂ ≠ x₉ ∧ x₃ ≠ x₉ ∧ x₄ ≠ x₉ ∧ x₅ ≠ x₉ ∧ x₆ ≠ x₉ ∧ x₇ ≠ x₉ ∧ x₈ ≠ x₉,\n let A'''''''' := λ (n : ℕ), ∃ (x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ : F.Model), x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ x₁ ≠ x₄ ∧ x₂ ≠ x₄ ∧ x₃ ≠ x₄ ∧ x₁ ≠ x₅ ∧ x₂ ≠ x₅ ∧ x₃ ≠ x₅ ∧ x₄ ≠ x₅ ∧ x₁ ≠ x₆ ∧ x\nend --Needs more than 2000 tokens!\n\n/- FEW SHOT PROMPTS TO CODEX(START)\n/--`theorem`\nPower Set is Closed under Intersection\nLet $S$ be a set.\n\nLet $\\powerset S$ be the power set of $S$.\n\n\nThen:\n:$\\forall A, B \\in \\powerset S: A \\cap B \\in \\powerset S$\n`proof`\nLet $A, B \\in \\powerset S$.\n\nThen by the definition of power set, $A \\subseteq S$ and $B \\subseteq S$.\n\nFrom Intersection is Subset we have that $A \\cap B \\subseteq A$.\n\nIt follows from Subset Relation is Transitive that $A \\cap B \\subseteq S$.\n\nThus $A \\cap B \\in \\powerset S$ and closure is proved.\n{{qed}}\n-/\ntheorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=\nbegin\n assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),\n have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB},\n have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left,\n have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left},\n show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3},\nend\n\n/--`theorem`\nSquare of Sum\n :$\\forall x, y \\in \\R: \\paren {x + y}^2 = x^2 + 2 x y + y^2$\n`proof`\nFollows from the distribution of multiplication over addition:\n\n{{begin-eqn}}\n{{eqn | l = \\left({x + y}\\right)^2\n | r = \\left({x + y}\\right) \\cdot \\left({x + y}\\right)\n}}\n{{eqn | r = x \\cdot \\left({x + y}\\right) + y \\cdot \\left({x + y}\\right)\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x \\cdot x + x \\cdot y + y \\cdot x + y \\cdot y\n | c = Real Multiplication Distributes over Addition\n}}\n{{eqn | r = x^2 + 2xy + y^2\n | c = \n}}\n{{end-eqn}}\n{{qed}}\n-/\ntheorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := \nbegin\n calc (x + y)^2 = (x+y)*(x+y) : by rw sq\n ... = x*(x+y) + y*(x+y) : by rw add_mul\n ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring}\n ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring}\nend\n\n\n/--`theorem`\nIdentity of Group is Unique\nLet $\\struct {G, \\circ}$ be a group. Then there is a unique identity element $e \\in G$.\n`proof`\nFrom Group has Latin Square Property, there exists a unique $x \\in G$ such that:\n:$a x = b$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = b$\n\nSetting $b = a$, this becomes:\n\nThere exists a unique $x \\in G$ such that:\n:$a x = a$\n\nand there exists a unique $y \\in G$ such that:\n:$y a = a$\n\nThese $x$ and $y$ are both $e$, by definition of identity element.\n{{qed}}\n-/\ntheorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=\nbegin\n have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by {\n assume a b : G, use a⁻¹ * b, obviously, },\n have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by {\n assume a b : G, use b * a⁻¹, obviously, }, \n\n have h3 : ∀ a : G, ∃! x : G, a * x = a, from \n assume a : G, h1 a a,\n have h4 : ∀ a : G, ∃! y : G, y * a = a, from\n assume a : G, h2 a a,\n\n have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G,\n exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a)))\n (mul_one a),\n have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G,\n exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), \n\n show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {\n use (1 : G),\n have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {\n assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a),\n have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G),\n exists_unique.unique (h3 a) (hident a).right\n (classical.some_spec (exists_unique.exists (h3 a))), \n have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G),\n exists_unique.unique (h4 a) (hident a).left\n (classical.some_spec (exists_unique.exists (h4 a))),\n show e = (1 : G), from eq.trans (h9 e) (h6 _), \n },\n exact ⟨by obviously, h7⟩,\n }\nend\n\n/--`theorem`\nOverflow theorem\nLet $F$ be a set of first-order formulas which has finite models of arbitrarily large size. Then $F$ has an infinite model.\n`proof`\nFor each $n$, let $\\mathbf A_n$ be the formula:\n\n$\\exists x_1 \\exists x_2 \\ldots \\exists x_n: \\{x_1 \\ne x_2 \\land x_1 \\ne x_3 \\land \\ldots \\land x_{n - 1} \\ne x_n\\}$\n\nThen $\\mathbf A_i$ is true in a structure $\\AA$ iff $\\AA$ has at least $n$ elements.\n\nTake:\n$$ \\Gamma := F \\cup \\bigcup_{i \\mathop = 1}^\\infty A_i $$\n\nSince $F$ has models of arbitrarily large size, every finite subset of $\\Gamma$ is satisfiable.\n\nFrom the Compactness Theorem, $\\Gamma$ is satisfiable in some model $\\mathbf{M}$.\n\nBut since $\\mathbf{M} \\models A_i$ for each $i$, $\\mathbf{M}$ must be infinite.\n\nSo $F$ has an infinite model.\n\nQED\n-/\ntheorem overflow {L : first_order.language} {F : L.Theory} (h : ∀ n : ℕ, ∃ (m : F.Model) [mfin : fintype m], n ≤ @fintype.card m mfin) : ∃ (M : F.Model), infinite M :=\nFEW SHOT PROMPTS TO CODEX(END)-/\n", "meta": {"author": "ayush1801", "repo": "Autoformalisation_benchmarks", "sha": "51e1e942a0314a46684f2521b95b6b091c536051", "save_path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks", "path": "github-repos/lean/ayush1801-Autoformalisation_benchmarks/Autoformalisation_benchmarks-51e1e942a0314a46684f2521b95b6b091c536051/proof/lean_proof-Natural-Language-Proof-Translation/Correct_statement-lean_proof-3_few_shot_temperature_0.2_max_tokens_2000_n_3/clean_files/Overflow theorem.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.519521321952093, "lm_q2_score": 0.3007455852086007, "lm_q1q2_score": 0.15624374399882804}} {"text": "import category_theory.abelian.exact\nimport for_mathlib.split_exact\n\nuniverses v u u'\n\nnamespace category_theory\n\nnamespace functor\n\nopen category_theory.limits\n\nvariables {A : Type u} {B : Type u'} [category.{v} A] [category.{v} B]\n [abelian A] [abelian B] (F : A ⥤ B) [functor.additive F]\n [preserves_finite_limits F] [preserves_finite_colimits F]\n\nvariables {X Y Z : A} (f : X ⟶ Y) (g : Y ⟶ Z)\n\nlemma map_short_exact (h : short_exact f g) : short_exact (F.map f) (F.map g) :=\nbegin\n rcases h with ⟨hf, hg, hfg⟩,\n haveI : mono (F.map f),\n { rw (abelian.tfae_mono X f).out 0 2 at hf,\n rw (abelian.tfae_mono (F.obj X) (F.map f)).out 0 2,\n have := F.map_exact _ _ hf, rwa F.map_zero at this, },\n haveI : epi (F.map g),\n { rw (abelian.tfae_epi Z g).out 0 2 at hg,\n rw (abelian.tfae_epi (F.obj Z) (F.map g)).out 0 2,\n have := F.map_exact _ _ hg, rwa F.map_zero at this, },\n refine ⟨F.map_exact f g hfg⟩,\nend\n\nend functor\n\nend category_theory\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/for_mathlib/preserves_exact.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO", "lm_q1_score": 0.5583269943353745, "lm_q2_score": 0.275129717879598, "lm_q1q2_score": 0.15361234843605548}} {"text": "import free_pfpng.main\nimport condensed.acyclic\nimport prop819\nimport locally_constant.completion\n.\n\nnoncomputable theory\n\nuniverses u\n\nopen category_theory category_theory.limits opposite ProFiltPseuNormGrp₁\nopen function (surjective)\nopen_locale nnreal\n\nvariables (S : Profinite.{u})\nvariables (V : SemiNormedGroup.{u}) [complete_space V] [separated_space V]\n\nset_option pp.universes true\n\nnamespace cosimplicial_object\n\nvariables {C D E : Type*} [category C] [category D] [category E]\nvariables (F : C ⥤ D) (G : D ⥤ E)\n\n@[simps]\ndef whiskering_comp :\n (cosimplicial_object.whiskering C E).obj (F ⋙ G) ≅\n (cosimplicial_object.whiskering C D).obj F ⋙\n (cosimplicial_object.whiskering D E).obj G :=\nnat_iso.of_components\n (λ X, (nat_iso.of_components\n (λ n, iso.refl _) $\n by { intros, dsimp, simp only [category.comp_id, category.id_comp] })) $\n by { intros, ext, dsimp, simp only [category.comp_id, category.id_comp] }\n\nnamespace augmented\n\ndef whiskering_comp :\n (cosimplicial_object.augmented.whiskering C E).obj (F ⋙ G) ≅\n (cosimplicial_object.augmented.whiskering C D).obj F ⋙\n (cosimplicial_object.augmented.whiskering D E).obj G :=\nnat_iso.of_components\n (λ X, comma.iso_mk (iso.refl _) ((cosimplicial_object.whiskering_comp F G).app _)\n begin\n ext,\n dsimp,\n simp only [iso.refl_hom, category_theory.functor.map_id, category.id_comp,\n iso.app_hom, functor.id_map, category.comp_id],\n end)\n begin\n intros, ext; dsimp;\n simp only [iso.refl_hom, category_theory.functor.map_id, category.id_comp,\n iso.app_hom, functor.id_map, category.comp_id],\n end\n.\n\n-- move me\nattribute [simps obj map] cosimplicial_object.augmented.cocomplex\n\ndef cocomplex_whiskering_additive [preadditive C] [preadditive D] [F.additive] :\n (cosimplicial_object.augmented.whiskering C D).obj F ⋙\n cosimplicial_object.augmented.cocomplex ≅\n cosimplicial_object.augmented.cocomplex ⋙ F.map_homological_complex _ :=\nnat_iso.of_components\n (λ X, homological_complex.hom.iso_of_components\n (λ i, by { cases i; exact iso.refl _, })\n begin\n rintro i j (rfl : i + 1 = j), cases i,\n { dsimp, rw [category.id_comp, category.comp_id, if_pos rfl, if_pos rfl,\n category.comp_id, category.comp_id],\n delta cosimplicial_object.augmented.to_cocomplex_d,\n dsimp, simp only [category.id_comp], },\n { dsimp, rw [category.id_comp, category.comp_id, if_pos rfl, if_pos rfl,\n category.comp_id, category.comp_id],\n delta cosimplicial_object.augmented.to_cocomplex_d cosimplicial_object.coboundary id_rhs,\n dsimp, simp only [← functor.map_add_hom_apply, map_sum, map_zsmul], refl }\n end)\n begin\n intros, ext n, dsimp, cases n;\n { dsimp, rw [category.id_comp, category.comp_id], refl, },\n end\n.\n\nend augmented\nend cosimplicial_object\n\nsection\nuniverse v\n-- move me\ninstance Ab.ulift_additive : Ab.ulift.{u v}.additive := {}\nend\n\nlemma free_acyclic_aux (F : arrow Profinite) (hF : surjective (F.hom)) (i : ℕ) :\n is_zero ((((cosimplicial_object.augmented.whiskering Profiniteᵒᵖ Ab).obj\n (LCC V ⋙ Ab.ulift.{u+1})).obj F.augmented_cech_nerve.right_op).to_cocomplex.homology i) :=\nbegin\n let U := (forget₂.{u+1 u+1 u u u} SemiNormedGroup.{u} Ab.{u} ⋙ Ab.ulift.{u+1 u}),\n show is_zero (homological_complex.homology.{u+1 u+2 0}\n (((cosimplicial_object.augmented.whiskering.{u u+1 u+1 u+2} Profinite.{u}ᵒᵖ Ab.{u+1}).obj\n (SemiNormedGroup.LCC.{u u}.obj V ⋙ U)).obj F.augmented_cech_nerve.right_op).to_cocomplex i),\n rw [← homology_functor_obj, ← category_theory.cosimplicial_object.augmented.cocomplex_obj],\n let e1 := (homology_functor _ (complex_shape.up.{0} ℕ) i).map_iso\n (cosimplicial_object.augmented.cocomplex.map_iso\n ((cosimplicial_object.augmented.whiskering_comp _ U).app\n F.augmented_cech_nerve.right_op)),\n refine is_zero_of_iso_of_zero _ e1.symm,\n let e2 := (homology_functor Ab (complex_shape.up.{0} ℕ) i).map_iso\n ((cosimplicial_object.augmented.cocomplex_whiskering_additive U).app _),\n refine is_zero_of_iso_of_zero _ e2.symm,\n clear e1 e2,\n let C :=\n (U.map_homological_complex (complex_shape.up.{0} ℕ)).obj\n (((cosimplicial_object.augmented.whiskering Profinite.{u}ᵒᵖ _).obj\n (SemiNormedGroup.LCC.{u u}.obj V)).obj\n F.augmented_cech_nerve.right_op).to_cocomplex,\n show is_zero (C.homology i),\n cases i,\n { apply exact.homology_is_zero,\n rw [AddCommGroup.exact_iff', homological_complex.d_to_comp_d_from, eq_self_iff_true, true_and,\n homological_complex.d_to_eq_zero],\n swap, { simp only [cochain_complex.prev_nat_zero, complex_shape.up_rel,\n nat.one_ne_zero, not_false_iff], },\n intros f hf, refine ⟨0, ulift.down_injective (prop819_degree_zero F hF V f.down _).symm⟩,\n rw [add_monoid_hom.mem_ker] at hf,\n have h01 : (complex_shape.up.{0} ℕ).rel 0 1 := rfl,\n have := homological_complex.d_from_comp_X_next_iso C h01,\n rw [← iso.eq_comp_inv] at this,\n apply_fun (C.X_next_iso h01).hom at hf,\n rw [this, ← Ab.comp_apply, category.assoc, iso.inv_hom_id, category.comp_id, map_zero] at hf,\n exact congr_arg ulift.down hf, },\n { let e := (homology_iso C i (i+1) (i+2) rfl rfl),\n refine is_zero_of_iso_of_zero _ e.symm,\n apply exact.homology_is_zero,\n rw [AddCommGroup.exact_iff', homological_complex.d_comp_d, eq_self_iff_true, true_and],\n intros f hf,\n -- use `prop819` from `prop819.lean`\n obtain ⟨g, hg, -⟩ := prop819 F hF V 1 zero_lt_one f.down (congr_arg ulift.down hf),\n refine ⟨ulift.up g, ulift.down_injective hg⟩, },\nend\n\ntheorem free_acyclic (i : ℤ) (hi : 0 < i) :\n is_zero (((Ext' i).obj (op ((Profinite_to_Condensed ⋙ CondensedSet_to_Condensed_Ab).obj S))).obj\n (Condensed.of_top_ab V)) :=\nbegin\n apply condensed.acyclic_of_exact _ _ _ i hi,\n intros F hF i,\n apply is_zero_of_iso_of_zero (free_acyclic_aux V F hF i),\n refine (homology_functor _ _ i).map_iso _,\n refine cosimplicial_object.augmented.cocomplex.map_iso _,\n conv_lhs { rw [← functor.flip_obj_obj] },\n conv_rhs { rw [← functor.flip_obj_obj] },\n refine functor.map_iso _ _,\n refine iso_whisker_right _ _,\n exact LCC_iso_Cond_of_top_ab V,\nend\n\ntheorem free_pfpng_acyclic (i : ℤ) (hi : 0 < i) :\n is_zero (((Ext' i).obj (op ((condensify (free_pfpng_functor ⋙ PFPNG₁_to_CHFPNG₁ₑₗ)).obj S))).obj\n (Condensed.of_top_ab V)) :=\nbegin\n refine is_zero_of_iso_of_zero (free_acyclic S V i hi) _,\n conv { rw ← functor.flip_obj_obj, congr, skip, rw ← functor.flip_obj_obj },\n refine functor.map_iso _ (iso.app _ _).op,\n exact free_pfpng_profinite_iso\nend\n", "meta": {"author": "leanprover-community", "repo": "lean-liquid", "sha": "92f188bd17f34dbfefc92a83069577f708851aec", "save_path": "github-repos/lean/leanprover-community-lean-liquid", "path": "github-repos/lean/leanprover-community-lean-liquid/lean-liquid-92f188bd17f34dbfefc92a83069577f708851aec/src/free_pfpng/acyclic.lean", "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. NO\n\n", "lm_q1_score": 0.5156199157230156, "lm_q2_score": 0.297469948832931, "lm_q1q2_score": 0.15338142994736564}}